History

Merge drm/drm-next into drm-intel-next

To catch up with recent rounds of pull requests and get some drm-misc dependencies so we can merge linux/string_helpers related changes.

Rodrigo Vivi committed 4 years ago

Commit 230bc2b2 parents 17003d1 38a15ad1716 files · +468428 −19915Browse files

Unified · Split

586 files
  1. .mailmap +6 −0
  2. Documentation/ABI/testing/sysfs-class-power +1 −0
  3. Documentation/ABI/testing/sysfs-driver-aspeed-uart-routing +3 −3
  4. Documentation/arm64/silicon-errata.rst +2 −0
  5. Documentation/core-api/dma-attributes.rst +8 −0
  6. Documentation/cpu-freq/cpu-drivers.rst +3 −0
  7. Documentation/dev-tools/kselftest.rst +8 −0
  8. Documentation/dev-tools/kunit/usage.rst +1 −1
  9. Documentation/devicetree/bindings/arm/omap/omap.txt +3 −0
  10. Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml +17 −0
  11. Documentation/devicetree/bindings/display/bridge/ingenic,jz4780-hdmi.yaml +82 −0
  12. Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml +1 −1
  13. Documentation/devicetree/bindings/display/lvds.yaml +4 −31
  14. Documentation/devicetree/bindings/display/mediatek/mediatek,aal.yaml +77 −0
  15. Documentation/devicetree/bindings/display/mediatek/mediatek,ccorr.yaml +76 −0
  16. Documentation/devicetree/bindings/display/mediatek/mediatek,color.yaml +86 −0
  17. Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt +0 −219
  18. Documentation/devicetree/bindings/display/mediatek/mediatek,dither.yaml +76 −0
  19. Documentation/devicetree/bindings/display/mediatek/mediatek,dsc.yaml +71 −0
  20. Documentation/devicetree/bindings/display/mediatek/mediatek,ethdr.yaml +147 −0
  21. Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml +77 −0
  22. Documentation/devicetree/bindings/display/mediatek/mediatek,merge.yaml +110 −0
  23. Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml +83 −0
  24. Documentation/devicetree/bindings/display/mediatek/mediatek,od.yaml +53 −0
  25. Documentation/devicetree/bindings/display/mediatek/mediatek,ovl-2l.yaml +88 −0
  26. Documentation/devicetree/bindings/display/mediatek/mediatek,ovl.yaml +103 −0
  27. Documentation/devicetree/bindings/display/mediatek/mediatek,postmask.yaml +69 −0
  28. Documentation/devicetree/bindings/display/mediatek/mediatek,rdma.yaml +117 −0
  29. Documentation/devicetree/bindings/display/mediatek/mediatek,split.yaml +58 −0
  30. Documentation/devicetree/bindings/display/mediatek/mediatek,ufoe.yaml +61 −0
  31. Documentation/devicetree/bindings/display/mediatek/mediatek,wdma.yaml +86 −0
  32. Documentation/devicetree/bindings/display/panel/advantech,idk-1110wr.yaml +17 −2
  33. Documentation/devicetree/bindings/display/panel/innolux,ee101ia-01d.yaml +21 −2
  34. Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.yaml +17 −2
  35. Documentation/devicetree/bindings/display/panel/mitsubishi,aa121td01.yaml +17 −2
  36. Documentation/devicetree/bindings/display/panel/panel-lvds.yaml +57 −0
  37. Documentation/devicetree/bindings/display/panel/panel-simple.yaml +2 −0
  38. Documentation/devicetree/bindings/display/panel/sgd,gktw70sdae4se.yaml +17 −2
  39. Documentation/devicetree/bindings/display/solomon,ssd1307fb.yaml +1 −0
  40. Documentation/devicetree/bindings/gpio/sifive,gpio.yaml +0 −1
  41. Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +15 −0
  42. Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml +15 −6
  43. Documentation/devicetree/bindings/mfd/ti,j721e-system-controller.yaml +1 −1
  44. Documentation/devicetree/bindings/net/qcom,ipa.yaml +6 −0
  45. Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml +1 −1
  46. Documentation/devicetree/bindings/pwm/pwm-sifive.yaml +0 −1
  47. Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml +0 −1
  48. Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml +1 −0
  49. Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml +3 −2
  50. Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +1 −1
  51. Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml +1 −1
  52. Documentation/filesystems/netfs_library.rst +16 −0
  53. Documentation/gpu/todo.rst +0 −24
  54. Documentation/tools/rtla/common_hist_options.rst +1 −1
  55. Documentation/tools/rtla/common_osnoise_description.rst +1 −1
  56. Documentation/tools/rtla/rtla-osnoise-hist.rst +1 −1
  57. Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst +2 −0
  58. Documentation/userspace-api/ioctl/ioctl-number.rst +3 −0
  59. Documentation/virt/kvm/api.rst +15 −1
  60. MAINTAINERS +107 −45
  61. Makefile +2 −2
  62. arch/arm/boot/dts/Makefile +1 −0
  63. arch/arm/boot/dts/am335x-wega.dtsi +1 −1
  64. arch/arm/boot/dts/dra7.dtsi +10 −10
  65. arch/arm/boot/dts/imx23-evk.dts +0 −1
  66. arch/arm/boot/dts/imx6qdl-udoo.dtsi +4 −1
  67. arch/arm/boot/dts/imx7ulp.dtsi +1 −1
  68. arch/arm/boot/dts/meson.dtsi +4 −4
  69. arch/arm/boot/dts/meson8.dtsi +12 −12
  70. arch/arm/boot/dts/meson8b.dtsi +12 −12
  71. arch/arm/boot/dts/omap3-beagle-ab4.dts +47 −0
  72. arch/arm/boot/dts/omap3-beagle.dts +0 −33
  73. arch/arm/boot/dts/spear320-hmi.dts +0 −1
  74. arch/arm/boot/dts/ste-ux500-samsung-skomer.dts +0 −4
  75. arch/arm/crypto/blake2s-shash.c +2 −2
  76. arch/arm/mach-omap2/display.c +1 −1
  77. arch/arm/mach-omap2/omap_hwmod.c +3 −1
  78. arch/arm/mach-socfpga/Kconfig +2 −0
  79. arch/arm64/Kconfig +17 −0
  80. arch/arm64/Kconfig.platforms +0 −3
  81. arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +6 −0
  82. arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +0 −8
  83. arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +2 −2
  84. arch/arm64/boot/dts/amlogic/meson-gx.dtsi +6 −0
  85. arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts +1 −1
  86. arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi +1 −1
  87. arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts +0 −8
  88. arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts +4 −0
  89. arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +2 −2
  90. arch/arm64/boot/dts/freescale/imx8mq.dtsi +5 −5
  91. arch/arm64/boot/dts/freescale/mba8mx.dtsi +1 −1
  92. arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts +12 −2
  93. arch/arm64/boot/dts/ti/k3-j721s2.dtsi +0 −22
  94. arch/arm64/include/asm/el2_setup.h +1 −1
  95. arch/arm64/kernel/cpu_errata.c +8 −0
  96. arch/arm64/kvm/arm.c +33 −18
  97. arch/arm64/kvm/handle_exit.c +8 −0
  98. arch/arm64/kvm/hyp/include/hyp/switch.h +21 −2
  99. arch/arm64/kvm/vgic/vgic-mmio.c +2 −0
  100. arch/arm64/tools/cpucaps +3 −2
  101. arch/mips/boot/dts/ingenic/ci20.dts +2 −13
  102. arch/mips/cavium-octeon/octeon-memcpy.S +1 −1
  103. arch/mips/kvm/mips.c +46 −4
  104. arch/mips/kvm/vz.c +9 −3
  105. arch/parisc/include/asm/bitops.h +8 −0
  106. arch/parisc/include/asm/uaccess.h +15 −14
  107. arch/parisc/kernel/unaligned.c +7 −7
  108. arch/parisc/lib/iomap.c +18 −0
  109. arch/parisc/mm/init.c +4 −5
  110. arch/powerpc/kernel/head_book3s_32.S +2 −2
  111. arch/powerpc/lib/sstep.c +2 −0
  112. arch/riscv/Makefile +6 −0
  113. arch/riscv/configs/nommu_k210_sdcard_defconfig +1 −1
  114. arch/riscv/kernel/Makefile +2 −0
  115. arch/riscv/kernel/cpu-hotplug.c +2 −0
  116. arch/riscv/kernel/entry.S +5 −5
  117. arch/riscv/kernel/head.S +5 −6
  118. arch/riscv/kernel/sbi.c +47 −25
  119. arch/riscv/kernel/stacktrace.c +5 −4
  120. arch/riscv/kernel/trace_irq.c +27 −0
  121. arch/riscv/kernel/trace_irq.h +11 −0
  122. arch/riscv/kvm/vcpu.c +31 −17
  123. arch/riscv/kvm/vcpu_sbi_base.c +2 −1
  124. arch/riscv/mm/extable.c +3 −3
  125. arch/riscv/mm/init.c +2 −0
  126. arch/s390/kvm/kvm-s390.c +2 −0
  127. arch/s390/lib/test_modules.c +0 −3
  128. arch/s390/lib/test_modules.h +3 −0
  129. arch/x86/crypto/blake2s-shash.c +2 −2
  130. arch/x86/events/intel/core.c +13 −0
  131. arch/x86/events/intel/pt.c +3 −2
  132. arch/x86/include/asm/bug.h +11 −9
  133. arch/x86/include/asm/kvm-x86-ops.h +1 −1
  134. arch/x86/include/asm/kvm_host.h +2 −2
  135. arch/x86/include/asm/msr-index.h +1 −0
  136. arch/x86/include/asm/svm.h +36 −0
  137. arch/x86/include/asm/xen/cpuid.h +7 −0
  138. arch/x86/include/asm/xen/hypervisor.h +0 −14
  139. arch/x86/kernel/cpu/sgx/encl.c +2 −0
  140. arch/x86/kernel/cpu/sgx/main.c +1 −9
  141. arch/x86/kernel/fpu/regset.c +4 −5
  142. arch/x86/kernel/fpu/xstate.c +4 −1
  143. arch/x86/kernel/kvm.c +6 −3
  144. arch/x86/kernel/ptrace.c +2 −2
  145. arch/x86/kernel/resource.c +1 −22
  146. arch/x86/kvm/cpuid.c +11 −7
  147. arch/x86/kvm/lapic.c +8 −9
  148. arch/x86/kvm/mmu/mmu.c +12 −1
  149. arch/x86/kvm/pmu.c +4 −3
  150. arch/x86/kvm/svm/avic.c +23 −70
  151. arch/x86/kvm/svm/nested.c +14 −12
  152. arch/x86/kvm/svm/svm.c +100 −11
  153. arch/x86/kvm/svm/svm.h +3 −12
  154. arch/x86/kvm/vmx/vmx.c +19 −3
  155. arch/x86/kvm/x86.c +34 −10
  156. arch/x86/kvm/x86.h +0 −45
  157. arch/x86/kvm/xen.c +67 −30
  158. arch/x86/xen/enlighten_hvm.c +11 −11
  159. arch/x86/xen/enlighten_pv.c +0 −4
  160. arch/x86/xen/smp_pv.c +6 −20
  161. arch/x86/xen/vga.c +8 −8
  162. block/bfq-iosched.c +2 −0
  163. block/bio-integrity.c +1 −1
  164. block/blk-core.c +2 −8
  165. block/blk-map.c +1 −1
  166. block/blk-mq.c +4 −0
  167. block/elevator.c +0 −2
  168. block/fops.c +21 −14
  169. block/genhd.c +14 −0
  170. crypto/af_alg.c +0 −3
  171. crypto/algapi.c +1 −0
  172. crypto/api.c +0 −1
  173. crypto/blake2s_generic.c +2 −2
  174. drivers/accessibility/speakup/speakup_dectlk.c +1 −0
  175. drivers/acpi/Kconfig +1 −0
  176. drivers/acpi/arm64/iort.c +11 −3
  177. drivers/acpi/ec.c +10 −0
  178. drivers/acpi/processor_idle.c +5 −0
  179. drivers/acpi/sleep.c +5 −10
  180. drivers/acpi/tables.c +1 −1
  181. drivers/acpi/x86/s2idle.c +4 −8
  182. drivers/ata/libata-core.c +17 −8
  183. drivers/ata/pata_hpt37x.c +16 −2
  184. drivers/ata/sata_fsl.c +7 −9
  185. drivers/base/dd.c +5 −0
  186. drivers/base/power/wakeup.c +34 −7
  187. drivers/base/regmap/regmap-irq.c +6 −14
  188. drivers/block/loop.c +36 −37
  189. drivers/block/loop.h +0 −1
  190. drivers/block/mtip32xx/mtip32xx.c +1 −1
  191. drivers/block/rbd.c +1 −1
  192. drivers/block/xen-blkfront.c +1 −1
  193. drivers/bus/mhi/pci_generic.c +2 −0
  194. drivers/char/random.c +22 −17
  195. drivers/clk/ingenic/jz4725b-cgu.c +1 −2
  196. drivers/clk/qcom/gcc-msm8994.c +9 −97
  197. drivers/clocksource/timer-ti-dm-systimer.c +1 −1
  198. drivers/cpufreq/cpufreq.c +4 −0
  199. drivers/cpufreq/qcom-cpufreq-hw.c +10 −1
  200. drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c +2 −1
  201. drivers/dma-buf/dma-fence-array.c +14 −0
  202. drivers/dma-buf/dma-fence-chain.c +11 −4
  203. drivers/dma-buf/dma-heap.c +2 −0
  204. drivers/dma-buf/dma-resv.c +20 −14
  205. drivers/dma/at_xdmac.c +3 −1
  206. drivers/dma/ptdma/ptdma-dev.c +9 −8
  207. drivers/dma/sh/rcar-dmac.c +7 −2
  208. drivers/dma/sh/shdma-base.c +3 −1
  209. drivers/dma/stm32-dmamux.c +3 −1
  210. drivers/edac/altera_edac.c +1 −1
  211. drivers/edac/edac_mc.c +1 −1
  212. drivers/edac/xgene_edac.c +1 −1
  213. drivers/gpio/gpio-aggregator.c +14 −4
  214. drivers/gpio/gpio-rockchip.c +29 −27
  215. drivers/gpio/gpio-sifive.c +1 −1
  216. drivers/gpio/gpio-sim.c +15 −4
  217. drivers/gpio/gpio-tegra186.c +10 −4
  218. drivers/gpio/gpiolib-cdev.c +3 −3
  219. drivers/gpio/gpiolib-sysfs.c +2 −5
  220. drivers/gpio/gpiolib.c +10 −0
  221. drivers/gpio/gpiolib.h +12 −0
  222. drivers/gpu/drm/Kconfig +3 −0
  223. drivers/gpu/drm/Makefile +1 −0
  224. drivers/gpu/drm/amd/amdgpu/Makefile +1 −1
  225. drivers/gpu/drm/amd/amdgpu/aldebaran.c +1 −1
  226. drivers/gpu/drm/amd/amdgpu/amdgpu.h +47 −26
  227. drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +32 −5
  228. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 −1
  229. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c +0 −3
  230. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c +0 −3
  231. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c +0 −24
  232. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c +0 −25
  233. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c +0 −96
  234. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c +0 −24
  235. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +2 −26
  236. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h +0 −10
  237. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +64 −12
  238. drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +2 −0
  239. drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h +12 −10
  240. drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +130 −114
  241. drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +38 −0
  242. drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +13 −6
  243. drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +1 −1
  244. drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +128 −4
  245. drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h +1 −1
  246. drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +132 −17
  247. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +285 −156
  248. drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +651 −32
  249. drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +6 −25
  250. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +101 −53
  251. drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +5 −38
  252. drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +31 −22
  253. drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +12 −24
  254. drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h +7 −8
  255. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 −1
  256. drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +11 −59
  257. drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +5 −19
  258. drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +64 −64
  259. drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6 −7
  260. drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +13 −45
  261. drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c +2 −38
  262. drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h +5 −8
  263. drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +6 −6
  264. drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +4 −1
  265. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +33 −93
  266. drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c +1 −40
  267. drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h +3 −14
  268. drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c +2 −38
  269. drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h +3 −10
  270. drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +1 −0
  271. drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c +7 −37
  272. drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +4 −7
  273. drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +7 −3
  274. drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c +5 −57
  275. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +106 −19
  276. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +9 −0
  277. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +285 −240
  278. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +43 −34
  279. drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +20 −15
  280. drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +56 −0
  281. drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h +40 −0
  282. drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 −2
  283. drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +3 −3
  284. drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h +14 −2
  285. drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +7 −43
  286. drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +5 −9
  287. drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +2 −3
  288. drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +0 −250
  289. drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +18 −3
  290. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +246 −165
  291. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +9 −12
  292. drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1 −0
  293. drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +47 −59
  294. drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h +14 −9
  295. drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 −0
  296. drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +8 −0
  297. drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +149 −2
  298. drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +24 −2
  299. drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +1 −2
  300. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +16 −5
  301. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 −1
  302. drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +22 −38
  303. drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +75 −44
  304. drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +6 −4
  305. drivers/gpu/drm/amd/amdgpu/athub_v1_0.c +7 −6
  306. drivers/gpu/drm/amd/amdgpu/athub_v2_0.c +1 −0
  307. drivers/gpu/drm/amd/amdgpu/athub_v2_1.c +1 −0
  308. drivers/gpu/drm/amd/amdgpu/atom.c +3 −1
  309. drivers/gpu/drm/amd/amdgpu/cik.c +1 −1
  310. drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +3 −1
  311. drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +3 −1
  312. drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +2 −1
  313. drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +3 −1
  314. drivers/gpu/drm/amd/amdgpu/df_v3_6.c +3 −3
  315. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +177 −157
  316. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +72 −162
  317. drivers/gpu/drm/amd/amdgpu/gfx_v9_4.c +14 −10
  318. drivers/gpu/drm/amd/amdgpu/gfx_v9_4.h +1 −1
  319. drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +14 −11
  320. drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h +1 −1
  321. drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c +6 −1
  322. drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +47 −13
  323. drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +6 −6
  324. drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +6 −7
  325. drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +6 −7
  326. drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +74 −31
  327. drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c +16 −3
  328. drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h +1 −1
  329. drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c +7 −2
  330. drivers/gpu/drm/amd/amdgpu/mca_v3_0.c +67 −35
  331. drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +7 −3
  332. drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h +1 −1
  333. drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c +7 −3
  334. drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.h +1 −1
  335. drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c +1 −0
  336. drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.c +7 −3
  337. drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.h +1 −1
  338. drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +12 −7
  339. drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +12 −7
  340. drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +9 −4
  341. drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +35 −13
  342. drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +16 −4
  343. drivers/gpu/drm/amd/amdgpu/nbio_v7_4.h +1 −1
  344. drivers/gpu/drm/amd/amdgpu/nv.c +51 −67
  345. drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h +1 −0
  346. drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +2 −2
  347. drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +14 −0
  348. drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +1 −0
  349. drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +59 −18
  350. drivers/gpu/drm/amd/amdgpu/sdma_v4_4.c +21 −4
  351. drivers/gpu/drm/amd/amdgpu/sdma_v4_4.h +1 −1
  352. drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +21 −7
  353. drivers/gpu/drm/amd/amdgpu/si.c +1 −1
  354. drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c +54 −27
  355. drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.h +3 −3
  356. drivers/gpu/drm/amd/amdgpu/soc15.c +16 −52
  357. drivers/gpu/drm/amd/amdgpu/soc15_common.h +4 −4
  358. drivers/gpu/drm/amd/amdgpu/ta_ras_if.h +2 −1
  359. drivers/gpu/drm/amd/amdgpu/umc_v6_1.c +11 −19
  360. drivers/gpu/drm/amd/amdgpu/umc_v6_1.h +1 −1
  361. drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +142 −83
  362. drivers/gpu/drm/amd/amdgpu/umc_v6_7.h +24 −1
  363. drivers/gpu/drm/amd/amdgpu/umc_v8_7.c +142 −24
  364. drivers/gpu/drm/amd/amdgpu/umc_v8_7.h +1 −1
  365. drivers/gpu/drm/amd/amdgpu/vi.c +1 −1
  366. drivers/gpu/drm/amd/amdkfd/Makefile +0 −2
  367. drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c +1 −1
  368. drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +1189 −433
  369. drivers/gpu/drm/amd/amdkfd/kfd_crat.c +5 −3
  370. drivers/gpu/drm/amd/amdkfd/kfd_crat.h +3 −2
  371. drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c +0 −845
  372. drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.h +0 −230
  373. drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c +0 −158
  374. drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.h +0 −293
  375. drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c +3 −2
  376. drivers/gpu/drm/amd/amdkfd/kfd_device.c +34 −33
  377. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +221 −48
  378. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +55 −7
  379. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c +2 −1
  380. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c +2 −10
  381. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c +2 −1
  382. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_vi.c +2 −1
  383. drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +2 −1
  384. drivers/gpu/drm/amd/amdkfd/kfd_events.c +281 −35
  385. drivers/gpu/drm/amd/amdkfd/kfd_events.h +2 −1
  386. drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c +3 −2
  387. drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c +6 −5
  388. drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +6 −5
  389. drivers/gpu/drm/amd/amdkfd/kfd_iommu.c +2 −13
  390. drivers/gpu/drm/amd/amdkfd/kfd_iommu.h +2 −1
  391. drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +2 −1
  392. drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h +2 −1
  393. drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +11 −13
  394. drivers/gpu/drm/amd/amdkfd/kfd_module.c +2 −1
  395. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +66 −1
  396. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h +43 −1
  397. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c +74 −52
  398. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +86 −69
  399. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +100 −75
  400. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c +92 −59
  401. drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +5 −6
  402. drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +16 −36
  403. drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c +5 −24
  404. drivers/gpu/drm/amd/amdkfd/kfd_pasid.c +2 −1
  405. drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers.h +2 −1
  406. drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_ai.h +2 −1
  407. drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_aldebaran.h +2 −1
  408. drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_diq.h +2 −1
  409. drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_vi.h +4 −3
  410. drivers/gpu/drm/amd/amdkfd/kfd_pm4_opcodes.h +2 −1
  411. drivers/gpu/drm/amd/amdkfd/kfd_priv.h +171 −25
  412. drivers/gpu/drm/amd/amdkfd/kfd_process.c +67 −28
  413. drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +371 −4
  414. drivers/gpu/drm/amd/amdkfd/kfd_queue.c +2 −1
  415. drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +3 −2
  416. drivers/gpu/drm/amd/amdkfd/kfd_smi_events.h +2 −1
  417. drivers/gpu/drm/amd/amdkfd/kfd_svm.c +380 −57
  418. drivers/gpu/drm/amd/amdkfd/kfd_svm.h +39 −0
  419. drivers/gpu/drm/amd/amdkfd/kfd_topology.c +5 −4
  420. drivers/gpu/drm/amd/amdkfd/kfd_topology.h +2 −1
  421. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +100 −61
  422. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +13 −0
  423. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +94 −32
  424. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +3 −1
  425. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +188 −15
  426. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +280 −9
  427. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +14 −0
  428. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +88 −160
  429. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +7 −57
  430. drivers/gpu/drm/amd/display/dc/Makefile +5 −3
  431. drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +0 −2
  432. drivers/gpu/drm/amd/display/dc/bios/command_table2.c +0 −4
  433. drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c +2 −0
  434. drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile +19 −0
  435. drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +36 −1
  436. drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +2 −0
  437. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c +2 −1
  438. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c +5 −2
  439. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c +8 −8
  440. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c +15 −13
  441. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c +20 −7
  442. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.h +1 −1
  443. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +617 −0
  444. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.h +49 −0
  445. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c +314 −0
  446. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.h +126 −0
  447. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +715 −0
  448. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.h +49 −0
  449. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c +312 −0
  450. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h +137 −0
  451. drivers/gpu/drm/amd/display/dc/core/dc.c +71 −13
  452. drivers/gpu/drm/amd/display/dc/core/dc_link.c +393 −505
  453. drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +3 −0
  454. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1017 −543
  455. drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c +23 −1
  456. drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +0 −917
  457. drivers/gpu/drm/amd/display/dc/core/dc_resource.c +83 −27
  458. drivers/gpu/drm/amd/display/dc/core/dc_stream.c +22 −1
  459. drivers/gpu/drm/amd/display/dc/dc.h +24 −22
  460. drivers/gpu/drm/amd/display/dc/dc_dp_types.h +46 −42
  461. drivers/gpu/drm/amd/display/dc/dc_helper.c +60 −0
  462. drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1 −0
  463. drivers/gpu/drm/amd/display/dc/dc_link.h +14 −7
  464. drivers/gpu/drm/amd/display/dc/dc_stream.h +0 −6
  465. drivers/gpu/drm/amd/display/dc/dc_types.h +0 −6
  466. drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1 −1
  467. drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +9 −8
  468. drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h +2 −1
  469. drivers/gpu/drm/amd/display/dc/dce/dmub_outbox.c +14 −11
  470. drivers/gpu/drm/amd/display/dc/dce/dmub_outbox.h +2 −2
  471. drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +4 −0
  472. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +39 −97
  473. drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 −1
  474. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 −10
  475. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +9 −9
  476. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.h +2 −1
  477. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +0 −15
  478. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h +0 −3
  479. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dccg.h +13 −2
  480. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +19 −34
  481. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +9 −12
  482. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c +0 −2
  483. drivers/gpu/drm/amd/display/dc/dcn201/dcn201_init.c +1 −0
  484. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dio_stream_encoder.c +0 −2
  485. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +3 −4
  486. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c +2 −2
  487. drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c +2 −2
  488. drivers/gpu/drm/amd/display/dc/dcn302/Makefile +0 −12
  489. drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c +12 −308
  490. drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.h +3 −0
  491. drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c +2 −2
  492. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c +81 −25
  493. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.h +6 −0
  494. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c +11 −0
  495. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.h +6 −3
  496. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.c +32 −29
  497. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +21 −7
  498. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_optc.c +1 −1
  499. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_optc.h +2 −0
  500. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +3 −1
  501. drivers/gpu/drm/amd/display/dc/dcn315/Makefile +12 −24
  502. drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c +2304 −0
  503. drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.h +42 −0
  504. drivers/gpu/drm/amd/display/dc/dcn316/Makefile +56 −0
  505. drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.c +2306 −0
  506. drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.h +42 −0
  507. drivers/gpu/drm/amd/display/dc/dm_helpers.h +3 −3
  508. drivers/gpu/drm/amd/display/dc/dml/Makefile +11 −1
  509. drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c +0 −0
  510. drivers/gpu/drm/amd/display/dc/dml/calcs/calcs_logger.h +0 −0
  511. drivers/gpu/drm/amd/display/dc/dml/calcs/custom_float.c +0 −0
  512. drivers/gpu/drm/amd/display/dc/dml/calcs/dce_calcs.c +23 −25
  513. drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_auto.c +0 −0
  514. drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_auto.h +0 −0
  515. drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c +0 −0
  516. drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c +0 −0
  517. drivers/gpu/drm/amd/display/dc/dml/dcn302/dcn302_fpu.c +357 −0
  518. drivers/gpu/drm/amd/display/dc/dml/dcn302/dcn302_fpu.h +32 −0
  519. drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +26 −3
  520. drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h +1 −0
  521. drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c +24 −0
  522. drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h +3 −0
  523. drivers/gpu/drm/amd/display/dc/dml/dsc/rc_calc_fpu.c +1 −1
  524. drivers/gpu/drm/amd/display/dc/gpio/Makefile +8 −0
  525. drivers/gpu/drm/amd/display/dc/gpio/dcn30/hw_factory_dcn30.c +2 −2
  526. drivers/gpu/drm/amd/display/dc/gpio/dcn30/hw_translate_dcn30.c +2 −2
  527. drivers/gpu/drm/amd/display/dc/gpio/dcn315/hw_factory_dcn315.c +260 −0
  528. drivers/gpu/drm/amd/display/dc/gpio/dcn315/hw_factory_dcn315.h +31 −0
  529. drivers/gpu/drm/amd/display/dc/gpio/dcn315/hw_translate_dcn315.c +374 −0
  530. drivers/gpu/drm/amd/display/dc/gpio/dcn315/hw_translate_dcn315.h +33 −0
  531. drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c +5 −0
  532. drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c +5 −0
  533. drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 −12
  534. drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +44 −12
  535. drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h +2 −2
  536. drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +0 −2
  537. drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h +2 −3
  538. drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +4 −6
  539. drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +0 −2
  540. drivers/gpu/drm/amd/display/dc/inc/hw_sequencer_private.h +0 −2
  541. drivers/gpu/drm/amd/display/dc/inc/link_dpcd.h +1 −1
  542. drivers/gpu/drm/amd/display/dc/inc/link_enc_cfg.h +3 −0
  543. drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +44 −42
  544. drivers/gpu/drm/amd/display/dc/inc/reg_helper.h +34 −0
  545. drivers/gpu/drm/amd/display/dc/inc/resource.h +6 −10
  546. drivers/gpu/drm/amd/display/dc/irq/Makefile +8 −0
  547. drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c +1 −1
  548. drivers/gpu/drm/amd/display/dc/irq/dcn201/irq_service_dcn201.c +0 −5
  549. drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c +0 −14
  550. drivers/gpu/drm/amd/display/dc/irq/dcn30/irq_service_dcn30.c +3 −3
  551. drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c +438 −0
  552. drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.h +34 −0
  553. drivers/gpu/drm/amd/display/dc/link/Makefile +30 −0
  554. drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.c +137 −0
  555. drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.h +53 −0
  556. drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.c +51 −0
  557. drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.h +34 −0
  558. drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.c +254 −0
  559. drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.h +35 −0
  560. drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.c +43 −0
  561. drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.h +34 −0
  562. drivers/gpu/drm/amd/display/dc/virtual/Makefile +1 −1
  563. drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c +2 −1
  564. drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.c +43 −0
  565. drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h +34 −0
  566. drivers/gpu/drm/amd/display/dmub/dmub_srv.h +2 −0
  567. drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +52 −5
  568. drivers/gpu/drm/amd/display/dmub/src/Makefile +1 −1
  569. drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c +1 −1
  570. drivers/gpu/drm/amd/display/dmub/src/dmub_dcn315.c +62 −0
  571. drivers/gpu/drm/amd/display/dmub/src/dmub_dcn315.h +68 −0
  572. drivers/gpu/drm/amd/display/dmub/src/dmub_dcn316.c +62 −0
  573. drivers/gpu/drm/amd/display/dmub/src/dmub_dcn316.h +33 −0
  574. drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +10 −1
  575. drivers/gpu/drm/amd/display/include/bios_parser_types.h +0 −2
  576. drivers/gpu/drm/amd/display/include/dal_asic_id.h +12 −1
  577. drivers/gpu/drm/amd/display/include/dal_types.h +2 −0
  578. drivers/gpu/drm/amd/display/include/ddc_service_types.h +6 −0
  579. drivers/gpu/drm/amd/display/include/dpcd_defs.h +0 −4
  580. drivers/gpu/drm/amd/display/include/grph_object_defs.h +0 −2
  581. drivers/gpu/drm/amd/display/include/grph_object_id.h +0 −2
  582. drivers/gpu/drm/amd/display/include/link_service_types.h +0 −12
  583. drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h +2 −1
  584. drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +13 −12
  585. drivers/gpu/drm/amd/include/amd_shared.h +1 −2
  586. drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_5_offset.h +15191 −0
.mailmap+6−0
@@ -80,6 +80,9 @@ Chris Chiu <chris.chiu@canonical.com> <chiu@endlessos.org> · 79 unmodified lines
8080 Christian Borntraeger <borntraeger@linux.ibm.com> <borntraeger@de.ibm.com>
8181 Christian Borntraeger <borntraeger@linux.ibm.com> <cborntra@de.ibm.com>
8282 Christian Borntraeger <borntraeger@linux.ibm.com> <borntrae@de.ibm.com>
83+Christian Brauner <brauner@kernel.org> <christian@brauner.io>
84+Christian Brauner <brauner@kernel.org> <christian.brauner@canonical.com>
85+Christian Brauner <brauner@kernel.org> <christian.brauner@ubuntu.com>
8386 Christophe Ricard <christophe.ricard@gmail.com>
8487 Christoph Hellwig <hch@lst.de>
8588 Colin Ian King <colin.king@intel.com> <colin.king@canonical.com>
@@ -330,6 +333,9 @@ Rémi Denis-Courmont <rdenis@simphalempin.com> · 244 unmodified lines
330333 Ricardo Ribalda <ribalda@kernel.org> <ricardo@ribalda.com>
331334 Ricardo Ribalda <ribalda@kernel.org> Ricardo Ribalda Delgado <ribalda@kernel.org>
332335 Ricardo Ribalda <ribalda@kernel.org> <ricardo.ribalda@gmail.com>
336+Roman Gushchin <roman.gushchin@linux.dev> <guro@fb.com>
337+Roman Gushchin <roman.gushchin@linux.dev> <guroan@gmail.com>
338+Roman Gushchin <roman.gushchin@linux.dev> <klamm@yandex-team.ru>
333339 Ross Zwisler <zwisler@kernel.org> <ross.zwisler@linux.intel.com>
334340 Rudolf Marek <R.Marek@sh.cvut.cz>
335341 Rui Saraiva <rmps@joel.ist.utl.pt>
Documentation/ABI/testing/sysfs-class-power+1−0
@@ -468,6 +468,7 @@ Description: · 467 unmodified lines
468468 auto: Charge normally, respect thresholds
469469 inhibit-charge: Do not charge while AC is attached
470470 force-discharge: Force discharge while AC is attached
471+ ================ ====================================
471472
472473 What: /sys/class/power_supply/<supply_name>/technology
473474 Date: May 2007
Documentation/ABI/testing/sysfs-driver-aspeed-uart-routing+3−3
@@ -1,4 +1,4 @@
1−What: /sys/bus/platform/drivers/aspeed-uart-routing/*/uart*
1+What: /sys/bus/platform/drivers/aspeed-uart-routing/\*/uart\*
22 Date: September 2021
33 Contact: Oskar Senft <osk@google.com>
44 Chia-Wei Wang <chiawei_wang@aspeedtech.com>
@@ -9,7 +9,7 @@ Description: Selects the RX source of the UARTx device. · 4 unmodified lines
99 depends on the selected file.
1010
1111 e.g.
12− cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1
12+ cat /sys/bus/platform/drivers/aspeed-uart-routing/\*.uart_routing/uart1
1313 [io1] io2 io3 io4 uart2 uart3 uart4 io6
1414
1515 In this case, UART1 gets its input from IO1 (physical serial port 1).
@@ -17,7 +17,7 @@ Description: Selects the RX source of the UARTx device. · 1 unmodified line
1717 Users: OpenBMC. Proposed changes should be mailed to
1818 openbmc@lists.ozlabs.org
1919
20−What: /sys/bus/platform/drivers/aspeed-uart-routing/*/io*
20+What: /sys/bus/platform/drivers/aspeed-uart-routing/\*/io\*
2121 Date: September 2021
2222 Contact: Oskar Senft <osk@google.com>
2323 Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Documentation/arm64/silicon-errata.rst+2−0
@@ -100,6 +100,8 @@ stable kernels. · 99 unmodified lines
100100 +----------------+-----------------+-----------------+-----------------------------+
101101 | ARM | Cortex-A510 | #2051678 | ARM64_ERRATUM_2051678 |
102102 +----------------+-----------------+-----------------+-----------------------------+
103+| ARM | Cortex-A510 | #2077057 | ARM64_ERRATUM_2077057 |
104++----------------+-----------------+-----------------+-----------------------------+
103105 | ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 |
104106 +----------------+-----------------+-----------------+-----------------------------+
105107 | ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 |
Documentation/core-api/dma-attributes.rst+8−0
@@ -130,3 +130,11 @@ accesses to DMA buffers in both privileged "supervisor" and unprivileged · 129 unmodified lines
130130 subsystem that the buffer is fully accessible at the elevated privilege
131131 level (and ideally inaccessible or at least read-only at the
132132 lesser-privileged levels).
133+
134+DMA_ATTR_OVERWRITE
135+------------------
136+
137+This is a hint to the DMA-mapping subsystem that the device is expected to
138+overwrite the entire mapped size, thus the caller does not require any of the
139+previous buffer contents to be preserved. This allows bounce-buffering
140+implementations to optimise DMA_FROM_DEVICE transfers.
Documentation/cpu-freq/cpu-drivers.rst+3−0
@@ -75,6 +75,9 @@ And optionally · 74 unmodified lines
7575 .resume - A pointer to a per-policy resume function which is called
7676 with interrupts disabled and _before_ the governor is started again.
7777
78+ .ready - A pointer to a per-policy ready function which is called after
79+ the policy is fully initialized.
80+
7881 .attr - A pointer to a NULL-terminated list of "struct freq_attr" which
7982 allow to export values to sysfs.
8083
Documentation/dev-tools/kselftest.rst+8−0
@@ -7,6 +7,14 @@ directory. These are intended to be small tests to exercise individual code · 6 unmodified lines
77 paths in the kernel. Tests are intended to be run after building, installing
88 and booting a kernel.
99
10+Kselftest from mainline can be run on older stable kernels. Running tests
11+from mainline offers the best coverage. Several test rings run mainline
12+kselftest suite on stable releases. The reason is that when a new test
13+gets added to test existing code to regression test a bug, we should be
14+able to run that test on an older kernel. Hence, it is important to keep
15+code that can still test an older kernel and make sure it skips the test
16+gracefully on newer releases.
17+
1018 You can find additional information on Kselftest framework, how to
1119 write new tests using the framework on Kselftest wiki:
1220
Documentation/dev-tools/kunit/usage.rst+1−1
@@ -242,7 +242,7 @@ example: · 241 unmodified lines
242242
243243 int rectangle_area(struct shape *this)
244244 {
245− struct rectangle *self = container_of(this, struct shape, parent);
245+ struct rectangle *self = container_of(this, struct rectangle, parent);
246246
247247 return self->length * self->width;
248248 };
Documentation/devicetree/bindings/arm/omap/omap.txt+3−0
@@ -119,6 +119,9 @@ Boards (incomplete list of examples): · 118 unmodified lines
119119 - OMAP3 BeagleBoard : Low cost community board
120120 compatible = "ti,omap3-beagle", "ti,omap3430", "ti,omap3"
121121
122+- OMAP3 BeagleBoard A to B4 : Early BeagleBoard revisions A to B4 with a timer quirk
123+ compatible = "ti,omap3-beagle-ab4", "ti,omap3-beagle", "ti,omap3430", "ti,omap3"
124+
122125 - OMAP3 Tobi with Overo : Commercial expansion board with daughter board
123126 compatible = "gumstix,omap3-overo-tobi", "gumstix,omap3-overo", "ti,omap3430", "ti,omap3"
124127
Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml+17−0
@@ -83,6 +83,9 @@ properties: · 82 unmodified lines
8383 type: boolean
8484 description: let the driver enable audio HDMI codec function or not.
8585
86+ aux-bus:
87+ $ref: /schemas/display/dp-aux-bus.yaml#
88+
8689 ports:
8790 $ref: /schemas/graph.yaml#/properties/ports
8891
@@ -167,5 +170,19 @@ examples: · 78 unmodified lines
167170 };
168171 };
169172 };
173+
174+ aux-bus {
175+ panel {
176+ compatible = "innolux,n125hce-gn1";
177+ power-supply = <&pp3300_disp_x>;
178+ backlight = <&backlight_lcd0>;
179+
180+ port {
181+ panel_in: endpoint {
182+ remote-endpoint = <&anx7625_out>;
183+ };
184+ };
185+ };
186+ };
170187 };
171188 };
Documentation/devicetree/bindings/display/bridge/ingenic,jz4780-hdmi.yaml+82−0
@@ -0,0 +1,82 @@
1+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/bridge/ingenic,jz4780-hdmi.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Bindings for Ingenic JZ4780 HDMI Transmitter
8+
9+maintainers:
10+ - H. Nikolaus Schaller <hns@goldelico.com>
11+
12+description: |
13+ The HDMI Transmitter in the Ingenic JZ4780 is a Synopsys DesignWare HDMI 1.4
14+ TX controller IP with accompanying PHY IP.
15+
16+allOf:
17+ - $ref: synopsys,dw-hdmi.yaml#
18+
19+properties:
20+ compatible:
21+ const: ingenic,jz4780-dw-hdmi
22+
23+ reg-io-width:
24+ const: 4
25+
26+ clocks:
27+ maxItems: 2
28+
29+ ports:
30+ $ref: /schemas/graph.yaml#/properties/ports
31+
32+ properties:
33+ port@0:
34+ $ref: /schemas/graph.yaml#/properties/port
35+ description: Input from LCD controller output.
36+
37+ port@1:
38+ $ref: /schemas/graph.yaml#/properties/port
39+ description: Link to the HDMI connector.
40+
41+required:
42+ - compatible
43+ - clocks
44+ - clock-names
45+ - ports
46+ - reg-io-width
47+
48+unevaluatedProperties: false
49+
50+examples:
51+ - |
52+ #include <dt-bindings/clock/ingenic,jz4780-cgu.h>
53+
54+ hdmi: hdmi@10180000 {
55+ compatible = "ingenic,jz4780-dw-hdmi";
56+ reg = <0x10180000 0x8000>;
57+ reg-io-width = <4>;
58+ ddc-i2c-bus = <&i2c4>;
59+ interrupt-parent = <&intc>;
60+ interrupts = <3>;
61+ clocks = <&cgu JZ4780_CLK_AHB0>, <&cgu JZ4780_CLK_HDMI>;
62+ clock-names = "iahb", "isfr";
63+
64+ ports {
65+ #address-cells = <1>;
66+ #size-cells = <0>;
67+ hdmi_in: port@0 {
68+ reg = <0>;
69+ dw_hdmi_in: endpoint {
70+ remote-endpoint = <&jz4780_lcd_out>;
71+ };
72+ };
73+ hdmi_out: port@1 {
74+ reg = <1>;
75+ dw_hdmi_out: endpoint {
76+ remote-endpoint = <&hdmi_con>;
77+ };
78+ };
79+ };
80+ };
81+
82+...
Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml+1−1
@@ -68,7 +68,7 @@ properties: · 67 unmodified lines
6868 - vesa-24
6969 description: |
7070 The color signals mapping order. See details in
71− Documentation/devicetree/bindings/display/panel/lvds.yaml
71+ Documentation/devicetree/bindings/display/lvds.yaml
7272
7373 port@1:
7474 $ref: /schemas/graph.yaml#/properties/port
Documentation/devicetree/bindings/display/lvds.yamlrenamed from Documentation/devicetree/bindings/display/panel/lvds.yaml+4−31
@@ -1,10 +1,10 @@
11 # SPDX-License-Identifier: GPL-2.0
22 %YAML 1.2
33 ---
4−$id: http://devicetree.org/schemas/display/panel/lvds.yaml#
4+$id: http://devicetree.org/schemas/display/lvds.yaml#
55 $schema: http://devicetree.org/meta-schemas/core.yaml#
66
7−title: LVDS Display Panel
7+title: LVDS Display Common Properties
88
99 maintainers:
1010 - Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
@@ -13,8 +13,8 @@ maintainers: · 2 unmodified lines
1313 description: |+
1414 LVDS is a physical layer specification defined in ANSI/TIA/EIA-644-A. Multiple
1515 incompatible data link layers have been used over time to transmit image data
16− to LVDS panels. This bindings supports display panels compatible with the
17− following specifications.
16+ to LVDS devices. This bindings supports devices compatible with the following
17+ specifications.
1818
1919 [JEIDA] "Digital Interface Standards for Monitor", JEIDA-59-1999, February
2020 1999 (Version 1.0), Japan Electronic Industry Development Association (JEIDA)
@@ -26,18 +26,7 @@ description: |+ · 5 unmodified lines
2626 Device compatible with those specifications have been marketed under the
2727 FPD-Link and FlatLink brands.
2828
29−allOf:
30− - $ref: panel-common.yaml#
31−
3229 properties:
33− compatible:
34− contains:
35− const: panel-lvds
36− description:
37− Shall contain "panel-lvds" in addition to a mandatory panel-specific
38− compatible string defined in individual panel bindings. The "panel-lvds"
39− value shall never be used on its own.
40−
4130 data-mapping:
4231 enum:
4332 - jeida-18
@@ -96,22 +85,6 @@ properties: · 52 unmodified lines
9685 If set, reverse the bit order described in the data mappings below on all
9786 data lanes, transmitting bits for slots 6 to 0 instead of 0 to 6.
9887
99− port: true
100− ports: true
101−
102−required:
103− - compatible
104− - data-mapping
105− - width-mm
106− - height-mm
107− - panel-timing
108−
109−oneOf:
110− - required:
111− - port
112− - required:
113− - ports
114−
11588 additionalProperties: true
11689
11790 ...
Documentation/devicetree/bindings/display/mediatek/mediatek,aal.yaml+77−0
@@ -0,0 +1,77 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,aal.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display adaptive ambient light processor
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display adaptive ambient light processor, namely AAL,
15+ is responsible for backlight power saving and sunlight visibility improving.
16+ AAL device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt8173-disp-aal
26+ - items:
27+ - enum:
28+ - mediatek,mt2712-disp-aal
29+ - mediatek,mt8183-disp-aal
30+ - mediatek,mt8192-disp-aal
31+ - mediatek,mt8195-disp-aal
32+ - enum:
33+ - mediatek,mt8173-disp-aal
34+
35+ reg:
36+ maxItems: 1
37+
38+ interrupts:
39+ maxItems: 1
40+
41+ power-domains:
42+ description: A phandle and PM domain specifier as defined by bindings of
43+ the power controller specified by phandle. See
44+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
45+
46+ clocks:
47+ items:
48+ - description: AAL Clock
49+
50+ mediatek,gce-client-reg:
51+ description: The register of client driver can be configured by gce with
52+ 4 arguments defined in this property, such as phandle of gce, subsys id,
53+ register offset and size. Each GCE subsys id is mapping to a client
54+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
55+ $ref: /schemas/types.yaml#/definitions/phandle-array
56+ maxItems: 1
57+
58+required:
59+ - compatible
60+ - reg
61+ - interrupts
62+ - power-domains
63+ - clocks
64+
65+additionalProperties: false
66+
67+examples:
68+ - |
69+
70+ aal@14015000 {
71+ compatible = "mediatek,mt8173-disp-aal";
72+ reg = <0 0x14015000 0 0x1000>;
73+ interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_LOW>;
74+ power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
75+ clocks = <&mmsys CLK_MM_DISP_AAL>;
76+ mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x5000 0x1000>;
77+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,ccorr.yaml+76−0
@@ -0,0 +1,76 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,ccorr.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display color correction
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display color correction, namely CCORR, reproduces correct color
15+ on panels with different color gamut.
16+ CCORR device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt8183-disp-ccorr
26+ - items:
27+ - const: mediatek,mt8192-disp-ccorr
28+ - items:
29+ - enum:
30+ - mediatek,mt8195-disp-ccorr
31+ - enum:
32+ - mediatek,mt8192-disp-ccorr
33+
34+ reg:
35+ maxItems: 1
36+
37+ interrupts:
38+ maxItems: 1
39+
40+ power-domains:
41+ description: A phandle and PM domain specifier as defined by bindings of
42+ the power controller specified by phandle. See
43+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
44+
45+ clocks:
46+ items:
47+ - description: CCORR Clock
48+
49+ mediatek,gce-client-reg:
50+ description: The register of client driver can be configured by gce with
51+ 4 arguments defined in this property, such as phandle of gce, subsys id,
52+ register offset and size. Each GCE subsys id is mapping to a client
53+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
54+ $ref: /schemas/types.yaml#/definitions/phandle-array
55+ maxItems: 1
56+
57+required:
58+ - compatible
59+ - reg
60+ - interrupts
61+ - power-domains
62+ - clocks
63+
64+additionalProperties: false
65+
66+examples:
67+ - |
68+
69+ ccorr0: ccorr@1400f000 {
70+ compatible = "mediatek,mt8183-disp-ccorr";
71+ reg = <0 0x1400f000 0 0x1000>;
72+ interrupts = <GIC_SPI 232 IRQ_TYPE_LEVEL_LOW>;
73+ power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
74+ clocks = <&mmsys CLK_MM_DISP_CCORR0>;
75+ mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xf000 0x1000>;
76+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,color.yaml+86−0
@@ -0,0 +1,86 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,color.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display color processor
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display color processor, namely COLOR, provides hue, luma and
15+ saturation adjustments to get better picture quality and to have one panel
16+ resemble the other in their output characteristics.
17+ COLOR device node must be siblings to the central MMSYS_CONFIG node.
18+ For a description of the MMSYS_CONFIG binding, see
19+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
20+ for details.
21+
22+properties:
23+ compatible:
24+ oneOf:
25+ - items:
26+ - const: mediatek,mt2701-disp-color
27+ - items:
28+ - const: mediatek,mt8167-disp-color
29+ - items:
30+ - const: mediatek,mt8173-disp-color
31+ - items:
32+ - enum:
33+ - mediatek,mt7623-disp-color
34+ - mediatek,mt2712-disp-color
35+ - enum:
36+ - mediatek,mt2701-disp-color
37+ - items:
38+ - enum:
39+ - mediatek,mt8183-disp-color
40+ - mediatek,mt8192-disp-color
41+ - mediatek,mt8195-disp-color
42+ - enum:
43+ - mediatek,mt8173-disp-color
44+ reg:
45+ maxItems: 1
46+
47+ interrupts:
48+ maxItems: 1
49+
50+ power-domains:
51+ description: A phandle and PM domain specifier as defined by bindings of
52+ the power controller specified by phandle. See
53+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
54+
55+ clocks:
56+ items:
57+ - description: COLOR Clock
58+
59+ mediatek,gce-client-reg:
60+ description: The register of client driver can be configured by gce with
61+ 4 arguments defined in this property, such as phandle of gce, subsys id,
62+ register offset and size. Each GCE subsys id is mapping to a client
63+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
64+ $ref: /schemas/types.yaml#/definitions/phandle-array
65+ maxItems: 1
66+
67+required:
68+ - compatible
69+ - reg
70+ - interrupts
71+ - power-domains
72+ - clocks
73+
74+additionalProperties: false
75+
76+examples:
77+ - |
78+
79+ color0: color@14013000 {
80+ compatible = "mediatek,mt8173-disp-color";
81+ reg = <0 0x14013000 0 0x1000>;
82+ interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_LOW>;
83+ power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
84+ clocks = <&mmsys CLK_MM_DISP_COLOR0>;
85+ mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x3000 0x1000>;
86+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt+0−219
@@ -1,219 +0,0 @@
1−Mediatek display subsystem
2−==========================
3−
4−The Mediatek display subsystem consists of various DISP function blocks in the
5−MMSYS register space. The connections between them can be configured by output
6−and input selectors in the MMSYS_CONFIG register space. Pixel clock and start
7−of frame signal are distributed to the other function blocks by a DISP_MUTEX
8−function block.
9−
10−All DISP device tree nodes must be siblings to the central MMSYS_CONFIG node.
11−For a description of the MMSYS_CONFIG binding, see
12−Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml.
13−
14−DISP function blocks
15−====================
16−
17−A display stream starts at a source function block that reads pixel data from
18−memory and ends with a sink function block that drives pixels on a display
19−interface, or writes pixels back to memory. All DISP function blocks have
20−their own register space, interrupt, and clock gate. The blocks that can
21−access memory additionally have to list the IOMMU and local arbiter they are
22−connected to.
23−
24−For a description of the display interface sink function blocks, see
25−Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt and
26−Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml.
27−
28−Required properties (all function blocks):
29−- compatible: "mediatek,<chip>-disp-<function>", one of
30− "mediatek,<chip>-disp-ovl" - overlay (4 layers, blending, csc)
31− "mediatek,<chip>-disp-ovl-2l" - overlay (2 layers, blending, csc)
32− "mediatek,<chip>-disp-rdma" - read DMA / line buffer
33− "mediatek,<chip>-disp-wdma" - write DMA
34− "mediatek,<chip>-disp-ccorr" - color correction
35− "mediatek,<chip>-disp-color" - color processor
36− "mediatek,<chip>-disp-dither" - dither
37− "mediatek,<chip>-disp-aal" - adaptive ambient light controller
38− "mediatek,<chip>-disp-gamma" - gamma correction
39− "mediatek,<chip>-disp-merge" - merge streams from two RDMA sources
40− "mediatek,<chip>-disp-postmask" - control round corner for display frame
41− "mediatek,<chip>-disp-split" - split stream to two encoders
42− "mediatek,<chip>-disp-ufoe" - data compression engine
43− "mediatek,<chip>-dsi" - DSI controller, see mediatek,dsi.txt
44− "mediatek,<chip>-dpi" - DPI controller, see mediatek,dpi.txt
45− "mediatek,<chip>-disp-mutex" - display mutex
46− "mediatek,<chip>-disp-od" - overdrive
47− the supported chips are mt2701, mt7623, mt2712, mt8167, mt8173, mt8183 and mt8192.
48−- reg: Physical base address and length of the function block register space
49−- interrupts: The interrupt signal from the function block (required, except for
50− merge and split function blocks).
51−- clocks: device clocks
52− See Documentation/devicetree/bindings/clock/clock-bindings.txt for details.
53− For most function blocks this is just a single clock input. Only the DSI and
54− DPI controller nodes have multiple clock inputs. These are documented in
55− mediatek,dsi.txt and mediatek,dpi.txt, respectively.
56− An exception is that the mt8183 mutex is always free running with no clocks property.
57−
58−Required properties (DMA function blocks):
59−- compatible: Should be one of
60− "mediatek,<chip>-disp-ovl"
61− "mediatek,<chip>-disp-rdma"
62− "mediatek,<chip>-disp-wdma"
63− the supported chips are mt2701, mt8167 and mt8173.
64−- larb: Should contain a phandle pointing to the local arbiter device as defined
65− in Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
66−- iommus: Should point to the respective IOMMU block with master port as
67− argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
68− for details.
69−
70−Optional properties (RDMA function blocks):
71−- mediatek,rdma-fifo-size: rdma fifo size may be different even in same SOC, add this
72− property to the corresponding rdma
73− the value is the Max value which defined in hardware data sheet.
74− mediatek,rdma-fifo-size of mt8173-rdma0 is 8K
75− mediatek,rdma-fifo-size of mt8183-rdma0 is 5K
76− mediatek,rdma-fifo-size of mt8183-rdma1 is 2K
77−
78−Examples:
79−
80−mmsys: clock-controller@14000000 {
81− compatible = "mediatek,mt8173-mmsys", "syscon";
82− reg = <0 0x14000000 0 0x1000>;
83− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
84− #clock-cells = <1>;
85−};
86−
87−ovl0: ovl@1400c000 {
88− compatible = "mediatek,mt8173-disp-ovl";
89− reg = <0 0x1400c000 0 0x1000>;
90− interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_LOW>;
91− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
92− clocks = <&mmsys CLK_MM_DISP_OVL0>;
93− iommus = <&iommu M4U_PORT_DISP_OVL0>;
94− mediatek,larb = <&larb0>;
95−};
96−
97−ovl1: ovl@1400d000 {
98− compatible = "mediatek,mt8173-disp-ovl";
99− reg = <0 0x1400d000 0 0x1000>;
100− interrupts = <GIC_SPI 181 IRQ_TYPE_LEVEL_LOW>;
101− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
102− clocks = <&mmsys CLK_MM_DISP_OVL1>;
103− iommus = <&iommu M4U_PORT_DISP_OVL1>;
104− mediatek,larb = <&larb4>;
105−};
106−
107−rdma0: rdma@1400e000 {
108− compatible = "mediatek,mt8173-disp-rdma";
109− reg = <0 0x1400e000 0 0x1000>;
110− interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_LOW>;
111− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
112− clocks = <&mmsys CLK_MM_DISP_RDMA0>;
113− iommus = <&iommu M4U_PORT_DISP_RDMA0>;
114− mediatek,larb = <&larb0>;
115− mediatek,rdma-fifosize = <8192>;
116−};
117−
118−rdma1: rdma@1400f000 {
119− compatible = "mediatek,mt8173-disp-rdma";
120− reg = <0 0x1400f000 0 0x1000>;
121− interrupts = <GIC_SPI 183 IRQ_TYPE_LEVEL_LOW>;
122− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
123− clocks = <&mmsys CLK_MM_DISP_RDMA1>;
124− iommus = <&iommu M4U_PORT_DISP_RDMA1>;
125− mediatek,larb = <&larb4>;
126−};
127−
128−rdma2: rdma@14010000 {
129− compatible = "mediatek,mt8173-disp-rdma";
130− reg = <0 0x14010000 0 0x1000>;
131− interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_LOW>;
132− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
133− clocks = <&mmsys CLK_MM_DISP_RDMA2>;
134− iommus = <&iommu M4U_PORT_DISP_RDMA2>;
135− mediatek,larb = <&larb4>;
136−};
137−
138−wdma0: wdma@14011000 {
139− compatible = "mediatek,mt8173-disp-wdma";
140− reg = <0 0x14011000 0 0x1000>;
141− interrupts = <GIC_SPI 185 IRQ_TYPE_LEVEL_LOW>;
142− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
143− clocks = <&mmsys CLK_MM_DISP_WDMA0>;
144− iommus = <&iommu M4U_PORT_DISP_WDMA0>;
145− mediatek,larb = <&larb0>;
146−};
147−
148−wdma1: wdma@14012000 {
149− compatible = "mediatek,mt8173-disp-wdma";
150− reg = <0 0x14012000 0 0x1000>;
151− interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_LOW>;
152− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
153− clocks = <&mmsys CLK_MM_DISP_WDMA1>;
154− iommus = <&iommu M4U_PORT_DISP_WDMA1>;
155− mediatek,larb = <&larb4>;
156−};
157−
158−color0: color@14013000 {
159− compatible = "mediatek,mt8173-disp-color";
160− reg = <0 0x14013000 0 0x1000>;
161− interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_LOW>;
162− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
163− clocks = <&mmsys CLK_MM_DISP_COLOR0>;
164−};
165−
166−color1: color@14014000 {
167− compatible = "mediatek,mt8173-disp-color";
168− reg = <0 0x14014000 0 0x1000>;
169− interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_LOW>;
170− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
171− clocks = <&mmsys CLK_MM_DISP_COLOR1>;
172−};
173−
174−aal@14015000 {
175− compatible = "mediatek,mt8173-disp-aal";
176− reg = <0 0x14015000 0 0x1000>;
177− interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_LOW>;
178− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
179− clocks = <&mmsys CLK_MM_DISP_AAL>;
180−};
181−
182−gamma@14016000 {
183− compatible = "mediatek,mt8173-disp-gamma";
184− reg = <0 0x14016000 0 0x1000>;
185− interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_LOW>;
186− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
187− clocks = <&mmsys CLK_MM_DISP_GAMMA>;
188−};
189−
190−ufoe@1401a000 {
191− compatible = "mediatek,mt8173-disp-ufoe";
192− reg = <0 0x1401a000 0 0x1000>;
193− interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_LOW>;
194− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
195− clocks = <&mmsys CLK_MM_DISP_UFOE>;
196−};
197−
198−dsi0: dsi@1401b000 {
199− /* See mediatek,dsi.txt for details */
200−};
201−
202−dpi0: dpi@1401d000 {
203− /* See mediatek,dpi.txt for details */
204−};
205−
206−mutex: mutex@14020000 {
207− compatible = "mediatek,mt8173-disp-mutex";
208− reg = <0 0x14020000 0 0x1000>;
209− interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_LOW>;
210− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
211− clocks = <&mmsys CLK_MM_MUTEX_32K>;
212−};
213−
214−od@14023000 {
215− compatible = "mediatek,mt8173-disp-od";
216− reg = <0 0x14023000 0 0x1000>;
217− power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
218− clocks = <&mmsys CLK_MM_DISP_OD>;
219−};
Documentation/devicetree/bindings/display/mediatek/mediatek,dither.yaml+76−0
@@ -0,0 +1,76 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,dither.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display dither processor
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display dither processor, namely DITHER, works by approximating
15+ unavailable colors with available colors and by mixing and matching available
16+ colors to mimic unavailable ones.
17+ DITHER device node must be siblings to the central MMSYS_CONFIG node.
18+ For a description of the MMSYS_CONFIG binding, see
19+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
20+ for details.
21+
22+properties:
23+ compatible:
24+ oneOf:
25+ - items:
26+ - const: mediatek,mt8183-disp-dither
27+ - items:
28+ - enum:
29+ - mediatek,mt8192-disp-dither
30+ - mediatek,mt8195-disp-dither
31+ - enum:
32+ - mediatek,mt8183-disp-dither
33+
34+ reg:
35+ maxItems: 1
36+
37+ interrupts:
38+ maxItems: 1
39+
40+ power-domains:
41+ description: A phandle and PM domain specifier as defined by bindings of
42+ the power controller specified by phandle. See
43+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
44+
45+ clocks:
46+ items:
47+ - description: DITHER Clock
48+
49+ mediatek,gce-client-reg:
50+ description: The register of client driver can be configured by gce with
51+ 4 arguments defined in this property, such as phandle of gce, subsys id,
52+ register offset and size. Each GCE subsys id is mapping to a client
53+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
54+ $ref: /schemas/types.yaml#/definitions/phandle-array
55+ maxItems: 1
56+
57+required:
58+ - compatible
59+ - reg
60+ - interrupts
61+ - power-domains
62+ - clocks
63+
64+additionalProperties: false
65+
66+examples:
67+ - |
68+
69+ dither0: dither@14012000 {
70+ compatible = "mediatek,mt8183-disp-dither";
71+ reg = <0 0x14012000 0 0x1000>;
72+ interrupts = <GIC_SPI 235 IRQ_TYPE_LEVEL_LOW>;
73+ power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
74+ clocks = <&mmsys CLK_MM_DISP_DITHER0>;
75+ mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x2000 0x1000>;
76+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,dsc.yaml+71−0
@@ -0,0 +1,71 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,dsc.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: mediatek display DSC controller
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ The DSC standard is a specification of the algorithms used for
15+ compressing and decompressing image display streams, including
16+ the specification of the syntax and semantics of the compressed
17+ video bit stream. DSC is designed for real-time systems with
18+ real-time compression, transmission, decompression and Display.
19+
20+properties:
21+ compatible:
22+ oneOf:
23+ - items:
24+ - const: mediatek,mt8195-disp-dsc
25+
26+ reg:
27+ maxItems: 1
28+
29+ interrupts:
30+ maxItems: 1
31+
32+ clocks:
33+ items:
34+ - description: DSC Wrapper Clock
35+
36+ power-domains:
37+ description: A phandle and PM domain specifier as defined by bindings of
38+ the power controller specified by phandle. See
39+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
40+
41+ mediatek,gce-client-reg:
42+ description:
43+ The register of client driver can be configured by gce with 4 arguments
44+ defined in this property, such as phandle of gce, subsys id,
45+ register offset and size.
46+ Each subsys id is mapping to a base address of display function blocks
47+ register which is defined in the gce header
48+ include/dt-bindings/gce/<chip>-gce.h.
49+ $ref: /schemas/types.yaml#/definitions/phandle-array
50+ maxItems: 1
51+
52+required:
53+ - compatible
54+ - reg
55+ - interrupts
56+ - power-domains
57+ - clocks
58+
59+additionalProperties: false
60+
61+examples:
62+ - |
63+
64+ dsc0: disp_dsc_wrap@1c009000 {
65+ compatible = "mediatek,mt8195-disp-dsc";
66+ reg = <0 0x1c009000 0 0x1000>;
67+ interrupts = <GIC_SPI 645 IRQ_TYPE_LEVEL_HIGH 0>;
68+ power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS0>;
69+ clocks = <&vdosys0 CLK_VDO0_DSC_WRAP0>;
70+ mediatek,gce-client-reg = <&gce1 SUBSYS_1c00XXXX 0x9000 0x1000>;
71+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,ethdr.yaml+147−0
@@ -0,0 +1,147 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,ethdr.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek Ethdr Device Tree Bindings
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ ETHDR is designed for HDR video and graphics conversion in the external display path.
15+ It handles multiple HDR input types and performs tone mapping, color space/color
16+ format conversion, and then combine different layers, output the required HDR or
17+ SDR signal to the subsequent display path. This engine is composed of two video
18+ frontends, two graphic frontends, one video backend and a mixer. ETHDR has two
19+ DMA function blocks, DS and ADL. These two function blocks read the pre-programmed
20+ registers from DRAM and set them to HW in the v-blanking period.
21+
22+properties:
23+ compatible:
24+ items:
25+ - const: mediatek,mt8195-disp-ethdr
26+ reg:
27+ maxItems: 7
28+ reg-names:
29+ items:
30+ - const: mixer
31+ - const: vdo_fe0
32+ - const: vdo_fe1
33+ - const: gfx_fe0
34+ - const: gfx_fe1
35+ - const: vdo_be
36+ - const: adl_ds
37+ interrupts:
38+ minItems: 1
39+ iommus:
40+ description: The compatible property is DMA function blocks.
41+ Should point to the respective IOMMU block with master port as argument,
42+ see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for
43+ details.
44+ minItems: 1
45+ maxItems: 2
46+ clocks:
47+ items:
48+ - description: mixer clock
49+ - description: video frontend 0 clock
50+ - description: video frontend 1 clock
51+ - description: graphic frontend 0 clock
52+ - description: graphic frontend 1 clock
53+ - description: video backend clock
54+ - description: autodownload and menuload clock
55+ - description: video frontend 0 async clock
56+ - description: video frontend 1 async clock
57+ - description: graphic frontend 0 async clock
58+ - description: graphic frontend 1 async clock
59+ - description: video backend async clock
60+ - description: ethdr top clock
61+ clock-names:
62+ items:
63+ - const: mixer
64+ - const: vdo_fe0
65+ - const: vdo_fe1
66+ - const: gfx_fe0
67+ - const: gfx_fe1
68+ - const: vdo_be
69+ - const: adl_ds
70+ - const: vdo_fe0_async
71+ - const: vdo_fe1_async
72+ - const: gfx_fe0_async
73+ - const: gfx_fe1_async
74+ - const: vdo_be_async
75+ - const: ethdr_top
76+ power-domains:
77+ maxItems: 1
78+ resets:
79+ maxItems: 5
80+ mediatek,gce-client-reg:
81+ $ref: /schemas/types.yaml#/definitions/phandle-array
82+ description: The register of display function block to be set by gce.
83+ There are 4 arguments in this property, gce node, subsys id, offset and
84+ register size. The subsys id is defined in the gce header of each chips
85+ include/include/dt-bindings/gce/<chip>-gce.h, mapping to the register of
86+ display function block.
87+
88+required:
89+ - compatible
90+ - reg
91+ - clocks
92+ - clock-names
93+ - interrupts
94+ - power-domains
95+
96+additionalProperties: false
97+
98+examples:
99+ - |
100+
101+ disp_ethdr@1c114000 {
102+ compatible = "mediatek,mt8195-disp-ethdr";
103+ reg = <0 0x1c114000 0 0x1000>,
104+ <0 0x1c115000 0 0x1000>,
105+ <0 0x1c117000 0 0x1000>,
106+ <0 0x1c119000 0 0x1000>,
107+ <0 0x1c11A000 0 0x1000>,
108+ <0 0x1c11B000 0 0x1000>,
109+ <0 0x1c11C000 0 0x1000>;
110+ reg-names = "mixer", "vdo_fe0", "vdo_fe1", "gfx_fe0", "gfx_fe1",
111+ "vdo_be", "adl_ds";
112+ mediatek,gce-client-reg = <&gce0 SUBSYS_1c11XXXX 0x4000 0x1000>,
113+ <&gce0 SUBSYS_1c11XXXX 0x5000 0x1000>,
114+ <&gce0 SUBSYS_1c11XXXX 0x7000 0x1000>,
115+ <&gce0 SUBSYS_1c11XXXX 0x9000 0x1000>,
116+ <&gce0 SUBSYS_1c11XXXX 0xA000 0x1000>,
117+ <&gce0 SUBSYS_1c11XXXX 0xB000 0x1000>,
118+ <&gce0 SUBSYS_1c11XXXX 0xC000 0x1000>;
119+ clocks = <&vdosys1 CLK_VDO1_DISP_MIXER>,
120+ <&vdosys1 CLK_VDO1_HDR_VDO_FE0>,
121+ <&vdosys1 CLK_VDO1_HDR_VDO_FE1>,
122+ <&vdosys1 CLK_VDO1_HDR_GFX_FE0>,
123+ <&vdosys1 CLK_VDO1_HDR_GFX_FE1>,
124+ <&vdosys1 CLK_VDO1_HDR_VDO_BE>,
125+ <&vdosys1 CLK_VDO1_26M_SLOW>,
126+ <&vdosys1 CLK_VDO1_HDR_VDO_FE0_DL_ASYNC>,
127+ <&vdosys1 CLK_VDO1_HDR_VDO_FE1_DL_ASYNC>,
128+ <&vdosys1 CLK_VDO1_HDR_GFX_FE0_DL_ASYNC>,
129+ <&vdosys1 CLK_VDO1_HDR_GFX_FE1_DL_ASYNC>,
130+ <&vdosys1 CLK_VDO1_HDR_VDO_BE_DL_ASYNC>,
131+ <&topckgen CLK_TOP_ETHDR_SEL>;
132+ clock-names = "mixer", "vdo_fe0", "vdo_fe1", "gfx_fe0", "gfx_fe1",
133+ "vdo_be", "adl_ds", "vdo_fe0_async", "vdo_fe1_async",
134+ "gfx_fe0_async", "gfx_fe1_async","vdo_be_async",
135+ "ethdr_top";
136+ power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
137+ iommus = <&iommu_vpp M4U_PORT_L3_HDR_DS>,
138+ <&iommu_vpp M4U_PORT_L3_HDR_ADL>;
139+ interrupts = <GIC_SPI 517 IRQ_TYPE_LEVEL_HIGH 0>; /* disp mixer */
140+ resets = <&vdosys1 MT8195_VDOSYS1_SW1_RST_B_HDR_VDO_FE0_DL_ASYNC>,
141+ <&vdosys1 MT8195_VDOSYS1_SW1_RST_B_HDR_VDO_FE1_DL_ASYNC>,
142+ <&vdosys1 MT8195_VDOSYS1_SW1_RST_B_HDR_GFX_FE0_DL_ASYNC>,
143+ <&vdosys1 MT8195_VDOSYS1_SW1_RST_B_HDR_GFX_FE1_DL_ASYNC>,
144+ <&vdosys1 MT8195_VDOSYS1_SW1_RST_B_HDR_VDO_BE_DL_ASYNC>;
145+ };
146+
147+...
Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml+77−0
@@ -0,0 +1,77 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,gamma.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display gamma correction
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display gamma correction, namely GAMMA, provides a nonlinear
15+ operation used to adjust luminance in display system.
16+ GAMMA device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt8173-disp-gamma
26+ - items:
27+ - const: mediatek,mt8183-disp-gamma
28+ - items:
29+ - enum:
30+ - mediatek,mt8192-disp-gamma
31+ - mediatek,mt8195-disp-gamma
32+ - enum:
33+ - mediatek,mt8183-disp-gamma
34+
35+ reg:
36+ maxItems: 1
37+
38+ interrupts:
39+ maxItems: 1
40+
41+ power-domains:
42+ description: A phandle and PM domain specifier as defined by bindings of
43+ the power controller specified by phandle. See
44+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
45+
46+ clocks:
47+ items:
48+ - description: GAMMA Clock
49+
50+ mediatek,gce-client-reg:
51+ description: The register of client driver can be configured by gce with
52+ 4 arguments defined in this property, such as phandle of gce, subsys id,
53+ register offset and size. Each GCE subsys id is mapping to a client
54+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
55+ $ref: /schemas/types.yaml#/definitions/phandle-array
56+ maxItems: 1
57+
58+required:
59+ - compatible
60+ - reg
61+ - interrupts
62+ - power-domains
63+ - clocks
64+
65+additionalProperties: false
66+
67+examples:
68+ - |
69+
70+ gamma@14016000 {
71+ compatible = "mediatek,mt8173-disp-gamma";
72+ reg = <0 0x14016000 0 0x1000>;
73+ interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_LOW>;
74+ power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
75+ clocks = <&mmsys CLK_MM_DISP_GAMMA>;
76+ mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x6000 0x1000>;
77+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,merge.yaml+110−0
@@ -0,0 +1,110 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,merge.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display merge
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display merge, namely MERGE, is used to merge two slice-per-line
15+ inputs into one side-by-side output.
16+ MERGE device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt8173-disp-merge
26+ - items:
27+ - const: mediatek,mt8195-disp-merge
28+
29+ reg:
30+ maxItems: 1
31+
32+ interrupts:
33+ maxItems: 1
34+
35+ power-domains:
36+ description: A phandle and PM domain specifier as defined by bindings of
37+ the power controller specified by phandle. See
38+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
39+
40+ clocks:
41+ maxItems: 2
42+ items:
43+ - description: MERGE Clock
44+ - description: MERGE Async Clock
45+ Controlling the synchronous process between MERGE and other display
46+ function blocks cross clock domain.
47+
48+ clock-names:
49+ maxItems: 2
50+ items:
51+ - const: merge
52+ - const: merge_async
53+
54+ mediatek,merge-fifo-en:
55+ description:
56+ The setting of merge fifo is mainly provided for the display latency
57+ buffer to ensure that the back-end panel display data will not be
58+ underrun, a little more data is needed in the fifo.
59+ According to the merge fifo settings, when the water level is detected
60+ to be insufficient, it will trigger RDMA sending ultra and preulra
61+ command to SMI to speed up the data rate.
62+ type: boolean
63+
64+ mediatek,merge-mute:
65+ description: Support mute function. Mute the content of merge output.
66+ type: boolean
67+
68+ mediatek,gce-client-reg:
69+ description: The register of client driver can be configured by gce with
70+ 4 arguments defined in this property, such as phandle of gce, subsys id,
71+ register offset and size. Each GCE subsys id is mapping to a client
72+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
73+ $ref: /schemas/types.yaml#/definitions/phandle-array
74+ maxItems: 1
75+
76+ resets:
77+ description: reset controller
78+ See Documentation/devicetree/bindings/reset/reset.txt for details.
79+ maxItems: 1
80+
81+required:
82+ - compatible
83+ - reg
84+ - power-domains
85+ - clocks
86+
87+additionalProperties: false
88+
89+examples:
90+ - |
91+
92+ merge@14017000 {
93+ compatible = "mediatek,mt8173-disp-merge";
94+ reg = <0 0x14017000 0 0x1000>;
95+ power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
96+ clocks = <&mmsys CLK_MM_DISP_MERGE>;
97+ };
98+
99+ merge5: disp_vpp_merge5@1c110000 {
100+ compatible = "mediatek,mt8195-disp-merge";
101+ reg = <0 0x1c110000 0 0x1000>;
102+ interrupts = <GIC_SPI 507 IRQ_TYPE_LEVEL_HIGH 0>;
103+ clocks = <&vdosys1 CLK_VDO1_VPP_MERGE4>,
104+ <&vdosys1 CLK_VDO1_MERGE4_DL_ASYNC>;
105+ clock-names = "merge","merge_async";
106+ power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
107+ mediatek,gce-client-reg = <&gce1 SUBSYS_1c11XXXX 0x0000 0x1000>;
108+ mediatek,merge-fifo-en = <1>;
109+ resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE4_DL_ASYNC>;
110+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml+83−0
@@ -0,0 +1,83 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,mutex.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek mutex
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek mutex, namely MUTEX, is used to send the triggers signals called
15+ Start Of Frame (SOF) / End Of Frame (EOF) to each sub-modules on the display
16+ data path or MDP data path.
17+ In some SoC, such as mt2701, MUTEX could be a hardware mutex which protects
18+ the shadow register.
19+ MUTEX device node must be siblings to the central MMSYS_CONFIG node.
20+ For a description of the MMSYS_CONFIG binding, see
21+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
22+ for details.
23+
24+properties:
25+ compatible:
26+ oneOf:
27+ - items:
28+ - const: mediatek,mt2701-disp-mutex
29+ - items:
30+ - const: mediatek,mt2712-disp-mutex
31+ - items:
32+ - const: mediatek,mt8167-disp-mutex
33+ - items:
34+ - const: mediatek,mt8173-disp-mutex
35+ - items:
36+ - const: mediatek,mt8183-disp-mutex
37+ - items:
38+ - const: mediatek,mt8192-disp-mutex
39+ - items:
40+ - const: mediatek,mt8195-disp-mutex
41+ reg:
42+ maxItems: 1
43+
44+ interrupts:
45+ maxItems: 1
46+
47+ power-domains:
48+ description: A phandle and PM domain specifier as defined by bindings of
49+ the power controller specified by phandle. See
50+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
51+
52+ clocks:
53+ items:
54+ - description: MUTEX Clock
55+
56+ mediatek,gce-events:
57+ description:
58+ The event id which is mapping to the specific hardware event signal
59+ to gce. The event id is defined in the gce header
60+ include/dt-bindings/gce/<chip>-gce.h of each chips.
61+ $ref: /schemas/types.yaml#/definitions/phandle-array
62+
63+required:
64+ - compatible
65+ - reg
66+ - interrupts
67+ - power-domains
68+ - clocks
69+
70+additionalProperties: false
71+
72+examples:
73+ - |
74+
75+ mutex: mutex@14020000 {
76+ compatible = "mediatek,mt8173-disp-mutex";
77+ reg = <0 0x14020000 0 0x1000>;
78+ interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_LOW>;
79+ power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
80+ clocks = <&mmsys CLK_MM_MUTEX_32K>;
81+ mediatek,gce-events = <CMDQ_EVENT_MUTEX0_STREAM_EOF>,
82+ <CMDQ_EVENT_MUTEX1_STREAM_EOF>;
83+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,od.yaml+53−0
@@ -0,0 +1,53 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,od.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display overdirve
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display overdrive, namely OD, increases the transition values
15+ of pixels between consecutive frames to make LCD rotate faster.
16+ OD device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt2712-disp-od
26+ - items:
27+ - const: mediatek,mt8173-disp-od
28+
29+ reg:
30+ maxItems: 1
31+
32+ interrupts:
33+ maxItems: 1
34+
35+ clocks:
36+ items:
37+ - description: OD Clock
38+
39+required:
40+ - compatible
41+ - reg
42+ - clocks
43+
44+additionalProperties: false
45+
46+examples:
47+ - |
48+
49+ od@14023000 {
50+ compatible = "mediatek,mt8173-disp-od";
51+ reg = <0 0x14023000 0 0x1000>;
52+ clocks = <&mmsys CLK_MM_DISP_OD>;
53+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,ovl-2l.yaml+88−0
@@ -0,0 +1,88 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,ovl-2l.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display overlay 2 layer
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display overlay 2 layer, namely OVL-2L, provides 2 more layer
15+ for OVL.
16+ OVL-2L device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt8183-disp-ovl-2l
26+ - items:
27+ - const: mediatek,mt8192-disp-ovl-2l
28+
29+ reg:
30+ maxItems: 1
31+
32+ interrupts:
33+ maxItems: 1
34+
35+ power-domains:
36+ description: A phandle and PM domain specifier as defined by bindings of
37+ the power controller specified by phandle. See
38+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
39+
40+ clocks:
41+ items:
42+ - description: OVL-2L Clock
43+
44+ iommus:
45+ description:
46+ This property should point to the respective IOMMU block with master port as argument,
47+ see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details.
48+
49+ mediatek,larb:
50+ description:
51+ This property should contain a phandle pointing to the local arbiter devices defined in
52+ Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml.
53+ It must sort according to the local arbiter index, like larb0, larb1, larb2...
54+ $ref: /schemas/types.yaml#/definitions/phandle-array
55+ minItems: 1
56+ maxItems: 32
57+
58+ mediatek,gce-client-reg:
59+ description: The register of client driver can be configured by gce with
60+ 4 arguments defined in this property, such as phandle of gce, subsys id,
61+ register offset and size. Each GCE subsys id is mapping to a client
62+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
63+ $ref: /schemas/types.yaml#/definitions/phandle-array
64+ maxItems: 1
65+
66+required:
67+ - compatible
68+ - reg
69+ - interrupts
70+ - power-domains
71+ - clocks
72+ - iommus
73+
74+additionalProperties: false
75+
76+examples:
77+ - |
78+
79+ ovl_2l0: ovl@14009000 {
80+ compatible = "mediatek,mt8183-disp-ovl-2l";
81+ reg = <0 0x14009000 0 0x1000>;
82+ interrupts = <GIC_SPI 226 IRQ_TYPE_LEVEL_LOW>;
83+ power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
84+ clocks = <&mmsys CLK_MM_DISP_OVL0_2L>;
85+ iommus = <&iommu M4U_PORT_DISP_2L_OVL0_LARB0>;
86+ mediatek,larb = <&larb0>;
87+ mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x9000 0x1000>;
88+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,ovl.yaml+103−0
@@ -0,0 +1,103 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,ovl.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display overlay
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display overlay, namely OVL, can do alpha blending from
15+ the memory.
16+ OVL device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt2701-disp-ovl
26+ - items:
27+ - const: mediatek,mt8173-disp-ovl
28+ - items:
29+ - const: mediatek,mt8183-disp-ovl
30+ - items:
31+ - const: mediatek,mt8192-disp-ovl
32+ - items:
33+ - enum:
34+ - mediatek,mt7623-disp-ovl
35+ - mediatek,mt2712-disp-ovl
36+ - enum:
37+ - mediatek,mt2701-disp-ovl
38+ - items:
39+ - enum:
40+ - mediatek,mt8195-disp-ovl
41+ - enum:
42+ - mediatek,mt8183-disp-ovl
43+
44+ reg:
45+ maxItems: 1
46+
47+ interrupts:
48+ maxItems: 1
49+
50+ power-domains:
51+ description: A phandle and PM domain specifier as defined by bindings of
52+ the power controller specified by phandle. See
53+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
54+
55+ clocks:
56+ items:
57+ - description: OVL Clock
58+
59+ iommus:
60+ description:
61+ This property should point to the respective IOMMU block with master port as argument,
62+ see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details.
63+
64+ mediatek,larb:
65+ description:
66+ This property should contain a phandle pointing to the local arbiter devices defined in
67+ Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml.
68+ It must sort according to the local arbiter index, like larb0, larb1, larb2...
69+ $ref: /schemas/types.yaml#/definitions/phandle-array
70+ minItems: 1
71+ maxItems: 32
72+
73+ mediatek,gce-client-reg:
74+ description: The register of client driver can be configured by gce with
75+ 4 arguments defined in this property, such as phandle of gce, subsys id,
76+ register offset and size. Each GCE subsys id is mapping to a client
77+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
78+ $ref: /schemas/types.yaml#/definitions/phandle-array
79+ maxItems: 1
80+
81+required:
82+ - compatible
83+ - reg
84+ - interrupts
85+ - power-domains
86+ - clocks
87+ - iommu
88+
89+additionalProperties: false
90+
91+examples:
92+ - |
93+
94+ ovl0: ovl@1400c000 {
95+ compatible = "mediatek,mt8173-disp-ovl";
96+ reg = <0 0x1400c000 0 0x1000>;
97+ interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_LOW>;
98+ power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
99+ clocks = <&mmsys CLK_MM_DISP_OVL0>;
100+ iommus = <&iommu M4U_PORT_DISP_OVL0>;
101+ mediatek,larb = <&larb0>;
102+ mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
103+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,postmask.yaml+69−0
@@ -0,0 +1,69 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,postmask.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display postmask
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display postmask, namely POSTMASK, provides round corner pattern
15+ generation.
16+ POSTMASK device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt8192-disp-postmask
26+
27+ reg:
28+ maxItems: 1
29+
30+ interrupts:
31+ maxItems: 1
32+
33+ power-domains:
34+ description: A phandle and PM domain specifier as defined by bindings of
35+ the power controller specified by phandle. See
36+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
37+
38+ clocks:
39+ items:
40+ - description: POSTMASK Clock
41+
42+ mediatek,gce-client-reg:
43+ description: The register of client driver can be configured by gce with
44+ 4 arguments defined in this property, such as phandle of gce, subsys id,
45+ register offset and size. Each GCE subsys id is mapping to a client
46+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
47+ $ref: /schemas/types.yaml#/definitions/phandle-array
48+ maxItems: 1
49+
50+required:
51+ - compatible
52+ - reg
53+ - interrupts
54+ - power-domains
55+ - clocks
56+
57+additionalProperties: false
58+
59+examples:
60+ - |
61+
62+ postmask0: postmask@1400d000 {
63+ compatible = "mediatek,mt8192-disp-postmask";
64+ reg = <0 0x1400d000 0 0x1000>;
65+ interrupts = <GIC_SPI 262 IRQ_TYPE_LEVEL_HIGH 0>;
66+ power-domains = <&scpsys MT8192_POWER_DOMAIN_DISP>;
67+ clocks = <&mmsys CLK_MM_DISP_POSTMASK0>;
68+ mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xd000 0x1000>;
69+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,rdma.yaml+117−0
@@ -0,0 +1,117 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,rdma.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek Read Direct Memory Access
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek Read Direct Memory Access(RDMA) component used to read the
15+ data into DMA. It provides real time data to the back-end panel
16+ driver, such as DSI, DPI and DP_INTF.
17+ It contains one line buffer to store the sufficient pixel data.
18+ RDMA device node must be siblings to the central MMSYS_CONFIG node.
19+ For a description of the MMSYS_CONFIG binding, see
20+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
21+ for details.
22+
23+properties:
24+ compatible:
25+ oneOf:
26+ - items:
27+ - const: mediatek,mt2701-disp-rdma
28+ - items:
29+ - const: mediatek,mt8173-disp-rdma
30+ - items:
31+ - const: mediatek,mt8183-disp-rdma
32+ - items:
33+ - const: mediatek,mt8195-disp-rdma
34+ - items:
35+ - enum:
36+ - mediatek,mt7623-disp-rdma
37+ - mediatek,mt2712-disp-rdma
38+ - enum:
39+ - mediatek,mt2701-disp-rdma
40+ - items:
41+ - enum:
42+ - mediatek,mt8192-disp-rdma
43+ - enum:
44+ - mediatek,mt8183-disp-rdma
45+
46+ reg:
47+ maxItems: 1
48+
49+ interrupts:
50+ maxItems: 1
51+
52+ power-domains:
53+ description: A phandle and PM domain specifier as defined by bindings of
54+ the power controller specified by phandle. See
55+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
56+
57+ clocks:
58+ items:
59+ - description: RDMA Clock
60+
61+ iommus:
62+ description:
63+ This property should point to the respective IOMMU block with master port as argument,
64+ see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details.
65+
66+ mediatek,larb:
67+ description:
68+ This property should contain a phandle pointing to the local arbiter devices defined in
69+ Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml.
70+ It must sort according to the local arbiter index, like larb0, larb1, larb2...
71+ $ref: /schemas/types.yaml#/definitions/phandle-array
72+ minItems: 1
73+ maxItems: 32
74+
75+ mediatek,rdma-fifo-size:
76+ description:
77+ rdma fifo size may be different even in same SOC, add this property to the
78+ corresponding rdma.
79+ The value below is the Max value which defined in hardware data sheet
80+ mediatek,rdma-fifo-size of mt8173-rdma0 is 8K
81+ mediatek,rdma-fifo-size of mt8183-rdma0 is 5K
82+ mediatek,rdma-fifo-size of mt8183-rdma1 is 2K
83+ $ref: /schemas/types.yaml#/definitions/uint32
84+ enum: [8192, 5120, 2048]
85+
86+ mediatek,gce-client-reg:
87+ description: The register of client driver can be configured by gce with
88+ 4 arguments defined in this property, such as phandle of gce, subsys id,
89+ register offset and size. Each GCE subsys id is mapping to a client
90+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
91+ $ref: /schemas/types.yaml#/definitions/phandle-array
92+ maxItems: 1
93+
94+required:
95+ - compatible
96+ - reg
97+ - interrupts
98+ - power-domains
99+ - clocks
100+ - iommus
101+
102+additionalProperties: false
103+
104+examples:
105+ - |
106+
107+ rdma0: rdma@1400e000 {
108+ compatible = "mediatek,mt8173-disp-rdma";
109+ reg = <0 0x1400e000 0 0x1000>;
110+ interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_LOW>;
111+ power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
112+ clocks = <&mmsys CLK_MM_DISP_RDMA0>;
113+ iommus = <&iommu M4U_PORT_DISP_RDMA0>;
114+ mediatek,larb = <&larb0>;
115+ mediatek,rdma-fifosize = <8192>;
116+ mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xe000 0x1000>;
117+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,split.yaml+58−0
@@ -0,0 +1,58 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,split.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display split
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display split, namely SPLIT, is used to split stream to two
15+ encoders.
16+ SPLIT device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt8173-disp-split
26+
27+ reg:
28+ maxItems: 1
29+
30+ interrupts:
31+ maxItems: 1
32+
33+ power-domains:
34+ description: A phandle and PM domain specifier as defined by bindings of
35+ the power controller specified by phandle. See
36+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
37+
38+ clocks:
39+ items:
40+ - description: SPLIT Clock
41+
42+required:
43+ - compatible
44+ - reg
45+ - power-domains
46+ - clocks
47+
48+additionalProperties: false
49+
50+examples:
51+ - |
52+
53+ split0: split@14018000 {
54+ compatible = "mediatek,mt8173-disp-split";
55+ reg = <0 0x14018000 0 0x1000>;
56+ power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
57+ clocks = <&mmsys CLK_MM_DISP_SPLIT0>;
58+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,ufoe.yaml+61−0
@@ -0,0 +1,61 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,ufoe.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek display UFOe
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek display UFOe stands for Unified Frame Optimization engine.
15+ UFOe can cut the data rate for DSI port which may lead to reduce power
16+ consumption.
17+ UFOe device node must be siblings to the central MMSYS_CONFIG node.
18+ For a description of the MMSYS_CONFIG binding, see
19+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
20+ for details.
21+
22+properties:
23+ compatible:
24+ oneOf:
25+ - items:
26+ - const: mediatek,mt8173-disp-ufoe
27+
28+ reg:
29+ maxItems: 1
30+
31+ interrupts:
32+ maxItems: 1
33+
34+ power-domains:
35+ description: A phandle and PM domain specifier as defined by bindings of
36+ the power controller specified by phandle. See
37+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
38+
39+ clocks:
40+ items:
41+ - description: UFOe Clock
42+
43+required:
44+ - compatible
45+ - reg
46+ - interrupts
47+ - power-domains
48+ - clocks
49+
50+additionalProperties: false
51+
52+examples:
53+ - |
54+
55+ ufoe@1401a000 {
56+ compatible = "mediatek,mt8173-disp-ufoe";
57+ reg = <0 0x1401a000 0 0x1000>;
58+ interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_LOW>;
59+ power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
60+ clocks = <&mmsys CLK_MM_DISP_UFOE>;
61+ };
Documentation/devicetree/bindings/display/mediatek/mediatek,wdma.yaml+86−0
@@ -0,0 +1,86 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/mediatek/mediatek,wdma.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Mediatek Write Direct Memory Access
8+
9+maintainers:
10+ - Chun-Kuang Hu <chunkuang.hu@kernel.org>
11+ - Philipp Zabel <p.zabel@pengutronix.de>
12+
13+description: |
14+ Mediatek Write Direct Memory Access(WDMA) component used to write
15+ the data into DMA.
16+ WDMA device node must be siblings to the central MMSYS_CONFIG node.
17+ For a description of the MMSYS_CONFIG binding, see
18+ Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
19+ for details.
20+
21+properties:
22+ compatible:
23+ oneOf:
24+ - items:
25+ - const: mediatek,mt8173-disp-wdma
26+
27+ reg:
28+ maxItems: 1
29+
30+ interrupts:
31+ maxItems: 1
32+
33+ power-domains:
34+ description: A phandle and PM domain specifier as defined by bindings of
35+ the power controller specified by phandle. See
36+ Documentation/devicetree/bindings/power/power-domain.yaml for details.
37+
38+ clocks:
39+ items:
40+ - description: WDMA Clock
41+
42+ iommus:
43+ description:
44+ This property should point to the respective IOMMU block with master port as argument,
45+ see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details.
46+
47+ mediatek,larb:
48+ description:
49+ This property should contain a phandle pointing to the local arbiter devices defined in
50+ Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml.
51+ It must sort according to the local arbiter index, like larb0, larb1, larb2...
52+ $ref: /schemas/types.yaml#/definitions/phandle-array
53+ minItems: 1
54+ maxItems: 32
55+
56+ mediatek,gce-client-reg:
57+ description: The register of client driver can be configured by gce with
58+ 4 arguments defined in this property, such as phandle of gce, subsys id,
59+ register offset and size. Each GCE subsys id is mapping to a client
60+ defined in the header include/dt-bindings/gce/<chip>-gce.h.
61+ $ref: /schemas/types.yaml#/definitions/phandle-array
62+ maxItems: 1
63+
64+required:
65+ - compatible
66+ - reg
67+ - interrupts
68+ - power-domains
69+ - clocks
70+ - iommus
71+
72+additionalProperties: false
73+
74+examples:
75+ - |
76+
77+ wdma0: wdma@14011000 {
78+ compatible = "mediatek,mt8173-disp-wdma";
79+ reg = <0 0x14011000 0 0x1000>;
80+ interrupts = <GIC_SPI 185 IRQ_TYPE_LEVEL_LOW>;
81+ power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
82+ clocks = <&mmsys CLK_MM_DISP_WDMA0>;
83+ iommus = <&iommu M4U_PORT_DISP_WDMA0>;
84+ mediatek,larb = <&larb0>;
85+ mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x1000 0x1000>;
86+ };
Documentation/devicetree/bindings/display/panel/advantech,idk-1110wr.yaml+17−2
@@ -11,13 +11,23 @@ maintainers: · 10 unmodified lines
1111 - Thierry Reding <thierry.reding@gmail.com>
1212
1313 allOf:
14− - $ref: lvds.yaml#
14+ - $ref: panel-common.yaml#
15+ - $ref: /schemas/display/lvds.yaml/#
16+
17+select:
18+ properties:
19+ compatible:
20+ contains:
21+ const: advantech,idk-1110wr
22+
23+ required:
24+ - compatible
1525
1626 properties:
1727 compatible:
1828 items:
1929 - const: advantech,idk-1110wr
20− - {} # panel-lvds, but not listed here to avoid false select
30+ - const: panel-lvds
2131
2232 data-mapping:
2333 const: jeida-24
@@ -35,6 +45,11 @@ additionalProperties: false · 11 unmodified lines
3545
3646 required:
3747 - compatible
48+ - data-mapping
49+ - width-mm
50+ - height-mm
51+ - panel-timing
52+ - port
3853
3954 examples:
4055 - |+
Documentation/devicetree/bindings/display/panel/innolux,ee101ia-01d.yaml+21−2
@@ -11,15 +11,26 @@ maintainers: · 10 unmodified lines
1111 - Thierry Reding <thierry.reding@gmail.com>
1212
1313 allOf:
14− - $ref: lvds.yaml#
14+ - $ref: panel-common.yaml#
15+ - $ref: /schemas/display/lvds.yaml/#
16+
17+select:
18+ properties:
19+ compatible:
20+ contains:
21+ const: innolux,ee101ia-01d
22+
23+ required:
24+ - compatible
1525
1626 properties:
1727 compatible:
1828 items:
1929 - const: innolux,ee101ia-01d
20− - {} # panel-lvds, but not listed here to avoid false select
30+ - const: panel-lvds
2131
2232 backlight: true
33+ data-mapping: true
2334 enable-gpios: true
2435 power-supply: true
2536 width-mm: true
@@ -27,5 +38,13 @@ properties: · 1 unmodified line
2738 panel-timing: true
2839 port: true
2940
41+required:
42+ - compatible
43+ - data-mapping
44+ - width-mm
45+ - height-mm
46+ - panel-timing
47+ - port
48+
3049 additionalProperties: false
3150 ...
Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.yaml+17−2
@@ -11,13 +11,23 @@ maintainers: · 10 unmodified lines
1111 - Thierry Reding <thierry.reding@gmail.com>
1212
1313 allOf:
14− - $ref: lvds.yaml#
14+ - $ref: panel-common.yaml#
15+ - $ref: /schemas/display/lvds.yaml/#
16+
17+select:
18+ properties:
19+ compatible:
20+ contains:
21+ const: mitsubishi,aa104xd12
22+
23+ required:
24+ - compatible
1525
1626 properties:
1727 compatible:
1828 items:
1929 - const: mitsubishi,aa104xd12
20− - {} # panel-lvds, but not listed here to avoid false select
30+ - const: panel-lvds
2131
2232 vcc-supply:
2333 description: Reference to the regulator powering the panel VCC pins.
@@ -39,6 +49,11 @@ additionalProperties: false · 15 unmodified lines
3949 required:
4050 - compatible
4151 - vcc-supply
52+ - data-mapping
53+ - width-mm
54+ - height-mm
55+ - panel-timing
56+ - port
4257
4358 examples:
4459 - |+
Documentation/devicetree/bindings/display/panel/mitsubishi,aa121td01.yaml+17−2
@@ -11,13 +11,23 @@ maintainers: · 10 unmodified lines
1111 - Thierry Reding <thierry.reding@gmail.com>
1212
1313 allOf:
14− - $ref: lvds.yaml#
14+ - $ref: panel-common.yaml#
15+ - $ref: /schemas/display/lvds.yaml/#
16+
17+select:
18+ properties:
19+ compatible:
20+ contains:
21+ const: mitsubishi,aa121td01
22+
23+ required:
24+ - compatible
1525
1626 properties:
1727 compatible:
1828 items:
1929 - const: mitsubishi,aa121td01
20− - {} # panel-lvds, but not listed here to avoid false select
30+ - const: panel-lvds
2131
2232 vcc-supply:
2333 description: Reference to the regulator powering the panel VCC pins.
@@ -39,6 +49,11 @@ additionalProperties: false · 15 unmodified lines
3949 required:
4050 - compatible
4151 - vcc-supply
52+ - data-mapping
53+ - width-mm
54+ - height-mm
55+ - panel-timing
56+ - port
4257
4358 examples:
4459 - |+
Documentation/devicetree/bindings/display/panel/panel-lvds.yaml+57−0
@@ -0,0 +1,57 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/panel/panel-lvds.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Generic LVDS Display Panel Device Tree Bindings
8+
9+maintainers:
10+ - Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
11+ - Thierry Reding <thierry.reding@gmail.com>
12+
13+allOf:
14+ - $ref: panel-common.yaml#
15+ - $ref: /schemas/display/lvds.yaml/#
16+
17+select:
18+ properties:
19+ compatible:
20+ contains:
21+ const: panel-lvds
22+
23+ not:
24+ properties:
25+ compatible:
26+ contains:
27+ enum:
28+ - advantech,idk-1110wr
29+ - advantech,idk-2121wr
30+ - innolux,ee101ia-01d
31+ - mitsubishi,aa104xd12
32+ - mitsubishi,aa121td01
33+ - sgd,gktw70sdae4se
34+
35+ required:
36+ - compatible
37+
38+properties:
39+ compatible:
40+ items:
41+ - enum:
42+ - auo,b101ew05
43+ - tbs,a711-panel
44+
45+ - const: panel-lvds
46+
47+unevaluatedProperties: false
48+
49+required:
50+ - compatible
51+ - data-mapping
52+ - width-mm
53+ - height-mm
54+ - panel-timing
55+ - port
56+
57+...
Documentation/devicetree/bindings/display/panel/panel-simple.yaml+2−0
@@ -284,6 +284,8 @@ properties: · 283 unmodified lines
284284 - sharp,lq101k1ly04
285285 # Sharp 12.3" (2400x1600 pixels) TFT LCD panel
286286 - sharp,lq123p1jx31
287+ # Sharp 14" (1920x1080 pixels) TFT LCD panel
288+ - sharp,lq140m1jw46
287289 # Sharp LS020B1DD01D 2.0" HQVGA TFT LCD panel
288290 - sharp,ls020b1dd01d
289291 # Shelly SCA07010-BFN-LNN 7.0" WVGA TFT LCD panel
Documentation/devicetree/bindings/display/panel/sgd,gktw70sdae4se.yaml+17−2
@@ -11,13 +11,23 @@ maintainers: · 10 unmodified lines
1111 - Thierry Reding <thierry.reding@gmail.com>
1212
1313 allOf:
14− - $ref: lvds.yaml#
14+ - $ref: panel-common.yaml#
15+ - $ref: /schemas/display/lvds.yaml/#
16+
17+select:
18+ properties:
19+ compatible:
20+ contains:
21+ const: sgd,gktw70sdae4se
22+
23+ required:
24+ - compatible
1525
1626 properties:
1727 compatible:
1828 items:
1929 - const: sgd,gktw70sdae4se
20− - {} # panel-lvds, but not listed here to avoid false select
30+ - const: panel-lvds
2131
2232 data-mapping:
2333 const: jeida-18
@@ -35,6 +45,11 @@ additionalProperties: false · 11 unmodified lines
3545
3646 required:
3747 - compatible
48+ - port
49+ - data-mapping
50+ - width-mm
51+ - height-mm
52+ - panel-timing
3853
3954 examples:
4055 - |+
Documentation/devicetree/bindings/display/solomon,ssd1307fb.yaml+1−0
@@ -8,6 +8,7 @@ title: Solomon SSD1307 OLED Controller Framebuffer · 7 unmodified lines
88
99 maintainers:
1010 - Maxime Ripard <mripard@kernel.org>
11+ - Javier Martinez Canillas <javierm@redhat.com>
1112
1213 properties:
1314 compatible:
Documentation/devicetree/bindings/gpio/sifive,gpio.yaml+0−1
@@ -7,7 +7,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines
77 title: SiFive GPIO controller
88
99 maintainers:
10− - Yash Shah <yash.shah@sifive.com>
1110 - Paul Walmsley <paul.walmsley@sifive.com>
1211
1312 properties:
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml+15−0
@@ -159,6 +159,21 @@ allOf: · 158 unmodified lines
159159 power-domains:
160160 maxItems: 1
161161 sram-supply: false
162+ - if:
163+ properties:
164+ compatible:
165+ contains:
166+ const: rockchip,rk3568-mali
167+ then:
168+ properties:
169+ clocks:
170+ minItems: 2
171+ clock-names:
172+ items:
173+ - const: gpu
174+ - const: bus
175+ required:
176+ - clock-names
162177
163178 examples:
164179 - |
Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml+15−6
@@ -35,6 +35,10 @@ description: · 34 unmodified lines
3535 contains a specific memory layout, which is documented in chapter 8 of the
3636 SiFive U5 Coreplex Series Manual <https://static.dev.sifive.com/U54-MC-RVCoreIP.pdf>.
3737
38+ The thead,c900-plic is different from sifive,plic-1.0.0 in opensbi, the
39+ T-HEAD PLIC implementation requires setting a delegation bit to allow access
40+ from S-mode. So add thead,c900-plic to distinguish them.
41+
3842 maintainers:
3943 - Sagar Kadam <sagar.kadam@sifive.com>
4044 - Paul Walmsley <paul.walmsley@sifive.com>
@@ -42,12 +46,17 @@ maintainers: · 1 unmodified line
4246
4347 properties:
4448 compatible:
45− items:
46− - enum:
47− - sifive,fu540-c000-plic
48− - starfive,jh7100-plic
49− - canaan,k210-plic
50− - const: sifive,plic-1.0.0
49+ oneOf:
50+ - items:
51+ - enum:
52+ - sifive,fu540-c000-plic
53+ - starfive,jh7100-plic
54+ - canaan,k210-plic
55+ - const: sifive,plic-1.0.0
56+ - items:
57+ - enum:
58+ - allwinner,sun20i-d1-plic
59+ - const: thead,c900-plic
5160
5261 reg:
5362 maxItems: 1
Documentation/devicetree/bindings/mfd/ti,j721e-system-controller.yaml+1−1
@@ -20,7 +20,7 @@ description: | · 19 unmodified lines
2020
2121 maintainers:
2222 - Kishon Vijay Abraham I <kishon@ti.com>
23− - Roger Quadros <rogerq@ti.com
23+ - Roger Quadros <rogerq@kernel.org>
2424
2525 properties:
2626 compatible:
Documentation/devicetree/bindings/net/qcom,ipa.yaml+6−0
@@ -107,6 +107,10 @@ properties: · 106 unmodified lines
107107 - const: imem
108108 - const: config
109109
110+ qcom,qmp:
111+ $ref: /schemas/types.yaml#/definitions/phandle
112+ description: phandle to the AOSS side-channel message RAM
113+
110114 qcom,smem-states:
111115 $ref: /schemas/types.yaml#/definitions/phandle-array
112116 description: State bits used in by the AP to signal the modem.
@@ -222,6 +226,8 @@ examples: · 109 unmodified lines
222226 "imem",
223227 "config";
224228
229+ qcom,qmp = <&aoss_qmp>;
230+
225231 qcom,smem-states = <&ipa_smp2p_out 0>,
226232 <&ipa_smp2p_out 1>;
227233 qcom,smem-state-names = "ipa-clock-enabled-valid",
Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml+1−1
@@ -8,7 +8,7 @@ title: OMAP USB2 PHY · 7 unmodified lines
88
99 maintainers:
1010 - Kishon Vijay Abraham I <kishon@ti.com>
11− - Roger Quadros <rogerq@ti.com>
11+ - Roger Quadros <rogerq@kernel.org>
1212
1313 properties:
1414 compatible:
Documentation/devicetree/bindings/pwm/pwm-sifive.yaml+0−1
@@ -8,7 +8,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 7 unmodified lines
88 title: SiFive PWM controller
99
1010 maintainers:
11− - Yash Shah <yash.shah@sifive.com>
1211 - Sagar Kadam <sagar.kadam@sifive.com>
1312 - Paul Walmsley <paul.walmsley@sifive.com>
1413
Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml+0−1
@@ -9,7 +9,6 @@ title: SiFive L2 Cache Controller · 8 unmodified lines
99
1010 maintainers:
1111 - Sagar Kadam <sagar.kadam@sifive.com>
12− - Yash Shah <yash.shah@sifive.com>
1312 - Paul Walmsley <paul.walmsley@sifive.com>
1413
1514 description:
Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml+1−0
@@ -8,6 +8,7 @@ title: Audio codec controlled by ChromeOS EC · 7 unmodified lines
88
99 maintainers:
1010 - Cheng-Yi Chiang <cychiang@chromium.org>
11+ - Tzung-Bi Shih <tzungbi@google.com>
1112
1213 description: |
1314 Google's ChromeOS EC codec is a digital mic codec provided by the
Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml+3−2
@@ -23,8 +23,9 @@ properties: · 22 unmodified lines
2323 minItems: 1
2424 maxItems: 256
2525 items:
26− minimum: 0
27− maximum: 256
26+ items:
27+ - minimum: 0
28+ maximum: 256
2829 description:
2930 Chip select used by the device.
3031
Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml+1−1
@@ -7,7 +7,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#" · 6 unmodified lines
77 title: Bindings for the TI wrapper module for the Cadence USBSS-DRD controller
88
99 maintainers:
10− - Roger Quadros <rogerq@ti.com>
10+ - Roger Quadros <rogerq@kernel.org>
1111
1212 properties:
1313 compatible:
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml+1−1
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines
77 title: TI Keystone Soc USB Controller
88
99 maintainers:
10− - Roger Quadros <rogerq@ti.com>
10+ - Roger Quadros <rogerq@kernel.org>
1111
1212 properties:
1313 compatible:
Documentation/filesystems/netfs_library.rst+16−0
@@ -462,6 +462,10 @@ operation table looks like the following:: · 461 unmodified lines
462462 struct iov_iter *iter,
463463 netfs_io_terminated_t term_func,
464464 void *term_func_priv);
465+
466+ int (*query_occupancy)(struct netfs_cache_resources *cres,
467+ loff_t start, size_t len, size_t granularity,
468+ loff_t *_data_start, size_t *_data_len);
465469 };
466470
467471 With a termination handler function pointer::
@@ -536,6 +540,18 @@ The methods defined in the table are: · 68 unmodified lines
536540 indicating whether the termination is definitely happening in the caller's
537541 context.
538542
543+ * ``query_occupancy()``
544+
545+ [Required] Called to find out where the next piece of data is within a
546+ particular region of the cache. The start and length of the region to be
547+ queried are passed in, along with the granularity to which the answer needs
548+ to be aligned. The function passes back the start and length of the data,
549+ if any, available within that region. Note that there may be a hole at the
550+ front.
551+
552+ It returns 0 if some data was found, -ENODATA if there was no usable data
553+ within the region or -ENOBUFS if there is no caching on this file.
554+
539555 Note that these methods are passed a pointer to the cache resource structure,
540556 not the read request structure as they could be used in other situations where
541557 there isn't a read request structure as well, such as writing dirty data to the
Documentation/gpu/todo.rst+0−24
@@ -300,30 +300,6 @@ Contact: Daniel Vetter, Noralf Tronnes · 299 unmodified lines
300300
301301 Level: Advanced
302302
303−Garbage collect fbdev scrolling acceleration
304−--------------------------------------------
305−
306−Scroll acceleration has been disabled in fbcon. Now it works as the old
307−SCROLL_REDRAW mode. A ton of code was removed in fbcon.c and the hook bmove was
308−removed from fbcon_ops.
309−Remaining tasks:
310−
311−- a bunch of the hooks in fbcon_ops could be removed or simplified by calling
312− directly instead of the function table (with a switch on p->rotate)
313−
314−- fb_copyarea is unused after this, and can be deleted from all drivers
315−
316−- after that, fb_copyarea can be deleted from fb_ops in include/linux/fb.h as
317− well as cfb_copyarea
318−
319−Note that not all acceleration code can be deleted, since clearing and cursor
320−support is still accelerated, which might be good candidates for further
321−deletion projects.
322−
323−Contact: Daniel Vetter
324−
325−Level: Intermediate
326−
327303 idr_init_base()
328304 ---------------
329305
Documentation/tools/rtla/common_hist_options.rst+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 Set the histogram bucket size (default *1*).
44
5−**-e**, **--entries** *N*
5+**-E**, **--entries** *N*
66
77 Set the number of entries of the histogram (default 256).
88
Documentation/tools/rtla/common_osnoise_description.rst+1−1
@@ -1,7 +1,7 @@
11 The **rtla osnoise** tool is an interface for the *osnoise* tracer. The
22 *osnoise* tracer dispatches a kernel thread per-cpu. These threads read the
33 time in a loop while with preemption, softirq and IRQs enabled, thus
4−allowing all the sources of operating systme noise during its execution.
4+allowing all the sources of operating system noise during its execution.
55 The *osnoise*'s tracer threads take note of the delta between each time
66 read, along with an interference counter of all sources of interference.
77 At the end of each period, the *osnoise* tracer displays a summary of
Documentation/tools/rtla/rtla-osnoise-hist.rst+1−1
@@ -36,7 +36,7 @@ default). The reason for reducing the runtime is to avoid starving the · 35 unmodified lines
3636 **rtla** tool. The tool is also set to run for *one minute*. The output
3737 histogram is set to group outputs in buckets of *10us* and *25* entries::
3838
39− [root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -e 25
39+ [root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -E 25
4040 # RTLA osnoise histogram
4141 # Time unit is microseconds (us)
4242 # Duration: 0 00:01:00
Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst+2−0
@@ -84,6 +84,8 @@ CPUfreq核心层注册一个cpufreq_driver结构体。 · 83 unmodified lines
8484 .resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次启动前被
8585 调用。
8686
87+ .ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。
88+
8789 .attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该列表允许导出值到
8890 sysfs。
8991
Documentation/userspace-api/ioctl/ioctl-number.rst+3−0
@@ -115,6 +115,7 @@ Code Seq# Include File Comments · 114 unmodified lines
115115 'B' 00-1F linux/cciss_ioctl.h conflict!
116116 'B' 00-0F include/linux/pmu.h conflict!
117117 'B' C0-FF advanced bbus <mailto:maassen@uni-freiburg.de>
118+'B' 00-0F xen/xenbus_dev.h conflict!
118119 'C' all linux/soundcard.h conflict!
119120 'C' 01-2F linux/capi.h conflict!
120121 'C' F0-FF drivers/net/wan/cosa.h conflict!
@@ -134,6 +135,7 @@ Code Seq# Include File Comments · 13 unmodified lines
134135 'F' 80-8F linux/arcfb.h conflict!
135136 'F' DD video/sstfb.h conflict!
136137 'G' 00-3F drivers/misc/sgi-gru/grulib.h conflict!
138+'G' 00-0F xen/gntalloc.h, xen/gntdev.h conflict!
137139 'H' 00-7F linux/hiddev.h conflict!
138140 'H' 00-0F linux/hidraw.h conflict!
139141 'H' 01 linux/mei.h conflict!
@@ -176,6 +178,7 @@ Code Seq# Include File Comments · 36 unmodified lines
176178 'P' 60-6F sound/sscape_ioctl.h conflict!
177179 'P' 00-0F drivers/usb/class/usblp.c conflict!
178180 'P' 01-09 drivers/misc/pci_endpoint_test.c conflict!
181+'P' 00-0F xen/privcmd.h conflict!
179182 'Q' all linux/soundcard.h
180183 'R' 00-1F linux/random.h conflict!
181184 'R' 01 linux/rfkill.h conflict!
Documentation/virt/kvm/api.rst+15−1
@@ -1394,7 +1394,7 @@ documentation when it pops into existence). · 1393 unmodified lines
13941394 -------------------
13951395
13961396 :Capability: KVM_CAP_ENABLE_CAP
1397−:Architectures: mips, ppc, s390
1397+:Architectures: mips, ppc, s390, x86
13981398 :Type: vcpu ioctl
13991399 :Parameters: struct kvm_enable_cap (in)
14001400 :Returns: 0 on success; -1 on error
@@ -6997,6 +6997,20 @@ indicated by the fd to the VM this is called on. · 5596 unmodified lines
69976997 This is intended to support intra-host migration of VMs between userspace VMMs,
69986998 upgrading the VMM process without interrupting the guest.
69996999
7000+7.30 KVM_CAP_PPC_AIL_MODE_3
7001+-------------------------------
7002+
7003+:Capability: KVM_CAP_PPC_AIL_MODE_3
7004+:Architectures: ppc
7005+:Type: vm
7006+
7007+This capability indicates that the kernel supports the mode 3 setting for the
7008+"Address Translation Mode on Interrupt" aka "Alternate Interrupt Location"
7009+resource that is controlled with the H_SET_MODE hypercall.
7010+
7011+This capability allows a guest kernel to use a better-performance mode for
7012+handling interrupts and system calls.
7013+
70007014 8. Other capabilities.
70017015 ======================
70027016
MAINTAINERS+107−45
@@ -1620,6 +1620,7 @@ M: Olof Johansson <olof@lixom.net> · 1619 unmodified lines
16201620 M: soc@kernel.org
16211621 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
16221622 S: Maintained
1623+C: irc://irc.libera.chat/armlinux
16231624 T: git git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
16241625 F: arch/arm/boot/dts/Makefile
16251626 F: arch/arm64/boot/dts/Makefile
@@ -1627,6 +1628,7 @@ F: arch/arm64/boot/dts/Makefile · 1 unmodified line
16271628 ARM SUB-ARCHITECTURES
16281629 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
16291630 S: Maintained
1631+C: irc://irc.libera.chat/armlinux
16301632 T: git git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
16311633 F: arch/arm/mach-*/
16321634 F: arch/arm/plat-*/
@@ -1780,6 +1782,7 @@ F: drivers/irqchip/irq-apple-aic.c · 147 unmodified lines
17801782 F: drivers/mailbox/apple-mailbox.c
17811783 F: drivers/pinctrl/pinctrl-apple-gpio.c
17821784 F: drivers/soc/apple/*
1785+F: drivers/watchdog/apple_wdt.c
17831786 F: include/dt-bindings/interrupt-controller/apple-aic.h
17841787 F: include/dt-bindings/pinctrl/apple.h
17851788 F: include/linux/apple-mailbox.h
@@ -2570,10 +2573,13 @@ N: rockchip · 784 unmodified lines
25702573
25712574 ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES
25722575 M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
2576+R: Alim Akhtar <alim.akhtar@samsung.com>
25732577 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
25742578 L: linux-samsung-soc@vger.kernel.org
25752579 S: Maintained
2580+C: irc://irc.libera.chat/linux-exynos
25762581 Q: https://patchwork.kernel.org/project/linux-samsung-soc/list/
2582+T: git git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git
25772583 F: Documentation/arm/samsung/
25782584 F: Documentation/devicetree/bindings/arm/samsung/
25792585 F: Documentation/devicetree/bindings/power/pd-samsung.yaml
@@ -3133,11 +3139,9 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/ath5k · 553 unmodified lines
31333139 F: drivers/net/wireless/ath/ath5k/
31343140
31353141 ATHEROS ATH6KL WIRELESS DRIVER
3136−M: Kalle Valo <kvalo@kernel.org>
31373142 L: linux-wireless@vger.kernel.org
3138−S: Supported
3143+S: Orphan
31393144 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath6kl
3140−T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
31413145 F: drivers/net/wireless/ath/ath6kl/
31423146
31433147 ATI_REMOTE2 DRIVER
@@ -4157,9 +4161,8 @@ N: csky · 1013 unmodified lines
41574161 K: csky
41584162
41594163 CA8210 IEEE-802.15.4 RADIO DRIVER
4160−M: Harry Morris <h.morris@cascoda.com>
41614164 L: linux-wpan@vger.kernel.org
4162−S: Maintained
4165+S: Orphan
41634166 W: https://github.com/Cascoda/ca8210-linux.git
41644167 F: Documentation/devicetree/bindings/net/ieee802154/ca8210.txt
41654168 F: drivers/net/ieee802154/ca8210.c
@@ -4544,6 +4547,7 @@ F: drivers/platform/chrome/ · 378 unmodified lines
45444547
45454548 CHROMEOS EC CODEC DRIVER
45464549 M: Cheng-Yi Chiang <cychiang@chromium.org>
4550+M: Tzung-Bi Shih <tzungbi@google.com>
45474551 R: Guenter Roeck <groeck@chromium.org>
45484552 S: Maintained
45494553 F: Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml
@@ -4909,7 +4913,8 @@ F: kernel/cgroup/cpuset.c · 359 unmodified lines
49094913 CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)
49104914 M: Johannes Weiner <hannes@cmpxchg.org>
49114915 M: Michal Hocko <mhocko@kernel.org>
4912−M: Vladimir Davydov <vdavydov.dev@gmail.com>
4916+M: Roman Gushchin <roman.gushchin@linux.dev>
4917+M: Shakeel Butt <shakeelb@google.com>
49134918 L: cgroups@vger.kernel.org
49144919 L: linux-mm@kvack.org
49154920 S: Maintained
@@ -5773,7 +5778,7 @@ F: tools/testing/selftests/dma/ · 857 unmodified lines
57735778
57745779 DMA-BUF HEAPS FRAMEWORK
57755780 M: Sumit Semwal <sumit.semwal@linaro.org>
5776−R: Benjamin Gaignard <benjamin.gaignard@linaro.org>
5781+R: Benjamin Gaignard <benjamin.gaignard@collabora.com>
57775782 R: Liam Mark <lmark@codeaurora.org>
57785783 R: Laura Abbott <labbott@redhat.com>
57795784 R: Brian Starkey <Brian.Starkey@arm.com>
@@ -6077,7 +6082,8 @@ L: dri-devel@lists.freedesktop.org · 297 unmodified lines
60776082 T: git git://anongit.freedesktop.org/drm/drm-misc
60786083 S: Maintained
60796084 F: drivers/gpu/drm/panel/panel-lvds.c
6080−F: Documentation/devicetree/bindings/display/panel/lvds.yaml
6085+F: Documentation/devicetree/bindings/display/lvds.yaml
6086+F: Documentation/devicetree/bindings/display/panel/panel-lvds.yaml
60816087
60826088 DRM DRIVER FOR MANTIX MLAF057WE51 PANELS
60836089 M: Guido Günther <agx@sigxcpu.org>
@@ -6126,6 +6132,13 @@ T: git git://anongit.freedesktop.org/drm/drm-misc · 42 unmodified lines
61266132 F: Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml
61276133 F: drivers/gpu/drm/panel/panel-novatek-nt35510.c
61286134
6135+DRM DRIVER FOR NOVATEK NT35560 PANELS
6136+M: Linus Walleij <linus.walleij@linaro.org>
6137+S: Maintained
6138+T: git git://anongit.freedesktop.org/drm/drm-misc
6139+F: Documentation/devicetree/bindings/display/panel/sony,acx424akp.yaml
6140+F: drivers/gpu/drm/panel/panel-novatek-nt35560.c
6141+
61296142 DRM DRIVER FOR NOVATEK NT36672A PANELS
61306143 M: Sumit Semwal <sumit.semwal@linaro.org>
61316144 S: Maintained
@@ -6162,6 +6175,13 @@ T: git git://anongit.freedesktop.org/drm/drm-misc · 30 unmodified lines
61626175 F: Documentation/devicetree/bindings/display/repaper.txt
61636176 F: drivers/gpu/drm/tiny/repaper.c
61646177
6178+DRM DRIVER FOR SOLOMON SSD130X OLED DISPLAYS
6179+M: Javier Martinez Canillas <javierm@redhat.com>
6180+S: Maintained
6181+T: git git://anongit.freedesktop.org/drm/drm-misc
6182+F: Documentation/devicetree/bindings/display/solomon,ssd1307fb.yaml
6183+F: drivers/gpu/drm/solomon/ssd130x*
6184+
61656185 DRM DRIVER FOR QEMU'S CIRRUS DEVICE
61666186 M: Dave Airlie <airlied@redhat.com>
61676187 M: Gerd Hoffmann <kraxel@redhat.com>
@@ -6250,12 +6270,6 @@ T: git git://anongit.freedesktop.org/drm/drm-misc · 82 unmodified lines
62506270 F: Documentation/devicetree/bindings/display/sitronix,st7735r.yaml
62516271 F: drivers/gpu/drm/tiny/st7735r.c
62526272
6253−DRM DRIVER FOR SONY ACX424AKP PANELS
6254−M: Linus Walleij <linus.walleij@linaro.org>
6255−S: Maintained
6256−T: git git://anongit.freedesktop.org/drm/drm-misc
6257−F: drivers/gpu/drm/panel/panel-sony-acx424akp.c
6258−
62596273 DRM DRIVER FOR ST-ERICSSON MCDE
62606274 M: Linus Walleij <linus.walleij@linaro.org>
62616275 S: Maintained
@@ -6503,7 +6517,7 @@ F: Documentation/devicetree/bindings/display/rockchip/ · 241 unmodified lines
65036517 F: drivers/gpu/drm/rockchip/
65046518
65056519 DRM DRIVERS FOR STI
6506−M: Benjamin Gaignard <benjamin.gaignard@linaro.org>
6520+M: Alain Volmat <alain.volmat@foss.st.com>
65076521 L: dri-devel@lists.freedesktop.org
65086522 S: Maintained
65096523 T: git git://anongit.freedesktop.org/drm/drm-misc
@@ -6512,8 +6526,8 @@ F: drivers/gpu/drm/sti · 2 unmodified lines
65126526
65136527 DRM DRIVERS FOR STM
65146528 M: Yannick Fertre <yannick.fertre@foss.st.com>
6529+M: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
65156530 M: Philippe Cornu <philippe.cornu@foss.st.com>
6516−M: Benjamin Gaignard <benjamin.gaignard@linaro.org>
65176531 L: dri-devel@lists.freedesktop.org
65186532 S: Maintained
65196533 T: git git://anongit.freedesktop.org/drm/drm-misc
@@ -7007,12 +7021,6 @@ L: linux-edac@vger.kernel.org · 487 unmodified lines
70077021 S: Maintained
70087022 F: drivers/edac/sb_edac.c
70097023
7010−EDAC-SIFIVE
7011−M: Yash Shah <yash.shah@sifive.com>
7012−L: linux-edac@vger.kernel.org
7013−S: Supported
7014−F: drivers/edac/sifive_edac.c
7015−
70167024 EDAC-SKYLAKE
70177025 M: Tony Luck <tony.luck@intel.com>
70187026 L: linux-edac@vger.kernel.org
@@ -7183,7 +7191,7 @@ F: drivers/net/can/usb/etas_es58x/ · 164 unmodified lines
71837191
71847192 ETHERNET BRIDGE
71857193 M: Roopa Prabhu <roopa@nvidia.com>
7186−M: Nikolay Aleksandrov <nikolay@nvidia.com>
7194+M: Nikolay Aleksandrov <razor@blackwall.org>
71877195 L: bridge@lists.linux-foundation.org (moderated for non-subscribers)
71887196 L: netdev@vger.kernel.org
71897197 S: Maintained
@@ -7576,6 +7584,12 @@ S: Maintained · 386 unmodified lines
75767584 W: http://floatingpoint.sourceforge.net/emulator/index.html
75777585 F: arch/x86/math-emu/
75787586
7587+FRAMEBUFFER CORE
7588+M: Daniel Vetter <daniel@ffwll.ch>
7589+F: drivers/video/fbdev/core/
7590+S: Odd Fixes
7591+T: git git://anongit.freedesktop.org/drm/drm-misc
7592+
75797593 FRAMEBUFFER LAYER
75807594 M: Helge Deller <deller@gmx.de>
75817595 L: linux-fbdev@vger.kernel.org
@@ -9253,6 +9267,15 @@ S: Maintained · 1671 unmodified lines
92539267 W: https://github.com/o2genum/ideapad-slidebar
92549268 F: drivers/input/misc/ideapad_slidebar.c
92559269
9270+IDMAPPED MOUNTS
9271+M: Christian Brauner <brauner@kernel.org>
9272+L: linux-fsdevel@vger.kernel.org
9273+S: Maintained
9274+T: git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
9275+F: Documentation/filesystems/idmappings.rst
9276+F: tools/testing/selftests/mount_setattr/
9277+F: include/linux/mnt_idmapping.h
9278+
92569279 IDT VersaClock 5 CLOCK DRIVER
92579280 M: Luca Ceresoli <luca@lucaceresoli.net>
92589281 S: Maintained
@@ -10887,6 +10910,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git · 1628 unmodified lines
1088710910 F: drivers/ata/pata_arasan_cf.c
1088810911 F: include/linux/pata_arasan_cf_data.h
1088910912
10913+LIBATA PATA DRIVERS
10914+R: Sergey Shtylyov <s.shtylyov@omp.ru>
10915+L: linux-ide@vger.kernel.org
10916+F: drivers/ata/ata_*.c
10917+F: drivers/ata/pata_*.c
10918+
1089010919 LIBATA PATA FARADAY FTIDE010 AND GEMINI SATA BRIDGE DRIVERS
1089110920 M: Linus Walleij <linus.walleij@linaro.org>
1089210921 L: linux-ide@vger.kernel.org
@@ -12407,7 +12436,7 @@ F: include/uapi/linux/membarrier.h · 1514 unmodified lines
1240712436 F: kernel/sched/membarrier.c
1240812437
1240912438 MEMBLOCK
12410−M: Mike Rapoport <rppt@linux.ibm.com>
12439+M: Mike Rapoport <rppt@kernel.org>
1241112440 L: linux-mm@kvack.org
1241212441 S: Maintained
1241312442 F: Documentation/core-api/boot-time-mm.rst
@@ -13305,8 +13334,8 @@ W: http://www.iptables.org/ · 891 unmodified lines
1330513334 W: http://www.nftables.org/
1330613335 Q: http://patchwork.ozlabs.org/project/netfilter-devel/list/
1330713336 C: irc://irc.libera.chat/netfilter
13308−T: git git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
13309−T: git git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git
13337+T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git
13338+T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git
1331013339 F: include/linux/netfilter*
1331113340 F: include/linux/netfilter/
1331213341 F: include/net/netfilter/
@@ -13573,7 +13602,7 @@ F: tools/testing/selftests/nci/ · 260 unmodified lines
1357313602
1357413603 NFS, SUNRPC, AND LOCKD CLIENTS
1357513604 M: Trond Myklebust <trond.myklebust@hammerspace.com>
13576−M: Anna Schumaker <anna.schumaker@netapp.com>
13605+M: Anna Schumaker <anna@kernel.org>
1357713606 L: linux-nfs@vger.kernel.org
1357813607 S: Maintained
1357913608 W: http://client.linux-nfs.org
@@ -14391,6 +14420,7 @@ M: Rob Herring <robh+dt@kernel.org> · 811 unmodified lines
1439114420 M: Frank Rowand <frowand.list@gmail.com>
1439214421 L: devicetree@vger.kernel.org
1439314422 S: Maintained
14423+C: irc://irc.libera.chat/devicetree
1439414424 W: http://www.devicetree.org/
1439514425 T: git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
1439614426 F: Documentation/ABI/testing/sysfs-firmware-ofw
@@ -14402,6 +14432,7 @@ OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS · 5 unmodified lines
1440214432 M: Rob Herring <robh+dt@kernel.org>
1440314433 L: devicetree@vger.kernel.org
1440414434 S: Maintained
14435+C: irc://irc.libera.chat/devicetree
1440514436 Q: http://patchwork.ozlabs.org/project/devicetree-bindings/list/
1440614437 T: git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
1440714438 F: Documentation/devicetree/
@@ -15135,7 +15166,7 @@ M: Ingo Molnar <mingo@redhat.com> · 727 unmodified lines
1513515166 M: Arnaldo Carvalho de Melo <acme@kernel.org>
1513615167 R: Mark Rutland <mark.rutland@arm.com>
1513715168 R: Alexander Shishkin <alexander.shishkin@linux.intel.com>
15138−R: Jiri Olsa <jolsa@redhat.com>
15169+R: Jiri Olsa <jolsa@kernel.org>
1513915170 R: Namhyung Kim <namhyung@kernel.org>
1514015171 L: linux-perf-users@vger.kernel.org
1514115172 L: linux-kernel@vger.kernel.org
@@ -15292,9 +15323,11 @@ PIN CONTROLLER - SAMSUNG · 150 unmodified lines
1529215323 M: Tomasz Figa <tomasz.figa@gmail.com>
1529315324 M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
1529415325 M: Sylwester Nawrocki <s.nawrocki@samsung.com>
15326+R: Alim Akhtar <alim.akhtar@samsung.com>
1529515327 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1529615328 L: linux-samsung-soc@vger.kernel.org
1529715329 S: Maintained
15330+C: irc://irc.libera.chat/linux-exynos
1529815331 Q: https://patchwork.kernel.org/project/linux-samsung-soc/list/
1529915332 T: git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung.git
1530015333 F: Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
@@ -15551,6 +15584,7 @@ M: Iurii Zaikin <yzaikin@google.com> · 250 unmodified lines
1555115584 L: linux-kernel@vger.kernel.org
1555215585 L: linux-fsdevel@vger.kernel.org
1555315586 S: Maintained
15587+T: git git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git sysctl-next
1555415588 F: fs/proc/proc_sysctl.c
1555515589 F: include/linux/sysctl.h
1555615590 F: kernel/sysctl-test.c
@@ -15898,6 +15932,7 @@ S: Supported · 341 unmodified lines
1589815932 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
1589915933 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
1590015934 F: drivers/net/wireless/ath/ath10k/
15935+F: Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
1590115936
1590215937 QUALCOMM ATHEROS ATH11K WIRELESS DRIVER
1590315938 M: Kalle Valo <kvalo@kernel.org>
@@ -15905,11 +15940,12 @@ L: ath11k@lists.infradead.org · 1 unmodified line
1590515940 S: Supported
1590615941 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
1590715942 F: drivers/net/wireless/ath/ath11k/
15943+F: Documentation/devicetree/bindings/net/wireless/qcom,ath11k.txt
1590815944
1590915945 QUALCOMM ATHEROS ATH9K WIRELESS DRIVER
15910−M: ath9k-devel@qca.qualcomm.com
15946+M: Toke Høiland-Jørgensen <toke@toke.dk>
1591115947 L: linux-wireless@vger.kernel.org
15912−S: Supported
15948+S: Maintained
1591315949 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath9k
1591415950 F: Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
1591515951 F: drivers/net/wireless/ath/ath9k/
@@ -15984,14 +16020,6 @@ F: Documentation/devicetree/bindings/misc/qcom,fastrpc.txt · 68 unmodified lines
1598416020 F: drivers/misc/fastrpc.c
1598516021 F: include/uapi/misc/fastrpc.h
1598616022
15987−QUALCOMM GENERIC INTERFACE I2C DRIVER
15988−M: Akash Asthana <akashast@codeaurora.org>
15989−M: Mukesh Savaliya <msavaliy@codeaurora.org>
15990−L: linux-i2c@vger.kernel.org
15991−L: linux-arm-msm@vger.kernel.org
15992−S: Supported
15993−F: drivers/i2c/busses/i2c-qcom-geni.c
15994−
1599516023 QUALCOMM HEXAGON ARCHITECTURE
1599616024 M: Brian Cain <bcain@codeaurora.org>
1599716025 L: linux-hexagon@vger.kernel.org
@@ -16063,8 +16091,8 @@ F: Documentation/devicetree/bindings/mtd/qcom,nandc.yaml · 65 unmodified lines
1606316091 F: drivers/mtd/nand/raw/qcom_nandc.c
1606416092
1606516093 QUALCOMM RMNET DRIVER
16066−M: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
16067−M: Sean Tranchetti <stranche@codeaurora.org>
16094+M: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com>
16095+M: Sean Tranchetti <quic_stranche@quicinc.com>
1606816096 L: netdev@vger.kernel.org
1606916097 S: Maintained
1607016098 F: Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
@@ -16090,11 +16118,10 @@ F: Documentation/devicetree/bindings/media/*venus* · 19 unmodified lines
1609016118 F: drivers/media/platform/qcom/venus/
1609116119
1609216120 QUALCOMM WCN36XX WIRELESS DRIVER
16093−M: Kalle Valo <kvalo@kernel.org>
16121+M: Loic Poulain <loic.poulain@linaro.org>
1609416122 L: wcn36xx@lists.infradead.org
1609516123 S: Supported
1609616124 W: https://wireless.wiki.kernel.org/en/users/Drivers/wcn36xx
16097−T: git git://github.com/KrasnikovEugene/wcn36xx.git
1609816125 F: drivers/net/wireless/ath/wcn36xx/
1609916126
1610016127 QUANTENNA QTNFMAC WIRELESS DRIVER
@@ -16357,6 +16384,7 @@ F: drivers/watchdog/realtek_otto_wdt.c · 256 unmodified lines
1635716384
1635816385 REALTEK RTL83xx SMI DSA ROUTER CHIPS
1635916386 M: Linus Walleij <linus.walleij@linaro.org>
16387+M: Alvin Šipraga <alsi@bang-olufsen.dk>
1636016388 S: Maintained
1636116389 F: Documentation/devicetree/bindings/net/dsa/realtek-smi.txt
1636216390 F: drivers/net/dsa/realtek-smi*
@@ -16476,6 +16504,14 @@ F: Documentation/devicetree/bindings/i2c/renesas,rmobile-iic.yaml · 113 unmodified lines
1647616504 F: drivers/i2c/busses/i2c-rcar.c
1647716505 F: drivers/i2c/busses/i2c-sh_mobile.c
1647816506
16507+RENESAS R-CAR SATA DRIVER
16508+R: Sergey Shtylyov <s.shtylyov@omp.ru>
16509+S: Supported
16510+L: linux-ide@vger.kernel.org
16511+L: linux-renesas-soc@vger.kernel.org
16512+F: Documentation/devicetree/bindings/ata/renesas,rcar-sata.yaml
16513+F: drivers/ata/sata_rcar.c
16514+
1647916515 RENESAS R-CAR THERMAL DRIVERS
1648016516 M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
1648116517 L: linux-renesas-soc@vger.kernel.org
@@ -16811,8 +16847,8 @@ F: drivers/video/fbdev/savage/ · 329 unmodified lines
1681116847 S390
1681216848 M: Heiko Carstens <hca@linux.ibm.com>
1681316849 M: Vasily Gorbik <gor@linux.ibm.com>
16814−M: Christian Borntraeger <borntraeger@linux.ibm.com>
16815−R: Alexander Gordeev <agordeev@linux.ibm.com>
16850+M: Alexander Gordeev <agordeev@linux.ibm.com>
16851+R: Christian Borntraeger <borntraeger@linux.ibm.com>
1681616852 R: Sven Schnelle <svens@linux.ibm.com>
1681716853 L: linux-s390@vger.kernel.org
1681816854 S: Supported
@@ -17083,6 +17119,7 @@ SAMSUNG SOC CLOCK DRIVERS · 264 unmodified lines
1708317119 M: Sylwester Nawrocki <s.nawrocki@samsung.com>
1708417120 M: Tomasz Figa <tomasz.figa@gmail.com>
1708517121 M: Chanwoo Choi <cw00.choi@samsung.com>
17122+R: Alim Akhtar <alim.akhtar@samsung.com>
1708617123 L: linux-samsung-soc@vger.kernel.org
1708717124 S: Supported
1708817125 T: git git://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk.git
@@ -17719,6 +17756,21 @@ S: Maintained · 630 unmodified lines
1771917756 W: http://www.winischhofer.at/linuxsisusbvga.shtml
1772017757 F: drivers/usb/misc/sisusbvga/
1772117758
17759+SL28 CPLD MFD DRIVER
17760+M: Michael Walle <michael@walle.cc>
17761+S: Maintained
17762+F: Documentation/devicetree/bindings/gpio/kontron,sl28cpld-gpio.yaml
17763+F: Documentation/devicetree/bindings/hwmon/kontron,sl28cpld-hwmon.yaml
17764+F: Documentation/devicetree/bindings/interrupt-controller/kontron,sl28cpld-intc.yaml
17765+F: Documentation/devicetree/bindings/mfd/kontron,sl28cpld.yaml
17766+F: Documentation/devicetree/bindings/pwm/kontron,sl28cpld-pwm.yaml
17767+F: Documentation/devicetree/bindings/watchdog/kontron,sl28cpld-wdt.yaml
17768+F: drivers/gpio/gpio-sl28cpld.c
17769+F: drivers/hwmon/sl28cpld-hwmon.c
17770+F: drivers/irqchip/irq-sl28cpld.c
17771+F: drivers/pwm/pwm-sl28cpld.c
17772+F: drivers/watchdog/sl28cpld_wdt.c
17773+
1772217774 SLAB ALLOCATOR
1772317775 M: Christoph Lameter <cl@linux.com>
1772417776 M: Pekka Enberg <penberg@kernel.org>
@@ -17726,8 +17778,10 @@ M: David Rientjes <rientjes@google.com> · 1 unmodified line
1772617778 M: Joonsoo Kim <iamjoonsoo.kim@lge.com>
1772717779 M: Andrew Morton <akpm@linux-foundation.org>
1772817780 M: Vlastimil Babka <vbabka@suse.cz>
17781+R: Roman Gushchin <roman.gushchin@linux.dev>
1772917782 L: linux-mm@kvack.org
1773017783 S: Maintained
17784+T: git git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git
1773117785 F: include/linux/sl?b*.h
1773217786 F: mm/sl?b*
1773317787
@@ -18435,7 +18489,7 @@ F: Documentation/devicetree/bindings/sound/st,sti-asoc-card.txt · 701 unmodified lines
1843518489 F: sound/soc/sti/
1843618490
1843718491 STI CEC DRIVER
18438−M: Benjamin Gaignard <benjamin.gaignard@linaro.org>
18492+M: Alain Volmat <alain.volmat@foss.st.com>
1843918493 S: Maintained
1844018494 F: Documentation/devicetree/bindings/media/stih-cec.txt
1844118495 F: drivers/media/cec/platform/sti/
@@ -19589,6 +19643,14 @@ F: Documentation/trace/timerlat-tracer.rst · 1147 unmodified lines
1958919643 F: Documentation/trace/hwlat_detector.rst
1959019644 F: arch/*/kernel/trace.c
1959119645
19646+Real-time Linux Analysis (RTLA) tools
19647+M: Daniel Bristot de Oliveira <bristot@kernel.org>
19648+M: Steven Rostedt <rostedt@goodmis.org>
19649+L: linux-trace-devel@vger.kernel.org
19650+S: Maintained
19651+F: Documentation/tools/rtla/
19652+F: tools/tracing/rtla/
19653+
1959219654 TRADITIONAL CHINESE DOCUMENTATION
1959319655 M: Hu Haowen <src.res@email.cn>
1959419656 L: linux-doc-tw-discuss@lists.sourceforge.net
Makefile+2−2
@@ -2,8 +2,8 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 17
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
6−NAME = Gobble Gobble
5+EXTRAVERSION = -rc6
6+NAME = Superb Owl
77
88 # *DOCUMENTATION*
99 # To see a list of typical targets execute "make help"
arch/arm/boot/dts/Makefile+1−0
@@ -806,6 +806,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \ · 805 unmodified lines
806806 logicpd-som-lv-37xx-devkit.dtb \
807807 omap3430-sdp.dtb \
808808 omap3-beagle.dtb \
809+ omap3-beagle-ab4.dtb \
809810 omap3-beagle-xm.dtb \
810811 omap3-beagle-xm-ab.dtb \
811812 omap3-cm-t3517.dtb \
arch/arm/boot/dts/am335x-wega.dtsi+1−1
@@ -55,7 +55,7 @@ · 54 unmodified lines
5555 2 1 0 0 /* # 0: INACTIVE, 1: TX, 2: RX */
5656 >;
5757 tx-num-evt = <16>;
58− rt-num-evt = <16>;
58+ rx-num-evt = <16>;
5959 status = "okay";
6060 };
6161
arch/arm/boot/dts/dra7.dtsi+10−10
@@ -160,7 +160,7 @@ · 159 unmodified lines
160160 target-module@48210000 {
161161 compatible = "ti,sysc-omap4-simple", "ti,sysc";
162162 power-domains = <&prm_mpu>;
163− clocks = <&mpu_clkctrl DRA7_MPU_CLKCTRL 0>;
163+ clocks = <&mpu_clkctrl DRA7_MPU_MPU_CLKCTRL 0>;
164164 clock-names = "fck";
165165 #address-cells = <1>;
166166 #size-cells = <1>;
@@ -875,10 +875,10 @@ · 708 unmodified lines
875875 <0x58000014 4>;
876876 reg-names = "rev", "syss";
877877 ti,syss-mask = <1>;
878− clocks = <&dss_clkctrl DRA7_DSS_CORE_CLKCTRL 0>,
879− <&dss_clkctrl DRA7_DSS_CORE_CLKCTRL 9>,
880− <&dss_clkctrl DRA7_DSS_CORE_CLKCTRL 10>,
881− <&dss_clkctrl DRA7_DSS_CORE_CLKCTRL 11>;
878+ clocks = <&dss_clkctrl DRA7_DSS_DSS_CORE_CLKCTRL 0>,
879+ <&dss_clkctrl DRA7_DSS_DSS_CORE_CLKCTRL 9>,
880+ <&dss_clkctrl DRA7_DSS_DSS_CORE_CLKCTRL 10>,
881+ <&dss_clkctrl DRA7_DSS_DSS_CORE_CLKCTRL 11>;
882882 clock-names = "fck", "hdmi_clk", "sys_clk", "tv_clk";
883883 #address-cells = <1>;
884884 #size-cells = <1>;
@@ -912,7 +912,7 @@ · 27 unmodified lines
912912 SYSC_OMAP2_SOFTRESET |
913913 SYSC_OMAP2_AUTOIDLE)>;
914914 ti,syss-mask = <1>;
915− clocks = <&dss_clkctrl DRA7_DSS_CORE_CLKCTRL 8>;
915+ clocks = <&dss_clkctrl DRA7_DSS_DSS_CORE_CLKCTRL 8>;
916916 clock-names = "fck";
917917 #address-cells = <1>;
918918 #size-cells = <1>;
@@ -939,8 +939,8 @@ · 20 unmodified lines
939939 <SYSC_IDLE_SMART>,
940940 <SYSC_IDLE_SMART_WKUP>;
941941 ti,sysc-mask = <(SYSC_OMAP4_SOFTRESET)>;
942− clocks = <&dss_clkctrl DRA7_DSS_CORE_CLKCTRL 9>,
943− <&dss_clkctrl DRA7_DSS_CORE_CLKCTRL 8>;
942+ clocks = <&dss_clkctrl DRA7_DSS_DSS_CORE_CLKCTRL 9>,
943+ <&dss_clkctrl DRA7_DSS_DSS_CORE_CLKCTRL 8>;
944944 clock-names = "fck", "dss_clk";
945945 #address-cells = <1>;
946946 #size-cells = <1>;
@@ -979,7 +979,7 @@ · 32 unmodified lines
979979 compatible = "vivante,gc";
980980 reg = <0x0 0x700>;
981981 interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
982− clocks = <&dss_clkctrl DRA7_BB2D_CLKCTRL 0>;
982+ clocks = <&dss_clkctrl DRA7_DSS_BB2D_CLKCTRL 0>;
983983 clock-names = "core";
984984 };
985985 };
@@ -1333,7 +1333,7 @@ · 347 unmodified lines
13331333 ti,no-reset-on-init;
13341334 ti,no-idle;
13351335 timer@0 {
1336− assigned-clocks = <&wkupaon_clkctrl DRA7_TIMER1_CLKCTRL 24>;
1336+ assigned-clocks = <&wkupaon_clkctrl DRA7_WKUPAON_TIMER1_CLKCTRL 24>;
13371337 assigned-clock-parents = <&sys_32k_ck>;
13381338 };
13391339 };
arch/arm/boot/dts/imx23-evk.dts+0−1
@@ -79,7 +79,6 @@ · 78 unmodified lines
7979 MX23_PAD_LCD_RESET__GPIO_1_18
8080 MX23_PAD_PWM3__GPIO_1_29
8181 MX23_PAD_PWM4__GPIO_1_30
82− MX23_PAD_SSP1_DETECT__SSP1_DETECT
8382 >;
8483 fsl,drive-strength = <MXS_DRIVE_4mA>;
8584 fsl,voltage = <MXS_VOLTAGE_HIGH>;
arch/arm/boot/dts/imx6qdl-udoo.dtsi+4−1
@@ -5,6 +5,8 @@ · 4 unmodified lines
55 * Author: Fabio Estevam <fabio.estevam@freescale.com>
66 */
77
8+#include <dt-bindings/gpio/gpio.h>
9+
810 / {
911 aliases {
1012 backlight = &backlight;
@@ -226,6 +228,7 @@ · 215 unmodified lines
226228 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
227229 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
228230 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
231+ MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x1b0b0
229232 >;
230233 };
231234
@@ -304,7 +307,7 @@ · 72 unmodified lines
304307 &usdhc3 {
305308 pinctrl-names = "default";
306309 pinctrl-0 = <&pinctrl_usdhc3>;
307− non-removable;
310+ cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
308311 status = "okay";
309312 };
310313
arch/arm/boot/dts/imx7ulp.dtsi+1−1
@@ -259,7 +259,7 @@ · 258 unmodified lines
259259 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
260260 clocks = <&pcc2 IMX7ULP_CLK_WDG1>;
261261 assigned-clocks = <&pcc2 IMX7ULP_CLK_WDG1>;
262− assigned-clocks-parents = <&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>;
262+ assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>;
263263 timeout-sec = <40>;
264264 };
265265
arch/arm/boot/dts/meson.dtsi+4−4
@@ -59,7 +59,7 @@ · 58 unmodified lines
5959 };
6060
6161 uart_A: serial@84c0 {
62− compatible = "amlogic,meson6-uart", "amlogic,meson-uart";
62+ compatible = "amlogic,meson6-uart";
6363 reg = <0x84c0 0x18>;
6464 interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
6565 fifo-size = <128>;
@@ -67,7 +67,7 @@ · 1 unmodified line
6767 };
6868
6969 uart_B: serial@84dc {
70− compatible = "amlogic,meson6-uart", "amlogic,meson-uart";
70+ compatible = "amlogic,meson6-uart";
7171 reg = <0x84dc 0x18>;
7272 interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_RISING>;
7373 status = "disabled";
@@ -105,7 +105,7 @@ · 31 unmodified lines
105105 };
106106
107107 uart_C: serial@8700 {
108− compatible = "amlogic,meson6-uart", "amlogic,meson-uart";
108+ compatible = "amlogic,meson6-uart";
109109 reg = <0x8700 0x18>;
110110 interrupts = <GIC_SPI 93 IRQ_TYPE_EDGE_RISING>;
111111 status = "disabled";
@@ -228,7 +228,7 @@ · 116 unmodified lines
228228 };
229229
230230 uart_AO: serial@4c0 {
231− compatible = "amlogic,meson6-uart", "amlogic,meson-ao-uart", "amlogic,meson-uart";
231+ compatible = "amlogic,meson6-uart", "amlogic,meson-ao-uart";
232232 reg = <0x4c0 0x18>;
233233 interrupts = <GIC_SPI 90 IRQ_TYPE_EDGE_RISING>;
234234 status = "disabled";
arch/arm/boot/dts/meson8.dtsi+12−12
@@ -736,27 +736,27 @@ · 735 unmodified lines
736736 };
737737
738738 &uart_AO {
739− compatible = "amlogic,meson8-uart", "amlogic,meson-uart";
740− clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_CLK81>;
741− clock-names = "baud", "xtal", "pclk";
739+ compatible = "amlogic,meson8-uart", "amlogic,meson-ao-uart";
740+ clocks = <&xtal>, <&clkc CLKID_CLK81>, <&clkc CLKID_CLK81>;
741+ clock-names = "xtal", "pclk", "baud";
742742 };
743743
744744 &uart_A {
745− compatible = "amlogic,meson8-uart", "amlogic,meson-uart";
746− clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART0>;
747− clock-names = "baud", "xtal", "pclk";
745+ compatible = "amlogic,meson8-uart";
746+ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>;
747+ clock-names = "xtal", "pclk", "baud";
748748 };
749749
750750 &uart_B {
751− compatible = "amlogic,meson8-uart", "amlogic,meson-uart";
752− clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART1>;
753− clock-names = "baud", "xtal", "pclk";
751+ compatible = "amlogic,meson8-uart";
752+ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>;
753+ clock-names = "xtal", "pclk", "baud";
754754 };
755755
756756 &uart_C {
757− compatible = "amlogic,meson8-uart", "amlogic,meson-uart";
758− clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART2>;
759− clock-names = "baud", "xtal", "pclk";
757+ compatible = "amlogic,meson8-uart";
758+ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>;
759+ clock-names = "xtal", "pclk", "baud";
760760 };
761761
762762 &usb0 {
arch/arm/boot/dts/meson8b.dtsi+12−12
@@ -724,27 +724,27 @@ · 723 unmodified lines
724724 };
725725
726726 &uart_AO {
727− compatible = "amlogic,meson8b-uart", "amlogic,meson-uart";
728− clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_CLK81>;
729− clock-names = "baud", "xtal", "pclk";
727+ compatible = "amlogic,meson8b-uart", "amlogic,meson-ao-uart";
728+ clocks = <&xtal>, <&clkc CLKID_CLK81>, <&clkc CLKID_CLK81>;
729+ clock-names = "xtal", "pclk", "baud";
730730 };
731731
732732 &uart_A {
733− compatible = "amlogic,meson8b-uart", "amlogic,meson-uart";
734− clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART0>;
735− clock-names = "baud", "xtal", "pclk";
733+ compatible = "amlogic,meson8b-uart";
734+ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>;
735+ clock-names = "xtal", "pclk", "baud";
736736 };
737737
738738 &uart_B {
739− compatible = "amlogic,meson8b-uart", "amlogic,meson-uart";
740− clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART1>;
741− clock-names = "baud", "xtal", "pclk";
739+ compatible = "amlogic,meson8b-uart";
740+ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>;
741+ clock-names = "xtal", "pclk", "baud";
742742 };
743743
744744 &uart_C {
745− compatible = "amlogic,meson8b-uart", "amlogic,meson-uart";
746− clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART2>;
747− clock-names = "baud", "xtal", "pclk";
745+ compatible = "amlogic,meson8b-uart";
746+ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>;
747+ clock-names = "xtal", "pclk", "baud";
748748 };
749749
750750 &usb0 {
arch/arm/boot/dts/omap3-beagle-ab4.dts+47−0
@@ -0,0 +1,47 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/dts-v1/;
3+
4+#include "omap3-beagle.dts"
5+
6+/ {
7+ model = "TI OMAP3 BeagleBoard A to B4";
8+ compatible = "ti,omap3-beagle-ab4", "ti,omap3-beagle", "ti,omap3430", "ti,omap3";
9+};
10+
11+/*
12+ * Workaround for capacitor C70 issue, see "Boards revision A and < B5"
13+ * section at https://elinux.org/BeagleBoard_Community
14+ */
15+
16+/* Unusable as clocksource because of unreliable oscillator */
17+&counter32k {
18+ status = "disabled";
19+};
20+
21+/* Unusable as clockevent because of unreliable oscillator, allow to idle */
22+&timer1_target {
23+ /delete-property/ti,no-reset-on-init;
24+ /delete-property/ti,no-idle;
25+ timer@0 {
26+ /delete-property/ti,timer-alwon;
27+ };
28+};
29+
30+/* Preferred always-on timer for clocksource */
31+&timer12_target {
32+ ti,no-reset-on-init;
33+ ti,no-idle;
34+ timer@0 {
35+ /* Always clocked by secure_32k_fck */
36+ };
37+};
38+
39+/* Preferred timer for clockevent */
40+&timer2_target {
41+ ti,no-reset-on-init;
42+ ti,no-idle;
43+ timer@0 {
44+ assigned-clocks = <&gpt2_fck>;
45+ assigned-clock-parents = <&sys_ck>;
46+ };
47+};
arch/arm/boot/dts/omap3-beagle.dts+0−33
@@ -304,39 +304,6 @@ · 303 unmodified lines
304304 phys = <0 &hsusb2_phy>;
305305 };
306306
307−/* Unusable as clocksource because of unreliable oscillator */
308−&counter32k {
309− status = "disabled";
310−};
311−
312−/* Unusable as clockevent because if unreliable oscillator, allow to idle */
313−&timer1_target {
314− /delete-property/ti,no-reset-on-init;
315− /delete-property/ti,no-idle;
316− timer@0 {
317− /delete-property/ti,timer-alwon;
318− };
319−};
320−
321−/* Preferred always-on timer for clocksource */
322−&timer12_target {
323− ti,no-reset-on-init;
324− ti,no-idle;
325− timer@0 {
326− /* Always clocked by secure_32k_fck */
327− };
328−};
329−
330−/* Preferred timer for clockevent */
331−&timer2_target {
332− ti,no-reset-on-init;
333− ti,no-idle;
334− timer@0 {
335− assigned-clocks = <&gpt2_fck>;
336− assigned-clock-parents = <&sys_ck>;
337− };
338−};
339−
340307 &twl_gpio {
341308 ti,use-leds;
342309 /* pullups: BIT(1) */
arch/arm/boot/dts/spear320-hmi.dts+0−1
@@ -235,7 +235,6 @@ · 234 unmodified lines
235235 #address-cells = <1>;
236236 #size-cells = <0>;
237237 reg = <0x41>;
238− irq-over-gpio;
239238 irq-gpios = <&gpiopinctrl 29 0x4>;
240239 id = <0>;
241240 blocks = <0x5>;
arch/arm/boot/dts/ste-ux500-samsung-skomer.dts+0−4
@@ -185,10 +185,6 @@ · 184 unmodified lines
185185 cap-sd-highspeed;
186186 cap-mmc-highspeed;
187187 /* All direction control is used */
188− st,sig-dir-cmd;
189− st,sig-dir-dat0;
190− st,sig-dir-dat2;
191− st,sig-dir-dat31;
192188 st,sig-pin-fbclk;
193189 full-pwr-cycle;
194190 vmmc-supply = <&ab8500_ldo_aux3_reg>;
arch/arm/crypto/blake2s-shash.c+2−2
@@ -13,12 +13,12 @@ · 12 unmodified lines
1313 static int crypto_blake2s_update_arm(struct shash_desc *desc,
1414 const u8 *in, unsigned int inlen)
1515 {
16− return crypto_blake2s_update(desc, in, inlen, blake2s_compress);
16+ return crypto_blake2s_update(desc, in, inlen, false);
1717 }
1818
1919 static int crypto_blake2s_final_arm(struct shash_desc *desc, u8 *out)
2020 {
21− return crypto_blake2s_final(desc, out, blake2s_compress);
21+ return crypto_blake2s_final(desc, out, false);
2222 }
2323
2424 #define BLAKE2S_ALG(name, driver_name, digest_size) \
arch/arm/mach-omap2/display.c+1−1
@@ -263,9 +263,9 @@ static int __init omapdss_init_of(void) · 262 unmodified lines
263263 }
264264
265265 r = of_platform_populate(node, NULL, NULL, &pdev->dev);
266+ put_device(&pdev->dev);
266267 if (r) {
267268 pr_err("Unable to populate DSS submodule devices\n");
268− put_device(&pdev->dev);
269269 return r;
270270 }
271271
arch/arm/mach-omap2/omap_hwmod.c+3−1
@@ -752,8 +752,10 @@ static int __init _init_clkctrl_providers(void) · 751 unmodified lines
752752
753753 for_each_matching_node(np, ti_clkctrl_match_table) {
754754 ret = _setup_clkctrl_provider(np);
755− if (ret)
755+ if (ret) {
756+ of_node_put(np);
756757 break;
758+ }
757759 }
758760
759761 return ret;
arch/arm/mach-socfpga/Kconfig+2−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 menuconfig ARCH_INTEL_SOCFPGA
33 bool "Altera SOCFPGA family"
44 depends on ARCH_MULTI_V7
5+ select ARCH_HAS_RESET_CONTROLLER
56 select ARCH_SUPPORTS_BIG_ENDIAN
67 select ARM_AMBA
78 select ARM_GIC
@@ -18,6 +19,7 @@ menuconfig ARCH_INTEL_SOCFPGA · 10 unmodified lines
1819 select PL310_ERRATA_727915
1920 select PL310_ERRATA_753970 if PL310
2021 select PL310_ERRATA_769419
22+ select RESET_CONTROLLER
2123
2224 if ARCH_INTEL_SOCFPGA
2325 config SOCFPGA_SUSPEND
arch/arm64/Kconfig+17−0
@@ -672,6 +672,7 @@ config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE · 671 unmodified lines
672672
673673 config ARM64_ERRATUM_2051678
674674 bool "Cortex-A510: 2051678: disable Hardware Update of the page table dirty bit"
675+ default y
675676 help
676677 This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678.
677678 Affected Coretex-A510 might not respect the ordering rules for
@@ -680,6 +681,22 @@ config ARM64_ERRATUM_2051678 · 2 unmodified lines
680681
681682 If unsure, say Y.
682683
684+config ARM64_ERRATUM_2077057
685+ bool "Cortex-A510: 2077057: workaround software-step corrupting SPSR_EL2"
686+ help
687+ This option adds the workaround for ARM Cortex-A510 erratum 2077057.
688+ Affected Cortex-A510 may corrupt SPSR_EL2 when the a step exception is
689+ expected, but a Pointer Authentication trap is taken instead. The
690+ erratum causes SPSR_EL1 to be copied to SPSR_EL2, which could allow
691+ EL1 to cause a return to EL2 with a guest controlled ELR_EL2.
692+
693+ This can only happen when EL2 is stepping EL1.
694+
695+ When these conditions occur, the SPSR_EL2 value is unchanged from the
696+ previous guest entry, and can be restored from the in-memory copy.
697+
698+ If unsure, say Y.
699+
683700 config ARM64_ERRATUM_2119858
684701 bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in FILL mode"
685702 default y
arch/arm64/Kconfig.platforms+0−3
@@ -309,9 +309,6 @@ config ARCH_VISCONTI · 308 unmodified lines
309309 help
310310 This enables support for Toshiba Visconti SoCs Family.
311311
312−config ARCH_VULCAN
313− def_bool n
314−
315312 config ARCH_XGENE
316313 bool "AppliedMicro X-Gene SOC Family"
317314 help
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi+6−0
@@ -107,6 +107,12 @@ · 106 unmodified lines
107107 no-map;
108108 };
109109
110+ /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
111+ secmon_reserved_bl32: secmon@5300000 {
112+ reg = <0x0 0x05300000 0x0 0x2000000>;
113+ no-map;
114+ };
115+
110116 linux,cma {
111117 compatible = "shared-dma-pool";
112118 reusable;
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts+0−8
@@ -157,14 +157,6 @@ · 156 unmodified lines
157157 regulator-always-on;
158158 };
159159
160− reserved-memory {
161− /* TEE Reserved Memory */
162− bl32_reserved: bl32@5000000 {
163− reg = <0x0 0x05300000 0x0 0x2000000>;
164− no-map;
165− };
166− };
167−
168160 sdio_pwrseq: sdio-pwrseq {
169161 compatible = "mmc-pwrseq-simple";
170162 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi+2−2
@@ -17,7 +17,7 @@ · 16 unmodified lines
1717 rtc1 = &vrtc;
1818 };
1919
20− dioo2133: audio-amplifier-0 {
20+ dio2133: audio-amplifier-0 {
2121 compatible = "simple-audio-amplifier";
2222 enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
2323 VCC-supply = <&vcc_5v>;
@@ -219,7 +219,7 @@ · 195 unmodified lines
219219 audio-widgets = "Line", "Lineout";
220220 audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>,
221221 <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>,
222− <&dioo2133>;
222+ <&dio2133>;
223223 audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
224224 "TDMOUT_B IN 1", "FRDDR_B OUT 1",
225225 "TDMOUT_B IN 2", "FRDDR_C OUT 1",
arch/arm64/boot/dts/amlogic/meson-gx.dtsi+6−0
@@ -49,6 +49,12 @@ · 48 unmodified lines
4949 no-map;
5050 };
5151
52+ /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
53+ secmon_reserved_bl32: secmon@5300000 {
54+ reg = <0x0 0x05300000 0x0 0x2000000>;
55+ no-map;
56+ };
57+
5258 linux,cma {
5359 compatible = "shared-dma-pool";
5460 reusable;
arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts+1−1
@@ -123,7 +123,7 @@ · 122 unmodified lines
123123 regulator-min-microvolt = <1800000>;
124124 regulator-max-microvolt = <3300000>;
125125
126− enable-gpio = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>;
126+ enable-gpio = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
127127 enable-active-high;
128128 regulator-always-on;
129129
arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi+1−1
@@ -48,7 +48,7 @@ · 47 unmodified lines
4848 regulator-max-microvolt = <3300000>;
4949 vin-supply = <&vcc_5v>;
5050
51− enable-gpio = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>;
51+ enable-gpio = <&gpio_ao GPIOE_2 GPIO_OPEN_DRAIN>;
5252 enable-active-high;
5353 regulator-always-on;
5454
arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts+0−8
@@ -203,14 +203,6 @@ · 202 unmodified lines
203203 regulator-always-on;
204204 };
205205
206− reserved-memory {
207− /* TEE Reserved Memory */
208− bl32_reserved: bl32@5000000 {
209− reg = <0x0 0x05300000 0x0 0x2000000>;
210− no-map;
211− };
212− };
213−
214206 sdio_pwrseq: sdio-pwrseq {
215207 compatible = "mmc-pwrseq-simple";
216208 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts+4−0
@@ -157,6 +157,10 @@ · 156 unmodified lines
157157 };
158158 };
159159
160+&ftm_alarm0 {
161+ status = "okay";
162+};
163+
160164 &gpio1 {
161165 gpio-line-names =
162166 "", "", "", "", "", "", "", "",
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi+2−2
@@ -1115,8 +1115,8 @@ · 1114 unmodified lines
11151115 status = "okay";
11161116
11171117 ports {
1118− port@1 {
1119− reg = <1>;
1118+ port@0 {
1119+ reg = <0>;
11201120
11211121 mipi1_sensor_ep: endpoint {
11221122 remote-endpoint = <&camera1_ep>;
arch/arm64/boot/dts/freescale/imx8mq.dtsi+5−5
@@ -554,7 +554,7 @@ · 553 unmodified lines
554554 assigned-clock-rates = <0>, <0>, <0>, <594000000>;
555555 status = "disabled";
556556
557− port@0 {
557+ port {
558558 lcdif_mipi_dsi: endpoint {
559559 remote-endpoint = <&mipi_dsi_lcdif_in>;
560560 };
@@ -1151,8 +1151,8 @@ · 590 unmodified lines
11511151 #address-cells = <1>;
11521152 #size-cells = <0>;
11531153
1154− port@0 {
1155− reg = <0>;
1154+ port@1 {
1155+ reg = <1>;
11561156
11571157 csi1_mipi_ep: endpoint {
11581158 remote-endpoint = <&csi1_ep>;
@@ -1203,8 +1203,8 @@ · 44 unmodified lines
12031203 #address-cells = <1>;
12041204 #size-cells = <0>;
12051205
1206− port@0 {
1207− reg = <0>;
1206+ port@1 {
1207+ reg = <1>;
12081208
12091209 csi2_mipi_ep: endpoint {
12101210 remote-endpoint = <&csi2_ep>;
arch/arm64/boot/dts/freescale/mba8mx.dtsi+1−1
@@ -91,7 +91,7 @@ · 90 unmodified lines
9191
9292 sound {
9393 compatible = "fsl,imx-audio-tlv320aic32x4";
94− model = "tqm-tlv320aic32";
94+ model = "imx-audio-tlv320aic32x4";
9595 ssi-controller = <&sai3>;
9696 audio-codec = <&tlv320aic3x04>;
9797 };
arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts+12−2
@@ -15,8 +15,18 @@ · 14 unmodified lines
1515 model = "Texas Instruments J721S2 EVM";
1616
1717 chosen {
18− stdout-path = "serial10:115200n8";
19− bootargs = "console=ttyS10,115200n8 earlycon=ns16550a,mmio32,2880000";
18+ stdout-path = "serial2:115200n8";
19+ bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,2880000";
20+ };
21+
22+ aliases {
23+ serial1 = &mcu_uart0;
24+ serial2 = &main_uart8;
25+ mmc0 = &main_sdhci0;
26+ mmc1 = &main_sdhci1;
27+ can0 = &main_mcan16;
28+ can1 = &mcu_mcan0;
29+ can2 = &mcu_mcan1;
2030 };
2131
2232 evm_12v0: fixedregulator-evm12v0 {
arch/arm64/boot/dts/ti/k3-j721s2.dtsi+0−22
@@ -21,28 +21,6 @@ · 20 unmodified lines
2121 #address-cells = <2>;
2222 #size-cells = <2>;
2323
24− aliases {
25− serial0 = &wkup_uart0;
26− serial1 = &mcu_uart0;
27− serial2 = &main_uart0;
28− serial3 = &main_uart1;
29− serial4 = &main_uart2;
30− serial5 = &main_uart3;
31− serial6 = &main_uart4;
32− serial7 = &main_uart5;
33− serial8 = &main_uart6;
34− serial9 = &main_uart7;
35− serial10 = &main_uart8;
36− serial11 = &main_uart9;
37− mmc0 = &main_sdhci0;
38− mmc1 = &main_sdhci1;
39− can0 = &main_mcan16;
40− can1 = &mcu_mcan0;
41− can2 = &mcu_mcan1;
42− can3 = &main_mcan3;
43− can4 = &main_mcan5;
44− };
45−
4624 chosen { };
4725
4826 cpus {
arch/arm64/include/asm/el2_setup.h+1−1
@@ -106,7 +106,7 @@ · 105 unmodified lines
106106 msr_s SYS_ICC_SRE_EL2, x0
107107 isb // Make sure SRE is now set
108108 mrs_s x0, SYS_ICC_SRE_EL2 // Read SRE back,
109− tbz x0, #0, 1f // and check that it sticks
109+ tbz x0, #0, .Lskip_gicv3_\@ // and check that it sticks
110110 msr_s SYS_ICH_HCR_EL2, xzr // Reset ICC_HCR_EL2 to defaults
111111 .Lskip_gicv3_\@:
112112 .endm
arch/arm64/kernel/cpu_errata.c+8−0
@@ -600,6 +600,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 599 unmodified lines
600600 CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus),
601601 },
602602 #endif
603+#ifdef CONFIG_ARM64_ERRATUM_2077057
604+ {
605+ .desc = "ARM erratum 2077057",
606+ .capability = ARM64_WORKAROUND_2077057,
607+ .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
608+ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2),
609+ },
610+#endif
603611 #ifdef CONFIG_ARM64_ERRATUM_2064142
604612 {
605613 .desc = "ARM erratum 2064142",
arch/arm64/kvm/arm.c+33−18
@@ -797,6 +797,24 @@ static bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu, int *ret) · 796 unmodified lines
797797 xfer_to_guest_mode_work_pending();
798798 }
799799
800+/*
801+ * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while
802+ * the vCPU is running.
803+ *
804+ * This must be noinstr as instrumentation may make use of RCU, and this is not
805+ * safe during the EQS.
806+ */
807+static int noinstr kvm_arm_vcpu_enter_exit(struct kvm_vcpu *vcpu)
808+{
809+ int ret;
810+
811+ guest_state_enter_irqoff();
812+ ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu);
813+ guest_state_exit_irqoff();
814+
815+ return ret;
816+}
817+
800818 /**
801819 * kvm_arch_vcpu_ioctl_run - the main VCPU run function to execute guest code
802820 * @vcpu: The VCPU pointer
@@ -881,9 +899,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 78 unmodified lines
881899 * Enter the guest
882900 */
883901 trace_kvm_entry(*vcpu_pc(vcpu));
884− guest_enter_irqoff();
902+ guest_timing_enter_irqoff();
885903
886− ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu);
904+ ret = kvm_arm_vcpu_enter_exit(vcpu);
887905
888906 vcpu->mode = OUTSIDE_GUEST_MODE;
889907 vcpu->stat.exits++;
@@ -918,26 +936,23 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 28 unmodified lines
918936 kvm_arch_vcpu_ctxsync_fp(vcpu);
919937
920938 /*
921− * We may have taken a host interrupt in HYP mode (ie
922− * while executing the guest). This interrupt is still
923− * pending, as we haven't serviced it yet!
939+ * We must ensure that any pending interrupts are taken before
940+ * we exit guest timing so that timer ticks are accounted as
941+ * guest time. Transiently unmask interrupts so that any
942+ * pending interrupts are taken.
924943 *
925− * We're now back in SVC mode, with interrupts
926− * disabled. Enabling the interrupts now will have
927− * the effect of taking the interrupt again, in SVC
928− * mode this time.
944+ * Per ARM DDI 0487G.b section D1.13.4, an ISB (or other
945+ * context synchronization event) is necessary to ensure that
946+ * pending interrupts are taken.
929947 */
930948 local_irq_enable();
949+ isb();
950+ local_irq_disable();
951+
952+ guest_timing_exit_irqoff();
953+
954+ local_irq_enable();
931955
932− /*
933− * We do local_irq_enable() before calling guest_exit() so
934− * that if a timer interrupt hits while running the guest we
935− * account that tick as being spent in the guest. We enable
936− * preemption after calling guest_exit() so that if we get
937− * preempted we make sure ticks after that is not counted as
938− * guest time.
939− */
940− guest_exit();
941956 trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu));
942957
943958 /* Exit types that need handling before we can be preempted */
arch/arm64/kvm/handle_exit.c+8−0
@@ -228,6 +228,14 @@ int handle_exit(struct kvm_vcpu *vcpu, int exception_index) · 227 unmodified lines
228228 {
229229 struct kvm_run *run = vcpu->run;
230230
231+ if (ARM_SERROR_PENDING(exception_index)) {
232+ /*
233+ * The SError is handled by handle_exit_early(). If the guest
234+ * survives it will re-execute the original instruction.
235+ */
236+ return 1;
237+ }
238+
231239 exception_index = ARM_EXCEPTION_CODE(exception_index);
232240
233241 switch (exception_index) {
arch/arm64/kvm/hyp/include/hyp/switch.h+21−2
@@ -402,6 +402,24 @@ static inline bool kvm_hyp_handle_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 401 unmodified lines
402402 return false;
403403 }
404404
405+static inline void synchronize_vcpu_pstate(struct kvm_vcpu *vcpu, u64 *exit_code)
406+{
407+ /*
408+ * Check for the conditions of Cortex-A510's #2077057. When these occur
409+ * SPSR_EL2 can't be trusted, but isn't needed either as it is
410+ * unchanged from the value in vcpu_gp_regs(vcpu)->pstate.
411+ * Are we single-stepping the guest, and took a PAC exception from the
412+ * active-not-pending state?
413+ */
414+ if (cpus_have_final_cap(ARM64_WORKAROUND_2077057) &&
415+ vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP &&
416+ *vcpu_cpsr(vcpu) & DBG_SPSR_SS &&
417+ ESR_ELx_EC(read_sysreg_el2(SYS_ESR)) == ESR_ELx_EC_PAC)
418+ write_sysreg_el2(*vcpu_cpsr(vcpu), SYS_SPSR);
419+
420+ vcpu->arch.ctxt.regs.pstate = read_sysreg_el2(SYS_SPSR);
421+}
422+
405423 /*
406424 * Return true when we were able to fixup the guest exit and should return to
407425 * the guest, false when we should restore the host state and return to the
@@ -413,7 +431,7 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 5 unmodified lines
413431 * Save PSTATE early so that we can evaluate the vcpu mode
414432 * early on.
415433 */
416− vcpu->arch.ctxt.regs.pstate = read_sysreg_el2(SYS_SPSR);
434+ synchronize_vcpu_pstate(vcpu, exit_code);
417435
418436 /*
419437 * Check whether we want to repaint the state one way or
@@ -424,7 +442,8 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 4 unmodified lines
424442 if (ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ)
425443 vcpu->arch.fault.esr_el2 = read_sysreg_el2(SYS_ESR);
426444
427− if (ARM_SERROR_PENDING(*exit_code)) {
445+ if (ARM_SERROR_PENDING(*exit_code) &&
446+ ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ) {
428447 u8 esr_ec = kvm_vcpu_trap_get_class(vcpu);
429448
430449 /*
arch/arm64/kvm/vgic/vgic-mmio.c+2−0
@@ -248,6 +248,8 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, · 247 unmodified lines
248248 IRQCHIP_STATE_PENDING,
249249 &val);
250250 WARN_RATELIMIT(err, "IRQ %d", irq->host_irq);
251+ } else if (vgic_irq_is_mapped_level(irq)) {
252+ val = vgic_get_phys_line_level(irq);
251253 } else {
252254 val = irq_is_pending(irq);
253255 }
arch/arm64/tools/cpucaps+3−2
@@ -55,9 +55,10 @@ WORKAROUND_1418040 · 54 unmodified lines
5555 WORKAROUND_1463225
5656 WORKAROUND_1508412
5757 WORKAROUND_1542419
58−WORKAROUND_2064142
59−WORKAROUND_2038923
6058 WORKAROUND_1902691
59+WORKAROUND_2038923
60+WORKAROUND_2064142
61+WORKAROUND_2077057
6162 WORKAROUND_TRBE_OVERWRITE_FILL_MODE
6263 WORKAROUND_TSB_FLUSH_FAILURE
6364 WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
arch/mips/boot/dts/ingenic/ci20.dts+2−13
@@ -83,6 +83,8 @@ · 82 unmodified lines
8383 label = "HDMI OUT";
8484 type = "a";
8585
86+ ddc-en-gpios = <&gpa 25 GPIO_ACTIVE_HIGH>;
87+
8688 port {
8789 hdmi_con: endpoint {
8890 remote-endpoint = <&dw_hdmi_out>;
@@ -114,17 +116,6 @@ · 25 unmodified lines
114116 gpio = <&gpf 14 GPIO_ACTIVE_LOW>;
115117 enable-active-high;
116118 };
117−
118− hdmi_power: fixedregulator@3 {
119− compatible = "regulator-fixed";
120−
121− regulator-name = "hdmi_power";
122− regulator-min-microvolt = <5000000>;
123− regulator-max-microvolt = <5000000>;
124−
125− gpio = <&gpa 25 0>;
126− enable-active-high;
127− };
128119 };
129120
130121 &ext {
@@ -576,8 +567,6 @@ · 445 unmodified lines
576567 pinctrl-names = "default";
577568 pinctrl-0 = <&pins_hdmi_ddc>;
578569
579− hdmi-5v-supply = <&hdmi_power>;
580−
581570 ports {
582571 #address-cells = <1>;
583572 #size-cells = <0>;
arch/mips/cavium-octeon/octeon-memcpy.S+1−1
@@ -74,7 +74,7 @@ · 73 unmodified lines
7474 #define EXC(inst_reg,addr,handler) \
7575 9: inst_reg, addr; \
7676 .section __ex_table,"a"; \
77− PTR 9b, handler; \
77+ PTR_WD 9b, handler; \
7878 .previous
7979
8080 /*
arch/mips/kvm/mips.c+46−4
@@ -414,6 +414,24 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, · 413 unmodified lines
414414 return -ENOIOCTLCMD;
415415 }
416416
417+/*
418+ * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while
419+ * the vCPU is running.
420+ *
421+ * This must be noinstr as instrumentation may make use of RCU, and this is not
422+ * safe during the EQS.
423+ */
424+static int noinstr kvm_mips_vcpu_enter_exit(struct kvm_vcpu *vcpu)
425+{
426+ int ret;
427+
428+ guest_state_enter_irqoff();
429+ ret = kvm_mips_callbacks->vcpu_run(vcpu);
430+ guest_state_exit_irqoff();
431+
432+ return ret;
433+}
434+
417435 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
418436 {
419437 int r = -EINTR;
@@ -434,7 +452,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 14 unmodified lines
434452 lose_fpu(1);
435453
436454 local_irq_disable();
437− guest_enter_irqoff();
455+ guest_timing_enter_irqoff();
438456 trace_kvm_enter(vcpu);
439457
440458 /*
@@ -445,10 +463,23 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 4 unmodified lines
445463 */
446464 smp_store_mb(vcpu->mode, IN_GUEST_MODE);
447465
448− r = kvm_mips_callbacks->vcpu_run(vcpu);
466+ r = kvm_mips_vcpu_enter_exit(vcpu);
467+
468+ /*
469+ * We must ensure that any pending interrupts are taken before
470+ * we exit guest timing so that timer ticks are accounted as
471+ * guest time. Transiently unmask interrupts so that any
472+ * pending interrupts are taken.
473+ *
474+ * TODO: is there a barrier which ensures that pending interrupts are
475+ * recognised? Currently this just hopes that the CPU takes any pending
476+ * interrupts between the enable and disable.
477+ */
478+ local_irq_enable();
479+ local_irq_disable();
449480
450481 trace_kvm_out(vcpu);
451− guest_exit_irqoff();
482+ guest_timing_exit_irqoff();
452483 local_irq_enable();
453484
454485 out:
@@ -1168,7 +1199,7 @@ static void kvm_mips_set_c0_status(void) · 713 unmodified lines
11681199 /*
11691200 * Return value is in the form (errcode<<2 | RESUME_FLAG_HOST | RESUME_FLAG_NV)
11701201 */
1171−int kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
1202+static int __kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
11721203 {
11731204 struct kvm_run *run = vcpu->run;
11741205 u32 cause = vcpu->arch.host_cp0_cause;
@@ -1357,6 +1388,17 @@ int kvm_mips_handle_exit(struct kvm_vcpu *vcpu) · 182 unmodified lines
13571388 return ret;
13581389 }
13591390
1391+int noinstr kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
1392+{
1393+ int ret;
1394+
1395+ guest_state_exit_irqoff();
1396+ ret = __kvm_mips_handle_exit(vcpu);
1397+ guest_state_enter_irqoff();
1398+
1399+ return ret;
1400+}
1401+
13601402 /* Enable FPU for guest and restore context */
13611403 void kvm_own_fpu(struct kvm_vcpu *vcpu)
13621404 {
arch/mips/kvm/vz.c+9−3
@@ -458,8 +458,8 @@ void kvm_vz_acquire_htimer(struct kvm_vcpu *vcpu) · 457 unmodified lines
458458 /**
459459 * _kvm_vz_save_htimer() - Switch to software emulation of guest timer.
460460 * @vcpu: Virtual CPU.
461− * @compare: Pointer to write compare value to.
462− * @cause: Pointer to write cause value to.
461+ * @out_compare: Pointer to write compare value to.
462+ * @out_cause: Pointer to write cause value to.
463463 *
464464 * Save VZ guest timer state and switch to software emulation of guest CP0
465465 * timer. The hard timer must already be in use, so preemption should be
@@ -1541,11 +1541,14 @@ static int kvm_trap_vz_handle_guest_exit(struct kvm_vcpu *vcpu) · 1075 unmodified lines
15411541 }
15421542
15431543 /**
1544− * kvm_trap_vz_handle_cop_unusuable() - Guest used unusable coprocessor.
1544+ * kvm_trap_vz_handle_cop_unusable() - Guest used unusable coprocessor.
15451545 * @vcpu: Virtual CPU context.
15461546 *
15471547 * Handle when the guest attempts to use a coprocessor which hasn't been allowed
15481548 * by the root context.
1549+ *
1550+ * Return: value indicating whether to resume the host or the guest
1551+ * (RESUME_HOST or RESUME_GUEST)
15491552 */
15501553 static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu)
15511554 {
@@ -1592,6 +1595,9 @@ static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu) · 40 unmodified lines
15921595 *
15931596 * Handle when the guest attempts to use MSA when it is disabled in the root
15941597 * context.
1598+ *
1599+ * Return: value indicating whether to resume the host or the guest
1600+ * (RESUME_HOST or RESUME_GUEST)
15951601 */
15961602 static int kvm_trap_vz_handle_msa_disabled(struct kvm_vcpu *vcpu)
15971603 {
arch/parisc/include/asm/bitops.h+8−0
@@ -12,6 +12,14 @@ · 11 unmodified lines
1212 #include <asm/barrier.h>
1313 #include <linux/atomic.h>
1414
15+/* compiler build environment sanity checks: */
16+#if !defined(CONFIG_64BIT) && defined(__LP64__)
17+#error "Please use 'ARCH=parisc' to build the 32-bit kernel."
18+#endif
19+#if defined(CONFIG_64BIT) && !defined(__LP64__)
20+#error "Please use 'ARCH=parisc64' to build the 64-bit kernel."
21+#endif
22+
1523 /* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion
1624 * on use of volatile and __*_bit() (set/clear/change):
1725 * *_bit() want use of volatile.
arch/parisc/include/asm/uaccess.h+15−14
@@ -89,8 +89,8 @@ struct exception_table_entry { · 88 unmodified lines
8989 __asm__("1: " ldx " 0(" sr "%2),%0\n" \
9090 "9:\n" \
9191 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
92− : "=r"(__gu_val), "=r"(__gu_err) \
93− : "r"(ptr), "1"(__gu_err)); \
92+ : "=r"(__gu_val), "+r"(__gu_err) \
93+ : "r"(ptr)); \
9494 \
9595 (val) = (__force __typeof__(*(ptr))) __gu_val; \
9696 }
@@ -123,8 +123,8 @@ struct exception_table_entry { · 26 unmodified lines
123123 "9:\n" \
124124 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
125125 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
126− : "=&r"(__gu_tmp.l), "=r"(__gu_err) \
127− : "r"(ptr), "1"(__gu_err)); \
126+ : "=&r"(__gu_tmp.l), "+r"(__gu_err) \
127+ : "r"(ptr)); \
128128 \
129129 (val) = __gu_tmp.t; \
130130 }
@@ -135,13 +135,12 @@ struct exception_table_entry { · 4 unmodified lines
135135 #define __put_user_internal(sr, x, ptr) \
136136 ({ \
137137 ASM_EXCEPTIONTABLE_VAR(__pu_err); \
138− __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \
139138 \
140139 switch (sizeof(*(ptr))) { \
141− case 1: __put_user_asm(sr, "stb", __x, ptr); break; \
142− case 2: __put_user_asm(sr, "sth", __x, ptr); break; \
143− case 4: __put_user_asm(sr, "stw", __x, ptr); break; \
144− case 8: STD_USER(sr, __x, ptr); break; \
140+ case 1: __put_user_asm(sr, "stb", x, ptr); break; \
141+ case 2: __put_user_asm(sr, "sth", x, ptr); break; \
142+ case 4: __put_user_asm(sr, "stw", x, ptr); break; \
143+ case 8: STD_USER(sr, x, ptr); break; \
145144 default: BUILD_BUG(); \
146145 } \
147146 \
@@ -150,7 +149,9 @@ struct exception_table_entry { · 2 unmodified lines
150149
151150 #define __put_user(x, ptr) \
152151 ({ \
153− __put_user_internal("%%sr3,", x, ptr); \
152+ __typeof__(&*(ptr)) __ptr = ptr; \
153+ __typeof__(*(__ptr)) __x = (__typeof__(*(__ptr)))(x); \
154+ __put_user_internal("%%sr3,", __x, __ptr); \
154155 })
155156
156157 #define __put_kernel_nofault(dst, src, type, err_label) \
@@ -180,8 +181,8 @@ struct exception_table_entry { · 23 unmodified lines
180181 "1: " stx " %2,0(" sr "%1)\n" \
181182 "9:\n" \
182183 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
183− : "=r"(__pu_err) \
184− : "r"(ptr), "r"(x), "0"(__pu_err))
184+ : "+r"(__pu_err) \
185+ : "r"(ptr), "r"(x))
185186
186187
187188 #if !defined(CONFIG_64BIT)
@@ -193,8 +194,8 @@ struct exception_table_entry { · 5 unmodified lines
193194 "9:\n" \
194195 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
195196 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
196− : "=r"(__pu_err) \
197− : "r"(ptr), "r"(__val), "0"(__pu_err)); \
197+ : "+r"(__pu_err) \
198+ : "r"(ptr), "r"(__val)); \
198199 } while (0)
199200
200201 #endif /* !defined(CONFIG_64BIT) */
arch/parisc/kernel/unaligned.c+7−7
@@ -340,7 +340,7 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop) · 339 unmodified lines
340340 : "r" (val), "r" (regs->ior), "r" (regs->isr)
341341 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
342342
343− return 0;
343+ return ret;
344344 }
345345 static int emulate_std(struct pt_regs *regs, int frreg, int flop)
346346 {
@@ -397,7 +397,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) · 50 unmodified lines
397397 __asm__ __volatile__ (
398398 " mtsp %4, %%sr1\n"
399399 " zdep %2, 29, 2, %%r19\n"
400−" dep %%r0, 31, 2, %2\n"
400+" dep %%r0, 31, 2, %3\n"
401401 " mtsar %%r19\n"
402402 " zvdepi -2, 32, %%r19\n"
403403 "1: ldw 0(%%sr1,%3),%%r20\n"
@@ -409,7 +409,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) · 5 unmodified lines
409409 " andcm %%r21, %%r19, %%r21\n"
410410 " or %1, %%r20, %1\n"
411411 " or %2, %%r21, %2\n"
412−"3: stw %1,0(%%sr1,%1)\n"
412+"3: stw %1,0(%%sr1,%3)\n"
413413 "4: stw %%r1,4(%%sr1,%3)\n"
414414 "5: stw %2,8(%%sr1,%3)\n"
415415 " copy %%r0, %0\n"
@@ -596,7 +596,6 @@ void handle_unaligned(struct pt_regs *regs) · 180 unmodified lines
596596 ret = ERR_NOTHANDLED; /* "undefined", but lets kill them. */
597597 break;
598598 }
599−#ifdef CONFIG_PA20
600599 switch (regs->iir & OPCODE2_MASK)
601600 {
602601 case OPCODE_FLDD_L:
@@ -607,22 +606,23 @@ void handle_unaligned(struct pt_regs *regs) · 4 unmodified lines
607606 flop=1;
608607 ret = emulate_std(regs, R2(regs->iir),1);
609608 break;
609+#ifdef CONFIG_PA20
610610 case OPCODE_LDD_L:
611611 ret = emulate_ldd(regs, R2(regs->iir),0);
612612 break;
613613 case OPCODE_STD_L:
614614 ret = emulate_std(regs, R2(regs->iir),0);
615615 break;
616− }
617616 #endif
617+ }
618618 switch (regs->iir & OPCODE3_MASK)
619619 {
620620 case OPCODE_FLDW_L:
621621 flop=1;
622− ret = emulate_ldw(regs, R2(regs->iir),0);
622+ ret = emulate_ldw(regs, R2(regs->iir), 1);
623623 break;
624624 case OPCODE_LDW_M:
625− ret = emulate_ldw(regs, R2(regs->iir),1);
625+ ret = emulate_ldw(regs, R2(regs->iir), 0);
626626 break;
627627
628628 case OPCODE_FSTW_L:
arch/parisc/lib/iomap.c+18−0
@@ -346,6 +346,16 @@ u64 ioread64be(const void __iomem *addr) · 345 unmodified lines
346346 return *((u64 *)addr);
347347 }
348348
349+u64 ioread64_lo_hi(const void __iomem *addr)
350+{
351+ u32 low, high;
352+
353+ low = ioread32(addr);
354+ high = ioread32(addr + sizeof(u32));
355+
356+ return low + ((u64)high << 32);
357+}
358+
349359 u64 ioread64_hi_lo(const void __iomem *addr)
350360 {
351361 u32 low, high;
@@ -419,6 +429,12 @@ void iowrite64be(u64 datum, void __iomem *addr) · 67 unmodified lines
419429 }
420430 }
421431
432+void iowrite64_lo_hi(u64 val, void __iomem *addr)
433+{
434+ iowrite32(val, addr);
435+ iowrite32(val >> 32, addr + sizeof(u32));
436+}
437+
422438 void iowrite64_hi_lo(u64 val, void __iomem *addr)
423439 {
424440 iowrite32(val >> 32, addr + sizeof(u32));
@@ -530,6 +546,7 @@ EXPORT_SYMBOL(ioread32); · 105 unmodified lines
530546 EXPORT_SYMBOL(ioread32be);
531547 EXPORT_SYMBOL(ioread64);
532548 EXPORT_SYMBOL(ioread64be);
549+EXPORT_SYMBOL(ioread64_lo_hi);
533550 EXPORT_SYMBOL(ioread64_hi_lo);
534551 EXPORT_SYMBOL(iowrite8);
535552 EXPORT_SYMBOL(iowrite16);
@@ -538,6 +555,7 @@ EXPORT_SYMBOL(iowrite32); · 2 unmodified lines
538555 EXPORT_SYMBOL(iowrite32be);
539556 EXPORT_SYMBOL(iowrite64);
540557 EXPORT_SYMBOL(iowrite64be);
558+EXPORT_SYMBOL(iowrite64_lo_hi);
541559 EXPORT_SYMBOL(iowrite64_hi_lo);
542560 EXPORT_SYMBOL(ioread8_rep);
543561 EXPORT_SYMBOL(ioread16_rep);
arch/parisc/mm/init.c+4−5
@@ -337,9 +337,9 @@ static void __init setup_bootmem(void) · 336 unmodified lines
337337
338338 static bool kernel_set_to_readonly;
339339
340−static void __init map_pages(unsigned long start_vaddr,
341− unsigned long start_paddr, unsigned long size,
342− pgprot_t pgprot, int force)
340+static void __ref map_pages(unsigned long start_vaddr,
341+ unsigned long start_paddr, unsigned long size,
342+ pgprot_t pgprot, int force)
343343 {
344344 pmd_t *pmd;
345345 pte_t *pg_table;
@@ -449,7 +449,7 @@ void __init set_kernel_text_rw(int enable_read_write) · 103 unmodified lines
449449 flush_tlb_all();
450450 }
451451
452−void __ref free_initmem(void)
452+void free_initmem(void)
453453 {
454454 unsigned long init_begin = (unsigned long)__init_begin;
455455 unsigned long init_end = (unsigned long)__init_end;
@@ -463,7 +463,6 @@ void __ref free_initmem(void) · 7 unmodified lines
463463 /* The init text pages are marked R-X. We have to
464464 * flush the icache and mark them RW-
465465 *
466− * This is tricky, because map_pages is in the init section.
467466 * Do a dummy remap of the data section first (the data
468467 * section is already PAGE_KERNEL) to pull in the TLB entries
469468 * for map_kernel */
arch/powerpc/kernel/head_book3s_32.S+2−2
@@ -421,14 +421,14 @@ InstructionTLBMiss: · 420 unmodified lines
421421 */
422422 /* Get PTE (linux-style) and check access */
423423 mfspr r3,SPRN_IMISS
424−#ifdef CONFIG_MODULES
424+#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
425425 lis r1, TASK_SIZE@h /* check if kernel address */
426426 cmplw 0,r1,r3
427427 #endif
428428 mfspr r2, SPRN_SDR1
429429 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER
430430 rlwinm r2, r2, 28, 0xfffff000
431−#ifdef CONFIG_MODULES
431+#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
432432 bgt- 112f
433433 lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
434434 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
arch/powerpc/lib/sstep.c+2−0
@@ -3264,12 +3264,14 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op) · 3263 unmodified lines
32643264 case BARRIER_EIEIO:
32653265 eieio();
32663266 break;
3267+#ifdef CONFIG_PPC64
32673268 case BARRIER_LWSYNC:
32683269 asm volatile("lwsync" : : : "memory");
32693270 break;
32703271 case BARRIER_PTESYNC:
32713272 asm volatile("ptesync" : : : "memory");
32723273 break;
3274+#endif
32733275 }
32743276 break;
32753277
arch/riscv/Makefile+6−0
@@ -50,6 +50,12 @@ riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima · 49 unmodified lines
5050 riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
5151 riscv-march-$(CONFIG_FPU) := $(riscv-march-y)fd
5252 riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c
53+
54+# Newer binutils versions default to ISA spec version 20191213 which moves some
55+# instructions from the I extension to the Zicsr and Zifencei extensions.
56+toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(riscv-march-y)_zicsr_zifencei)
57+riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei
58+
5359 KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y))
5460 KBUILD_AFLAGS += -march=$(riscv-march-y)
5561
arch/riscv/configs/nommu_k210_sdcard_defconfig+1−1
@@ -23,7 +23,7 @@ CONFIG_SLOB=y · 22 unmodified lines
2323 CONFIG_SOC_CANAAN=y
2424 CONFIG_SMP=y
2525 CONFIG_NR_CPUS=2
26−CONFIG_CMDLINE="earlycon console=ttySIF0 rootdelay=2 root=/dev/mmcblk0p1 ro"
26+CONFIG_CMDLINE="earlycon console=ttySIF0 root=/dev/mmcblk0p1 rootwait ro"
2727 CONFIG_CMDLINE_FORCE=y
2828 # CONFIG_SECCOMP is not set
2929 # CONFIG_STACKPROTECTOR is not set
arch/riscv/kernel/Makefile+2−0
@@ -51,6 +51,8 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o · 50 unmodified lines
5151 obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
5252 obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
5353
54+obj-$(CONFIG_TRACE_IRQFLAGS) += trace_irq.o
55+
5456 obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o
5557 obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
5658 obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
arch/riscv/kernel/cpu-hotplug.c+2−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/sched/hotplug.h>
1313 #include <asm/irq.h>
1414 #include <asm/cpu_ops.h>
15+#include <asm/numa.h>
1516 #include <asm/sbi.h>
1617
1718 bool cpu_has_hotplug(unsigned int cpu)
@@ -40,6 +41,7 @@ int __cpu_disable(void) · 22 unmodified lines
4041 return ret;
4142
4243 remove_cpu_topology(cpu);
44+ numa_remove_cpu(cpu);
4345 set_cpu_online(cpu, false);
4446 irq_migrate_all_off_this_cpu();
4547
arch/riscv/kernel/entry.S+5−5
@@ -108,7 +108,7 @@ _save_context: · 107 unmodified lines
108108 .option pop
109109
110110 #ifdef CONFIG_TRACE_IRQFLAGS
111− call trace_hardirqs_off
111+ call __trace_hardirqs_off
112112 #endif
113113
114114 #ifdef CONFIG_CONTEXT_TRACKING
@@ -143,7 +143,7 @@ skip_context_tracking: · 28 unmodified lines
143143 li t0, EXC_BREAKPOINT
144144 beq s4, t0, 1f
145145 #ifdef CONFIG_TRACE_IRQFLAGS
146− call trace_hardirqs_on
146+ call __trace_hardirqs_on
147147 #endif
148148 csrs CSR_STATUS, SR_IE
149149
@@ -234,7 +234,7 @@ ret_from_exception: · 84 unmodified lines
234234 REG_L s0, PT_STATUS(sp)
235235 csrc CSR_STATUS, SR_IE
236236 #ifdef CONFIG_TRACE_IRQFLAGS
237− call trace_hardirqs_off
237+ call __trace_hardirqs_off
238238 #endif
239239 #ifdef CONFIG_RISCV_M_MODE
240240 /* the MPP value is too large to be used as an immediate arg for addi */
@@ -270,10 +270,10 @@ restore_all: · 29 unmodified lines
270270 REG_L s1, PT_STATUS(sp)
271271 andi t0, s1, SR_PIE
272272 beqz t0, 1f
273− call trace_hardirqs_on
273+ call __trace_hardirqs_on
274274 j 2f
275275 1:
276− call trace_hardirqs_off
276+ call __trace_hardirqs_off
277277 2:
278278 #endif
279279 REG_L a0, PT_STATUS(sp)
arch/riscv/kernel/head.S+5−6
@@ -22,14 +22,13 @@ · 21 unmodified lines
2222 add \reg, \reg, t0
2323 .endm
2424 .macro XIP_FIXUP_FLASH_OFFSET reg
25− la t1, __data_loc
26− li t0, XIP_OFFSET_MASK
27− and t1, t1, t0
28− li t1, XIP_OFFSET
29− sub t0, t0, t1
30− sub \reg, \reg, t0
25+ la t0, __data_loc
26+ REG_L t1, _xip_phys_offset
27+ sub \reg, \reg, t1
28+ add \reg, \reg, t0
3129 .endm
3230 _xip_fixup: .dword CONFIG_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET
31+_xip_phys_offset: .dword CONFIG_XIP_PHYS_ADDR + XIP_OFFSET
3332 #else
3433 .macro XIP_FIXUP_OFFSET reg
3534 .endm
arch/riscv/kernel/sbi.c+47−25
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 * Copyright (c) 2020 Western Digital Corporation or its affiliates.
66 */
77
8+#include <linux/bits.h>
89 #include <linux/init.h>
910 #include <linux/pm.h>
1011 #include <linux/reboot.h>
@@ -85,7 +86,7 @@ static unsigned long __sbi_v01_cpumask_to_hartmask(const struct cpumask *cpu_mas · 74 unmodified lines
8586 pr_warn("Unable to send any request to hartid > BITS_PER_LONG for SBI v0.1\n");
8687 break;
8788 }
88− hmask |= 1 << hartid;
89+ hmask |= BIT(hartid);
8990 }
9091
9192 return hmask;
@@ -160,7 +161,7 @@ static int __sbi_send_ipi_v01(const struct cpumask *cpu_mask) · 68 unmodified lines
160161 {
161162 unsigned long hart_mask;
162163
163− if (!cpu_mask)
164+ if (!cpu_mask || cpumask_empty(cpu_mask))
164165 cpu_mask = cpu_online_mask;
165166 hart_mask = __sbi_v01_cpumask_to_hartmask(cpu_mask);
166167
@@ -176,7 +177,7 @@ static int __sbi_rfence_v01(int fid, const struct cpumask *cpu_mask, · 9 unmodified lines
176177 int result = 0;
177178 unsigned long hart_mask;
178179
179− if (!cpu_mask)
180+ if (!cpu_mask || cpumask_empty(cpu_mask))
180181 cpu_mask = cpu_online_mask;
181182 hart_mask = __sbi_v01_cpumask_to_hartmask(cpu_mask);
182183
@@ -249,26 +250,37 @@ static void __sbi_set_timer_v02(uint64_t stime_value) · 66 unmodified lines
249250
250251 static int __sbi_send_ipi_v02(const struct cpumask *cpu_mask)
251252 {
252− unsigned long hartid, cpuid, hmask = 0, hbase = 0;
253+ unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0;
253254 struct sbiret ret = {0};
254255 int result;
255256
256− if (!cpu_mask)
257+ if (!cpu_mask || cpumask_empty(cpu_mask))
257258 cpu_mask = cpu_online_mask;
258259
259260 for_each_cpu(cpuid, cpu_mask) {
260261 hartid = cpuid_to_hartid_map(cpuid);
261− if (hmask && ((hbase + BITS_PER_LONG) <= hartid)) {
262− ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI,
263− hmask, hbase, 0, 0, 0, 0);
264− if (ret.error)
265− goto ecall_failed;
266− hmask = 0;
267− hbase = 0;
262+ if (hmask) {
263+ if (hartid + BITS_PER_LONG <= htop ||
264+ hbase + BITS_PER_LONG <= hartid) {
265+ ret = sbi_ecall(SBI_EXT_IPI,
266+ SBI_EXT_IPI_SEND_IPI, hmask,
267+ hbase, 0, 0, 0, 0);
268+ if (ret.error)
269+ goto ecall_failed;
270+ hmask = 0;
271+ } else if (hartid < hbase) {
272+ /* shift the mask to fit lower hartid */
273+ hmask <<= hbase - hartid;
274+ hbase = hartid;
275+ }
268276 }
269− if (!hmask)
277+ if (!hmask) {
270278 hbase = hartid;
271− hmask |= 1UL << (hartid - hbase);
279+ htop = hartid;
280+ } else if (hartid > htop) {
281+ htop = hartid;
282+ }
283+ hmask |= BIT(hartid - hbase);
272284 }
273285
274286 if (hmask) {
@@ -344,25 +356,35 @@ static int __sbi_rfence_v02(int fid, const struct cpumask *cpu_mask, · 69 unmodified lines
344356 unsigned long start, unsigned long size,
345357 unsigned long arg4, unsigned long arg5)
346358 {
347− unsigned long hartid, cpuid, hmask = 0, hbase = 0;
359+ unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0;
348360 int result;
349361
350− if (!cpu_mask)
362+ if (!cpu_mask || cpumask_empty(cpu_mask))
351363 cpu_mask = cpu_online_mask;
352364
353365 for_each_cpu(cpuid, cpu_mask) {
354366 hartid = cpuid_to_hartid_map(cpuid);
355− if (hmask && ((hbase + BITS_PER_LONG) <= hartid)) {
356− result = __sbi_rfence_v02_call(fid, hmask, hbase,
357− start, size, arg4, arg5);
358− if (result)
359− return result;
360− hmask = 0;
361− hbase = 0;
367+ if (hmask) {
368+ if (hartid + BITS_PER_LONG <= htop ||
369+ hbase + BITS_PER_LONG <= hartid) {
370+ result = __sbi_rfence_v02_call(fid, hmask,
371+ hbase, start, size, arg4, arg5);
372+ if (result)
373+ return result;
374+ hmask = 0;
375+ } else if (hartid < hbase) {
376+ /* shift the mask to fit lower hartid */
377+ hmask <<= hbase - hartid;
378+ hbase = hartid;
379+ }
362380 }
363− if (!hmask)
381+ if (!hmask) {
364382 hbase = hartid;
365− hmask |= 1UL << (hartid - hbase);
383+ htop = hartid;
384+ } else if (hartid > htop) {
385+ htop = hartid;
386+ }
387+ hmask |= BIT(hartid - hbase);
366388 }
367389
368390 if (hmask) {
arch/riscv/kernel/stacktrace.c+5−4
@@ -22,15 +22,16 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, · 21 unmodified lines
2222 bool (*fn)(void *, unsigned long), void *arg)
2323 {
2424 unsigned long fp, sp, pc;
25+ int level = 0;
2526
2627 if (regs) {
2728 fp = frame_pointer(regs);
2829 sp = user_stack_pointer(regs);
2930 pc = instruction_pointer(regs);
3031 } else if (task == NULL || task == current) {
31− fp = (unsigned long)__builtin_frame_address(1);
32− sp = (unsigned long)__builtin_frame_address(0);
33− pc = (unsigned long)__builtin_return_address(0);
32+ fp = (unsigned long)__builtin_frame_address(0);
33+ sp = sp_in_global;
34+ pc = (unsigned long)walk_stackframe;
3435 } else {
3536 /* task blocked in __switch_to */
3637 fp = task->thread.s[0];
@@ -42,7 +43,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, · 5 unmodified lines
4243 unsigned long low, high;
4344 struct stackframe *frame;
4445
45− if (unlikely(!__kernel_text_address(pc) || !fn(arg, pc)))
46+ if (unlikely(!__kernel_text_address(pc) || (level++ >= 1 && !fn(arg, pc))))
4647 break;
4748
4849 /* Validate frame pointer */
arch/riscv/kernel/trace_irq.c+27−0
@@ -0,0 +1,27 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * Copyright (C) 2022 Changbin Du <changbin.du@gmail.com>
4+ */
5+
6+#include <linux/irqflags.h>
7+#include <linux/kprobes.h>
8+#include "trace_irq.h"
9+
10+/*
11+ * trace_hardirqs_on/off require the caller to setup frame pointer properly.
12+ * Otherwise, CALLER_ADDR1 might trigger an pagging exception in kernel.
13+ * Here we add one extra level so they can be safely called by low
14+ * level entry code which $fp is used for other purpose.
15+ */
16+
17+void __trace_hardirqs_on(void)
18+{
19+ trace_hardirqs_on();
20+}
21+NOKPROBE_SYMBOL(__trace_hardirqs_on);
22+
23+void __trace_hardirqs_off(void)
24+{
25+ trace_hardirqs_off();
26+}
27+NOKPROBE_SYMBOL(__trace_hardirqs_off);
arch/riscv/kernel/trace_irq.h+11−0
@@ -0,0 +1,11 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Copyright (C) 2022 Changbin Du <changbin.du@gmail.com>
4+ */
5+#ifndef __TRACE_IRQ_H
6+#define __TRACE_IRQ_H
7+
8+void __trace_hardirqs_on(void);
9+void __trace_hardirqs_off(void);
10+
11+#endif /* __TRACE_IRQ_H */
arch/riscv/kvm/vcpu.c+31−17
@@ -90,6 +90,7 @@ int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id) · 89 unmodified lines
9090 int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
9191 {
9292 struct kvm_cpu_context *cntx;
93+ struct kvm_vcpu_csr *reset_csr = &vcpu->arch.guest_reset_csr;
9394
9495 /* Mark this VCPU never ran */
9596 vcpu->arch.ran_atleast_once = false;
@@ -106,6 +107,9 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) · 10 unmodified lines
106107 cntx->hstatus |= HSTATUS_SPVP;
107108 cntx->hstatus |= HSTATUS_SPV;
108109
110+ /* By default, make CY, TM, and IR counters accessible in VU mode */
111+ reset_csr->scounteren = 0x7;
112+
109113 /* Setup VCPU timer */
110114 kvm_riscv_vcpu_timer_init(vcpu);
111115
@@ -699,6 +703,20 @@ static void kvm_riscv_update_hvip(struct kvm_vcpu *vcpu) · 587 unmodified lines
699703 csr_write(CSR_HVIP, csr->hvip);
700704 }
701705
706+/*
707+ * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while
708+ * the vCPU is running.
709+ *
710+ * This must be noinstr as instrumentation may make use of RCU, and this is not
711+ * safe during the EQS.
712+ */
713+static void noinstr kvm_riscv_vcpu_enter_exit(struct kvm_vcpu *vcpu)
714+{
715+ guest_state_enter_irqoff();
716+ __kvm_riscv_switch_to(&vcpu->arch);
717+ guest_state_exit_irqoff();
718+}
719+
702720 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
703721 {
704722 int ret;
@@ -790,9 +808,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 85 unmodified lines
790808 continue;
791809 }
792810
793− guest_enter_irqoff();
811+ guest_timing_enter_irqoff();
794812
795− __kvm_riscv_switch_to(&vcpu->arch);
813+ kvm_riscv_vcpu_enter_exit(vcpu);
796814
797815 vcpu->mode = OUTSIDE_GUEST_MODE;
798816 vcpu->stat.exits++;
@@ -812,25 +830,21 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 13 unmodified lines
812830 kvm_riscv_vcpu_sync_interrupts(vcpu);
813831
814832 /*
815− * We may have taken a host interrupt in VS/VU-mode (i.e.
816− * while executing the guest). This interrupt is still
817− * pending, as we haven't serviced it yet!
833+ * We must ensure that any pending interrupts are taken before
834+ * we exit guest timing so that timer ticks are accounted as
835+ * guest time. Transiently unmask interrupts so that any
836+ * pending interrupts are taken.
818837 *
819− * We're now back in HS-mode with interrupts disabled
820− * so enabling the interrupts now will have the effect
821− * of taking the interrupt again, in HS-mode this time.
838+ * There's no barrier which ensures that pending interrupts are
839+ * recognised, so we just hope that the CPU takes any pending
840+ * interrupts between the enable and disable.
822841 */
823842 local_irq_enable();
843+ local_irq_disable();
824844
825− /*
826− * We do local_irq_enable() before calling guest_exit() so
827− * that if a timer interrupt hits while running the guest
828− * we account that tick as being spent in the guest. We
829− * enable preemption after calling guest_exit() so that if
830− * we get preempted we make sure ticks after that is not
831− * counted as guest time.
832− */
833− guest_exit();
845+ guest_timing_exit_irqoff();
846+
847+ local_irq_enable();
834848
835849 preempt_enable();
836850
arch/riscv/kvm/vcpu_sbi_base.c+2−1
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/errno.h>
1010 #include <linux/err.h>
1111 #include <linux/kvm_host.h>
12+#include <linux/version.h>
1213 #include <asm/csr.h>
1314 #include <asm/sbi.h>
1415 #include <asm/kvm_vcpu_timer.h>
@@ -32,7 +33,7 @@ static int kvm_sbi_ext_base_handler(struct kvm_vcpu *vcpu, struct kvm_run *run, · 17 unmodified lines
3233 *out_val = KVM_SBI_IMPID;
3334 break;
3435 case SBI_EXT_BASE_GET_IMP_VERSION:
35− *out_val = 0;
36+ *out_val = LINUX_VERSION_CODE;
3637 break;
3738 case SBI_EXT_BASE_PROBE_EXT:
3839 if ((cp->a0 >= SBI_EXT_EXPERIMENTAL_START &&
arch/riscv/mm/extable.c+3−3
@@ -33,7 +33,7 @@ static inline void regs_set_gpr(struct pt_regs *regs, unsigned int offset, · 32 unmodified lines
3333 if (unlikely(offset > MAX_REG_OFFSET))
3434 return;
3535
36− if (!offset)
36+ if (offset)
3737 *(unsigned long *)((unsigned long)regs + offset) = val;
3838 }
3939
@@ -43,8 +43,8 @@ static bool ex_handler_uaccess_err_zero(const struct exception_table_entry *ex, · 3 unmodified lines
4343 int reg_err = FIELD_GET(EX_DATA_REG_ERR, ex->data);
4444 int reg_zero = FIELD_GET(EX_DATA_REG_ZERO, ex->data);
4545
46− regs_set_gpr(regs, reg_err, -EFAULT);
47− regs_set_gpr(regs, reg_zero, 0);
46+ regs_set_gpr(regs, reg_err * sizeof(unsigned long), -EFAULT);
47+ regs_set_gpr(regs, reg_zero * sizeof(unsigned long), 0);
4848
4949 regs->epc = get_ex_fixup(ex);
5050 return true;
arch/riscv/mm/init.c+2−0
@@ -232,6 +232,7 @@ static pmd_t __maybe_unused early_dtb_pmd[PTRS_PER_PMD] __initdata __aligned(PAG · 231 unmodified lines
232232
233233 #ifdef CONFIG_XIP_KERNEL
234234 #define pt_ops (*(struct pt_alloc_ops *)XIP_FIXUP(&pt_ops))
235+#define riscv_pfn_base (*(unsigned long *)XIP_FIXUP(&riscv_pfn_base))
235236 #define trampoline_pg_dir ((pgd_t *)XIP_FIXUP(trampoline_pg_dir))
236237 #define fixmap_pte ((pte_t *)XIP_FIXUP(fixmap_pte))
237238 #define early_pg_dir ((pgd_t *)XIP_FIXUP(early_pg_dir))
@@ -522,6 +523,7 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size) · 284 unmodified lines
522523 }
523524
524525 #ifdef CONFIG_XIP_KERNEL
526+#define phys_ram_base (*(phys_addr_t *)XIP_FIXUP(&phys_ram_base))
525527 extern char _xiprom[], _exiprom[], __data_loc;
526528
527529 /* called from head.S with MMU off */
arch/s390/kvm/kvm-s390.c+2−0
@@ -4667,6 +4667,8 @@ static long kvm_s390_guest_sida_op(struct kvm_vcpu *vcpu, · 4666 unmodified lines
46674667 return -EINVAL;
46684668 if (mop->size + mop->sida_offset > sida_size(vcpu->arch.sie_block))
46694669 return -E2BIG;
4670+ if (!kvm_s390_pv_cpu_is_protected(vcpu))
4671+ return -EINVAL;
46704672
46714673 switch (mop->op) {
46724674 case KVM_S390_MEMOP_SIDA_READ:
arch/s390/lib/test_modules.c+0−3
@@ -5,9 +5,6 @@ · 4 unmodified lines
55
66 #include "test_modules.h"
77
8−#define DECLARE_RETURN(i) int test_modules_return_ ## i(void)
9−REPEAT_10000(DECLARE_RETURN);
10−
118 /*
129 * Test that modules with many relocations are loaded properly.
1310 */
arch/s390/lib/test_modules.h+3−0
@@ -47,4 +47,7 @@ · 46 unmodified lines
4747 __REPEAT_10000_1(f, 8); \
4848 __REPEAT_10000_1(f, 9)
4949
50+#define DECLARE_RETURN(i) int test_modules_return_ ## i(void)
51+REPEAT_10000(DECLARE_RETURN);
52+
5053 #endif
arch/x86/crypto/blake2s-shash.c+2−2
@@ -18,12 +18,12 @@ · 17 unmodified lines
1818 static int crypto_blake2s_update_x86(struct shash_desc *desc,
1919 const u8 *in, unsigned int inlen)
2020 {
21− return crypto_blake2s_update(desc, in, inlen, blake2s_compress);
21+ return crypto_blake2s_update(desc, in, inlen, false);
2222 }
2323
2424 static int crypto_blake2s_final_x86(struct shash_desc *desc, u8 *out)
2525 {
26− return crypto_blake2s_final(desc, out, blake2s_compress);
26+ return crypto_blake2s_final(desc, out, false);
2727 }
2828
2929 #define BLAKE2S_ALG(name, driver_name, digest_size) \
arch/x86/events/intel/core.c+13−0
@@ -4703,6 +4703,19 @@ static __initconst const struct x86_pmu intel_pmu = { · 4702 unmodified lines
47034703 .lbr_read = intel_pmu_lbr_read_64,
47044704 .lbr_save = intel_pmu_lbr_save,
47054705 .lbr_restore = intel_pmu_lbr_restore,
4706+
4707+ /*
4708+ * SMM has access to all 4 rings and while traditionally SMM code only
4709+ * ran in CPL0, 2021-era firmware is starting to make use of CPL3 in SMM.
4710+ *
4711+ * Since the EVENTSEL.{USR,OS} CPL filtering makes no distinction
4712+ * between SMM or not, this results in what should be pure userspace
4713+ * counters including SMM data.
4714+ *
4715+ * This is a clear privilege issue, therefore globally disable
4716+ * counting SMM by default.
4717+ */
4718+ .attr_freeze_on_smi = 1,
47064719 };
47074720
47084721 static __init void intel_clovertown_quirk(void)
arch/x86/events/intel/pt.c+3−2
@@ -897,8 +897,9 @@ static void pt_handle_status(struct pt *pt) · 896 unmodified lines
897897 * means we are already losing data; need to let the decoder
898898 * know.
899899 */
900− if (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries) ||
901− buf->output_off == pt_buffer_region_size(buf)) {
900+ if (!buf->single &&
901+ (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries) ||
902+ buf->output_off == pt_buffer_region_size(buf))) {
902903 perf_aux_output_flag(&pt->handle,
903904 PERF_AUX_FLAG_TRUNCATED);
904905 advance++;
arch/x86/include/asm/bug.h+11−9
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222
2323 #ifdef CONFIG_DEBUG_BUGVERBOSE
2424
25−#define _BUG_FLAGS(ins, flags) \
25+#define _BUG_FLAGS(ins, flags, extra) \
2626 do { \
2727 asm_inline volatile("1:\t" ins "\n" \
2828 ".pushsection __bug_table,\"aw\"\n" \
@@ -31,7 +31,8 @@ do { \ · 2 unmodified lines
3131 "\t.word %c1" "\t# bug_entry::line\n" \
3232 "\t.word %c2" "\t# bug_entry::flags\n" \
3333 "\t.org 2b+%c3\n" \
34− ".popsection" \
34+ ".popsection\n" \
35+ extra \
3536 : : "i" (__FILE__), "i" (__LINE__), \
3637 "i" (flags), \
3738 "i" (sizeof(struct bug_entry))); \
@@ -39,14 +40,15 @@ do { \ · 1 unmodified line
3940
4041 #else /* !CONFIG_DEBUG_BUGVERBOSE */
4142
42−#define _BUG_FLAGS(ins, flags) \
43+#define _BUG_FLAGS(ins, flags, extra) \
4344 do { \
4445 asm_inline volatile("1:\t" ins "\n" \
4546 ".pushsection __bug_table,\"aw\"\n" \
4647 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
4748 "\t.word %c0" "\t# bug_entry::flags\n" \
4849 "\t.org 2b+%c1\n" \
49− ".popsection" \
50+ ".popsection\n" \
51+ extra \
5052 : : "i" (flags), \
5153 "i" (sizeof(struct bug_entry))); \
5254 } while (0)
@@ -55,7 +57,7 @@ do { \ · 2 unmodified lines
5557
5658 #else
5759
58−#define _BUG_FLAGS(ins, flags) asm volatile(ins)
60+#define _BUG_FLAGS(ins, flags, extra) asm volatile(ins)
5961
6062 #endif /* CONFIG_GENERIC_BUG */
6163
@@ -63,8 +65,8 @@ do { \ · 1 unmodified line
6365 #define BUG() \
6466 do { \
6567 instrumentation_begin(); \
66− _BUG_FLAGS(ASM_UD2, 0); \
67− unreachable(); \
68+ _BUG_FLAGS(ASM_UD2, 0, ""); \
69+ __builtin_unreachable(); \
6870 } while (0)
6971
7072 /*
@@ -75,9 +77,9 @@ do { \ · 4 unmodified lines
7577 */
7678 #define __WARN_FLAGS(flags) \
7779 do { \
80+ __auto_type f = BUGFLAG_WARNING|(flags); \
7881 instrumentation_begin(); \
79− _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \
80− annotate_reachable(); \
82+ _BUG_FLAGS(ASM_UD2, f, ASM_REACHABLE); \
8183 instrumentation_end(); \
8284 } while (0)
8385
arch/x86/include/asm/kvm-x86-ops.h+1−1
@@ -82,7 +82,7 @@ KVM_X86_OP_NULL(guest_apic_has_interrupt) · 81 unmodified lines
8282 KVM_X86_OP(load_eoi_exitmap)
8383 KVM_X86_OP(set_virtual_apic_mode)
8484 KVM_X86_OP_NULL(set_apic_access_page_addr)
85−KVM_X86_OP(deliver_posted_interrupt)
85+KVM_X86_OP(deliver_interrupt)
8686 KVM_X86_OP_NULL(sync_pir_to_irr)
8787 KVM_X86_OP(set_tss_addr)
8888 KVM_X86_OP(set_identity_map_addr)
arch/x86/include/asm/kvm_host.h+2−2
@@ -703,7 +703,6 @@ struct kvm_vcpu_arch { · 702 unmodified lines
703703 struct fpu_guest guest_fpu;
704704
705705 u64 xcr0;
706− u64 guest_supported_xcr0;
707706
708707 struct kvm_pio_request pio;
709708 void *pio_data;
@@ -1410,7 +1409,8 @@ struct kvm_x86_ops { · 700 unmodified lines
14101409 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
14111410 void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu);
14121411 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu);
1413− int (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);
1412+ void (*deliver_interrupt)(struct kvm_lapic *apic, int delivery_mode,
1413+ int trig_mode, int vector);
14141414 int (*sync_pir_to_irr)(struct kvm_vcpu *vcpu);
14151415 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
14161416 int (*set_identity_map_addr)(struct kvm *kvm, u64 ident_addr);
arch/x86/include/asm/msr-index.h+1−0
@@ -476,6 +476,7 @@ · 475 unmodified lines
476476 #define MSR_AMD64_ICIBSEXTDCTL 0xc001103c
477477 #define MSR_AMD64_IBSOPDATA4 0xc001103d
478478 #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
479+#define MSR_AMD64_SVM_AVIC_DOORBELL 0xc001011b
479480 #define MSR_AMD64_VM_PAGE_FLUSH 0xc001011e
480481 #define MSR_AMD64_SEV_ES_GHCB 0xc0010130
481482 #define MSR_AMD64_SEV 0xc0010131
arch/x86/include/asm/svm.h+36−0
@@ -220,6 +220,42 @@ struct __attribute__ ((__packed__)) vmcb_control_area { · 219 unmodified lines
220220 #define SVM_NESTED_CTL_SEV_ENABLE BIT(1)
221221 #define SVM_NESTED_CTL_SEV_ES_ENABLE BIT(2)
222222
223+
224+/* AVIC */
225+#define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF)
226+#define AVIC_LOGICAL_ID_ENTRY_VALID_BIT 31
227+#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31)
228+
229+#define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL)
230+#define AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK (0xFFFFFFFFFFULL << 12)
231+#define AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK (1ULL << 62)
232+#define AVIC_PHYSICAL_ID_ENTRY_VALID_MASK (1ULL << 63)
233+#define AVIC_PHYSICAL_ID_TABLE_SIZE_MASK (0xFF)
234+
235+#define AVIC_DOORBELL_PHYSICAL_ID_MASK (0xFF)
236+
237+#define AVIC_UNACCEL_ACCESS_WRITE_MASK 1
238+#define AVIC_UNACCEL_ACCESS_OFFSET_MASK 0xFF0
239+#define AVIC_UNACCEL_ACCESS_VECTOR_MASK 0xFFFFFFFF
240+
241+enum avic_ipi_failure_cause {
242+ AVIC_IPI_FAILURE_INVALID_INT_TYPE,
243+ AVIC_IPI_FAILURE_TARGET_NOT_RUNNING,
244+ AVIC_IPI_FAILURE_INVALID_TARGET,
245+ AVIC_IPI_FAILURE_INVALID_BACKING_PAGE,
246+};
247+
248+
249+/*
250+ * 0xff is broadcast, so the max index allowed for physical APIC ID
251+ * table is 0xfe. APIC IDs above 0xff are reserved.
252+ */
253+#define AVIC_MAX_PHYSICAL_ID_COUNT 0xff
254+
255+#define AVIC_HPA_MASK ~((0xFFFULL << 52) | 0xFFF)
256+#define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL
257+
258+
223259 struct vmcb_seg {
224260 u16 selector;
225261 u16 attrib;
arch/x86/include/asm/xen/cpuid.h+7−0
@@ -100,6 +100,13 @@ · 99 unmodified lines
100100 /* Memory mapped from other domains has valid IOMMU entries */
101101 #define XEN_HVM_CPUID_IOMMU_MAPPINGS (1u << 2)
102102 #define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) /* vcpu id is present in EBX */
103+#define XEN_HVM_CPUID_DOMID_PRESENT (1u << 4) /* domid is present in ECX */
104+/*
105+ * Bits 55:49 from the IO-APIC RTE and bits 11:5 from the MSI address can be
106+ * used to store high bits for the Destination ID. This expands the Destination
107+ * ID field from 8 to 15 bits, allowing to target APIC IDs up 32768.
108+ */
109+#define XEN_HVM_CPUID_EXT_DEST_ID (1u << 5)
103110
104111 /*
105112 * Leaf 6 (0x40000x05)
arch/x86/include/asm/xen/hypervisor.h+0−14
@@ -43,20 +43,6 @@ static inline uint32_t xen_cpuid_base(void) · 42 unmodified lines
4343 return hypervisor_cpuid_base("XenVMMXenVMM", 2);
4444 }
4545
46−#ifdef CONFIG_XEN
47−extern bool __init xen_hvm_need_lapic(void);
48−
49−static inline bool __init xen_x2apic_para_available(void)
50−{
51− return xen_hvm_need_lapic();
52−}
53−#else
54−static inline bool __init xen_x2apic_para_available(void)
55−{
56− return (xen_cpuid_base() != 0);
57−}
58−#endif
59−
6046 struct pci_dev;
6147
6248 #ifdef CONFIG_XEN_PV_DOM0
arch/x86/kernel/cpu/sgx/encl.c+2−0
@@ -410,6 +410,8 @@ void sgx_encl_release(struct kref *ref) · 409 unmodified lines
410410 }
411411
412412 kfree(entry);
413+ /* Invoke scheduler to prevent soft lockups. */
414+ cond_resched();
413415 }
414416
415417 xa_destroy(&encl->page_array);
arch/x86/kernel/cpu/sgx/main.c+1−9
@@ -344,10 +344,8 @@ static void sgx_reclaim_pages(void) · 343 unmodified lines
344344 {
345345 struct sgx_epc_page *chunk[SGX_NR_TO_SCAN];
346346 struct sgx_backing backing[SGX_NR_TO_SCAN];
347− struct sgx_epc_section *section;
348347 struct sgx_encl_page *encl_page;
349348 struct sgx_epc_page *epc_page;
350− struct sgx_numa_node *node;
351349 pgoff_t page_index;
352350 int cnt = 0;
353351 int ret;
@@ -418,13 +416,7 @@ skip: · 64 unmodified lines
418416 kref_put(&encl_page->encl->refcount, sgx_encl_release);
419417 epc_page->flags &= ~SGX_EPC_PAGE_RECLAIMER_TRACKED;
420418
421− section = &sgx_epc_sections[epc_page->section];
422− node = section->node;
423−
424− spin_lock(&node->lock);
425− list_add_tail(&epc_page->list, &node->free_page_list);
426− spin_unlock(&node->lock);
427− atomic_long_inc(&sgx_nr_free_pages);
419+ sgx_free_epc_page(epc_page);
428420 }
429421 }
430422
arch/x86/kernel/fpu/regset.c+4−5
@@ -91,11 +91,9 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, · 90 unmodified lines
9191 const void *kbuf, const void __user *ubuf)
9292 {
9393 struct fpu *fpu = &target->thread.fpu;
94− struct user32_fxsr_struct newstate;
94+ struct fxregs_state newstate;
9595 int ret;
9696
97− BUILD_BUG_ON(sizeof(newstate) != sizeof(struct fxregs_state));
98−
9997 if (!cpu_feature_enabled(X86_FEATURE_FXSR))
10098 return -ENODEV;
10199
@@ -116,9 +114,10 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, · 14 unmodified lines
116114 /* Copy the state */
117115 memcpy(&fpu->fpstate->regs.fxsave, &newstate, sizeof(newstate));
118116
119− /* Clear xmm8..15 */
117+ /* Clear xmm8..15 for 32-bit callers */
120118 BUILD_BUG_ON(sizeof(fpu->__fpstate.regs.fxsave.xmm_space) != 16 * 16);
121− memset(&fpu->fpstate->regs.fxsave.xmm_space[8], 0, 8 * 16);
119+ if (in_ia32_syscall())
120+ memset(&fpu->fpstate->regs.fxsave.xmm_space[8*4], 0, 8 * 16);
122121
123122 /* Mark FP and SSE as in use when XSAVE is enabled */
124123 if (use_xsave())
arch/x86/kernel/fpu/xstate.c+4−1
@@ -1558,7 +1558,10 @@ static int fpstate_realloc(u64 xfeatures, unsigned int ksize, · 1557 unmodified lines
15581558 fpregs_restore_userregs();
15591559
15601560 newfps->xfeatures = curfps->xfeatures | xfeatures;
1561− newfps->user_xfeatures = curfps->user_xfeatures | xfeatures;
1561+
1562+ if (!guest_fpu)
1563+ newfps->user_xfeatures = curfps->user_xfeatures | xfeatures;
1564+
15621565 newfps->xfd = curfps->xfd & ~xfeatures;
15631566
15641567 /* Do the final updates within the locked region */
arch/x86/kernel/kvm.c+6−3
@@ -462,19 +462,22 @@ static bool pv_tlb_flush_supported(void) · 461 unmodified lines
462462 {
463463 return (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
464464 !kvm_para_has_hint(KVM_HINTS_REALTIME) &&
465− kvm_para_has_feature(KVM_FEATURE_STEAL_TIME));
465+ kvm_para_has_feature(KVM_FEATURE_STEAL_TIME) &&
466+ (num_possible_cpus() != 1));
466467 }
467468
468469 static bool pv_ipi_supported(void)
469470 {
470− return kvm_para_has_feature(KVM_FEATURE_PV_SEND_IPI);
471+ return (kvm_para_has_feature(KVM_FEATURE_PV_SEND_IPI) &&
472+ (num_possible_cpus() != 1));
471473 }
472474
473475 static bool pv_sched_yield_supported(void)
474476 {
475477 return (kvm_para_has_feature(KVM_FEATURE_PV_SCHED_YIELD) &&
476478 !kvm_para_has_hint(KVM_HINTS_REALTIME) &&
477− kvm_para_has_feature(KVM_FEATURE_STEAL_TIME));
479+ kvm_para_has_feature(KVM_FEATURE_STEAL_TIME) &&
480+ (num_possible_cpus() != 1));
478481 }
479482
480483 #define KVM_IPI_CLUSTER_SIZE (2 * BITS_PER_LONG)
arch/x86/kernel/ptrace.c+2−2
@@ -1224,7 +1224,7 @@ static struct user_regset x86_64_regsets[] __ro_after_init = { · 1223 unmodified lines
12241224 },
12251225 [REGSET_FP] = {
12261226 .core_note_type = NT_PRFPREG,
1227− .n = sizeof(struct user_i387_struct) / sizeof(long),
1227+ .n = sizeof(struct fxregs_state) / sizeof(long),
12281228 .size = sizeof(long), .align = sizeof(long),
12291229 .active = regset_xregset_fpregs_active, .regset_get = xfpregs_get, .set = xfpregs_set
12301230 },
@@ -1271,7 +1271,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = { · 40 unmodified lines
12711271 },
12721272 [REGSET_XFP] = {
12731273 .core_note_type = NT_PRXFPREG,
1274− .n = sizeof(struct user32_fxsr_struct) / sizeof(u32),
1274+ .n = sizeof(struct fxregs_state) / sizeof(u32),
12751275 .size = sizeof(u32), .align = sizeof(u32),
12761276 .active = regset_xregset_fpregs_active, .regset_get = xfpregs_get, .set = xfpregs_set
12771277 },
arch/x86/kernel/resource.c+1−22
@@ -1,5 +1,4 @@
11 // SPDX-License-Identifier: GPL-2.0
2−#include <linux/dmi.h>
32 #include <linux/ioport.h>
43 #include <asm/e820/api.h>
54
@@ -24,31 +23,11 @@ static void resource_clip(struct resource *res, resource_size_t start, · 18 unmodified lines
2423 res->start = end + 1;
2524 }
2625
27−/*
28− * Some BIOS-es contain a bug where they add addresses which map to
29− * system RAM in the PCI host bridge window returned by the ACPI _CRS
30− * method, see commit 4dc2287c1805 ("x86: avoid E820 regions when
31− * allocating address space"). To avoid this Linux by default excludes
32− * E820 reservations when allocating addresses since 2010.
33− * In 2019 some systems have shown-up with E820 reservations which cover
34− * the entire _CRS returned PCI host bridge window, causing all attempts
35− * to assign memory to PCI BARs to fail if Linux uses E820 reservations.
36− *
37− * Ideally Linux would fully stop using E820 reservations, but then
38− * the old systems this was added for will regress.
39− * Instead keep the old behavior for old systems, while ignoring the
40− * E820 reservations for any systems from now on.
41− */
4226 static void remove_e820_regions(struct resource *avail)
4327 {
44− int i, year = dmi_get_bios_year();
28+ int i;
4529 struct e820_entry *entry;
4630
47− if (year >= 2018)
48− return;
49−
50− pr_info_once("PCI: Removing E820 reservations from host bridge windows\n");
51−
5231 for (i = 0; i < e820_table->nr_entries; i++) {
5332 entry = &e820_table->entries[i];
5433
arch/x86/kvm/cpuid.c+11−7
@@ -282,6 +282,7 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 281 unmodified lines
282282 {
283283 struct kvm_lapic *apic = vcpu->arch.apic;
284284 struct kvm_cpuid_entry2 *best;
285+ u64 guest_supported_xcr0;
285286
286287 best = kvm_find_cpuid_entry(vcpu, 1, 0);
287288 if (best && apic) {
@@ -293,9 +294,11 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 5 unmodified lines
293294 kvm_apic_set_version(vcpu);
294295 }
295296
296− vcpu->arch.guest_supported_xcr0 =
297+ guest_supported_xcr0 =
297298 cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent);
298299
300+ vcpu->arch.guest_fpu.fpstate->user_xfeatures = guest_supported_xcr0;
301+
299302 kvm_update_pv_runtime(vcpu);
300303
301304 vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
@@ -554,12 +557,13 @@ void kvm_set_cpu_caps(void) · 252 unmodified lines
554557 );
555558
556559 kvm_cpu_cap_mask(CPUID_7_0_EBX,
557− F(FSGSBASE) | F(SGX) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) |
558− F(BMI2) | F(ERMS) | F(INVPCID) | F(RTM) | 0 /*MPX*/ | F(RDSEED) |
559− F(ADX) | F(SMAP) | F(AVX512IFMA) | F(AVX512F) | F(AVX512PF) |
560− F(AVX512ER) | F(AVX512CD) | F(CLFLUSHOPT) | F(CLWB) | F(AVX512DQ) |
561− F(SHA_NI) | F(AVX512BW) | F(AVX512VL) | 0 /*INTEL_PT*/
562− );
560+ F(FSGSBASE) | F(SGX) | F(BMI1) | F(HLE) | F(AVX2) |
561+ F(FDP_EXCPTN_ONLY) | F(SMEP) | F(BMI2) | F(ERMS) | F(INVPCID) |
562+ F(RTM) | F(ZERO_FCS_FDS) | 0 /*MPX*/ | F(AVX512F) |
563+ F(AVX512DQ) | F(RDSEED) | F(ADX) | F(SMAP) | F(AVX512IFMA) |
564+ F(CLFLUSHOPT) | F(CLWB) | 0 /*INTEL_PT*/ | F(AVX512PF) |
565+ F(AVX512ER) | F(AVX512CD) | F(SHA_NI) | F(AVX512BW) |
566+ F(AVX512VL));
563567
564568 kvm_cpu_cap_mask(CPUID_7_ECX,
565569 F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | F(RDPID) |
arch/x86/kvm/lapic.c+8−9
@@ -1096,14 +1096,8 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, · 1095 unmodified lines
10961096 apic->regs + APIC_TMR);
10971097 }
10981098
1099− if (static_call(kvm_x86_deliver_posted_interrupt)(vcpu, vector)) {
1100− kvm_lapic_set_irr(vector, apic);
1101− kvm_make_request(KVM_REQ_EVENT, vcpu);
1102− kvm_vcpu_kick(vcpu);
1103− } else {
1104− trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode,
1105− trig_mode, vector);
1106− }
1099+ static_call(kvm_x86_deliver_interrupt)(apic, delivery_mode,
1100+ trig_mode, vector);
11071101 break;
11081102
11091103 case APIC_DM_REMRD:
@@ -2312,7 +2306,12 @@ void kvm_apic_update_apicv(struct kvm_vcpu *vcpu) · 1202 unmodified lines
23122306 apic->irr_pending = true;
23132307 apic->isr_count = 1;
23142308 } else {
2315− apic->irr_pending = (apic_search_irr(apic) != -1);
2309+ /*
2310+ * Don't clear irr_pending, searching the IRR can race with
2311+ * updates from the CPU as APICv is still active from hardware's
2312+ * perspective. The flag will be cleared as appropriate when
2313+ * KVM injects the interrupt.
2314+ */
23162315 apic->isr_count = count_vectors(apic->regs + APIC_ISR);
23172316 }
23182317 }
arch/x86/kvm/mmu/mmu.c+12−1
@@ -3889,12 +3889,23 @@ static void shadow_page_table_clear_flood(struct kvm_vcpu *vcpu, gva_t addr) · 3888 unmodified lines
38893889 walk_shadow_page_lockless_end(vcpu);
38903890 }
38913891
3892+static u32 alloc_apf_token(struct kvm_vcpu *vcpu)
3893+{
3894+ /* make sure the token value is not 0 */
3895+ u32 id = vcpu->arch.apf.id;
3896+
3897+ if (id << 12 == 0)
3898+ vcpu->arch.apf.id = 1;
3899+
3900+ return (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id;
3901+}
3902+
38923903 static bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
38933904 gfn_t gfn)
38943905 {
38953906 struct kvm_arch_async_pf arch;
38963907
3897− arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id;
3908+ arch.token = alloc_apf_token(vcpu);
38983909 arch.gfn = gfn;
38993910 arch.direct_map = vcpu->arch.mmu->direct_map;
39003911 arch.cr3 = vcpu->arch.mmu->get_guest_pgd(vcpu);
arch/x86/kvm/pmu.c+4−3
@@ -95,7 +95,7 @@ static void kvm_perf_overflow(struct perf_event *perf_event, · 94 unmodified lines
9595 }
9696
9797 static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
98− unsigned config, bool exclude_user,
98+ u64 config, bool exclude_user,
9999 bool exclude_kernel, bool intr,
100100 bool in_tx, bool in_tx_cp)
101101 {
@@ -181,7 +181,8 @@ static int cmp_u64(const void *a, const void *b) · 79 unmodified lines
181181
182182 void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel)
183183 {
184− unsigned config, type = PERF_TYPE_RAW;
184+ u64 config;
185+ u32 type = PERF_TYPE_RAW;
185186 struct kvm *kvm = pmc->vcpu->kvm;
186187 struct kvm_pmu_event_filter *filter;
187188 bool allow_event = true;
@@ -220,7 +221,7 @@ void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) · 32 unmodified lines
220221 }
221222
222223 if (type == PERF_TYPE_RAW)
223− config = eventsel & X86_RAW_EVENT_MASK;
224+ config = eventsel & AMD64_RAW_EVENT_MASK;
224225
225226 if (pmc->current_config == eventsel && pmc_resume_counter(pmc))
226227 return;
arch/x86/kvm/svm/avic.c+23−70
@@ -27,20 +27,6 @@ · 26 unmodified lines
2727 #include "irq.h"
2828 #include "svm.h"
2929
30−#define SVM_AVIC_DOORBELL 0xc001011b
31−
32−#define AVIC_HPA_MASK ~((0xFFFULL << 52) | 0xFFF)
33−
34−/*
35− * 0xff is broadcast, so the max index allowed for physical APIC ID
36− * table is 0xfe. APIC IDs above 0xff are reserved.
37− */
38−#define AVIC_MAX_PHYSICAL_ID_COUNT 255
39−
40−#define AVIC_UNACCEL_ACCESS_WRITE_MASK 1
41−#define AVIC_UNACCEL_ACCESS_OFFSET_MASK 0xFF0
42−#define AVIC_UNACCEL_ACCESS_VECTOR_MASK 0xFFFFFFFF
43−
4430 /* AVIC GATAG is encoded using VM and VCPU IDs */
4531 #define AVIC_VCPU_ID_BITS 8
4632 #define AVIC_VCPU_ID_MASK ((1 << AVIC_VCPU_ID_BITS) - 1)
@@ -73,12 +59,6 @@ struct amd_svm_iommu_ir { · 26 unmodified lines
7359 void *data; /* Storing pointer to struct amd_ir_data */
7460 };
7561
76−enum avic_ipi_failure_cause {
77− AVIC_IPI_FAILURE_INVALID_INT_TYPE,
78− AVIC_IPI_FAILURE_TARGET_NOT_RUNNING,
79− AVIC_IPI_FAILURE_INVALID_TARGET,
80− AVIC_IPI_FAILURE_INVALID_BACKING_PAGE,
81−};
8262
8363 /* Note:
8464 * This function is called from IOMMU driver to notify
@@ -289,6 +269,22 @@ static int avic_init_backing_page(struct kvm_vcpu *vcpu) · 204 unmodified lines
289269 return 0;
290270 }
291271
272+void avic_ring_doorbell(struct kvm_vcpu *vcpu)
273+{
274+ /*
275+ * Note, the vCPU could get migrated to a different pCPU at any point,
276+ * which could result in signalling the wrong/previous pCPU. But if
277+ * that happens the vCPU is guaranteed to do a VMRUN (after being
278+ * migrated) and thus will process pending interrupts, i.e. a doorbell
279+ * is not needed (and the spurious one is harmless).
280+ */
281+ int cpu = READ_ONCE(vcpu->cpu);
282+
283+ if (cpu != get_cpu())
284+ wrmsrl(MSR_AMD64_SVM_AVIC_DOORBELL, kvm_cpu_get_apicid(cpu));
285+ put_cpu();
286+}
287+
292288 static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source,
293289 u32 icrl, u32 icrh)
294290 {
@@ -304,8 +300,13 @@ static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source, · 9 unmodified lines
304300 kvm_for_each_vcpu(i, vcpu, kvm) {
305301 if (kvm_apic_match_dest(vcpu, source, icrl & APIC_SHORT_MASK,
306302 GET_APIC_DEST_FIELD(icrh),
307− icrl & APIC_DEST_MASK))
308− kvm_vcpu_wake_up(vcpu);
303+ icrl & APIC_DEST_MASK)) {
304+ vcpu->arch.apic->irr_pending = true;
305+ svm_complete_interrupt_delivery(vcpu,
306+ icrl & APIC_MODE_MASK,
307+ icrl & APIC_INT_LEVELTRIG,
308+ icrl & APIC_VECTOR_MASK);
309+ }
309310 }
310311 }
311312
@@ -345,8 +346,6 @@ int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu) · 33 unmodified lines
345346 avic_kick_target_vcpus(vcpu->kvm, apic, icrl, icrh);
346347 break;
347348 case AVIC_IPI_FAILURE_INVALID_TARGET:
348− WARN_ONCE(1, "Invalid IPI target: index=%u, vcpu=%d, icr=%#0x:%#0x\n",
349− index, vcpu->vcpu_id, icrh, icrl);
350349 break;
351350 case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE:
352351 WARN_ONCE(1, "Invalid backing page\n");
@@ -669,52 +668,6 @@ void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) · 316 unmodified lines
669668 return;
670669 }
671670
672−int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec)
673−{
674− if (!vcpu->arch.apicv_active)
675− return -1;
676−
677− kvm_lapic_set_irr(vec, vcpu->arch.apic);
678−
679− /*
680− * Pairs with the smp_mb_*() after setting vcpu->guest_mode in
681− * vcpu_enter_guest() to ensure the write to the vIRR is ordered before
682− * the read of guest_mode, which guarantees that either VMRUN will see
683− * and process the new vIRR entry, or that the below code will signal
684− * the doorbell if the vCPU is already running in the guest.
685− */
686− smp_mb__after_atomic();
687−
688− /*
689− * Signal the doorbell to tell hardware to inject the IRQ if the vCPU
690− * is in the guest. If the vCPU is not in the guest, hardware will
691− * automatically process AVIC interrupts at VMRUN.
692− */
693− if (vcpu->mode == IN_GUEST_MODE) {
694− int cpu = READ_ONCE(vcpu->cpu);
695−
696− /*
697− * Note, the vCPU could get migrated to a different pCPU at any
698− * point, which could result in signalling the wrong/previous
699− * pCPU. But if that happens the vCPU is guaranteed to do a
700− * VMRUN (after being migrated) and thus will process pending
701− * interrupts, i.e. a doorbell is not needed (and the spurious
702− * one is harmless).
703− */
704− if (cpu != get_cpu())
705− wrmsrl(SVM_AVIC_DOORBELL, kvm_cpu_get_apicid(cpu));
706− put_cpu();
707− } else {
708− /*
709− * Wake the vCPU if it was blocking. KVM will then detect the
710− * pending IRQ when checking if the vCPU has a wake event.
711− */
712− kvm_vcpu_wake_up(vcpu);
713− }
714−
715− return 0;
716−}
717−
718671 bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu)
719672 {
720673 return false;
arch/x86/kvm/svm/nested.c+14−12
@@ -1457,18 +1457,6 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 1456 unmodified lines
14571457 !__nested_vmcb_check_save(vcpu, &save_cached))
14581458 goto out_free;
14591459
1460− /*
1461− * While the nested guest CR3 is already checked and set by
1462− * KVM_SET_SREGS, it was set when nested state was yet loaded,
1463− * thus MMU might not be initialized correctly.
1464− * Set it again to fix this.
1465− */
1466−
1467− ret = nested_svm_load_cr3(&svm->vcpu, vcpu->arch.cr3,
1468− nested_npt_enabled(svm), false);
1469− if (WARN_ON_ONCE(ret))
1470− goto out_free;
1471−
14721460
14731461 /*
14741462 * All checks done, we can enter guest mode. Userspace provides
@@ -1494,6 +1482,20 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 19 unmodified lines
14941482
14951483 svm_switch_vmcb(svm, &svm->nested.vmcb02);
14961484 nested_vmcb02_prepare_control(svm);
1485+
1486+ /*
1487+ * While the nested guest CR3 is already checked and set by
1488+ * KVM_SET_SREGS, it was set when nested state was yet loaded,
1489+ * thus MMU might not be initialized correctly.
1490+ * Set it again to fix this.
1491+ */
1492+
1493+ ret = nested_svm_load_cr3(&svm->vcpu, vcpu->arch.cr3,
1494+ nested_npt_enabled(svm), false);
1495+ if (WARN_ON_ONCE(ret))
1496+ goto out_free;
1497+
1498+
14971499 kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
14981500 ret = 0;
14991501 out_free:
arch/x86/kvm/svm/svm.c+100−11
@@ -1585,6 +1585,7 @@ void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 1584 unmodified lines
15851585 {
15861586 struct vcpu_svm *svm = to_svm(vcpu);
15871587 u64 hcr0 = cr0;
1588+ bool old_paging = is_paging(vcpu);
15881589
15891590 #ifdef CONFIG_X86_64
15901591 if (vcpu->arch.efer & EFER_LME && !vcpu->arch.guest_state_protected) {
@@ -1601,8 +1602,11 @@ void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 10 unmodified lines
16011602 #endif
16021603 vcpu->arch.cr0 = cr0;
16031604
1604− if (!npt_enabled)
1605+ if (!npt_enabled) {
16051606 hcr0 |= X86_CR0_PG | X86_CR0_WP;
1607+ if (old_paging != is_paging(vcpu))
1608+ svm_set_cr4(vcpu, kvm_read_cr4(vcpu));
1609+ }
16061610
16071611 /*
16081612 * re-enable caching here because the QEMU bios
@@ -1646,8 +1650,12 @@ void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) · 37 unmodified lines
16461650 svm_flush_tlb(vcpu);
16471651
16481652 vcpu->arch.cr4 = cr4;
1649− if (!npt_enabled)
1653+ if (!npt_enabled) {
16501654 cr4 |= X86_CR4_PAE;
1655+
1656+ if (!is_paging(vcpu))
1657+ cr4 &= ~(X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE);
1658+ }
16511659 cr4 |= host_cr4_mce;
16521660 to_svm(vcpu)->vmcb->save.cr4 = cr4;
16531661 vmcb_mark_dirty(to_svm(vcpu)->vmcb, VMCB_CR);
@@ -2685,8 +2693,23 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 1031 unmodified lines
26852693 u64 data = msr->data;
26862694 switch (ecx) {
26872695 case MSR_AMD64_TSC_RATIO:
2688− if (!msr->host_initiated && !svm->tsc_scaling_enabled)
2689− return 1;
2696+
2697+ if (!svm->tsc_scaling_enabled) {
2698+
2699+ if (!msr->host_initiated)
2700+ return 1;
2701+ /*
2702+ * In case TSC scaling is not enabled, always
2703+ * leave this MSR at the default value.
2704+ *
2705+ * Due to bug in qemu 6.2.0, it would try to set
2706+ * this msr to 0 if tsc scaling is not enabled.
2707+ * Ignore this value as well.
2708+ */
2709+ if (data != 0 && data != svm->tsc_ratio_msr)
2710+ return 1;
2711+ break;
2712+ }
26902713
26912714 if (data & TSC_RATIO_RSVD)
26922715 return 1;
@@ -3291,6 +3314,55 @@ static void svm_set_irq(struct kvm_vcpu *vcpu) · 598 unmodified lines
32913314 SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR;
32923315 }
32933316
3317+void svm_complete_interrupt_delivery(struct kvm_vcpu *vcpu, int delivery_mode,
3318+ int trig_mode, int vector)
3319+{
3320+ /*
3321+ * vcpu->arch.apicv_active must be read after vcpu->mode.
3322+ * Pairs with smp_store_release in vcpu_enter_guest.
3323+ */
3324+ bool in_guest_mode = (smp_load_acquire(&vcpu->mode) == IN_GUEST_MODE);
3325+
3326+ if (!READ_ONCE(vcpu->arch.apicv_active)) {
3327+ /* Process the interrupt via inject_pending_event */
3328+ kvm_make_request(KVM_REQ_EVENT, vcpu);
3329+ kvm_vcpu_kick(vcpu);
3330+ return;
3331+ }
3332+
3333+ trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode, trig_mode, vector);
3334+ if (in_guest_mode) {
3335+ /*
3336+ * Signal the doorbell to tell hardware to inject the IRQ. If
3337+ * the vCPU exits the guest before the doorbell chimes, hardware
3338+ * will automatically process AVIC interrupts at the next VMRUN.
3339+ */
3340+ avic_ring_doorbell(vcpu);
3341+ } else {
3342+ /*
3343+ * Wake the vCPU if it was blocking. KVM will then detect the
3344+ * pending IRQ when checking if the vCPU has a wake event.
3345+ */
3346+ kvm_vcpu_wake_up(vcpu);
3347+ }
3348+}
3349+
3350+static void svm_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode,
3351+ int trig_mode, int vector)
3352+{
3353+ kvm_lapic_set_irr(vector, apic);
3354+
3355+ /*
3356+ * Pairs with the smp_mb_*() after setting vcpu->guest_mode in
3357+ * vcpu_enter_guest() to ensure the write to the vIRR is ordered before
3358+ * the read of guest_mode. This guarantees that either VMRUN will see
3359+ * and process the new vIRR entry, or that svm_complete_interrupt_delivery
3360+ * will signal the doorbell if the CPU has already entered the guest.
3361+ */
3362+ smp_mb__after_atomic();
3363+ svm_complete_interrupt_delivery(apic->vcpu, delivery_mode, trig_mode, vector);
3364+}
3365+
32943366 static void svm_update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
32953367 {
32963368 struct vcpu_svm *svm = to_svm(vcpu);
@@ -3338,11 +3410,13 @@ static int svm_nmi_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 41 unmodified lines
33383410 if (svm->nested.nested_run_pending)
33393411 return -EBUSY;
33403412
3413+ if (svm_nmi_blocked(vcpu))
3414+ return 0;
3415+
33413416 /* An NMI must not be injected into L2 if it's supposed to VM-Exit. */
33423417 if (for_injection && is_guest_mode(vcpu) && nested_exit_on_nmi(svm))
33433418 return -EBUSY;
3344−
3345− return !svm_nmi_blocked(vcpu);
3419+ return 1;
33463420 }
33473421
33483422 static bool svm_get_nmi_mask(struct kvm_vcpu *vcpu)
@@ -3394,9 +3468,13 @@ bool svm_interrupt_blocked(struct kvm_vcpu *vcpu) · 45 unmodified lines
33943468 static int svm_interrupt_allowed(struct kvm_vcpu *vcpu, bool for_injection)
33953469 {
33963470 struct vcpu_svm *svm = to_svm(vcpu);
3471+
33973472 if (svm->nested.nested_run_pending)
33983473 return -EBUSY;
33993474
3475+ if (svm_interrupt_blocked(vcpu))
3476+ return 0;
3477+
34003478 /*
34013479 * An IRQ must not be injected into L2 if it's supposed to VM-Exit,
34023480 * e.g. if the IRQ arrived asynchronously after checking nested events.
@@ -3404,7 +3482,7 @@ static int svm_interrupt_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 1 unmodified line
34043482 if (for_injection && is_guest_mode(vcpu) && nested_exit_on_intr(svm))
34053483 return -EBUSY;
34063484
3407− return !svm_interrupt_blocked(vcpu);
3485+ return 1;
34083486 }
34093487
34103488 static void svm_enable_irq_window(struct kvm_vcpu *vcpu)
@@ -3615,7 +3693,7 @@ static noinstr void svm_vcpu_enter_exit(struct kvm_vcpu *vcpu) · 204 unmodified lines
36153693 struct vcpu_svm *svm = to_svm(vcpu);
36163694 unsigned long vmcb_pa = svm->current_vmcb->pa;
36173695
3618− kvm_guest_enter_irqoff();
3696+ guest_state_enter_irqoff();
36193697
36203698 if (sev_es_guest(vcpu->kvm)) {
36213699 __svm_sev_es_vcpu_run(vmcb_pa);
@@ -3635,7 +3713,7 @@ static noinstr void svm_vcpu_enter_exit(struct kvm_vcpu *vcpu) · 13 unmodified lines
36353713 vmload(__sme_page_pa(sd->save_area));
36363714 }
36373715
3638− kvm_guest_exit_irqoff();
3716+ guest_state_exit_irqoff();
36393717 }
36403718
36413719 static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu)
@@ -4135,11 +4213,14 @@ static int svm_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 493 unmodified lines
41354213 if (svm->nested.nested_run_pending)
41364214 return -EBUSY;
41374215
4216+ if (svm_smi_blocked(vcpu))
4217+ return 0;
4218+
41384219 /* An SMI must not be injected into L2 if it's supposed to VM-Exit. */
41394220 if (for_injection && is_guest_mode(vcpu) && nested_exit_on_smi(svm))
41404221 return -EBUSY;
41414222
4142− return !svm_smi_blocked(vcpu);
4223+ return 1;
41434224 }
41444225
41454226 static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
@@ -4233,11 +4314,18 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) · 87 unmodified lines
42334314 * Enter the nested guest now
42344315 */
42354316
4317+ vmcb_mark_all_dirty(svm->vmcb01.ptr);
4318+
42364319 vmcb12 = map.hva;
42374320 nested_copy_vmcb_control_to_cache(svm, &vmcb12->control);
42384321 nested_copy_vmcb_save_to_cache(svm, &vmcb12->save);
42394322 ret = enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, false);
42404323
4324+ if (ret)
4325+ goto unmap_save;
4326+
4327+ svm->nested.nested_run_pending = 1;
4328+
42414329 unmap_save:
42424330 kvm_vcpu_unmap(vcpu, &map_save, true);
42434331 unmap_map:
@@ -4545,7 +4633,7 @@ static struct kvm_x86_ops svm_x86_ops __initdata = { · 301 unmodified lines
45454633 .pmu_ops = &amd_pmu_ops,
45464634 .nested_ops = &svm_nested_ops,
45474635
4548− .deliver_posted_interrupt = svm_deliver_avic_intr,
4636+ .deliver_interrupt = svm_deliver_interrupt,
45494637 .dy_apicv_has_pending_interrupt = svm_dy_apicv_has_pending_interrupt,
45504638 .update_pi_irte = svm_update_pi_irte,
45514639 .setup_mce = svm_setup_mce,
@@ -4622,6 +4710,7 @@ static __init void svm_set_cpu_caps(void) · 70 unmodified lines
46224710 /* CPUID 0x80000001 and 0x8000000A (SVM features) */
46234711 if (nested) {
46244712 kvm_cpu_cap_set(X86_FEATURE_SVM);
4713+ kvm_cpu_cap_set(X86_FEATURE_VMCBCLEAN);
46254714
46264715 if (nrips)
46274716 kvm_cpu_cap_set(X86_FEATURE_NRIPS);
arch/x86/kvm/svm/svm.h+3−12
@@ -489,6 +489,8 @@ void svm_set_gif(struct vcpu_svm *svm, bool value); · 488 unmodified lines
489489 int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code);
490490 void set_msr_interception(struct kvm_vcpu *vcpu, u32 *msrpm, u32 msr,
491491 int read, int write);
492+void svm_complete_interrupt_delivery(struct kvm_vcpu *vcpu, int delivery_mode,
493+ int trig_mode, int vec);
492494
493495 /* nested.c */
494496
@@ -556,17 +558,6 @@ extern struct kvm_x86_nested_ops svm_nested_ops; · 61 unmodified lines
556558
557559 /* avic.c */
558560
559−#define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF)
560−#define AVIC_LOGICAL_ID_ENTRY_VALID_BIT 31
561−#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31)
562−
563−#define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL)
564−#define AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK (0xFFFFFFFFFFULL << 12)
565−#define AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK (1ULL << 62)
566−#define AVIC_PHYSICAL_ID_ENTRY_VALID_MASK (1ULL << 63)
567−
568−#define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL
569−
570561 int avic_ga_log_notifier(u32 ga_tag);
571562 void avic_vm_destroy(struct kvm *kvm);
572563 int avic_vm_init(struct kvm *kvm);
@@ -583,12 +574,12 @@ bool svm_check_apicv_inhibit_reasons(ulong bit); · 10 unmodified lines
583574 void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
584575 void svm_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr);
585576 void svm_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr);
586−int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec);
587577 bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu);
588578 int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq,
589579 uint32_t guest_irq, bool set);
590580 void avic_vcpu_blocking(struct kvm_vcpu *vcpu);
591581 void avic_vcpu_unblocking(struct kvm_vcpu *vcpu);
582+void avic_ring_doorbell(struct kvm_vcpu *vcpu);
592583
593584 /* sev.c */
594585
arch/x86/kvm/vmx/vmx.c+19−3
@@ -4041,6 +4041,21 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) · 4040 unmodified lines
40414041 return 0;
40424042 }
40434043
4044+static void vmx_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode,
4045+ int trig_mode, int vector)
4046+{
4047+ struct kvm_vcpu *vcpu = apic->vcpu;
4048+
4049+ if (vmx_deliver_posted_interrupt(vcpu, vector)) {
4050+ kvm_lapic_set_irr(vector, apic);
4051+ kvm_make_request(KVM_REQ_EVENT, vcpu);
4052+ kvm_vcpu_kick(vcpu);
4053+ } else {
4054+ trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode,
4055+ trig_mode, vector);
4056+ }
4057+}
4058+
40444059 /*
40454060 * Set up the vmcs's constant host-state fields, i.e., host-state fields that
40464061 * will not change in the lifetime of the guest.
@@ -6754,7 +6769,7 @@ static fastpath_t vmx_exit_handlers_fastpath(struct kvm_vcpu *vcpu) · 2707 unmodified lines
67546769 static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,
67556770 struct vcpu_vmx *vmx)
67566771 {
6757− kvm_guest_enter_irqoff();
6772+ guest_state_enter_irqoff();
67586773
67596774 /* L1D Flush includes CPU buffer clear to mitigate MDS */
67606775 if (static_branch_unlikely(&vmx_l1d_should_flush))
@@ -6770,7 +6785,7 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu, · 9 unmodified lines
67706785
67716786 vcpu->arch.cr2 = native_read_cr2();
67726787
6773− kvm_guest_exit_irqoff();
6788+ guest_state_exit_irqoff();
67746789 }
67756790
67766791 static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
@@ -7644,6 +7659,7 @@ static int vmx_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) · 867 unmodified lines
76447659 if (ret)
76457660 return ret;
76467661
7662+ vmx->nested.nested_run_pending = 1;
76477663 vmx->nested.smm.guest_mode = false;
76487664 }
76497665 return 0;
@@ -7768,7 +7784,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = { · 118 unmodified lines
77687784 .hwapic_isr_update = vmx_hwapic_isr_update,
77697785 .guest_apic_has_interrupt = vmx_guest_apic_has_interrupt,
77707786 .sync_pir_to_irr = vmx_sync_pir_to_irr,
7771− .deliver_posted_interrupt = vmx_deliver_posted_interrupt,
7787+ .deliver_interrupt = vmx_deliver_interrupt,
77727788 .dy_apicv_has_pending_interrupt = pi_has_pending_interrupt,
77737789
77747790 .set_tss_addr = vmx_set_tss_addr,
arch/x86/kvm/x86.c+34−10
@@ -90,6 +90,8 @@ · 89 unmodified lines
9090 u64 __read_mostly kvm_mce_cap_supported = MCG_CTL_P | MCG_SER_P;
9191 EXPORT_SYMBOL_GPL(kvm_mce_cap_supported);
9292
93+#define ERR_PTR_USR(e) ((void __user *)ERR_PTR(e))
94+
9395 #define emul_to_vcpu(ctxt) \
9496 ((struct kvm_vcpu *)(ctxt)->vcpu)
9597
@@ -982,6 +984,18 @@ void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu) · 886 unmodified lines
982984 }
983985 EXPORT_SYMBOL_GPL(kvm_load_host_xsave_state);
984986
987+static inline u64 kvm_guest_supported_xcr0(struct kvm_vcpu *vcpu)
988+{
989+ return vcpu->arch.guest_fpu.fpstate->user_xfeatures;
990+}
991+
992+#ifdef CONFIG_X86_64
993+static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu)
994+{
995+ return kvm_guest_supported_xcr0(vcpu) & XFEATURE_MASK_USER_DYNAMIC;
996+}
997+#endif
998+
985999 static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
9861000 {
9871001 u64 xcr0 = xcr;
@@ -1001,7 +1015,7 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) · 13 unmodified lines
10011015 * saving. However, xcr0 bit 0 is always set, even if the
10021016 * emulated CPU does not support XSAVE (see kvm_vcpu_reset()).
10031017 */
1004− valid_bits = vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FP;
1018+ valid_bits = kvm_guest_supported_xcr0(vcpu) | XFEATURE_MASK_FP;
10051019 if (xcr0 & ~valid_bits)
10061020 return 1;
10071021
@@ -2349,10 +2363,12 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns) · 1341 unmodified lines
23492363 return tsc;
23502364 }
23512365
2366+#ifdef CONFIG_X86_64
23522367 static inline int gtod_is_based_on_tsc(int mode)
23532368 {
23542369 return mode == VDSO_CLOCKMODE_TSC || mode == VDSO_CLOCKMODE_HVCLOCK;
23552370 }
2371+#endif
23562372
23572373 static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
23582374 {
@@ -3704,8 +3720,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1345 unmodified lines
37043720 !guest_cpuid_has(vcpu, X86_FEATURE_XFD))
37053721 return 1;
37063722
3707− if (data & ~(XFEATURE_MASK_USER_DYNAMIC &
3708− vcpu->arch.guest_supported_xcr0))
3723+ if (data & ~kvm_guest_supported_xfd(vcpu))
37093724 return 1;
37103725
37113726 fpu_update_guest_xfd(&vcpu->arch.guest_fpu, data);
@@ -3715,8 +3730,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 3 unmodified lines
37153730 !guest_cpuid_has(vcpu, X86_FEATURE_XFD))
37163731 return 1;
37173732
3718− if (data & ~(XFEATURE_MASK_USER_DYNAMIC &
3719− vcpu->arch.guest_supported_xcr0))
3733+ if (data & ~kvm_guest_supported_xfd(vcpu))
37203734 return 1;
37213735
37223736 vcpu->arch.guest_fpu.xfd_err = data;
@@ -4231,6 +4245,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 508 unmodified lines
42314245 case KVM_CAP_EXIT_ON_EMULATION_FAILURE:
42324246 case KVM_CAP_VCPU_ATTRIBUTES:
42334247 case KVM_CAP_SYS_ATTRIBUTES:
4248+ case KVM_CAP_ENABLE_CAP:
42344249 r = 1;
42354250 break;
42364251 case KVM_CAP_EXIT_HYPERCALL:
@@ -4340,7 +4355,7 @@ static inline void __user *kvm_get_attr_addr(struct kvm_device_attr *attr) · 103 unmodified lines
43404355 void __user *uaddr = (void __user*)(unsigned long)attr->addr;
43414356
43424357 if ((u64)(unsigned long)uaddr != attr->addr)
4343− return ERR_PTR(-EFAULT);
4358+ return ERR_PTR_USR(-EFAULT);
43444359 return uaddr;
43454360 }
43464361
@@ -8940,6 +8955,13 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vcpu, gpa_t paddr, · 4593 unmodified lines
89408955 if (clock_type != KVM_CLOCK_PAIRING_WALLCLOCK)
89418956 return -KVM_EOPNOTSUPP;
89428957
8958+ /*
8959+ * When tsc is in permanent catchup mode guests won't be able to use
8960+ * pvclock_read_retry loop to get consistent view of pvclock
8961+ */
8962+ if (vcpu->arch.tsc_always_catchup)
8963+ return -KVM_EOPNOTSUPP;
8964+
89438965 if (!kvm_get_walltime_and_clockread(&ts, &cycle))
89448966 return -KVM_EOPNOTSUPP;
89458967
@@ -9981,7 +10003,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 1035 unmodified lines
998110003 * result in virtual interrupt delivery.
998210004 */
998310005 local_irq_disable();
9984− vcpu->mode = IN_GUEST_MODE;
10006+
10007+ /* Store vcpu->apicv_active before vcpu->mode. */
10008+ smp_store_release(&vcpu->mode, IN_GUEST_MODE);
998510009
998610010 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
998710011
@@ -10041,6 +10065,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 53 unmodified lines
1004110065 set_debugreg(0, 7);
1004210066 }
1004310067
10068+ guest_timing_enter_irqoff();
10069+
1004410070 for (;;) {
1004510071 /*
1004610072 * Assert that vCPU vs. VM APICv state is consistent. An APICv
@@ -10125,7 +10151,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 78 unmodified lines
1012510151 * of accounting via context tracking, but the loss of accuracy is
1012610152 * acceptable for all known use cases.
1012710153 */
10128− vtime_account_guest_exit();
10154+ guest_timing_exit_irqoff();
1012910155
1013010156 if (lapic_in_kernel(vcpu)) {
1013110157 s64 delta = vcpu->arch.apic->lapic_timer.advance_expire_delta;
@@ -11639,8 +11665,6 @@ void kvm_arch_sync_events(struct kvm *kvm) · 1507 unmodified lines
1163911665 kvm_free_pit(kvm);
1164011666 }
1164111667
11642−#define ERR_PTR_USR(e) ((void __user *)ERR_PTR(e))
11643−
1164411668 /**
1164511669 * __x86_set_memory_region: Setup KVM internal memory slot
1164611670 *
arch/x86/kvm/x86.h+0−45
@@ -10,51 +10,6 @@ · 9 unmodified lines
1010
1111 void kvm_spurious_fault(void);
1212
13−static __always_inline void kvm_guest_enter_irqoff(void)
14−{
15− /*
16− * VMENTER enables interrupts (host state), but the kernel state is
17− * interrupts disabled when this is invoked. Also tell RCU about
18− * it. This is the same logic as for exit_to_user_mode().
19− *
20− * This ensures that e.g. latency analysis on the host observes
21− * guest mode as interrupt enabled.
22− *
23− * guest_enter_irqoff() informs context tracking about the
24− * transition to guest mode and if enabled adjusts RCU state
25− * accordingly.
26− */
27− instrumentation_begin();
28− trace_hardirqs_on_prepare();
29− lockdep_hardirqs_on_prepare(CALLER_ADDR0);
30− instrumentation_end();
31−
32− guest_enter_irqoff();
33− lockdep_hardirqs_on(CALLER_ADDR0);
34−}
35−
36−static __always_inline void kvm_guest_exit_irqoff(void)
37−{
38− /*
39− * VMEXIT disables interrupts (host state), but tracing and lockdep
40− * have them in state 'on' as recorded before entering guest mode.
41− * Same as enter_from_user_mode().
42− *
43− * context_tracking_guest_exit() restores host context and reinstates
44− * RCU if enabled and required.
45− *
46− * This needs to be done immediately after VM-Exit, before any code
47− * that might contain tracepoints or call out to the greater world,
48− * e.g. before x86_spec_ctrl_restore_host().
49− */
50− lockdep_hardirqs_off(CALLER_ADDR0);
51− context_tracking_guest_exit();
52−
53− instrumentation_begin();
54− trace_hardirqs_off_finish();
55− instrumentation_end();
56−}
57−
5813 #define KVM_NESTED_VMENTER_CONSISTENCY_CHECK(consistency_check) \
5914 ({ \
6015 bool failed = (consistency_check); \
arch/x86/kvm/xen.c+67−30
@@ -133,32 +133,57 @@ static void kvm_xen_update_runstate(struct kvm_vcpu *v, int state) · 132 unmodified lines
133133 void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state)
134134 {
135135 struct kvm_vcpu_xen *vx = &v->arch.xen;
136+ struct gfn_to_hva_cache *ghc = &vx->runstate_cache;
137+ struct kvm_memslots *slots = kvm_memslots(v->kvm);
138+ bool atomic = (state == RUNSTATE_runnable);
136139 uint64_t state_entry_time;
137− unsigned int offset;
140+ int __user *user_state;
141+ uint64_t __user *user_times;
138142
139143 kvm_xen_update_runstate(v, state);
140144
141145 if (!vx->runstate_set)
142146 return;
143147
144− BUILD_BUG_ON(sizeof(struct compat_vcpu_runstate_info) != 0x2c);
148+ if (unlikely(slots->generation != ghc->generation || kvm_is_error_hva(ghc->hva)) &&
149+ kvm_gfn_to_hva_cache_init(v->kvm, ghc, ghc->gpa, ghc->len))
150+ return;
151+
152+ /* We made sure it fits in a single page */
153+ BUG_ON(!ghc->memslot);
154+
155+ if (atomic)
156+ pagefault_disable();
145157
146− offset = offsetof(struct compat_vcpu_runstate_info, state_entry_time);
147−#ifdef CONFIG_X86_64
148158 /*
149− * The only difference is alignment of uint64_t in 32-bit.
150− * So the first field 'state' is accessed directly using
151− * offsetof() (where its offset happens to be zero), while the
152− * remaining fields which are all uint64_t, start at 'offset'
153− * which we tweak here by adding 4.
159+ * The only difference between 32-bit and 64-bit versions of the
160+ * runstate struct us the alignment of uint64_t in 32-bit, which
161+ * means that the 64-bit version has an additional 4 bytes of
162+ * padding after the first field 'state'.
163+ *
164+ * So we use 'int __user *user_state' to point to the state field,
165+ * and 'uint64_t __user *user_times' for runstate_entry_time. So
166+ * the actual array of time[] in each state starts at user_times[1].
154167 */
168+ BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, state) != 0);
169+ BUILD_BUG_ON(offsetof(struct compat_vcpu_runstate_info, state) != 0);
170+ user_state = (int __user *)ghc->hva;
171+
172+ BUILD_BUG_ON(sizeof(struct compat_vcpu_runstate_info) != 0x2c);
173+
174+ user_times = (uint64_t __user *)(ghc->hva +
175+ offsetof(struct compat_vcpu_runstate_info,
176+ state_entry_time));
177+#ifdef CONFIG_X86_64
155178 BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, state_entry_time) !=
156179 offsetof(struct compat_vcpu_runstate_info, state_entry_time) + 4);
157180 BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, time) !=
158181 offsetof(struct compat_vcpu_runstate_info, time) + 4);
159182
160183 if (v->kvm->arch.xen.long_mode)
161− offset = offsetof(struct vcpu_runstate_info, state_entry_time);
184+ user_times = (uint64_t __user *)(ghc->hva +
185+ offsetof(struct vcpu_runstate_info,
186+ state_entry_time));
162187 #endif
163188 /*
164189 * First write the updated state_entry_time at the appropriate
@@ -172,10 +197,8 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 7 unmodified lines
172197 BUILD_BUG_ON(sizeof_field(struct compat_vcpu_runstate_info, state_entry_time) !=
173198 sizeof(state_entry_time));
174199
175− if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache,
176− &state_entry_time, offset,
177− sizeof(state_entry_time)))
178− return;
200+ if (__put_user(state_entry_time, user_times))
201+ goto out;
179202 smp_wmb();
180203
181204 /*
@@ -189,11 +212,8 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 7 unmodified lines
189212 BUILD_BUG_ON(sizeof_field(struct compat_vcpu_runstate_info, state) !=
190213 sizeof(vx->current_runstate));
191214
192− if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache,
193− &vx->current_runstate,
194− offsetof(struct vcpu_runstate_info, state),
195− sizeof(vx->current_runstate)))
196− return;
215+ if (__put_user(vx->current_runstate, user_state))
216+ goto out;
197217
198218 /*
199219 * Write the actual runstate times immediately after the
@@ -208,24 +228,23 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 8 unmodified lines
208228 BUILD_BUG_ON(sizeof_field(struct vcpu_runstate_info, time) !=
209229 sizeof(vx->runstate_times));
210230
211− if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache,
212− &vx->runstate_times[0],
213− offset + sizeof(u64),
214− sizeof(vx->runstate_times)))
215− return;
216−
231+ if (__copy_to_user(user_times + 1, vx->runstate_times, sizeof(vx->runstate_times)))
232+ goto out;
217233 smp_wmb();
218234
219235 /*
220236 * Finally, clear the XEN_RUNSTATE_UPDATE bit in the guest's
221237 * runstate_entry_time field.
222238 */
223−
224239 state_entry_time &= ~XEN_RUNSTATE_UPDATE;
225− if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache,
226− &state_entry_time, offset,
227− sizeof(state_entry_time)))
228− return;
240+ __put_user(state_entry_time, user_times);
241+ smp_wmb();
242+
243+ out:
244+ mark_page_dirty_in_slot(v->kvm, ghc->memslot, ghc->gpa >> PAGE_SHIFT);
245+
246+ if (atomic)
247+ pagefault_enable();
229248 }
230249
231250 int __kvm_xen_has_interrupt(struct kvm_vcpu *v)
@@ -443,6 +462,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 211 unmodified lines
443462 break;
444463 }
445464
465+ /* It must fit within a single page */
466+ if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct vcpu_info) > PAGE_SIZE) {
467+ r = -EINVAL;
468+ break;
469+ }
470+
446471 r = kvm_gfn_to_hva_cache_init(vcpu->kvm,
447472 &vcpu->arch.xen.vcpu_info_cache,
448473 data->u.gpa,
@@ -460,6 +485,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 11 unmodified lines
460485 break;
461486 }
462487
488+ /* It must fit within a single page */
489+ if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct pvclock_vcpu_time_info) > PAGE_SIZE) {
490+ r = -EINVAL;
491+ break;
492+ }
493+
463494 r = kvm_gfn_to_hva_cache_init(vcpu->kvm,
464495 &vcpu->arch.xen.vcpu_time_info_cache,
465496 data->u.gpa,
@@ -481,6 +512,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 15 unmodified lines
481512 break;
482513 }
483514
515+ /* It must fit within a single page */
516+ if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct vcpu_runstate_info) > PAGE_SIZE) {
517+ r = -EINVAL;
518+ break;
519+ }
520+
484521 r = kvm_gfn_to_hva_cache_init(vcpu->kvm,
485522 &vcpu->arch.xen.runstate_cache,
486523 data->u.gpa,
arch/x86/xen/enlighten_hvm.c+11−11
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <xen/events.h>
1010 #include <xen/interface/memory.h>
1111
12+#include <asm/apic.h>
1213 #include <asm/cpu.h>
1314 #include <asm/smp.h>
1415 #include <asm/io_apic.h>
@@ -184,8 +185,7 @@ static int xen_cpu_dead_hvm(unsigned int cpu) · 169 unmodified lines
184185
185186 if (xen_have_vector_callback && xen_feature(XENFEAT_hvm_safe_pvclock))
186187 xen_teardown_timer(cpu);
187−
188− return 0;
188+ return 0;
189189 }
190190
191191 static bool no_vector_callback __initdata;
@@ -242,15 +242,14 @@ static __init int xen_parse_no_vector_callback(char *arg) · 50 unmodified lines
242242 }
243243 early_param("xen_no_vector_callback", xen_parse_no_vector_callback);
244244
245−bool __init xen_hvm_need_lapic(void)
245+static __init bool xen_x2apic_available(void)
246246 {
247− if (xen_pv_domain())
248− return false;
249− if (!xen_hvm_domain())
250− return false;
251− if (xen_feature(XENFEAT_hvm_pirqs) && xen_have_vector_callback)
252− return false;
253− return true;
247+ return x2apic_supported();
248+}
249+
250+static bool __init msi_ext_dest_id(void)
251+{
252+ return cpuid_eax(xen_cpuid_base() + 4) & XEN_HVM_CPUID_EXT_DEST_ID;
254253 }
255254
256255 static __init void xen_hvm_guest_late_init(void)
@@ -312,9 +311,10 @@ struct hypervisor_x86 x86_hyper_xen_hvm __initdata = { · 55 unmodified lines
312311 .detect = xen_platform_hvm,
313312 .type = X86_HYPER_XEN_HVM,
314313 .init.init_platform = xen_hvm_guest_init,
315− .init.x2apic_available = xen_x2apic_para_available,
314+ .init.x2apic_available = xen_x2apic_available,
316315 .init.init_mem_mapping = xen_hvm_init_mem_mapping,
317316 .init.guest_late_init = xen_hvm_guest_late_init,
317+ .init.msi_ext_dest_id = msi_ext_dest_id,
318318 .runtime.pin_vcpu = xen_pin_vcpu,
319319 .ignore_nopv = true,
320320 };
arch/x86/xen/enlighten_pv.c+0−4
@@ -1341,10 +1341,6 @@ asmlinkage __visible void __init xen_start_kernel(void) · 1340 unmodified lines
13411341
13421342 xen_acpi_sleep_register();
13431343
1344− /* Avoid searching for BIOS MP tables */
1345− x86_init.mpparse.find_smp_config = x86_init_noop;
1346− x86_init.mpparse.get_smp_config = x86_init_uint_noop;
1347−
13481344 xen_boot_params_init_edd();
13491345
13501346 #ifdef CONFIG_ACPI
arch/x86/xen/smp_pv.c+6−20
@@ -148,28 +148,12 @@ int xen_smp_intr_init_pv(unsigned int cpu) · 147 unmodified lines
148148 return rc;
149149 }
150150
151−static void __init xen_fill_possible_map(void)
152−{
153− int i, rc;
154−
155− if (xen_initial_domain())
156− return;
157−
158− for (i = 0; i < nr_cpu_ids; i++) {
159− rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
160− if (rc >= 0) {
161− num_processors++;
162− set_cpu_possible(i, true);
163− }
164− }
165−}
166−
167−static void __init xen_filter_cpu_maps(void)
151+static void __init _get_smp_config(unsigned int early)
168152 {
169153 int i, rc;
170154 unsigned int subtract = 0;
171155
172− if (!xen_initial_domain())
156+ if (early)
173157 return;
174158
175159 num_processors = 0;
@@ -210,7 +194,6 @@ static void __init xen_pv_smp_prepare_boot_cpu(void) · 34 unmodified lines
210194 * sure the old memory can be recycled. */
211195 make_lowmem_page_readwrite(xen_initial_gdt);
212196
213− xen_filter_cpu_maps();
214197 xen_setup_vcpu_info_placement();
215198
216199 /*
@@ -476,5 +459,8 @@ static const struct smp_ops xen_smp_ops __initconst = { · 259 unmodified lines
476459 void __init xen_smp_init(void)
477460 {
478461 smp_ops = xen_smp_ops;
479− xen_fill_possible_map();
462+
463+ /* Avoid searching for BIOS MP tables */
464+ x86_init.mpparse.find_smp_config = x86_init_noop;
465+ x86_init.mpparse.get_smp_config = _get_smp_config;
480466 }
arch/x86/xen/vga.c+8−8
@@ -57,6 +57,14 @@ void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size) · 56 unmodified lines
5757 screen_info->rsvd_size = info->u.vesa_lfb.rsvd_size;
5858 screen_info->rsvd_pos = info->u.vesa_lfb.rsvd_pos;
5959
60+ if (size >= offsetof(struct dom0_vga_console_info,
61+ u.vesa_lfb.ext_lfb_base)
62+ + sizeof(info->u.vesa_lfb.ext_lfb_base)
63+ && info->u.vesa_lfb.ext_lfb_base) {
64+ screen_info->ext_lfb_base = info->u.vesa_lfb.ext_lfb_base;
65+ screen_info->capabilities |= VIDEO_CAPABILITY_64BIT_BASE;
66+ }
67+
6068 if (info->video_type == XEN_VGATYPE_EFI_LFB) {
6169 screen_info->orig_video_isVGA = VIDEO_TYPE_EFI;
6270 break;
@@ -66,14 +74,6 @@ void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size) · 3 unmodified lines
6674 u.vesa_lfb.mode_attrs)
6775 + sizeof(info->u.vesa_lfb.mode_attrs))
6876 screen_info->vesa_attributes = info->u.vesa_lfb.mode_attrs;
69−
70− if (size >= offsetof(struct dom0_vga_console_info,
71− u.vesa_lfb.ext_lfb_base)
72− + sizeof(info->u.vesa_lfb.ext_lfb_base)
73− && info->u.vesa_lfb.ext_lfb_base) {
74− screen_info->ext_lfb_base = info->u.vesa_lfb.ext_lfb_base;
75− screen_info->capabilities |= VIDEO_CAPABILITY_64BIT_BASE;
76− }
7777 break;
7878 }
7979 }
block/bfq-iosched.c+2−0
@@ -7018,6 +7018,8 @@ static void bfq_exit_queue(struct elevator_queue *e) · 7017 unmodified lines
70187018 spin_unlock_irq(&bfqd->lock);
70197019 #endif
70207020
7021+ wbt_enable_default(bfqd->queue);
7022+
70217023 kfree(bfqd);
70227024 }
70237025
block/bio-integrity.c+1−1
@@ -373,7 +373,7 @@ void bio_integrity_advance(struct bio *bio, unsigned int bytes_done) · 372 unmodified lines
373373 struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
374374 unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9);
375375
376− bip->bip_iter.bi_sector += bytes_done >> 9;
376+ bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9);
377377 bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes);
378378 }
379379
block/blk-core.c+2−8
@@ -284,13 +284,6 @@ void blk_queue_start_drain(struct request_queue *q) · 283 unmodified lines
284284 wake_up_all(&q->mq_freeze_wq);
285285 }
286286
287−void blk_set_queue_dying(struct request_queue *q)
288−{
289− blk_queue_flag_set(QUEUE_FLAG_DYING, q);
290− blk_queue_start_drain(q);
291−}
292−EXPORT_SYMBOL_GPL(blk_set_queue_dying);
293−
294287 /**
295288 * blk_cleanup_queue - shutdown a request queue
296289 * @q: request queue to shutdown
@@ -308,7 +301,8 @@ void blk_cleanup_queue(struct request_queue *q) · 11 unmodified lines
308301 WARN_ON_ONCE(blk_queue_registered(q));
309302
310303 /* mark @q DYING, no new request or merges will be allowed afterwards */
311− blk_set_queue_dying(q);
304+ blk_queue_flag_set(QUEUE_FLAG_DYING, q);
305+ blk_queue_start_drain(q);
312306
313307 blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q);
314308 blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q);
block/blk-map.c+1−1
@@ -446,7 +446,7 @@ static struct bio *bio_copy_kern(struct request_queue *q, void *data, · 445 unmodified lines
446446 if (bytes > len)
447447 bytes = len;
448448
449− page = alloc_page(GFP_NOIO | gfp_mask);
449+ page = alloc_page(GFP_NOIO | __GFP_ZERO | gfp_mask);
450450 if (!page)
451451 goto cleanup;
452452
block/blk-mq.c+4−0
@@ -736,6 +736,10 @@ static void blk_complete_request(struct request *req) · 735 unmodified lines
736736
737737 /* Completion has already been traced */
738738 bio_clear_flag(bio, BIO_TRACE_COMPLETION);
739+
740+ if (req_op(req) == REQ_OP_ZONE_APPEND)
741+ bio->bi_iter.bi_sector = req->__sector;
742+
739743 if (!is_flush)
740744 bio_endio(bio);
741745 bio = next;
block/elevator.c+0−2
@@ -525,8 +525,6 @@ void elv_unregister_queue(struct request_queue *q) · 524 unmodified lines
525525 kobject_del(&e->kobj);
526526
527527 e->registered = 0;
528− /* Re-enable throttling in case elevator disabled it */
529− wbt_enable_default(q);
530528 }
531529 }
532530
block/fops.c+21−14
@@ -289,6 +289,8 @@ static void blkdev_bio_end_io_async(struct bio *bio) · 288 unmodified lines
289289 struct kiocb *iocb = dio->iocb;
290290 ssize_t ret;
291291
292+ WRITE_ONCE(iocb->private, NULL);
293+
292294 if (likely(!bio->bi_status)) {
293295 ret = dio->size;
294296 iocb->ki_pos += ret;
@@ -566,34 +568,37 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) · 271 unmodified lines
566568 {
567569 struct block_device *bdev = iocb->ki_filp->private_data;
568570 loff_t size = bdev_nr_bytes(bdev);
569− size_t count = iov_iter_count(to);
570571 loff_t pos = iocb->ki_pos;
571572 size_t shorted = 0;
572573 ssize_t ret = 0;
574+ size_t count;
573575
574− if (unlikely(pos + count > size)) {
576+ if (unlikely(pos + iov_iter_count(to) > size)) {
575577 if (pos >= size)
576578 return 0;
577579 size -= pos;
578− if (count > size) {
579− shorted = count - size;
580− iov_iter_truncate(to, size);
581− }
580+ shorted = iov_iter_count(to) - size;
581+ iov_iter_truncate(to, size);
582582 }
583583
584+ count = iov_iter_count(to);
585+ if (!count)
586+ goto reexpand; /* skip atime */
587+
584588 if (iocb->ki_flags & IOCB_DIRECT) {
585589 struct address_space *mapping = iocb->ki_filp->f_mapping;
586590
587591 if (iocb->ki_flags & IOCB_NOWAIT) {
588− if (filemap_range_needs_writeback(mapping, iocb->ki_pos,
589− iocb->ki_pos + count - 1))
590− return -EAGAIN;
592+ if (filemap_range_needs_writeback(mapping, pos,
593+ pos + count - 1)) {
594+ ret = -EAGAIN;
595+ goto reexpand;
596+ }
591597 } else {
592− ret = filemap_write_and_wait_range(mapping,
593− iocb->ki_pos,
594− iocb->ki_pos + count - 1);
598+ ret = filemap_write_and_wait_range(mapping, pos,
599+ pos + count - 1);
595600 if (ret < 0)
596− return ret;
601+ goto reexpand;
597602 }
598603
599604 file_accessed(iocb->ki_filp);
@@ -603,12 +608,14 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) · 3 unmodified lines
603608 iocb->ki_pos += ret;
604609 count -= ret;
605610 }
611+ iov_iter_revert(to, count - iov_iter_count(to));
606612 if (ret < 0 || !count)
607− return ret;
613+ goto reexpand;
608614 }
609615
610616 ret = filemap_read(iocb, to, ret);
611617
618+reexpand:
612619 if (unlikely(shorted))
613620 iov_iter_reexpand(to, iov_iter_count(to) + shorted);
614621 return ret;
block/genhd.c+14−0
@@ -548,6 +548,20 @@ out_free_ext_minor: · 547 unmodified lines
548548 }
549549 EXPORT_SYMBOL(device_add_disk);
550550
551+/**
552+ * blk_mark_disk_dead - mark a disk as dead
553+ * @disk: disk to mark as dead
554+ *
555+ * Mark as disk as dead (e.g. surprise removed) and don't accept any new I/O
556+ * to this disk.
557+ */
558+void blk_mark_disk_dead(struct gendisk *disk)
559+{
560+ set_bit(GD_DEAD, &disk->state);
561+ blk_queue_start_drain(disk->queue);
562+}
563+EXPORT_SYMBOL_GPL(blk_mark_disk_dead);
564+
551565 /**
552566 * del_gendisk - remove the gendisk
553567 * @disk: the struct gendisk to remove
crypto/af_alg.c+0−3
@@ -25,12 +25,9 @@ struct alg_type_list { · 24 unmodified lines
2525 struct list_head list;
2626 };
2727
28−static atomic_long_t alg_memory_allocated;
29−
3028 static struct proto alg_proto = {
3129 .name = "ALG",
3230 .owner = THIS_MODULE,
33− .memory_allocated = &alg_memory_allocated,
3431 .obj_size = sizeof(struct alg_sock),
3532 };
3633
crypto/algapi.c+1−0
@@ -1324,3 +1324,4 @@ module_exit(crypto_algapi_exit); · 1323 unmodified lines
13241324
13251325 MODULE_LICENSE("GPL");
13261326 MODULE_DESCRIPTION("Cryptographic algorithms API");
1327+MODULE_SOFTDEP("pre: cryptomgr");
crypto/api.c+0−1
@@ -643,4 +643,3 @@ EXPORT_SYMBOL_GPL(crypto_req_done); · 642 unmodified lines
643643
644644 MODULE_DESCRIPTION("Cryptographic core API");
645645 MODULE_LICENSE("GPL");
646−MODULE_SOFTDEP("pre: cryptomgr");
crypto/blake2s_generic.c+2−2
@@ -15,12 +15,12 @@ · 14 unmodified lines
1515 static int crypto_blake2s_update_generic(struct shash_desc *desc,
1616 const u8 *in, unsigned int inlen)
1717 {
18− return crypto_blake2s_update(desc, in, inlen, blake2s_compress_generic);
18+ return crypto_blake2s_update(desc, in, inlen, true);
1919 }
2020
2121 static int crypto_blake2s_final_generic(struct shash_desc *desc, u8 *out)
2222 {
23− return crypto_blake2s_final(desc, out, blake2s_compress_generic);
23+ return crypto_blake2s_final(desc, out, true);
2424 }
2525
2626 #define BLAKE2S_ALG(name, driver_name, digest_size) \
drivers/accessibility/speakup/speakup_dectlk.c+1−0
@@ -44,6 +44,7 @@ static struct var_t vars[] = { · 43 unmodified lines
4444 { CAPS_START, .u.s = {"[:dv ap 160] " } },
4545 { CAPS_STOP, .u.s = {"[:dv ap 100 ] " } },
4646 { RATE, .u.n = {"[:ra %d] ", 180, 75, 650, 0, 0, NULL } },
47+ { PITCH, .u.n = {"[:dv ap %d] ", 122, 50, 350, 0, 0, NULL } },
4748 { INFLECTION, .u.n = {"[:dv pr %d] ", 100, 0, 10000, 0, 0, NULL } },
4849 { VOL, .u.n = {"[:dv g5 %d] ", 86, 60, 86, 0, 0, NULL } },
4950 { PUNCT, .u.n = {"[:pu %c] ", 0, 0, 2, 0, 0, "nsa" } },
drivers/acpi/Kconfig+1−0
@@ -11,6 +11,7 @@ menuconfig ACPI · 10 unmodified lines
1111 depends on ARCH_SUPPORTS_ACPI
1212 select PNP
1313 select NLS
14+ select CRC32
1415 default y if X86
1516 help
1617 Advanced Configuration and Power Interface (ACPI) support for
drivers/acpi/arm64/iort.c+11−3
@@ -1361,9 +1361,17 @@ static void __init arm_smmu_v3_pmcg_init_resources(struct resource *res, · 1360 unmodified lines
13611361 res[0].start = pmcg->page0_base_address;
13621362 res[0].end = pmcg->page0_base_address + SZ_4K - 1;
13631363 res[0].flags = IORESOURCE_MEM;
1364− res[1].start = pmcg->page1_base_address;
1365− res[1].end = pmcg->page1_base_address + SZ_4K - 1;
1366− res[1].flags = IORESOURCE_MEM;
1364+ /*
1365+ * The initial version in DEN0049C lacked a way to describe register
1366+ * page 1, which makes it broken for most PMCG implementations; in
1367+ * that case, just let the driver fail gracefully if it expects to
1368+ * find a second memory resource.
1369+ */
1370+ if (node->revision > 0) {
1371+ res[1].start = pmcg->page1_base_address;
1372+ res[1].end = pmcg->page1_base_address + SZ_4K - 1;
1373+ res[1].flags = IORESOURCE_MEM;
1374+ }
13671375
13681376 if (pmcg->overflow_gsiv)
13691377 acpi_iort_register_irq(pmcg->overflow_gsiv, "overflow",
drivers/acpi/ec.c+10−0
@@ -2065,6 +2065,16 @@ bool acpi_ec_dispatch_gpe(void) · 2064 unmodified lines
20652065 if (acpi_any_gpe_status_set(first_ec->gpe))
20662066 return true;
20672067
2068+ /*
2069+ * Cancel the SCI wakeup and process all pending events in case there
2070+ * are any wakeup ones in there.
2071+ *
2072+ * Note that if any non-EC GPEs are active at this point, the SCI will
2073+ * retrigger after the rearming in acpi_s2idle_wake(), so no events
2074+ * should be missed by canceling the wakeup here.
2075+ */
2076+ pm_system_cancel_wakeup();
2077+
20682078 /*
20692079 * Dispatch the EC GPE in-band, but do not report wakeup in any case
20702080 * to allow the caller to process events properly after that.
drivers/acpi/processor_idle.c+5−0
@@ -96,6 +96,11 @@ static const struct dmi_system_id processor_power_dmi_table[] = { · 95 unmodified lines
9696 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
9797 DMI_MATCH(DMI_PRODUCT_NAME,"L8400B series Notebook PC")},
9898 (void *)1},
99+ /* T40 can not handle C3 idle state */
100+ { set_max_cstate, "IBM ThinkPad T40", {
101+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
102+ DMI_MATCH(DMI_PRODUCT_NAME, "23737CU")},
103+ (void *)2},
99104 {},
100105 };
101106
drivers/acpi/sleep.c+5−10
@@ -736,21 +736,15 @@ bool acpi_s2idle_wake(void) · 735 unmodified lines
736736 return true;
737737 }
738738
739− /* Check non-EC GPE wakeups and dispatch the EC GPE. */
739+ /*
740+ * Check non-EC GPE wakeups and if there are none, cancel the
741+ * SCI-related wakeup and dispatch the EC GPE.
742+ */
740743 if (acpi_ec_dispatch_gpe()) {
741744 pm_pr_dbg("ACPI non-EC GPE wakeup\n");
742745 return true;
743746 }
744747
745− /*
746− * Cancel the SCI wakeup and process all pending events in case
747− * there are any wakeup ones in there.
748− *
749− * Note that if any non-EC GPEs are active at this point, the
750− * SCI will retrigger after the rearming below, so no events
751− * should be missed by canceling the wakeup here.
752− */
753− pm_system_cancel_wakeup();
754748 acpi_os_wait_events_complete();
755749
756750 /*
@@ -764,6 +758,7 @@ bool acpi_s2idle_wake(void) · 7 unmodified lines
764758 return true;
765759 }
766760
761+ pm_wakeup_clear(acpi_sci_irq);
767762 rearm_wake_irq(acpi_sci_irq);
768763 }
769764
drivers/acpi/tables.c+1−1
@@ -400,7 +400,7 @@ int __init_or_acpilib acpi_table_parse_entries_array( · 399 unmodified lines
400400
401401 acpi_get_table(id, instance, &table_header);
402402 if (!table_header) {
403− pr_warn("%4.4s not present\n", id);
403+ pr_debug("%4.4s not present\n", id);
404404 return -ENODEV;
405405 }
406406
drivers/acpi/x86/s2idle.c+4−8
@@ -424,15 +424,11 @@ static int lps0_device_attach(struct acpi_device *adev, · 423 unmodified lines
424424 mem_sleep_current = PM_SUSPEND_TO_IDLE;
425425
426426 /*
427− * Some Intel based LPS0 systems, like ASUS Zenbook UX430UNR/i7-8550U don't
428− * use intel-hid or intel-vbtn but require the EC GPE to be enabled while
429− * suspended for certain wakeup devices to work, so mark it as wakeup-capable.
430− *
431− * Only enable on !AMD as enabling this universally causes problems for a number
432− * of AMD based systems.
427+ * Some LPS0 systems, like ASUS Zenbook UX430UNR/i7-8550U, require the
428+ * EC GPE to be enabled while suspended for certain wakeup devices to
429+ * work, so mark it as wakeup-capable.
433430 */
434− if (!acpi_s2idle_vendor_amd())
435− acpi_ec_mark_gpe_for_wake();
431+ acpi_ec_mark_gpe_for_wake();
436432
437433 return 0;
438434 }
drivers/ata/libata-core.c+17−8
@@ -2007,6 +2007,9 @@ static bool ata_log_supported(struct ata_device *dev, u8 log) · 2006 unmodified lines
20072007 {
20082008 struct ata_port *ap = dev->link->ap;
20092009
2010+ if (dev->horkage & ATA_HORKAGE_NO_LOG_DIR)
2011+ return false;
2012+
20102013 if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1))
20112014 return false;
20122015 return get_unaligned_le16(&ap->sector_buf[log * 2]) ? true : false;
@@ -2445,23 +2448,21 @@ static void ata_dev_config_cpr(struct ata_device *dev) · 432 unmodified lines
24452448 struct ata_cpr_log *cpr_log = NULL;
24462449 u8 *desc, *buf = NULL;
24472450
2448− if (!ata_identify_page_supported(dev,
2449− ATA_LOG_CONCURRENT_POSITIONING_RANGES))
2451+ if (ata_id_major_version(dev->id) < 11 ||
2452+ !ata_log_supported(dev, ATA_LOG_CONCURRENT_POSITIONING_RANGES))
24502453 goto out;
24512454
24522455 /*
2453− * Read IDENTIFY DEVICE data log, page 0x47
2454− * (concurrent positioning ranges). We can have at most 255 32B range
2455− * descriptors plus a 64B header.
2456+ * Read the concurrent positioning ranges log (0x47). We can have at
2457+ * most 255 32B range descriptors plus a 64B header.
24562458 */
24572459 buf_len = (64 + 255 * 32 + 511) & ~511;
24582460 buf = kzalloc(buf_len, GFP_KERNEL);
24592461 if (!buf)
24602462 goto out;
24612463
2462− err_mask = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE,
2463− ATA_LOG_CONCURRENT_POSITIONING_RANGES,
2464− buf, buf_len >> 9);
2464+ err_mask = ata_read_log_page(dev, ATA_LOG_CONCURRENT_POSITIONING_RANGES,
2465+ 0, buf, buf_len >> 9);
24652466 if (err_mask)
24662467 goto out;
24672468
@@ -4028,6 +4029,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 1560 unmodified lines
40284029
40294030 /* devices that don't properly handle TRIM commands */
40304031 { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, },
4032+ { "M88V29*", NULL, ATA_HORKAGE_NOTRIM, },
40314033
40324034 /*
40334035 * As defined, the DRAT (Deterministic Read After Trim) and RZAT
@@ -4073,6 +4075,13 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 39 unmodified lines
40734075 { "WDC WD3000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
40744076 { "WDC WD3200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
40754077
4078+ /*
4079+ * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY
4080+ * log page is accessed. Ensure we never ask for this log page with
4081+ * these devices.
4082+ */
4083+ { "SATADOM-ML 3ME", NULL, ATA_HORKAGE_NO_LOG_DIR },
4084+
40764085 /* End Marker */
40774086 { }
40784087 };
drivers/ata/pata_hpt37x.c+16−2
@@ -919,6 +919,20 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) · 918 unmodified lines
919919 irqmask &= ~0x10;
920920 pci_write_config_byte(dev, 0x5a, irqmask);
921921
922+ /*
923+ * HPT371 chips physically have only one channel, the secondary one,
924+ * but the primary channel registers do exist! Go figure...
925+ * So, we manually disable the non-existing channel here
926+ * (if the BIOS hasn't done this already).
927+ */
928+ if (dev->device == PCI_DEVICE_ID_TTI_HPT371) {
929+ u8 mcr1;
930+
931+ pci_read_config_byte(dev, 0x50, &mcr1);
932+ mcr1 &= ~0x04;
933+ pci_write_config_byte(dev, 0x50, mcr1);
934+ }
935+
922936 /*
923937 * default to pci clock. make sure MA15/16 are set to output
924938 * to prevent drives having problems with 40-pin cables. Needed
@@ -950,14 +964,14 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) · 25 unmodified lines
950964
951965 if ((freq >> 12) != 0xABCDE) {
952966 int i;
953− u8 sr;
967+ u16 sr;
954968 u32 total = 0;
955969
956970 dev_warn(&dev->dev, "BIOS has not set timing clocks\n");
957971
958972 /* This is the process the HPT371 BIOS is reported to use */
959973 for (i = 0; i < 128; i++) {
960− pci_read_config_byte(dev, 0x78, &sr);
974+ pci_read_config_word(dev, 0x78, &sr);
961975 total += sr & 0x1FF;
962976 udelay(15);
963977 }
drivers/ata/sata_fsl.c+7−9
@@ -322,7 +322,7 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host, · 321 unmodified lines
322322 static ssize_t fsl_sata_intr_coalescing_show(struct device *dev,
323323 struct device_attribute *attr, char *buf)
324324 {
325− return sysfs_emit(buf, "%d %d\n",
325+ return sysfs_emit(buf, "%u %u\n",
326326 intr_coalescing_count, intr_coalescing_ticks);
327327 }
328328
@@ -332,10 +332,8 @@ static ssize_t fsl_sata_intr_coalescing_store(struct device *dev, · 3 unmodified lines
332332 {
333333 unsigned int coalescing_count, coalescing_ticks;
334334
335− if (sscanf(buf, "%d%d",
336− &coalescing_count,
337− &coalescing_ticks) != 2) {
338− printk(KERN_ERR "fsl-sata: wrong parameter format.\n");
335+ if (sscanf(buf, "%u%u", &coalescing_count, &coalescing_ticks) != 2) {
336+ dev_err(dev, "fsl-sata: wrong parameter format.\n");
339337 return -EINVAL;
340338 }
341339
@@ -359,7 +357,7 @@ static ssize_t fsl_sata_rx_watermark_show(struct device *dev, · 17 unmodified lines
359357 rx_watermark &= 0x1f;
360358 spin_unlock_irqrestore(&host->lock, flags);
361359
362− return sysfs_emit(buf, "%d\n", rx_watermark);
360+ return sysfs_emit(buf, "%u\n", rx_watermark);
363361 }
364362
365363 static ssize_t fsl_sata_rx_watermark_store(struct device *dev,
@@ -373,8 +371,8 @@ static ssize_t fsl_sata_rx_watermark_store(struct device *dev, · 7 unmodified lines
373371 void __iomem *csr_base = host_priv->csr_base;
374372 u32 temp;
375373
376− if (sscanf(buf, "%d", &rx_watermark) != 1) {
377− printk(KERN_ERR "fsl-sata: wrong parameter format.\n");
374+ if (kstrtouint(buf, 10, &rx_watermark) < 0) {
375+ dev_err(dev, "fsl-sata: wrong parameter format.\n");
378376 return -EINVAL;
379377 }
380378
@@ -382,8 +380,8 @@ static ssize_t fsl_sata_rx_watermark_store(struct device *dev, · 1 unmodified line
382380 temp = ioread32(csr_base + TRANSCFG);
383381 temp &= 0xffffffe0;
384382 iowrite32(temp | rx_watermark, csr_base + TRANSCFG);
385−
386383 spin_unlock_irqrestore(&host->lock, flags);
384+
387385 return strlen(buf);
388386 }
389387
drivers/base/dd.c+5−0
@@ -629,6 +629,9 @@ re_probe: · 628 unmodified lines
629629 drv->remove(dev);
630630
631631 devres_release_all(dev);
632+ arch_teardown_dma_ops(dev);
633+ kfree(dev->dma_range_map);
634+ dev->dma_range_map = NULL;
632635 driver_sysfs_remove(dev);
633636 dev->driver = NULL;
634637 dev_set_drvdata(dev, NULL);
@@ -1209,6 +1212,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) · 574 unmodified lines
12091212
12101213 devres_release_all(dev);
12111214 arch_teardown_dma_ops(dev);
1215+ kfree(dev->dma_range_map);
1216+ dev->dma_range_map = NULL;
12121217 dev->driver = NULL;
12131218 dev_set_drvdata(dev, NULL);
12141219 if (dev->pm_domain && dev->pm_domain->dismiss)
drivers/base/power/wakeup.c+34−7
@@ -34,7 +34,8 @@ suspend_state_t pm_suspend_target_state; · 33 unmodified lines
3434 bool events_check_enabled __read_mostly;
3535
3636 /* First wakeup IRQ seen by the kernel in the last cycle. */
37−unsigned int pm_wakeup_irq __read_mostly;
37+static unsigned int wakeup_irq[2] __read_mostly;
38+static DEFINE_RAW_SPINLOCK(wakeup_irq_lock);
3839
3940 /* If greater than 0 and the system is suspending, terminate the suspend. */
4041 static atomic_t pm_abort_suspend __read_mostly;
@@ -942,19 +943,45 @@ void pm_system_cancel_wakeup(void) · 901 unmodified lines
942943 atomic_dec_if_positive(&pm_abort_suspend);
943944 }
944945
945−void pm_wakeup_clear(bool reset)
946+void pm_wakeup_clear(unsigned int irq_number)
946947 {
947− pm_wakeup_irq = 0;
948− if (reset)
948+ raw_spin_lock_irq(&wakeup_irq_lock);
949+
950+ if (irq_number && wakeup_irq[0] == irq_number)
951+ wakeup_irq[0] = wakeup_irq[1];
952+ else
953+ wakeup_irq[0] = 0;
954+
955+ wakeup_irq[1] = 0;
956+
957+ raw_spin_unlock_irq(&wakeup_irq_lock);
958+
959+ if (!irq_number)
949960 atomic_set(&pm_abort_suspend, 0);
950961 }
951962
952963 void pm_system_irq_wakeup(unsigned int irq_number)
953964 {
954− if (pm_wakeup_irq == 0) {
955− pm_wakeup_irq = irq_number;
965+ unsigned long flags;
966+
967+ raw_spin_lock_irqsave(&wakeup_irq_lock, flags);
968+
969+ if (wakeup_irq[0] == 0)
970+ wakeup_irq[0] = irq_number;
971+ else if (wakeup_irq[1] == 0)
972+ wakeup_irq[1] = irq_number;
973+ else
974+ irq_number = 0;
975+
976+ raw_spin_unlock_irqrestore(&wakeup_irq_lock, flags);
977+
978+ if (irq_number)
956979 pm_system_wakeup();
957− }
980+}
981+
982+unsigned int pm_wakeup_irq(void)
983+{
984+ return wakeup_irq[0];
958985 }
959986
960987 /**
drivers/base/regmap/regmap-irq.c+6−14
@@ -189,11 +189,9 @@ static void regmap_irq_sync_unlock(struct irq_data *data) · 188 unmodified lines
189189 ret = regmap_write(map, reg, d->mask_buf[i]);
190190 if (d->chip->clear_ack) {
191191 if (d->chip->ack_invert && !ret)
192− ret = regmap_write(map, reg,
193− d->mask_buf[i]);
192+ ret = regmap_write(map, reg, UINT_MAX);
194193 else if (!ret)
195− ret = regmap_write(map, reg,
196− ~d->mask_buf[i]);
194+ ret = regmap_write(map, reg, 0);
197195 }
198196 if (ret != 0)
199197 dev_err(d->map->dev, "Failed to ack 0x%x: %d\n",
@@ -556,11 +554,9 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) · 356 unmodified lines
556554 data->status_buf[i]);
557555 if (chip->clear_ack) {
558556 if (chip->ack_invert && !ret)
559− ret = regmap_write(map, reg,
560− data->status_buf[i]);
557+ ret = regmap_write(map, reg, UINT_MAX);
561558 else if (!ret)
562− ret = regmap_write(map, reg,
563− ~data->status_buf[i]);
559+ ret = regmap_write(map, reg, 0);
564560 }
565561 if (ret != 0)
566562 dev_err(map->dev, "Failed to ack 0x%x: %d\n",
@@ -817,13 +813,9 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, · 250 unmodified lines
817813 d->status_buf[i] & d->mask_buf[i]);
818814 if (chip->clear_ack) {
819815 if (chip->ack_invert && !ret)
820− ret = regmap_write(map, reg,
821− (d->status_buf[i] &
822− d->mask_buf[i]));
816+ ret = regmap_write(map, reg, UINT_MAX);
823817 else if (!ret)
824− ret = regmap_write(map, reg,
825− ~(d->status_buf[i] &
826− d->mask_buf[i]));
818+ ret = regmap_write(map, reg, 0);
827819 }
828820 if (ret != 0) {
829821 dev_err(map->dev, "Failed to ack 0x%x: %d\n",
drivers/block/loop.c+36−37
@@ -79,6 +79,7 @@ · 78 unmodified lines
7979 #include <linux/ioprio.h>
8080 #include <linux/blk-cgroup.h>
8181 #include <linux/sched/mm.h>
82+#include <linux/statfs.h>
8283
8384 #include "loop.h"
8485
@@ -774,8 +775,13 @@ static void loop_config_discard(struct loop_device *lo) · 689 unmodified lines
774775 granularity = 0;
775776
776777 } else {
778+ struct kstatfs sbuf;
779+
777780 max_discard_sectors = UINT_MAX >> 9;
778− granularity = inode->i_sb->s_blocksize;
781+ if (!vfs_statfs(&file->f_path, &sbuf))
782+ granularity = sbuf.f_bsize;
783+ else
784+ max_discard_sectors = 0;
779785 }
780786
781787 if (max_discard_sectors) {
@@ -1082,7 +1088,7 @@ out_putf: · 300 unmodified lines
10821088 return error;
10831089 }
10841090
1085−static void __loop_clr_fd(struct loop_device *lo)
1091+static void __loop_clr_fd(struct loop_device *lo, bool release)
10861092 {
10871093 struct file *filp;
10881094 gfp_t gfp = lo->old_gfp_mask;
@@ -1144,6 +1150,8 @@ static void __loop_clr_fd(struct loop_device *lo) · 55 unmodified lines
11441150 /* let user-space know about this change */
11451151 kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
11461152 mapping_set_gfp_mask(filp->f_mapping, gfp);
1153+ /* This is safe: open() is still holding a reference. */
1154+ module_put(THIS_MODULE);
11471155 blk_mq_unfreeze_queue(lo->lo_queue);
11481156
11491157 disk_force_media_change(lo->lo_disk, DISK_EVENT_MEDIA_CHANGE);
@@ -1151,52 +1159,44 @@ static void __loop_clr_fd(struct loop_device *lo) · 1 unmodified line
11511159 if (lo->lo_flags & LO_FLAGS_PARTSCAN) {
11521160 int err;
11531161
1154− mutex_lock(&lo->lo_disk->open_mutex);
1162+ /*
1163+ * open_mutex has been held already in release path, so don't
1164+ * acquire it if this function is called in such case.
1165+ *
1166+ * If the reread partition isn't from release path, lo_refcnt
1167+ * must be at least one and it can only become zero when the
1168+ * current holder is released.
1169+ */
1170+ if (!release)
1171+ mutex_lock(&lo->lo_disk->open_mutex);
11551172 err = bdev_disk_changed(lo->lo_disk, false);
1156− mutex_unlock(&lo->lo_disk->open_mutex);
1173+ if (!release)
1174+ mutex_unlock(&lo->lo_disk->open_mutex);
11571175 if (err)
11581176 pr_warn("%s: partition scan of loop%d failed (rc=%d)\n",
11591177 __func__, lo->lo_number, err);
11601178 /* Device is gone, no point in returning error */
11611179 }
11621180
1181+ /*
1182+ * lo->lo_state is set to Lo_unbound here after above partscan has
1183+ * finished. There cannot be anybody else entering __loop_clr_fd() as
1184+ * Lo_rundown state protects us from all the other places trying to
1185+ * change the 'lo' device.
1186+ */
11631187 lo->lo_flags = 0;
11641188 if (!part_shift)
11651189 lo->lo_disk->flags |= GENHD_FL_NO_PART;
1166−
1167− fput(filp);
1168−}
1169−
1170−static void loop_rundown_completed(struct loop_device *lo)
1171−{
11721190 mutex_lock(&lo->lo_mutex);
11731191 lo->lo_state = Lo_unbound;
11741192 mutex_unlock(&lo->lo_mutex);
1175− module_put(THIS_MODULE);
1176−}
1177−
1178−static void loop_rundown_workfn(struct work_struct *work)
1179−{
1180− struct loop_device *lo = container_of(work, struct loop_device,
1181− rundown_work);
1182− struct block_device *bdev = lo->lo_device;
1183− struct gendisk *disk = lo->lo_disk;
1184−
1185− __loop_clr_fd(lo);
1186− kobject_put(&bdev->bd_device.kobj);
1187− module_put(disk->fops->owner);
1188− loop_rundown_completed(lo);
1189−}
1190−
1191−static void loop_schedule_rundown(struct loop_device *lo)
1192−{
1193− struct block_device *bdev = lo->lo_device;
1194− struct gendisk *disk = lo->lo_disk;
11951193
1196− __module_get(disk->fops->owner);
1197− kobject_get(&bdev->bd_device.kobj);
1198− INIT_WORK(&lo->rundown_work, loop_rundown_workfn);
1199− queue_work(system_long_wq, &lo->rundown_work);
1194+ /*
1195+ * Need not hold lo_mutex to fput backing file. Calling fput holding
1196+ * lo_mutex triggers a circular lock dependency possibility warning as
1197+ * fput can take open_mutex which is usually taken before lo_mutex.
1198+ */
1199+ fput(filp);
12001200 }
12011201
12021202 static int loop_clr_fd(struct loop_device *lo)
@@ -1228,8 +1228,7 @@ static int loop_clr_fd(struct loop_device *lo) · 25 unmodified lines
12281228 lo->lo_state = Lo_rundown;
12291229 mutex_unlock(&lo->lo_mutex);
12301230
1231− __loop_clr_fd(lo);
1232− loop_rundown_completed(lo);
1231+ __loop_clr_fd(lo, false);
12331232 return 0;
12341233 }
12351234
@@ -1754,7 +1753,7 @@ static void lo_release(struct gendisk *disk, fmode_t mode) · 518 unmodified lines
17541753 * In autoclear mode, stop the loop thread
17551754 * and remove configuration after last close.
17561755 */
1757− loop_schedule_rundown(lo);
1756+ __loop_clr_fd(lo, true);
17581757 return;
17591758 } else if (lo->lo_state == Lo_bound) {
17601759 /*
drivers/block/loop.h+0−1
@@ -56,7 +56,6 @@ struct loop_device { · 55 unmodified lines
5656 struct gendisk *lo_disk;
5757 struct mutex lo_mutex;
5858 bool idr_visible;
59− struct work_struct rundown_work;
6059 };
6160
6261 struct loop_cmd {
drivers/block/mtip32xx/mtip32xx.c+1−1
@@ -4112,7 +4112,7 @@ static void mtip_pci_remove(struct pci_dev *pdev) · 4111 unmodified lines
41124112 "Completion workers still active!\n");
41134113 }
41144114
4115− blk_set_queue_dying(dd->queue);
4115+ blk_mark_disk_dead(dd->disk);
41164116 set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag);
41174117
41184118 /* Clean up the block layer. */
drivers/block/rbd.c+1−1
@@ -7185,7 +7185,7 @@ static ssize_t do_rbd_remove(struct bus_type *bus, · 7184 unmodified lines
71857185 * IO to complete/fail.
71867186 */
71877187 blk_mq_freeze_queue(rbd_dev->disk->queue);
7188− blk_set_queue_dying(rbd_dev->disk->queue);
7188+ blk_mark_disk_dead(rbd_dev->disk);
71897189 }
71907190
71917191 del_gendisk(rbd_dev->disk);
drivers/block/xen-blkfront.c+1−1
@@ -2126,7 +2126,7 @@ static void blkfront_closing(struct blkfront_info *info) · 2125 unmodified lines
21262126
21272127 /* No more blkif_request(). */
21282128 blk_mq_stop_hw_queues(info->rq);
2129− blk_set_queue_dying(info->rq);
2129+ blk_mark_disk_dead(info->gd);
21302130 set_capacity(info->gd, 0);
21312131
21322132 for_each_rinfo(info, rinfo, i) {
drivers/bus/mhi/pci_generic.c+2−0
@@ -366,6 +366,7 @@ static const struct mhi_pci_dev_info mhi_foxconn_sdx55_info = { · 365 unmodified lines
366366 .config = &modem_foxconn_sdx55_config,
367367 .bar_num = MHI_PCI_DEFAULT_BAR_NUM,
368368 .dma_data_width = 32,
369+ .mru_default = 32768,
369370 .sideband_wake = false,
370371 };
371372
@@ -401,6 +402,7 @@ static const struct mhi_pci_dev_info mhi_mv31_info = { · 29 unmodified lines
401402 .config = &modem_mv31_config,
402403 .bar_num = MHI_PCI_DEFAULT_BAR_NUM,
403404 .dma_data_width = 32,
405+ .mru_default = 32768,
404406 };
405407
406408 static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
drivers/char/random.c+22−17
@@ -762,7 +762,7 @@ static bool crng_init_try_arch(struct crng_state *crng) · 761 unmodified lines
762762 return arch_init;
763763 }
764764
765−static bool __init crng_init_try_arch_early(struct crng_state *crng)
765+static bool __init crng_init_try_arch_early(void)
766766 {
767767 int i;
768768 bool arch_init = true;
@@ -774,7 +774,7 @@ static bool __init crng_init_try_arch_early(struct crng_state *crng) · 5 unmodified lines
774774 rv = random_get_entropy();
775775 arch_init = false;
776776 }
777− crng->state[i] ^= rv;
777+ primary_crng.state[i] ^= rv;
778778 }
779779
780780 return arch_init;
@@ -788,22 +788,20 @@ static void crng_initialize_secondary(struct crng_state *crng) · 7 unmodified lines
788788 crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
789789 }
790790
791−static void __init crng_initialize_primary(struct crng_state *crng)
791+static void __init crng_initialize_primary(void)
792792 {
793− _extract_entropy(&crng->state[4], sizeof(u32) * 12);
794− if (crng_init_try_arch_early(crng) && trust_cpu && crng_init < 2) {
793+ _extract_entropy(&primary_crng.state[4], sizeof(u32) * 12);
794+ if (crng_init_try_arch_early() && trust_cpu && crng_init < 2) {
795795 invalidate_batched_entropy();
796796 numa_crng_init();
797797 crng_init = 2;
798798 pr_notice("crng init done (trusting CPU's manufacturer)\n");
799799 }
800− crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
800+ primary_crng.init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
801801 }
802802
803−static void crng_finalize_init(struct crng_state *crng)
803+static void crng_finalize_init(void)
804804 {
805− if (crng != &primary_crng || crng_init >= 2)
806− return;
807805 if (!system_wq) {
808806 /* We can't call numa_crng_init until we have workqueues,
809807 * so mark this for processing later. */
@@ -814,6 +812,7 @@ static void crng_finalize_init(struct crng_state *crng) · 4 unmodified lines
814812 invalidate_batched_entropy();
815813 numa_crng_init();
816814 crng_init = 2;
815+ crng_need_final_init = false;
817816 process_random_ready_list();
818817 wake_up_interruptible(&crng_init_wait);
819818 kill_fasync(&fasync, SIGIO, POLL_IN);
@@ -980,7 +979,8 @@ static void crng_reseed(struct crng_state *crng, bool use_input_pool) · 160 unmodified lines
980979 memzero_explicit(&buf, sizeof(buf));
981980 WRITE_ONCE(crng->init_time, jiffies);
982981 spin_unlock_irqrestore(&crng->lock, flags);
983− crng_finalize_init(crng);
982+ if (crng == &primary_crng && crng_init < 2)
983+ crng_finalize_init();
984984 }
985985
986986 static void _extract_crng(struct crng_state *crng, u8 out[CHACHA_BLOCK_SIZE])
@@ -1697,8 +1697,8 @@ int __init rand_initialize(void) · 710 unmodified lines
16971697 {
16981698 init_std_data();
16991699 if (crng_need_final_init)
1700− crng_finalize_init(&primary_crng);
1701− crng_initialize_primary(&primary_crng);
1700+ crng_finalize_init();
1701+ crng_initialize_primary();
17021702 crng_global_init_time = jiffies;
17031703 if (ratelimit_disable) {
17041704 urandom_warning.interval = 0;
@@ -1856,7 +1856,10 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg) · 151 unmodified lines
18561856 */
18571857 if (!capable(CAP_SYS_ADMIN))
18581858 return -EPERM;
1859− input_pool.entropy_count = 0;
1859+ if (xchg(&input_pool.entropy_count, 0) && random_write_wakeup_bits) {
1860+ wake_up_interruptible(&random_write_wait);
1861+ kill_fasync(&fasync, SIGIO, POLL_OUT);
1862+ }
18601863 return 0;
18611864 case RNDRESEEDCRNG:
18621865 if (!capable(CAP_SYS_ADMIN))
@@ -2205,13 +2208,15 @@ void add_hwgenerator_randomness(const char *buffer, size_t count, · 342 unmodified lines
22052208 return;
22062209 }
22072210
2208− /* Suspend writing if we're above the trickle threshold.
2211+ /* Throttle writing if we're above the trickle threshold.
22092212 * We'll be woken up again once below random_write_wakeup_thresh,
2210− * or when the calling thread is about to terminate.
2213+ * when the calling thread is about to terminate, or once
2214+ * CRNG_RESEED_INTERVAL has lapsed.
22112215 */
2212− wait_event_interruptible(random_write_wait,
2216+ wait_event_interruptible_timeout(random_write_wait,
22132217 !system_wq || kthread_should_stop() ||
2214− POOL_ENTROPY_BITS() <= random_write_wakeup_bits);
2218+ POOL_ENTROPY_BITS() <= random_write_wakeup_bits,
2219+ CRNG_RESEED_INTERVAL);
22152220 mix_pool_bytes(buffer, count);
22162221 credit_entropy_bits(entropy);
22172222 }
drivers/clk/ingenic/jz4725b-cgu.c+1−2
@@ -139,11 +139,10 @@ static const struct ingenic_cgu_clk_info jz4725b_cgu_clocks[] = { · 138 unmodified lines
139139 },
140140
141141 [JZ4725B_CLK_I2S] = {
142− "i2s", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE,
142+ "i2s", CGU_CLK_MUX | CGU_CLK_DIV,
143143 .parents = { JZ4725B_CLK_EXT, JZ4725B_CLK_PLL_HALF, -1, -1 },
144144 .mux = { CGU_REG_CPCCR, 31, 1 },
145145 .div = { CGU_REG_I2SCDR, 0, 1, 9, -1, -1, -1 },
146− .gate = { CGU_REG_CLKGR, 6 },
147146 },
148147
149148 [JZ4725B_CLK_SPI] = {
drivers/clk/qcom/gcc-msm8994.c+9−97
@@ -108,42 +108,6 @@ static const struct clk_parent_data gcc_xo_gpll0_gpll4[] = { · 107 unmodified lines
108108 { .hw = &gpll4.clkr.hw },
109109 };
110110
111−static struct clk_rcg2 system_noc_clk_src = {
112− .cmd_rcgr = 0x0120,
113− .hid_width = 5,
114− .parent_map = gcc_xo_gpll0_map,
115− .clkr.hw.init = &(struct clk_init_data){
116− .name = "system_noc_clk_src",
117− .parent_data = gcc_xo_gpll0,
118− .num_parents = ARRAY_SIZE(gcc_xo_gpll0),
119− .ops = &clk_rcg2_ops,
120− },
121−};
122−
123−static struct clk_rcg2 config_noc_clk_src = {
124− .cmd_rcgr = 0x0150,
125− .hid_width = 5,
126− .parent_map = gcc_xo_gpll0_map,
127− .clkr.hw.init = &(struct clk_init_data){
128− .name = "config_noc_clk_src",
129− .parent_data = gcc_xo_gpll0,
130− .num_parents = ARRAY_SIZE(gcc_xo_gpll0),
131− .ops = &clk_rcg2_ops,
132− },
133−};
134−
135−static struct clk_rcg2 periph_noc_clk_src = {
136− .cmd_rcgr = 0x0190,
137− .hid_width = 5,
138− .parent_map = gcc_xo_gpll0_map,
139− .clkr.hw.init = &(struct clk_init_data){
140− .name = "periph_noc_clk_src",
141− .parent_data = gcc_xo_gpll0,
142− .num_parents = ARRAY_SIZE(gcc_xo_gpll0),
143− .ops = &clk_rcg2_ops,
144− },
145−};
146−
147111 static struct freq_tbl ftbl_ufs_axi_clk_src[] = {
148112 F(50000000, P_GPLL0, 12, 0, 0),
149113 F(100000000, P_GPLL0, 6, 0, 0),
@@ -1150,8 +1114,6 @@ static struct clk_branch gcc_blsp1_ahb_clk = { · 1000 unmodified lines
11501114 .enable_mask = BIT(17),
11511115 .hw.init = &(struct clk_init_data){
11521116 .name = "gcc_blsp1_ahb_clk",
1153− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
1154− .num_parents = 1,
11551117 .ops = &clk_branch2_ops,
11561118 },
11571119 },
@@ -1435,8 +1397,6 @@ static struct clk_branch gcc_blsp2_ahb_clk = { · 277 unmodified lines
14351397 .enable_mask = BIT(15),
14361398 .hw.init = &(struct clk_init_data){
14371399 .name = "gcc_blsp2_ahb_clk",
1438− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
1439− .num_parents = 1,
14401400 .ops = &clk_branch2_ops,
14411401 },
14421402 },
@@ -1764,8 +1724,6 @@ static struct clk_branch gcc_lpass_q6_axi_clk = { · 321 unmodified lines
17641724 .enable_mask = BIT(0),
17651725 .hw.init = &(struct clk_init_data){
17661726 .name = "gcc_lpass_q6_axi_clk",
1767− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1768− .num_parents = 1,
17691727 .ops = &clk_branch2_ops,
17701728 },
17711729 },
@@ -1778,8 +1736,6 @@ static struct clk_branch gcc_mss_q6_bimc_axi_clk = { · 6 unmodified lines
17781736 .enable_mask = BIT(0),
17791737 .hw.init = &(struct clk_init_data){
17801738 .name = "gcc_mss_q6_bimc_axi_clk",
1781− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1782− .num_parents = 1,
17831739 .ops = &clk_branch2_ops,
17841740 },
17851741 },
@@ -1807,9 +1763,6 @@ static struct clk_branch gcc_pcie_0_cfg_ahb_clk = { · 21 unmodified lines
18071763 .enable_mask = BIT(0),
18081764 .hw.init = &(struct clk_init_data){
18091765 .name = "gcc_pcie_0_cfg_ahb_clk",
1810− .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw },
1811− .num_parents = 1,
1812− .flags = CLK_SET_RATE_PARENT,
18131766 .ops = &clk_branch2_ops,
18141767 },
18151768 },
@@ -1822,9 +1775,6 @@ static struct clk_branch gcc_pcie_0_mstr_axi_clk = { · 6 unmodified lines
18221775 .enable_mask = BIT(0),
18231776 .hw.init = &(struct clk_init_data){
18241777 .name = "gcc_pcie_0_mstr_axi_clk",
1825− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1826− .num_parents = 1,
1827− .flags = CLK_SET_RATE_PARENT,
18281778 .ops = &clk_branch2_ops,
18291779 },
18301780 },
@@ -1854,9 +1804,6 @@ static struct clk_branch gcc_pcie_0_slv_axi_clk = { · 23 unmodified lines
18541804 .enable_mask = BIT(0),
18551805 .hw.init = &(struct clk_init_data){
18561806 .name = "gcc_pcie_0_slv_axi_clk",
1857− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1858− .num_parents = 1,
1859− .flags = CLK_SET_RATE_PARENT,
18601807 .ops = &clk_branch2_ops,
18611808 },
18621809 },
@@ -1884,9 +1831,6 @@ static struct clk_branch gcc_pcie_1_cfg_ahb_clk = { · 21 unmodified lines
18841831 .enable_mask = BIT(0),
18851832 .hw.init = &(struct clk_init_data){
18861833 .name = "gcc_pcie_1_cfg_ahb_clk",
1887− .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw },
1888− .num_parents = 1,
1889− .flags = CLK_SET_RATE_PARENT,
18901834 .ops = &clk_branch2_ops,
18911835 },
18921836 },
@@ -1899,9 +1843,6 @@ static struct clk_branch gcc_pcie_1_mstr_axi_clk = { · 6 unmodified lines
18991843 .enable_mask = BIT(0),
19001844 .hw.init = &(struct clk_init_data){
19011845 .name = "gcc_pcie_1_mstr_axi_clk",
1902− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1903− .num_parents = 1,
1904− .flags = CLK_SET_RATE_PARENT,
19051846 .ops = &clk_branch2_ops,
19061847 },
19071848 },
@@ -1930,9 +1871,6 @@ static struct clk_branch gcc_pcie_1_slv_axi_clk = { · 22 unmodified lines
19301871 .enable_mask = BIT(0),
19311872 .hw.init = &(struct clk_init_data){
19321873 .name = "gcc_pcie_1_slv_axi_clk",
1933− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1934− .num_parents = 1,
1935− .flags = CLK_SET_RATE_PARENT,
19361874 .ops = &clk_branch2_ops,
19371875 },
19381876 },
@@ -1960,8 +1898,6 @@ static struct clk_branch gcc_pdm_ahb_clk = { · 21 unmodified lines
19601898 .enable_mask = BIT(0),
19611899 .hw.init = &(struct clk_init_data){
19621900 .name = "gcc_pdm_ahb_clk",
1963− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
1964− .num_parents = 1,
19651901 .ops = &clk_branch2_ops,
19661902 },
19671903 },
@@ -1989,9 +1925,6 @@ static struct clk_branch gcc_sdcc1_ahb_clk = { · 21 unmodified lines
19891925 .enable_mask = BIT(0),
19901926 .hw.init = &(struct clk_init_data){
19911927 .name = "gcc_sdcc1_ahb_clk",
1992− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
1993− .num_parents = 1,
1994− .flags = CLK_SET_RATE_PARENT,
19951928 .ops = &clk_branch2_ops,
19961929 },
19971930 },
@@ -2004,9 +1937,6 @@ static struct clk_branch gcc_sdcc2_ahb_clk = { · 6 unmodified lines
20041937 .enable_mask = BIT(0),
20051938 .hw.init = &(struct clk_init_data){
20061939 .name = "gcc_sdcc2_ahb_clk",
2007− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2008− .num_parents = 1,
2009− .flags = CLK_SET_RATE_PARENT,
20101940 .ops = &clk_branch2_ops,
20111941 },
20121942 },
@@ -2034,9 +1964,6 @@ static struct clk_branch gcc_sdcc3_ahb_clk = { · 21 unmodified lines
20341964 .enable_mask = BIT(0),
20351965 .hw.init = &(struct clk_init_data){
20361966 .name = "gcc_sdcc3_ahb_clk",
2037− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2038− .num_parents = 1,
2039− .flags = CLK_SET_RATE_PARENT,
20401967 .ops = &clk_branch2_ops,
20411968 },
20421969 },
@@ -2064,9 +1991,6 @@ static struct clk_branch gcc_sdcc4_ahb_clk = { · 21 unmodified lines
20641991 .enable_mask = BIT(0),
20651992 .hw.init = &(struct clk_init_data){
20661993 .name = "gcc_sdcc4_ahb_clk",
2067− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2068− .num_parents = 1,
2069− .flags = CLK_SET_RATE_PARENT,
20701994 .ops = &clk_branch2_ops,
20711995 },
20721996 },
@@ -2124,8 +2048,6 @@ static struct clk_branch gcc_tsif_ahb_clk = { · 51 unmodified lines
21242048 .enable_mask = BIT(0),
21252049 .hw.init = &(struct clk_init_data){
21262050 .name = "gcc_tsif_ahb_clk",
2127− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2128− .num_parents = 1,
21292051 .ops = &clk_branch2_ops,
21302052 },
21312053 },
@@ -2153,8 +2075,6 @@ static struct clk_branch gcc_ufs_ahb_clk = { · 21 unmodified lines
21532075 .enable_mask = BIT(0),
21542076 .hw.init = &(struct clk_init_data){
21552077 .name = "gcc_ufs_ahb_clk",
2156− .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw },
2157− .num_parents = 1,
21582078 .ops = &clk_branch2_ops,
21592079 },
21602080 },
@@ -2198,8 +2118,6 @@ static struct clk_branch gcc_ufs_rx_symbol_0_clk = { · 37 unmodified lines
21982118 .enable_mask = BIT(0),
21992119 .hw.init = &(struct clk_init_data){
22002120 .name = "gcc_ufs_rx_symbol_0_clk",
2201− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
2202− .num_parents = 1,
22032121 .ops = &clk_branch2_ops,
22042122 },
22052123 },
@@ -2213,8 +2131,6 @@ static struct clk_branch gcc_ufs_rx_symbol_1_clk = { · 7 unmodified lines
22132131 .enable_mask = BIT(0),
22142132 .hw.init = &(struct clk_init_data){
22152133 .name = "gcc_ufs_rx_symbol_1_clk",
2216− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
2217− .num_parents = 1,
22182134 .ops = &clk_branch2_ops,
22192135 },
22202136 },
@@ -2243,8 +2159,6 @@ static struct clk_branch gcc_ufs_tx_symbol_0_clk = { · 22 unmodified lines
22432159 .enable_mask = BIT(0),
22442160 .hw.init = &(struct clk_init_data){
22452161 .name = "gcc_ufs_tx_symbol_0_clk",
2246− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
2247− .num_parents = 1,
22482162 .ops = &clk_branch2_ops,
22492163 },
22502164 },
@@ -2258,8 +2172,6 @@ static struct clk_branch gcc_ufs_tx_symbol_1_clk = { · 7 unmodified lines
22582172 .enable_mask = BIT(0),
22592173 .hw.init = &(struct clk_init_data){
22602174 .name = "gcc_ufs_tx_symbol_1_clk",
2261− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
2262− .num_parents = 1,
22632175 .ops = &clk_branch2_ops,
22642176 },
22652177 },
@@ -2364,8 +2276,6 @@ static struct clk_branch gcc_usb_hs_ahb_clk = { · 98 unmodified lines
23642276 .enable_mask = BIT(0),
23652277 .hw.init = &(struct clk_init_data){
23662278 .name = "gcc_usb_hs_ahb_clk",
2367− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2368− .num_parents = 1,
23692279 .ops = &clk_branch2_ops,
23702280 },
23712281 },
@@ -2488,8 +2398,6 @@ static struct clk_branch gcc_boot_rom_ahb_clk = { · 116 unmodified lines
24882398 .enable_mask = BIT(10),
24892399 .hw.init = &(struct clk_init_data){
24902400 .name = "gcc_boot_rom_ahb_clk",
2491− .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw },
2492− .num_parents = 1,
24932401 .ops = &clk_branch2_ops,
24942402 },
24952403 },
@@ -2503,8 +2411,6 @@ static struct clk_branch gcc_prng_ahb_clk = { · 7 unmodified lines
25032411 .enable_mask = BIT(13),
25042412 .hw.init = &(struct clk_init_data){
25052413 .name = "gcc_prng_ahb_clk",
2506− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2507− .num_parents = 1,
25082414 .ops = &clk_branch2_ops,
25092415 },
25102416 },
@@ -2547,9 +2453,6 @@ static struct clk_regmap *gcc_msm8994_clocks[] = { · 36 unmodified lines
25472453 [GPLL0] = &gpll0.clkr,
25482454 [GPLL4_EARLY] = &gpll4_early.clkr,
25492455 [GPLL4] = &gpll4.clkr,
2550− [CONFIG_NOC_CLK_SRC] = &config_noc_clk_src.clkr,
2551− [PERIPH_NOC_CLK_SRC] = &periph_noc_clk_src.clkr,
2552− [SYSTEM_NOC_CLK_SRC] = &system_noc_clk_src.clkr,
25532456 [UFS_AXI_CLK_SRC] = &ufs_axi_clk_src.clkr,
25542457 [USB30_MASTER_CLK_SRC] = &usb30_master_clk_src.clkr,
25552458 [BLSP1_QUP1_I2C_APPS_CLK_SRC] = &blsp1_qup1_i2c_apps_clk_src.clkr,
@@ -2696,6 +2599,15 @@ static struct clk_regmap *gcc_msm8994_clocks[] = { · 140 unmodified lines
26962599 [USB_SS_PHY_LDO] = &usb_ss_phy_ldo.clkr,
26972600 [GCC_BOOT_ROM_AHB_CLK] = &gcc_boot_rom_ahb_clk.clkr,
26982601 [GCC_PRNG_AHB_CLK] = &gcc_prng_ahb_clk.clkr,
2602+
2603+ /*
2604+ * The following clocks should NOT be managed by this driver, but they once were
2605+ * mistakengly added. Now they are only here to indicate that they are not defined
2606+ * on purpose, even though the names will stay in the header file (for ABI sanity).
2607+ */
2608+ [CONFIG_NOC_CLK_SRC] = NULL,
2609+ [PERIPH_NOC_CLK_SRC] = NULL,
2610+ [SYSTEM_NOC_CLK_SRC] = NULL,
26992611 };
27002612
27012613 static struct gdsc *gcc_msm8994_gdscs[] = {
drivers/clocksource/timer-ti-dm-systimer.c+1−1
@@ -241,7 +241,7 @@ static void __init dmtimer_systimer_assign_alwon(void) · 240 unmodified lines
241241 bool quirk_unreliable_oscillator = false;
242242
243243 /* Quirk unreliable 32 KiHz oscillator with incomplete dts */
244− if (of_machine_is_compatible("ti,omap3-beagle") ||
244+ if (of_machine_is_compatible("ti,omap3-beagle-ab4") ||
245245 of_machine_is_compatible("timll,omap3-devkit8000")) {
246246 quirk_unreliable_oscillator = true;
247247 counter_32k = -ENODEV;
drivers/cpufreq/cpufreq.c+4−0
@@ -1518,6 +1518,10 @@ static int cpufreq_online(unsigned int cpu) · 1517 unmodified lines
15181518
15191519 kobject_uevent(&policy->kobj, KOBJ_ADD);
15201520
1521+ /* Callback for handling stuff after policy is ready */
1522+ if (cpufreq_driver->ready)
1523+ cpufreq_driver->ready(policy);
1524+
15211525 if (cpufreq_thermal_control_enabled(cpufreq_driver))
15221526 policy->cdev = of_cpufreq_cooling_register(policy);
15231527
drivers/cpufreq/qcom-cpufreq-hw.c+10−1
@@ -388,7 +388,7 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index) · 387 unmodified lines
388388
389389 snprintf(data->irq_name, sizeof(data->irq_name), "dcvsh-irq-%u", policy->cpu);
390390 ret = request_threaded_irq(data->throttle_irq, NULL, qcom_lmh_dcvs_handle_irq,
391− IRQF_ONESHOT, data->irq_name, data);
391+ IRQF_ONESHOT | IRQF_NO_AUTOEN, data->irq_name, data);
392392 if (ret) {
393393 dev_err(&pdev->dev, "Error registering %s: %d\n", data->irq_name, ret);
394394 return 0;
@@ -542,6 +542,14 @@ static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy) · 147 unmodified lines
542542 return 0;
543543 }
544544
545+static void qcom_cpufreq_ready(struct cpufreq_policy *policy)
546+{
547+ struct qcom_cpufreq_data *data = policy->driver_data;
548+
549+ if (data->throttle_irq >= 0)
550+ enable_irq(data->throttle_irq);
551+}
552+
545553 static struct freq_attr *qcom_cpufreq_hw_attr[] = {
546554 &cpufreq_freq_attr_scaling_available_freqs,
547555 &cpufreq_freq_attr_scaling_boost_freqs,
@@ -561,6 +569,7 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = { · 13 unmodified lines
561569 .fast_switch = qcom_cpufreq_hw_fast_switch,
562570 .name = "qcom-cpufreq-hw",
563571 .attr = qcom_cpufreq_hw_attr,
572+ .ready = qcom_cpufreq_ready,
564573 };
565574
566575 static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c+2−1
@@ -1753,7 +1753,6 @@ void otx2_cpt_print_uc_dbg_info(struct otx2_cptpf_dev *cptpf) · 1752 unmodified lines
17531753 char engs_info[2 * OTX2_CPT_NAME_LENGTH];
17541754 struct otx2_cpt_eng_grp_info *grp;
17551755 struct otx2_cpt_engs_rsvd *engs;
1756− u32 mask[4];
17571756 int i, j;
17581757
17591758 pr_debug("Engine groups global info");
@@ -1785,6 +1784,8 @@ void otx2_cpt_print_uc_dbg_info(struct otx2_cptpf_dev *cptpf) · 25 unmodified lines
17851784 for (j = 0; j < OTX2_CPT_MAX_ETYPES_PER_GRP; j++) {
17861785 engs = &grp->engs[j];
17871786 if (engs->type) {
1787+ u32 mask[5] = { };
1788+
17881789 get_engs_info(grp, engs_info,
17891790 2 * OTX2_CPT_NAME_LENGTH, j);
17901791 pr_debug("Slot%d: %s", j, engs_info);
drivers/dma-buf/dma-fence-array.c+14−0
@@ -176,6 +176,20 @@ struct dma_fence_array *dma_fence_array_create(int num_fences, · 175 unmodified lines
176176
177177 array->base.error = PENDING_ERROR;
178178
179+ /*
180+ * dma_fence_array objects should never contain any other fence
181+ * containers or otherwise we run into recursion and potential kernel
182+ * stack overflow on operations on the dma_fence_array.
183+ *
184+ * The correct way of handling this is to flatten out the array by the
185+ * caller instead.
186+ *
187+ * Enforce this here by checking that we don't create a dma_fence_array
188+ * with any container inside.
189+ */
190+ while (num_fences--)
191+ WARN_ON(dma_fence_is_container(fences[num_fences]));
192+
179193 return array;
180194 }
181195 EXPORT_SYMBOL(dma_fence_array_create);
drivers/dma-buf/dma-fence-chain.c+11−4
@@ -148,8 +148,7 @@ static bool dma_fence_chain_enable_signaling(struct dma_fence *fence) · 147 unmodified lines
148148
149149 dma_fence_get(&head->base);
150150 dma_fence_chain_for_each(fence, &head->base) {
151− struct dma_fence_chain *chain = to_dma_fence_chain(fence);
152− struct dma_fence *f = chain ? chain->fence : fence;
151+ struct dma_fence *f = dma_fence_chain_contained(fence);
153152
154153 dma_fence_get(f);
155154 if (!dma_fence_add_callback(f, &head->cb, dma_fence_chain_cb)) {
@@ -165,8 +164,7 @@ static bool dma_fence_chain_enable_signaling(struct dma_fence *fence) · 9 unmodified lines
165164 static bool dma_fence_chain_signaled(struct dma_fence *fence)
166165 {
167166 dma_fence_chain_for_each(fence, fence) {
168− struct dma_fence_chain *chain = to_dma_fence_chain(fence);
169− struct dma_fence *f = chain ? chain->fence : fence;
167+ struct dma_fence *f = dma_fence_chain_contained(fence);
170168
171169 if (!dma_fence_is_signaled(f)) {
172170 dma_fence_put(fence);
@@ -254,5 +252,14 @@ void dma_fence_chain_init(struct dma_fence_chain *chain, · 81 unmodified lines
254252
255253 dma_fence_init(&chain->base, &dma_fence_chain_ops,
256254 &chain->lock, context, seqno);
255+
256+ /*
257+ * Chaining dma_fence_chain container together is only allowed through
258+ * the prev fence and not through the contained fence.
259+ *
260+ * The correct way of handling this is to flatten out the fence
261+ * structure into a dma_fence_array by the caller instead.
262+ */
263+ WARN_ON(dma_fence_is_chain(fence));
257264 }
258265 EXPORT_SYMBOL(dma_fence_chain_init);
drivers/dma-buf/dma-heap.c+2−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/xarray.h>
1515 #include <linux/list.h>
1616 #include <linux/slab.h>
17+#include <linux/nospec.h>
1718 #include <linux/uaccess.h>
1819 #include <linux/syscalls.h>
1920 #include <linux/dma-heap.h>
@@ -135,6 +136,7 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd, · 115 unmodified lines
135136 if (nr >= ARRAY_SIZE(dma_heap_ioctl_cmds))
136137 return -EINVAL;
137138
139+ nr = array_index_nospec(nr, ARRAY_SIZE(dma_heap_ioctl_cmds));
138140 /* Get the kernel ioctl cmd that matches */
139141 kcmd = dma_heap_ioctl_cmds[nr];
140142
drivers/dma-buf/dma-resv.c+20−14
@@ -256,6 +256,11 @@ void dma_resv_add_shared_fence(struct dma_resv *obj, struct dma_fence *fence) · 255 unmodified lines
256256
257257 dma_resv_assert_held(obj);
258258
259+ /* Drivers should not add containers here, instead add each fence
260+ * individually.
261+ */
262+ WARN_ON(dma_fence_is_container(fence));
263+
259264 fobj = dma_resv_shared_list(obj);
260265 count = fobj->shared_count;
261266
@@ -323,12 +328,8 @@ void dma_resv_add_excl_fence(struct dma_resv *obj, struct dma_fence *fence) · 61 unmodified lines
323328 }
324329 EXPORT_SYMBOL(dma_resv_add_excl_fence);
325330
326−/**
327− * dma_resv_iter_restart_unlocked - restart the unlocked iterator
328− * @cursor: The dma_resv_iter object to restart
329− *
330− * Restart the unlocked iteration by initializing the cursor object.
331− */
331+/* Restart the iterator by initializing all the necessary fields, but not the
332+ * relation to the dma_resv object. */
332333 static void dma_resv_iter_restart_unlocked(struct dma_resv_iter *cursor)
333334 {
334335 cursor->seq = read_seqcount_begin(&cursor->obj->seq);
@@ -344,14 +345,7 @@ static void dma_resv_iter_restart_unlocked(struct dma_resv_iter *cursor) · 9 unmodified lines
344345 cursor->is_restarted = true;
345346 }
346347
347−/**
348− * dma_resv_iter_walk_unlocked - walk over fences in a dma_resv obj
349− * @cursor: cursor to record the current position
350− *
351− * Return all the fences in the dma_resv object which are not yet signaled.
352− * The returned fence has an extra local reference so will stay alive.
353− * If a concurrent modify is detected the whole iteration is started over again.
354− */
348+/* Walk to the next not signaled fence and grab a reference to it */
355349 static void dma_resv_iter_walk_unlocked(struct dma_resv_iter *cursor)
356350 {
357351 struct dma_resv *obj = cursor->obj;
@@ -387,6 +381,12 @@ static void dma_resv_iter_walk_unlocked(struct dma_resv_iter *cursor) · 29 unmodified lines
387381 * dma_resv_iter_first_unlocked - first fence in an unlocked dma_resv obj.
388382 * @cursor: the cursor with the current position
389383 *
384+ * Subsequent fences are iterated with dma_resv_iter_next_unlocked().
385+ *
386+ * Beware that the iterator can be restarted. Code which accumulates statistics
387+ * or similar needs to check for this with dma_resv_iter_is_restarted(). For
388+ * this reason prefer the locked dma_resv_iter_first() whenver possible.
389+ *
390390 * Returns the first fence from an unlocked dma_resv obj.
391391 */
392392 struct dma_fence *dma_resv_iter_first_unlocked(struct dma_resv_iter *cursor)
@@ -406,6 +406,10 @@ EXPORT_SYMBOL(dma_resv_iter_first_unlocked); · 13 unmodified lines
406406 * dma_resv_iter_next_unlocked - next fence in an unlocked dma_resv obj.
407407 * @cursor: the cursor with the current position
408408 *
409+ * Beware that the iterator can be restarted. Code which accumulates statistics
410+ * or similar needs to check for this with dma_resv_iter_is_restarted(). For
411+ * this reason prefer the locked dma_resv_iter_next() whenver possible.
412+ *
409413 * Returns the next fence from an unlocked dma_resv obj.
410414 */
411415 struct dma_fence *dma_resv_iter_next_unlocked(struct dma_resv_iter *cursor)
@@ -431,6 +435,8 @@ EXPORT_SYMBOL(dma_resv_iter_next_unlocked); · 19 unmodified lines
431435 * dma_resv_iter_first - first fence from a locked dma_resv object
432436 * @cursor: cursor to record the current position
433437 *
438+ * Subsequent fences are iterated with dma_resv_iter_next_unlocked().
439+ *
434440 * Return the first fence in the dma_resv object while holding the
435441 * &dma_resv.lock.
436442 */
drivers/dma/at_xdmac.c+3−1
@@ -1681,8 +1681,10 @@ static void at_xdmac_tasklet(struct tasklet_struct *t) · 1680 unmodified lines
16811681 __func__, atchan->irq_status);
16821682
16831683 if (!(atchan->irq_status & AT_XDMAC_CIS_LIS) &&
1684− !(atchan->irq_status & error_mask))
1684+ !(atchan->irq_status & error_mask)) {
1685+ spin_unlock_irq(&atchan->lock);
16851686 return;
1687+ }
16861688
16871689 if (atchan->irq_status & error_mask)
16881690 at_xdmac_handle_error(atchan);
drivers/dma/ptdma/ptdma-dev.c+9−8
@@ -207,7 +207,7 @@ int pt_core_init(struct pt_device *pt) · 206 unmodified lines
207207 if (!cmd_q->qbase) {
208208 dev_err(dev, "unable to allocate command queue\n");
209209 ret = -ENOMEM;
210− goto e_dma_alloc;
210+ goto e_destroy_pool;
211211 }
212212
213213 cmd_q->qidx = 0;
@@ -229,8 +229,10 @@ int pt_core_init(struct pt_device *pt) · 15 unmodified lines
229229
230230 /* Request an irq */
231231 ret = request_irq(pt->pt_irq, pt_core_irq_handler, 0, dev_name(pt->dev), pt);
232− if (ret)
233− goto e_pool;
232+ if (ret) {
233+ dev_err(dev, "unable to allocate an IRQ\n");
234+ goto e_free_dma;
235+ }
234236
235237 /* Update the device registers with queue information. */
236238 cmd_q->qcontrol &= ~CMD_Q_SIZE;
@@ -250,21 +252,20 @@ int pt_core_init(struct pt_device *pt) · 13 unmodified lines
250252 /* Register the DMA engine support */
251253 ret = pt_dmaengine_register(pt);
252254 if (ret)
253− goto e_dmaengine;
255+ goto e_free_irq;
254256
255257 /* Set up debugfs entries */
256258 ptdma_debugfs_setup(pt);
257259
258260 return 0;
259261
260−e_dmaengine:
262+e_free_irq:
261263 free_irq(pt->pt_irq, pt);
262264
263−e_dma_alloc:
265+e_free_dma:
264266 dma_free_coherent(dev, cmd_q->qsize, cmd_q->qbase, cmd_q->qbase_dma);
265267
266−e_pool:
267− dev_err(dev, "unable to allocate an IRQ\n");
268+e_destroy_pool:
268269 dma_pool_destroy(pt->cmd_q.dma_pool);
269270
270271 return ret;
drivers/dma/sh/rcar-dmac.c+7−2
@@ -1868,8 +1868,13 @@ static int rcar_dmac_probe(struct platform_device *pdev) · 1867 unmodified lines
18681868
18691869 dmac->dev = &pdev->dev;
18701870 platform_set_drvdata(pdev, dmac);
1871− dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
1872− dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
1871+ ret = dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
1872+ if (ret)
1873+ return ret;
1874+
1875+ ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
1876+ if (ret)
1877+ return ret;
18731878
18741879 ret = rcar_dmac_parse_of(&pdev->dev, dmac);
18751880 if (ret < 0)
drivers/dma/sh/shdma-base.c+3−1
@@ -115,8 +115,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) · 114 unmodified lines
115115 ret = pm_runtime_get(schan->dev);
116116
117117 spin_unlock_irq(&schan->chan_lock);
118− if (ret < 0)
118+ if (ret < 0) {
119119 dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret);
120+ pm_runtime_put(schan->dev);
121+ }
120122
121123 pm_runtime_barrier(schan->dev);
122124
drivers/dma/stm32-dmamux.c+3−1
@@ -292,10 +292,12 @@ static int stm32_dmamux_probe(struct platform_device *pdev) · 291 unmodified lines
292292 ret = of_dma_router_register(node, stm32_dmamux_route_allocate,
293293 &stm32_dmamux->dmarouter);
294294 if (ret)
295− goto err_clk;
295+ goto pm_disable;
296296
297297 return 0;
298298
299+pm_disable:
300+ pm_runtime_disable(&pdev->dev);
299301 err_clk:
300302 clk_disable_unprepare(stm32_dmamux->clk);
301303
drivers/edac/altera_edac.c+1−1
@@ -350,7 +350,7 @@ static int altr_sdram_probe(struct platform_device *pdev) · 349 unmodified lines
350350 if (irq < 0) {
351351 edac_printk(KERN_ERR, EDAC_MC,
352352 "No irq %d in DT\n", irq);
353− return -ENODEV;
353+ return irq;
354354 }
355355
356356 /* Arria10 has a 2nd IRQ */
drivers/edac/edac_mc.c+1−1
@@ -215,7 +215,7 @@ void *edac_align_ptr(void **p, unsigned int size, int n_elems) · 214 unmodified lines
215215 else
216216 return (char *)ptr;
217217
218− r = (unsigned long)p % align;
218+ r = (unsigned long)ptr % align;
219219
220220 if (r == 0)
221221 return (char *)ptr;
drivers/edac/xgene_edac.c+1−1
@@ -1919,7 +1919,7 @@ static int xgene_edac_probe(struct platform_device *pdev) · 1918 unmodified lines
19191919 irq = platform_get_irq_optional(pdev, i);
19201920 if (irq < 0) {
19211921 dev_err(&pdev->dev, "No IRQ resource\n");
1922− rc = -EINVAL;
1922+ rc = irq;
19231923 goto out_err;
19241924 }
19251925 rc = devm_request_irq(&pdev->dev, irq,
drivers/gpio/gpio-aggregator.c+14−4
@@ -278,7 +278,8 @@ static int gpio_fwd_get(struct gpio_chip *chip, unsigned int offset) · 277 unmodified lines
278278 {
279279 struct gpiochip_fwd *fwd = gpiochip_get_data(chip);
280280
281− return gpiod_get_value(fwd->descs[offset]);
281+ return chip->can_sleep ? gpiod_get_value_cansleep(fwd->descs[offset])
282+ : gpiod_get_value(fwd->descs[offset]);
282283 }
283284
284285 static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask,
@@ -293,7 +294,10 @@ static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, · 8 unmodified lines
293294 for_each_set_bit(i, mask, fwd->chip.ngpio)
294295 descs[j++] = fwd->descs[i];
295296
296− error = gpiod_get_array_value(j, descs, NULL, values);
297+ if (fwd->chip.can_sleep)
298+ error = gpiod_get_array_value_cansleep(j, descs, NULL, values);
299+ else
300+ error = gpiod_get_array_value(j, descs, NULL, values);
297301 if (error)
298302 return error;
299303
@@ -328,7 +332,10 @@ static void gpio_fwd_set(struct gpio_chip *chip, unsigned int offset, int value) · 28 unmodified lines
328332 {
329333 struct gpiochip_fwd *fwd = gpiochip_get_data(chip);
330334
331− gpiod_set_value(fwd->descs[offset], value);
335+ if (chip->can_sleep)
336+ gpiod_set_value_cansleep(fwd->descs[offset], value);
337+ else
338+ gpiod_set_value(fwd->descs[offset], value);
332339 }
333340
334341 static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask,
@@ -343,7 +350,10 @@ static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, · 8 unmodified lines
343350 descs[j++] = fwd->descs[i];
344351 }
345352
346− gpiod_set_array_value(j, descs, NULL, values);
353+ if (fwd->chip.can_sleep)
354+ gpiod_set_array_value_cansleep(j, descs, NULL, values);
355+ else
356+ gpiod_set_array_value(j, descs, NULL, values);
347357 }
348358
349359 static void gpio_fwd_set_multiple_locked(struct gpio_chip *chip,
drivers/gpio/gpio-rockchip.c+29−27
@@ -410,10 +410,8 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) · 409 unmodified lines
410410 level = rockchip_gpio_readl(bank, bank->gpio_regs->int_type);
411411 polarity = rockchip_gpio_readl(bank, bank->gpio_regs->int_polarity);
412412
413− switch (type) {
414− case IRQ_TYPE_EDGE_BOTH:
413+ if (type == IRQ_TYPE_EDGE_BOTH) {
415414 if (bank->gpio_type == GPIO_TYPE_V2) {
416− bank->toggle_edge_mode &= ~mask;
417415 rockchip_gpio_writel_bit(bank, d->hwirq, 1,
418416 bank->gpio_regs->int_bothedge);
419417 goto out;
@@ -431,30 +429,34 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) · 11 unmodified lines
431429 else
432430 polarity |= mask;
433431 }
434− break;
435− case IRQ_TYPE_EDGE_RISING:
436− bank->toggle_edge_mode &= ~mask;
437− level |= mask;
438− polarity |= mask;
439− break;
440− case IRQ_TYPE_EDGE_FALLING:
441− bank->toggle_edge_mode &= ~mask;
442− level |= mask;
443− polarity &= ~mask;
444− break;
445− case IRQ_TYPE_LEVEL_HIGH:
446− bank->toggle_edge_mode &= ~mask;
447− level &= ~mask;
448− polarity |= mask;
449− break;
450− case IRQ_TYPE_LEVEL_LOW:
451− bank->toggle_edge_mode &= ~mask;
452− level &= ~mask;
453− polarity &= ~mask;
454− break;
455− default:
456− ret = -EINVAL;
457− goto out;
432+ } else {
433+ if (bank->gpio_type == GPIO_TYPE_V2) {
434+ rockchip_gpio_writel_bit(bank, d->hwirq, 0,
435+ bank->gpio_regs->int_bothedge);
436+ } else {
437+ bank->toggle_edge_mode &= ~mask;
438+ }
439+ switch (type) {
440+ case IRQ_TYPE_EDGE_RISING:
441+ level |= mask;
442+ polarity |= mask;
443+ break;
444+ case IRQ_TYPE_EDGE_FALLING:
445+ level |= mask;
446+ polarity &= ~mask;
447+ break;
448+ case IRQ_TYPE_LEVEL_HIGH:
449+ level &= ~mask;
450+ polarity |= mask;
451+ break;
452+ case IRQ_TYPE_LEVEL_LOW:
453+ level &= ~mask;
454+ polarity &= ~mask;
455+ break;
456+ default:
457+ ret = -EINVAL;
458+ goto out;
459+ }
458460 }
459461
460462 rockchip_gpio_writel(bank, level, bank->gpio_regs->int_type);
drivers/gpio/gpio-sifive.c+1−1
@@ -223,7 +223,7 @@ static int sifive_gpio_probe(struct platform_device *pdev) · 222 unmodified lines
223223 NULL,
224224 chip->base + SIFIVE_GPIO_OUTPUT_EN,
225225 chip->base + SIFIVE_GPIO_INPUT_EN,
226− 0);
226+ BGPIOF_READ_OUTPUT_REG_SET);
227227 if (ret) {
228228 dev_err(dev, "unable to init generic GPIO\n");
229229 return ret;
drivers/gpio/gpio-sim.c+15−4
@@ -570,6 +570,11 @@ static struct gpio_sim_bank *to_gpio_sim_bank(struct config_item *item) · 569 unmodified lines
570570 return container_of(group, struct gpio_sim_bank, group);
571571 }
572572
573+static bool gpio_sim_bank_has_label(struct gpio_sim_bank *bank)
574+{
575+ return bank->label && *bank->label;
576+}
577+
573578 static struct gpio_sim_device *
574579 gpio_sim_bank_get_device(struct gpio_sim_bank *bank)
575580 {
@@ -770,9 +775,15 @@ static int gpio_sim_add_hogs(struct gpio_sim_device *dev) · 194 unmodified lines
770775 * point the device doesn't exist yet and so dev_name()
771776 * is not available.
772777 */
773− hog->chip_label = kasprintf(GFP_KERNEL,
774− "gpio-sim.%u-%s", dev->id,
775− fwnode_get_name(bank->swnode));
778+ if (gpio_sim_bank_has_label(bank))
779+ hog->chip_label = kstrdup(bank->label,
780+ GFP_KERNEL);
781+ else
782+ hog->chip_label = kasprintf(GFP_KERNEL,
783+ "gpio-sim.%u-%s",
784+ dev->id,
785+ fwnode_get_name(
786+ bank->swnode));
776787 if (!hog->chip_label) {
777788 gpio_sim_remove_hogs(dev);
778789 return -ENOMEM;
@@ -816,7 +827,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 37 unmodified lines
816827
817828 properties[prop_idx++] = PROPERTY_ENTRY_U32("ngpios", bank->num_lines);
818829
819− if (bank->label && (strlen(bank->label) > 0))
830+ if (gpio_sim_bank_has_label(bank))
820831 properties[prop_idx++] = PROPERTY_ENTRY_STRING("gpio-sim,label",
821832 bank->label);
822833
drivers/gpio/gpio-tegra186.c+10−4
@@ -343,9 +343,12 @@ static int tegra186_gpio_of_xlate(struct gpio_chip *chip, · 342 unmodified lines
343343 return offset + pin;
344344 }
345345
346+#define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio)
347+
346348 static void tegra186_irq_ack(struct irq_data *data)
347349 {
348− struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
350+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
351+ struct tegra_gpio *gpio = to_tegra_gpio(gc);
349352 void __iomem *base;
350353
351354 base = tegra186_gpio_get_base(gpio, data->hwirq);
@@ -357,7 +360,8 @@ static void tegra186_irq_ack(struct irq_data *data) · 5 unmodified lines
357360
358361 static void tegra186_irq_mask(struct irq_data *data)
359362 {
360− struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
363+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
364+ struct tegra_gpio *gpio = to_tegra_gpio(gc);
361365 void __iomem *base;
362366 u32 value;
363367
@@ -372,7 +376,8 @@ static void tegra186_irq_mask(struct irq_data *data) · 8 unmodified lines
372376
373377 static void tegra186_irq_unmask(struct irq_data *data)
374378 {
375− struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
379+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
380+ struct tegra_gpio *gpio = to_tegra_gpio(gc);
376381 void __iomem *base;
377382 u32 value;
378383
@@ -387,7 +392,8 @@ static void tegra186_irq_unmask(struct irq_data *data) · 8 unmodified lines
387392
388393 static int tegra186_irq_set_type(struct irq_data *data, unsigned int type)
389394 {
390− struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
395+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
396+ struct tegra_gpio *gpio = to_tegra_gpio(gc);
391397 void __iomem *base;
392398 u32 value;
393399
drivers/gpio/gpiolib-cdev.c+3−3
@@ -330,7 +330,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip) · 329 unmodified lines
330330 goto out_free_lh;
331331 }
332332
333− ret = gpiod_request(desc, lh->label);
333+ ret = gpiod_request_user(desc, lh->label);
334334 if (ret)
335335 goto out_free_lh;
336336 lh->descs[i] = desc;
@@ -1378,7 +1378,7 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip) · 1041 unmodified lines
13781378 goto out_free_linereq;
13791379 }
13801380
1381− ret = gpiod_request(desc, lr->label);
1381+ ret = gpiod_request_user(desc, lr->label);
13821382 if (ret)
13831383 goto out_free_linereq;
13841384
@@ -1764,7 +1764,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip) · 379 unmodified lines
17641764 }
17651765 }
17661766
1767− ret = gpiod_request(desc, le->label);
1767+ ret = gpiod_request_user(desc, le->label);
17681768 if (ret)
17691769 goto out_free_le;
17701770 le->desc = desc;
drivers/gpio/gpiolib-sysfs.c+2−5
@@ -475,12 +475,9 @@ static ssize_t export_store(struct class *class, · 474 unmodified lines
475475 * they may be undone on its behalf too.
476476 */
477477
478− status = gpiod_request(desc, "sysfs");
479− if (status) {
480− if (status == -EPROBE_DEFER)
481− status = -ENODEV;
478+ status = gpiod_request_user(desc, "sysfs");
479+ if (status)
482480 goto done;
483− }
484481
485482 status = gpiod_set_transitory(desc, false);
486483 if (!status) {
drivers/gpio/gpiolib.c+10−0
@@ -3147,6 +3147,16 @@ int gpiod_to_irq(const struct gpio_desc *desc) · 3146 unmodified lines
31473147
31483148 return retirq;
31493149 }
3150+#ifdef CONFIG_GPIOLIB_IRQCHIP
3151+ if (gc->irq.chip) {
3152+ /*
3153+ * Avoid race condition with other code, which tries to lookup
3154+ * an IRQ before the irqchip has been properly registered,
3155+ * i.e. while gpiochip is still being brought up.
3156+ */
3157+ return -EPROBE_DEFER;
3158+ }
3159+#endif
31503160 return -ENXIO;
31513161 }
31523162 EXPORT_SYMBOL_GPL(gpiod_to_irq);
drivers/gpio/gpiolib.h+12−0
@@ -135,6 +135,18 @@ struct gpio_desc { · 134 unmodified lines
135135
136136 int gpiod_request(struct gpio_desc *desc, const char *label);
137137 void gpiod_free(struct gpio_desc *desc);
138+
139+static inline int gpiod_request_user(struct gpio_desc *desc, const char *label)
140+{
141+ int ret;
142+
143+ ret = gpiod_request(desc, label);
144+ if (ret == -EPROBE_DEFER)
145+ ret = -ENODEV;
146+
147+ return ret;
148+}
149+
138150 int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id,
139151 unsigned long lflags, enum gpiod_flags dflags);
140152 int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce);
drivers/gpu/drm/Kconfig+3−0
@@ -71,6 +71,7 @@ config DRM_DEBUG_SELFTEST · 70 unmodified lines
7171 select DRM_DP_HELPER
7272 select DRM_LIB_RANDOM
7373 select DRM_KMS_HELPER
74+ select DRM_BUDDY
7475 select DRM_EXPORT_FOR_TESTS if m
7576 default n
7677 help
@@ -403,6 +404,8 @@ source "drivers/gpu/drm/xlnx/Kconfig" · 326 unmodified lines
403404
404405 source "drivers/gpu/drm/gud/Kconfig"
405406
407+source "drivers/gpu/drm/solomon/Kconfig"
408+
406409 source "drivers/gpu/drm/sprd/Kconfig"
407410
408411 config DRM_HYPERV
drivers/gpu/drm/Makefile+1−0
@@ -132,4 +132,5 @@ obj-$(CONFIG_DRM_TIDSS) += tidss/ · 131 unmodified lines
132132 obj-y += xlnx/
133133 obj-y += gud/
134134 obj-$(CONFIG_DRM_HYPERV) += hyperv/
135+obj-y += solomon/
135136 obj-$(CONFIG_DRM_SPRD) += sprd/
drivers/gpu/drm/amd/amdgpu/Makefile+1−1
@@ -46,7 +46,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ · 45 unmodified lines
4646 atom.o amdgpu_fence.o amdgpu_ttm.o amdgpu_object.o amdgpu_gart.o \
4747 amdgpu_encoders.o amdgpu_display.o amdgpu_i2c.o \
4848 amdgpu_gem.o amdgpu_ring.o \
49− amdgpu_cs.o amdgpu_bios.o amdgpu_benchmark.o amdgpu_test.o \
49+ amdgpu_cs.o amdgpu_bios.o amdgpu_benchmark.o \
5050 atombios_dp.o amdgpu_afmt.o amdgpu_trace_points.o \
5151 atombios_encoders.o amdgpu_sa.o atombios_i2c.o \
5252 amdgpu_dma_buf.o amdgpu_vm.o amdgpu_ib.o amdgpu_pll.o \
drivers/gpu/drm/amd/amdgpu/aldebaran.c+1−1
@@ -260,7 +260,7 @@ static int aldebaran_mode2_restore_ip(struct amdgpu_device *adev) · 259 unmodified lines
260260 adev->gfx.rlc.funcs->resume(adev);
261261
262262 /* Wait for FW reset event complete */
263− r = smu_wait_for_event(adev, SMU_EVENT_RESET_COMPLETE, 0);
263+ r = amdgpu_dpm_wait_for_event(adev, SMU_EVENT_RESET_COMPLETE, 0);
264264 if (r) {
265265 dev_err(adev->dev,
266266 "Failed to get response from firmware after reset\n");
drivers/gpu/drm/amd/amdgpu/amdgpu.h+47−26
@@ -99,7 +99,6 @@ · 98 unmodified lines
9999 #include "amdgpu_gem.h"
100100 #include "amdgpu_doorbell.h"
101101 #include "amdgpu_amdkfd.h"
102−#include "amdgpu_smu.h"
103102 #include "amdgpu_discovery.h"
104103 #include "amdgpu_mes.h"
105104 #include "amdgpu_umc.h"
@@ -109,6 +108,7 @@ · 3 unmodified lines
109108 #include "amdgpu_smuio.h"
110109 #include "amdgpu_fdinfo.h"
111110 #include "amdgpu_mca.h"
111+#include "amdgpu_ras.h"
112112
113113 #define MAX_GPU_INSTANCE 16
114114
@@ -155,8 +155,6 @@ extern int amdgpu_vis_vram_limit; · 40 unmodified lines
155155 extern int amdgpu_gart_size;
156156 extern int amdgpu_gtt_size;
157157 extern int amdgpu_moverate;
158−extern int amdgpu_benchmarking;
159−extern int amdgpu_testing;
160158 extern int amdgpu_audio;
161159 extern int amdgpu_disp_priority;
162160 extern int amdgpu_hw_i2c;
@@ -197,7 +195,6 @@ extern int amdgpu_emu_mode; · 34 unmodified lines
197195 extern uint amdgpu_smu_memory_pool_size;
198196 extern int amdgpu_smu_pptable_id;
199197 extern uint amdgpu_dc_feature_mask;
200−extern uint amdgpu_freesync_vid_mode;
201198 extern uint amdgpu_dc_debug_mask;
202199 extern uint amdgpu_dm_abm_level;
203200 extern int amdgpu_backlight;
@@ -214,6 +211,7 @@ extern int amdgpu_mes; · 10 unmodified lines
214211 extern int amdgpu_noretry;
215212 extern int amdgpu_force_asic_type;
216213 extern int amdgpu_smartshift_bias;
214+extern int amdgpu_use_xgmi_p2p;
217215 #ifdef CONFIG_HSA_AMD
218216 extern int sched_policy;
219217 extern bool debug_evictions;
@@ -373,7 +371,8 @@ int amdgpu_device_ip_block_add(struct amdgpu_device *adev, · 153 unmodified lines
373371 */
374372 bool amdgpu_get_bios(struct amdgpu_device *adev);
375373 bool amdgpu_read_bios(struct amdgpu_device *adev);
376−
374+bool amdgpu_soc15_read_bios_from_rom(struct amdgpu_device *adev,
375+ u8 *bios, u32 length_bytes);
377376 /*
378377 * Clocks
379378 */
@@ -586,13 +585,7 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb); · 206 unmodified lines
586585 /*
587586 * Benchmarking
588587 */
589−void amdgpu_benchmark(struct amdgpu_device *adev, int test_number);
590−
591−
592−/*
593− * Testing
594− */
595−void amdgpu_test_moves(struct amdgpu_device *adev);
588+int amdgpu_benchmark(struct amdgpu_device *adev, int test_number);
596589
597590 /*
598591 * ASIC specific register table accessible by UMD
@@ -771,6 +764,8 @@ struct amd_powerplay { · 172 unmodified lines
771764 const struct amd_pm_funcs *pp_funcs;
772765 };
773766
767+struct ip_discovery_top;
768+
774769 /* polaris10 kickers */
775770 #define ASICID_IS_P20(did, rid) (((did == 0x67DF) && \
776771 ((rid == 0xE3) || \
@@ -813,6 +808,8 @@ struct amd_powerplay { · 36 unmodified lines
813808 #define AMDGPU_RESET_MAGIC_NUM 64
814809 #define AMDGPU_MAX_DF_PERFMONS 4
815810 #define AMDGPU_PRODUCT_NAME_LEN 64
811+struct amdgpu_reset_domain;
812+
816813 struct amdgpu_device {
817814 struct device *dev;
818815 struct pci_dev *pdev;
@@ -950,12 +947,6 @@ struct amdgpu_device { · 131 unmodified lines
950947
951948 /* powerplay */
952949 struct amd_powerplay powerplay;
953− bool pp_force_state_enabled;
954−
955− /* smu */
956− struct smu_context smu;
957−
958− /* dpm */
959950 struct amdgpu_pm pm;
960951 u32 cg_flags;
961952 u32 pg_flags;
@@ -1054,9 +1045,7 @@ struct amdgpu_device { · 92 unmodified lines
10541045 bool in_s4;
10551046 bool in_s0ix;
10561047
1057− atomic_t in_gpu_reset;
10581048 enum pp_mp1_state mp1_state;
1059− struct rw_semaphore reset_sem;
10601049 struct amdgpu_doorbell_index doorbell_index;
10611050
10621051 struct mutex notifier_lock;
@@ -1100,6 +1089,18 @@ struct amdgpu_device { · 37 unmodified lines
11001089 uint32_t ip_versions[MAX_HWIP][HWIP_MAX_INSTANCE];
11011090
11021091 bool ram_is_direct_mapped;
1092+
1093+ struct list_head ras_list;
1094+
1095+ struct ip_discovery_top *ip_top;
1096+
1097+ struct amdgpu_reset_domain *reset_domain;
1098+
1099+ struct mutex benchmark_mutex;
1100+
1101+ /* reset dump register */
1102+ uint32_t *reset_dump_reg_list;
1103+ int num_regs;
11031104 };
11041105
11051106 static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev)
@@ -1293,9 +1294,12 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev); · 187 unmodified lines
12931294 bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev);
12941295 int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
12951296 struct amdgpu_job* job);
1297+int amdgpu_device_gpu_recover_imp(struct amdgpu_device *adev,
1298+ struct amdgpu_job *job);
12961299 void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
12971300 int amdgpu_device_pci_reset(struct amdgpu_device *adev);
12981301 bool amdgpu_device_need_post(struct amdgpu_device *adev);
1302+bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
12991303
13001304 void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
13011305 u64 num_vis_bytes);
@@ -1321,6 +1325,10 @@ void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev, · 19 unmodified lines
13211325 struct amdgpu_ring *ring);
13221326
13231327 void amdgpu_device_halt(struct amdgpu_device *adev);
1328+u32 amdgpu_device_pcie_port_rreg(struct amdgpu_device *adev,
1329+ u32 reg);
1330+void amdgpu_device_pcie_port_wreg(struct amdgpu_device *adev,
1331+ u32 reg, u32 v);
13241332
13251333 /* atpx handler */
13261334 #if defined(CONFIG_VGA_SWITCHEROO)
@@ -1408,12 +1416,10 @@ int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_sta · 81 unmodified lines
14081416 int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
14091417
14101418 void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);
1411−bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
14121419 void amdgpu_acpi_detect(void);
14131420 #else
14141421 static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
14151422 static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
1416−static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
14171423 static inline void amdgpu_acpi_detect(void) { }
14181424 static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
14191425 static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
@@ -1422,6 +1428,14 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev, · 2 unmodified lines
14221428 enum amdgpu_ss ss_state) { return 0; }
14231429 #endif
14241430
1431+#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
1432+bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
1433+bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
1434+#else
1435+static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
1436+static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
1437+#endif
1438+
14251439 int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
14261440 uint64_t addr, struct amdgpu_bo **bo,
14271441 struct amdgpu_bo_va_mapping **mapping);
@@ -1452,6 +1466,15 @@ int amdgpu_device_set_cg_state(struct amdgpu_device *adev, · 24 unmodified lines
14521466 int amdgpu_device_set_pg_state(struct amdgpu_device *adev,
14531467 enum amd_powergating_state state);
14541468
1469+static inline bool amdgpu_device_has_timeouts_enabled(struct amdgpu_device *adev)
1470+{
1471+ return amdgpu_gpu_recovery != 0 &&
1472+ adev->gfx_timeout != MAX_SCHEDULE_TIMEOUT &&
1473+ adev->compute_timeout != MAX_SCHEDULE_TIMEOUT &&
1474+ adev->sdma_timeout != MAX_SCHEDULE_TIMEOUT &&
1475+ adev->video_timeout != MAX_SCHEDULE_TIMEOUT;
1476+}
1477+
14551478 #include "amdgpu_object.h"
14561479
14571480 static inline bool amdgpu_is_tmz(struct amdgpu_device *adev)
@@ -1459,8 +1482,6 @@ static inline bool amdgpu_is_tmz(struct amdgpu_device *adev) · 1 unmodified line
14591482 return adev->gmc.tmz_enabled;
14601483 }
14611484
1462−static inline int amdgpu_in_reset(struct amdgpu_device *adev)
1463−{
1464− return atomic_read(&adev->in_gpu_reset);
1465−}
1485+int amdgpu_in_reset(struct amdgpu_device *adev);
1486+
14661487 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c+32−5
@@ -1031,6 +1031,20 @@ void amdgpu_acpi_detect(void) · 1030 unmodified lines
10311031 }
10321032 }
10331033
1034+#if IS_ENABLED(CONFIG_SUSPEND)
1035+/**
1036+ * amdgpu_acpi_is_s3_active
1037+ *
1038+ * @adev: amdgpu_device_pointer
1039+ *
1040+ * returns true if supported, false if not.
1041+ */
1042+bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
1043+{
1044+ return !(adev->flags & AMD_IS_APU) ||
1045+ (pm_suspend_target_state == PM_SUSPEND_MEM);
1046+}
1047+
10341048 /**
10351049 * amdgpu_acpi_is_s0ix_active
10361050 *
@@ -1040,11 +1054,24 @@ void amdgpu_acpi_detect(void) · 3 unmodified lines
10401054 */
10411055 bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
10421056 {
1043−#if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)
1044− if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
1045− if (adev->flags & AMD_IS_APU)
1046− return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;
1057+ if (!(adev->flags & AMD_IS_APU) ||
1058+ (pm_suspend_target_state != PM_SUSPEND_TO_IDLE))
1059+ return false;
1060+
1061+ if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
1062+ dev_warn_once(adev->dev,
1063+ "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
1064+ "To use suspend-to-idle change the sleep mode in BIOS setup.\n");
1065+ return false;
10471066 }
1048−#endif
1067+
1068+#if !IS_ENABLED(CONFIG_AMD_PMC)
1069+ dev_warn_once(adev->dev,
1070+ "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
10491071 return false;
1072+#else
1073+ return true;
1074+#endif /* CONFIG_AMD_PMC */
10501075 }
1076+
1077+#endif /* CONFIG_SUSPEND */
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h+6−1
@@ -131,6 +131,7 @@ struct amdkfd_process_info { · 130 unmodified lines
131131 atomic_t evicted_bos;
132132 struct delayed_work restore_userptr_work;
133133 struct pid *pid;
134+ bool block_mmu_notifications;
134135 };
135136
136137 int amdgpu_amdkfd_init(void);
@@ -268,7 +269,7 @@ uint64_t amdgpu_amdkfd_gpuvm_get_process_page_dir(void *drm_priv); · 131 unmodified lines
268269 int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
269270 struct amdgpu_device *adev, uint64_t va, uint64_t size,
270271 void *drm_priv, struct kgd_mem **mem,
271− uint64_t *offset, uint32_t flags);
272+ uint64_t *offset, uint32_t flags, bool criu_resume);
272273 int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
273274 struct amdgpu_device *adev, struct kgd_mem *mem, void *drm_priv,
274275 uint64_t *size);
@@ -297,6 +298,10 @@ int amdgpu_amdkfd_get_tile_config(struct amdgpu_device *adev, · 22 unmodified lines
297298 struct tile_config *config);
298299 void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev,
299300 bool reset);
301+bool amdgpu_amdkfd_bo_mapped_to_dev(struct amdgpu_device *adev, struct kgd_mem *mem);
302+void amdgpu_amdkfd_block_mmu_notifications(void *p);
303+int amdgpu_amdkfd_criu_resume(void *p);
304+
300305 #if IS_ENABLED(CONFIG_HSA_AMD)
301306 void amdgpu_amdkfd_gpuvm_init_mem_limits(void);
302307 void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c+0−3
@@ -37,10 +37,7 @@ const struct kfd2kgd_calls aldebaran_kfd2kgd = { · 36 unmodified lines
3737 .hqd_sdma_is_occupied = kgd_arcturus_hqd_sdma_is_occupied,
3838 .hqd_destroy = kgd_gfx_v9_hqd_destroy,
3939 .hqd_sdma_destroy = kgd_arcturus_hqd_sdma_destroy,
40− .address_watch_disable = kgd_gfx_v9_address_watch_disable,
41− .address_watch_execute = kgd_gfx_v9_address_watch_execute,
4240 .wave_control_execute = kgd_gfx_v9_wave_control_execute,
43− .address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset,
4441 .get_atc_vmid_pasid_mapping_info =
4542 kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
4643 .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c+0−3
@@ -289,10 +289,7 @@ const struct kfd2kgd_calls arcturus_kfd2kgd = { · 288 unmodified lines
289289 .hqd_sdma_is_occupied = kgd_arcturus_hqd_sdma_is_occupied,
290290 .hqd_destroy = kgd_gfx_v9_hqd_destroy,
291291 .hqd_sdma_destroy = kgd_arcturus_hqd_sdma_destroy,
292− .address_watch_disable = kgd_gfx_v9_address_watch_disable,
293− .address_watch_execute = kgd_gfx_v9_address_watch_execute,
294292 .wave_control_execute = kgd_gfx_v9_wave_control_execute,
295− .address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset,
296293 .get_atc_vmid_pasid_mapping_info =
297294 kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
298295 .set_vm_context_page_table_base =
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c+0−24
@@ -671,20 +671,6 @@ static bool get_atc_vmid_pasid_mapping_info(struct amdgpu_device *adev, · 670 unmodified lines
671671 return !!(value & ATC_VMID0_PASID_MAPPING__VALID_MASK);
672672 }
673673
674−static int kgd_address_watch_disable(struct amdgpu_device *adev)
675−{
676− return 0;
677−}
678−
679−static int kgd_address_watch_execute(struct amdgpu_device *adev,
680− unsigned int watch_point_id,
681− uint32_t cntl_val,
682− uint32_t addr_hi,
683− uint32_t addr_lo)
684−{
685− return 0;
686−}
687−
688674 static int kgd_wave_control_execute(struct amdgpu_device *adev,
689675 uint32_t gfx_index_val,
690676 uint32_t sq_cmd)
@@ -709,13 +695,6 @@ static int kgd_wave_control_execute(struct amdgpu_device *adev, · 18 unmodified lines
709695 return 0;
710696 }
711697
712−static uint32_t kgd_address_watch_get_offset(struct amdgpu_device *adev,
713− unsigned int watch_point_id,
714− unsigned int reg_offset)
715−{
716− return 0;
717−}
718−
719698 static void set_vm_context_page_table_base(struct amdgpu_device *adev,
720699 uint32_t vmid, uint64_t page_table_base)
721700 {
@@ -767,10 +746,7 @@ const struct kfd2kgd_calls gfx_v10_kfd2kgd = { · 45 unmodified lines
767746 .hqd_sdma_is_occupied = kgd_hqd_sdma_is_occupied,
768747 .hqd_destroy = kgd_hqd_destroy,
769748 .hqd_sdma_destroy = kgd_hqd_sdma_destroy,
770− .address_watch_disable = kgd_address_watch_disable,
771− .address_watch_execute = kgd_address_watch_execute,
772749 .wave_control_execute = kgd_wave_control_execute,
773− .address_watch_get_offset = kgd_address_watch_get_offset,
774750 .get_atc_vmid_pasid_mapping_info =
775751 get_atc_vmid_pasid_mapping_info,
776752 .set_vm_context_page_table_base = set_vm_context_page_table_base,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c+0−25
@@ -582,21 +582,6 @@ static int hqd_sdma_destroy_v10_3(struct amdgpu_device *adev, void *mqd, · 581 unmodified lines
582582 return 0;
583583 }
584584
585−
586−static int address_watch_disable_v10_3(struct amdgpu_device *adev)
587−{
588− return 0;
589−}
590−
591−static int address_watch_execute_v10_3(struct amdgpu_device *adev,
592− unsigned int watch_point_id,
593− uint32_t cntl_val,
594− uint32_t addr_hi,
595− uint32_t addr_lo)
596−{
597− return 0;
598−}
599−
600585 static int wave_control_execute_v10_3(struct amdgpu_device *adev,
601586 uint32_t gfx_index_val,
602587 uint32_t sq_cmd)
@@ -621,13 +606,6 @@ static int wave_control_execute_v10_3(struct amdgpu_device *adev, · 18 unmodified lines
621606 return 0;
622607 }
623608
624−static uint32_t address_watch_get_offset_v10_3(struct amdgpu_device *adev,
625− unsigned int watch_point_id,
626− unsigned int reg_offset)
627−{
628− return 0;
629−}
630−
631609 static void set_vm_context_page_table_base_v10_3(struct amdgpu_device *adev,
632610 uint32_t vmid, uint64_t page_table_base)
633611 {
@@ -809,10 +787,7 @@ const struct kfd2kgd_calls gfx_v10_3_kfd2kgd = { · 175 unmodified lines
809787 .hqd_sdma_is_occupied = hqd_sdma_is_occupied_v10_3,
810788 .hqd_destroy = hqd_destroy_v10_3,
811789 .hqd_sdma_destroy = hqd_sdma_destroy_v10_3,
812− .address_watch_disable = address_watch_disable_v10_3,
813− .address_watch_execute = address_watch_execute_v10_3,
814790 .wave_control_execute = wave_control_execute_v10_3,
815− .address_watch_get_offset = address_watch_get_offset_v10_3,
816791 .get_atc_vmid_pasid_mapping_info = NULL,
817792 .set_vm_context_page_table_base = set_vm_context_page_table_base_v10_3,
818793 .program_trap_handler_settings = program_trap_handler_settings_v10_3,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c+0−96
@@ -45,43 +45,6 @@ enum { · 44 unmodified lines
4545 MAX_WATCH_ADDRESSES = 4
4646 };
4747
48−enum {
49− ADDRESS_WATCH_REG_ADDR_HI = 0,
50− ADDRESS_WATCH_REG_ADDR_LO,
51− ADDRESS_WATCH_REG_CNTL,
52− ADDRESS_WATCH_REG_MAX
53−};
54−
55−/* not defined in the CI/KV reg file */
56−enum {
57− ADDRESS_WATCH_REG_CNTL_ATC_BIT = 0x10000000UL,
58− ADDRESS_WATCH_REG_CNTL_DEFAULT_MASK = 0x00FFFFFF,
59− ADDRESS_WATCH_REG_ADDLOW_MASK_EXTENSION = 0x03000000,
60− /* extend the mask to 26 bits to match the low address field */
61− ADDRESS_WATCH_REG_ADDLOW_SHIFT = 6,
62− ADDRESS_WATCH_REG_ADDHIGH_MASK = 0xFFFF
63−};
64−
65−static const uint32_t watchRegs[MAX_WATCH_ADDRESSES * ADDRESS_WATCH_REG_MAX] = {
66− mmTCP_WATCH0_ADDR_H, mmTCP_WATCH0_ADDR_L, mmTCP_WATCH0_CNTL,
67− mmTCP_WATCH1_ADDR_H, mmTCP_WATCH1_ADDR_L, mmTCP_WATCH1_CNTL,
68− mmTCP_WATCH2_ADDR_H, mmTCP_WATCH2_ADDR_L, mmTCP_WATCH2_CNTL,
69− mmTCP_WATCH3_ADDR_H, mmTCP_WATCH3_ADDR_L, mmTCP_WATCH3_CNTL
70−};
71−
72−union TCP_WATCH_CNTL_BITS {
73− struct {
74− uint32_t mask:24;
75− uint32_t vmid:4;
76− uint32_t atc:1;
77− uint32_t mode:2;
78− uint32_t valid:1;
79− } bitfields, bits;
80− uint32_t u32All;
81− signed int i32All;
82− float f32All;
83−};
84−
8548 static void lock_srbm(struct amdgpu_device *adev, uint32_t mec, uint32_t pipe,
8649 uint32_t queue, uint32_t vmid)
8750 {
@@ -529,55 +492,6 @@ static int kgd_hqd_sdma_destroy(struct amdgpu_device *adev, void *mqd, · 441 unmodified lines
529492 return 0;
530493 }
531494
532−static int kgd_address_watch_disable(struct amdgpu_device *adev)
533−{
534− union TCP_WATCH_CNTL_BITS cntl;
535− unsigned int i;
536−
537− cntl.u32All = 0;
538−
539− cntl.bitfields.valid = 0;
540− cntl.bitfields.mask = ADDRESS_WATCH_REG_CNTL_DEFAULT_MASK;
541− cntl.bitfields.atc = 1;
542−
543− /* Turning off this address until we set all the registers */
544− for (i = 0; i < MAX_WATCH_ADDRESSES; i++)
545− WREG32(watchRegs[i * ADDRESS_WATCH_REG_MAX +
546− ADDRESS_WATCH_REG_CNTL], cntl.u32All);
547−
548− return 0;
549−}
550−
551−static int kgd_address_watch_execute(struct amdgpu_device *adev,
552− unsigned int watch_point_id,
553− uint32_t cntl_val,
554− uint32_t addr_hi,
555− uint32_t addr_lo)
556−{
557− union TCP_WATCH_CNTL_BITS cntl;
558−
559− cntl.u32All = cntl_val;
560−
561− /* Turning off this watch point until we set all the registers */
562− cntl.bitfields.valid = 0;
563− WREG32(watchRegs[watch_point_id * ADDRESS_WATCH_REG_MAX +
564− ADDRESS_WATCH_REG_CNTL], cntl.u32All);
565−
566− WREG32(watchRegs[watch_point_id * ADDRESS_WATCH_REG_MAX +
567− ADDRESS_WATCH_REG_ADDR_HI], addr_hi);
568−
569− WREG32(watchRegs[watch_point_id * ADDRESS_WATCH_REG_MAX +
570− ADDRESS_WATCH_REG_ADDR_LO], addr_lo);
571−
572− /* Enable the watch point */
573− cntl.bitfields.valid = 1;
574−
575− WREG32(watchRegs[watch_point_id * ADDRESS_WATCH_REG_MAX +
576− ADDRESS_WATCH_REG_CNTL], cntl.u32All);
577−
578− return 0;
579−}
580−
581495 static int kgd_wave_control_execute(struct amdgpu_device *adev,
582496 uint32_t gfx_index_val,
583497 uint32_t sq_cmd)
@@ -602,13 +516,6 @@ static int kgd_wave_control_execute(struct amdgpu_device *adev, · 18 unmodified lines
602516 return 0;
603517 }
604518
605−static uint32_t kgd_address_watch_get_offset(struct amdgpu_device *adev,
606− unsigned int watch_point_id,
607− unsigned int reg_offset)
608−{
609− return watchRegs[watch_point_id * ADDRESS_WATCH_REG_MAX + reg_offset];
610−}
611−
612519 static bool get_atc_vmid_pasid_mapping_info(struct amdgpu_device *adev,
613520 uint8_t vmid, uint16_t *p_pasid)
614521 {
@@ -665,10 +572,7 @@ const struct kfd2kgd_calls gfx_v7_kfd2kgd = { · 50 unmodified lines
665572 .hqd_sdma_is_occupied = kgd_hqd_sdma_is_occupied,
666573 .hqd_destroy = kgd_hqd_destroy,
667574 .hqd_sdma_destroy = kgd_hqd_sdma_destroy,
668− .address_watch_disable = kgd_address_watch_disable,
669− .address_watch_execute = kgd_address_watch_execute,
670575 .wave_control_execute = kgd_wave_control_execute,
671− .address_watch_get_offset = kgd_address_watch_get_offset,
672576 .get_atc_vmid_pasid_mapping_info = get_atc_vmid_pasid_mapping_info,
673577 .set_scratch_backing_va = set_scratch_backing_va,
674578 .set_vm_context_page_table_base = set_vm_context_page_table_base,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c+0−24
@@ -538,20 +538,6 @@ static bool get_atc_vmid_pasid_mapping_info(struct amdgpu_device *adev, · 537 unmodified lines
538538 return !!(value & ATC_VMID0_PASID_MAPPING__VALID_MASK);
539539 }
540540
541−static int kgd_address_watch_disable(struct amdgpu_device *adev)
542−{
543− return 0;
544−}
545−
546−static int kgd_address_watch_execute(struct amdgpu_device *adev,
547− unsigned int watch_point_id,
548− uint32_t cntl_val,
549− uint32_t addr_hi,
550− uint32_t addr_lo)
551−{
552− return 0;
553−}
554−
555541 static int kgd_wave_control_execute(struct amdgpu_device *adev,
556542 uint32_t gfx_index_val,
557543 uint32_t sq_cmd)
@@ -576,13 +562,6 @@ static int kgd_wave_control_execute(struct amdgpu_device *adev, · 18 unmodified lines
576562 return 0;
577563 }
578564
579−static uint32_t kgd_address_watch_get_offset(struct amdgpu_device *adev,
580− unsigned int watch_point_id,
581− unsigned int reg_offset)
582−{
583− return 0;
584−}
585−
586565 static void set_scratch_backing_va(struct amdgpu_device *adev,
587566 uint64_t va, uint32_t vmid)
588567 {
@@ -614,10 +593,7 @@ const struct kfd2kgd_calls gfx_v8_kfd2kgd = { · 25 unmodified lines
614593 .hqd_sdma_is_occupied = kgd_hqd_sdma_is_occupied,
615594 .hqd_destroy = kgd_hqd_destroy,
616595 .hqd_sdma_destroy = kgd_hqd_sdma_destroy,
617− .address_watch_disable = kgd_address_watch_disable,
618− .address_watch_execute = kgd_address_watch_execute,
619596 .wave_control_execute = kgd_wave_control_execute,
620− .address_watch_get_offset = kgd_address_watch_get_offset,
621597 .get_atc_vmid_pasid_mapping_info =
622598 get_atc_vmid_pasid_mapping_info,
623599 .set_scratch_backing_va = set_scratch_backing_va,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c+2−26
@@ -622,20 +622,6 @@ bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct amdgpu_device *adev, · 621 unmodified lines
622622 return !!(value & ATC_VMID0_PASID_MAPPING__VALID_MASK);
623623 }
624624
625−int kgd_gfx_v9_address_watch_disable(struct amdgpu_device *adev)
626−{
627− return 0;
628−}
629−
630−int kgd_gfx_v9_address_watch_execute(struct amdgpu_device *adev,
631− unsigned int watch_point_id,
632− uint32_t cntl_val,
633− uint32_t addr_hi,
634− uint32_t addr_lo)
635−{
636− return 0;
637−}
638−
639625 int kgd_gfx_v9_wave_control_execute(struct amdgpu_device *adev,
640626 uint32_t gfx_index_val,
641627 uint32_t sq_cmd)
@@ -660,13 +646,6 @@ int kgd_gfx_v9_wave_control_execute(struct amdgpu_device *adev, · 18 unmodified lines
660646 return 0;
661647 }
662648
663−uint32_t kgd_gfx_v9_address_watch_get_offset(struct amdgpu_device *adev,
664− unsigned int watch_point_id,
665− unsigned int reg_offset)
666−{
667− return 0;
668−}
669−
670649 void kgd_gfx_v9_set_vm_context_page_table_base(struct amdgpu_device *adev,
671650 uint32_t vmid, uint64_t page_table_base)
672651 {
@@ -736,7 +715,7 @@ static void get_wave_count(struct amdgpu_device *adev, int queue_idx, · 63 unmodified lines
736715 * process whose pasid is provided as a parameter. The process could have ZERO
737716 * or more queues running and submitting waves to compute units.
738717 *
739− * @kgd: Handle of device from which to get number of waves in flight
718+ * @adev: Handle of device from which to get number of waves in flight
740719 * @pasid: Identifies the process for which this query call is invoked
741720 * @pasid_wave_cnt: Output parameter updated with number of waves in flight that
742721 * belong to process with given pasid
@@ -745,7 +724,7 @@ static void get_wave_count(struct amdgpu_device *adev, int queue_idx, · 2 unmodified lines
745724 *
746725 * Note: It's possible that the device has too many queues (oversubscription)
747726 * in which case a VMID could be remapped to a different PASID. This could lead
748− * to an iaccurate wave count. Following is a high-level sequence:
727+ * to an inaccurate wave count. Following is a high-level sequence:
749728 * Time T1: vmid = getVmid(); vmid is associated with Pasid P1
750729 * Time T2: passId = getPasId(vmid); vmid is associated with Pasid P2
751730 * In the sequence above wave count obtained from time T1 will be incorrectly
@@ -888,10 +867,7 @@ const struct kfd2kgd_calls gfx_v9_kfd2kgd = { · 136 unmodified lines
888867 .hqd_sdma_is_occupied = kgd_hqd_sdma_is_occupied,
889868 .hqd_destroy = kgd_gfx_v9_hqd_destroy,
890869 .hqd_sdma_destroy = kgd_hqd_sdma_destroy,
891− .address_watch_disable = kgd_gfx_v9_address_watch_disable,
892− .address_watch_execute = kgd_gfx_v9_address_watch_execute,
893870 .wave_control_execute = kgd_gfx_v9_wave_control_execute,
894− .address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset,
895871 .get_atc_vmid_pasid_mapping_info =
896872 kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
897873 .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h+0−10
@@ -46,19 +46,9 @@ int kgd_gfx_v9_hqd_destroy(struct amdgpu_device *adev, void *mqd, · 45 unmodified lines
4646 enum kfd_preempt_type reset_type,
4747 unsigned int utimeout, uint32_t pipe_id,
4848 uint32_t queue_id);
49−int kgd_gfx_v9_address_watch_disable(struct amdgpu_device *adev);
50−int kgd_gfx_v9_address_watch_execute(struct amdgpu_device *adev,
51− unsigned int watch_point_id,
52− uint32_t cntl_val,
53− uint32_t addr_hi,
54− uint32_t addr_lo);
5549 int kgd_gfx_v9_wave_control_execute(struct amdgpu_device *adev,
5650 uint32_t gfx_index_val,
5751 uint32_t sq_cmd);
58−uint32_t kgd_gfx_v9_address_watch_get_offset(struct amdgpu_device *adev,
59− unsigned int watch_point_id,
60− unsigned int reg_offset);
61−
6252 bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct amdgpu_device *adev,
6353 uint8_t vmid, uint16_t *p_pasid);
6454
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c+64−12
@@ -121,7 +121,7 @@ static size_t amdgpu_amdkfd_acc_size(uint64_t size) · 120 unmodified lines
121121 }
122122
123123 /**
124− * @amdgpu_amdkfd_reserve_mem_limit() - Decrease available memory by size
124+ * amdgpu_amdkfd_reserve_mem_limit() - Decrease available memory by size
125125 * of buffer including any reserved for control structures
126126 *
127127 * @adev: Device to which allocated BO belongs to
@@ -778,7 +778,7 @@ unwind: · 650 unmodified lines
778778 continue;
779779 if (attachment[i]->bo_va) {
780780 amdgpu_bo_reserve(bo[i], true);
781− amdgpu_vm_bo_rmv(adev, attachment[i]->bo_va);
781+ amdgpu_vm_bo_del(adev, attachment[i]->bo_va);
782782 amdgpu_bo_unreserve(bo[i]);
783783 list_del(&attachment[i]->list);
784784 }
@@ -795,7 +795,7 @@ static void kfd_mem_detach(struct kfd_mem_attachment *attachment) · 10 unmodified lines
795795
796796 pr_debug("\t remove VA 0x%llx in entry %p\n",
797797 attachment->va, attachment);
798− amdgpu_vm_bo_rmv(attachment->adev, attachment->bo_va);
798+ amdgpu_vm_bo_del(attachment->adev, attachment->bo_va);
799799 drm_gem_object_put(&bo->tbo.base);
800800 list_del(&attachment->list);
801801 kfree(attachment);
@@ -842,7 +842,8 @@ static void remove_kgd_mem_from_kfd_bo_list(struct kgd_mem *mem, · 40 unmodified lines
842842 *
843843 * Returns 0 for success, negative errno for errors.
844844 */
845−static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr)
845+static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
846+ bool criu_resume)
846847 {
847848 struct amdkfd_process_info *process_info = mem->process_info;
848849 struct amdgpu_bo *bo = mem->bo;
@@ -864,6 +865,18 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr) · 15 unmodified lines
864865 goto out;
865866 }
866867
868+ if (criu_resume) {
869+ /*
870+ * During a CRIU restore operation, the userptr buffer objects
871+ * will be validated in the restore_userptr_work worker at a
872+ * later stage when it is scheduled by another ioctl called by
873+ * CRIU master process for the target pid for restore.
874+ */
875+ atomic_inc(&mem->invalid);
876+ mutex_unlock(&process_info->lock);
877+ return 0;
878+ }
879+
867880 ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages);
868881 if (ret) {
869882 pr_err("%s: Failed to get user pages: %d\n", __func__, ret);
@@ -1452,10 +1465,39 @@ uint64_t amdgpu_amdkfd_gpuvm_get_process_page_dir(void *drm_priv) · 582 unmodified lines
14521465 return avm->pd_phys_addr;
14531466 }
14541467
1468+void amdgpu_amdkfd_block_mmu_notifications(void *p)
1469+{
1470+ struct amdkfd_process_info *pinfo = (struct amdkfd_process_info *)p;
1471+
1472+ mutex_lock(&pinfo->lock);
1473+ WRITE_ONCE(pinfo->block_mmu_notifications, true);
1474+ mutex_unlock(&pinfo->lock);
1475+}
1476+
1477+int amdgpu_amdkfd_criu_resume(void *p)
1478+{
1479+ int ret = 0;
1480+ struct amdkfd_process_info *pinfo = (struct amdkfd_process_info *)p;
1481+
1482+ mutex_lock(&pinfo->lock);
1483+ pr_debug("scheduling work\n");
1484+ atomic_inc(&pinfo->evicted_bos);
1485+ if (!READ_ONCE(pinfo->block_mmu_notifications)) {
1486+ ret = -EINVAL;
1487+ goto out_unlock;
1488+ }
1489+ WRITE_ONCE(pinfo->block_mmu_notifications, false);
1490+ schedule_delayed_work(&pinfo->restore_userptr_work, 0);
1491+
1492+out_unlock:
1493+ mutex_unlock(&pinfo->lock);
1494+ return ret;
1495+}
1496+
14551497 int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
14561498 struct amdgpu_device *adev, uint64_t va, uint64_t size,
14571499 void *drm_priv, struct kgd_mem **mem,
1458− uint64_t *offset, uint32_t flags)
1500+ uint64_t *offset, uint32_t flags, bool criu_resume)
14591501 {
14601502 struct amdgpu_vm *avm = drm_priv_to_vm(drm_priv);
14611503 enum ttm_bo_type bo_type = ttm_bo_type_device;
@@ -1558,7 +1600,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu( · 96 unmodified lines
15581600 add_kgd_mem_to_kfd_bo_list(*mem, avm->process_info, user_addr);
15591601
15601602 if (user_addr) {
1561− ret = init_user_pages(*mem, user_addr);
1603+ pr_debug("creating userptr BO for user_addr = %llu\n", user_addr);
1604+ ret = init_user_pages(*mem, user_addr, criu_resume);
15621605 if (ret)
15631606 goto allocate_init_user_pages_failed;
15641607 } else if (flags & (KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL |
@@ -1813,12 +1856,6 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu( · 248 unmodified lines
18131856 true);
18141857 ret = unreserve_bo_and_vms(&ctx, false, false);
18151858
1816− /* Only apply no TLB flush on Aldebaran to
1817− * workaround regressions on other Asics.
1818− */
1819− if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
1820− *table_freed = true;
1821−
18221859 goto out;
18231860
18241861 out_unreserve:
@@ -2068,6 +2105,10 @@ int amdgpu_amdkfd_evict_userptr(struct kgd_mem *mem, · 243 unmodified lines
20682105 int evicted_bos;
20692106 int r = 0;
20702107
2108+ /* Do not process MMU notifications until stage-4 IOCTL is received */
2109+ if (READ_ONCE(process_info->block_mmu_notifications))
2110+ return 0;
2111+
20712112 atomic_inc(&mem->invalid);
20722113 evicted_bos = atomic_inc_return(&process_info->evicted_bos);
20732114 if (evicted_bos == 1) {
@@ -2635,3 +2676,14 @@ int amdgpu_amdkfd_get_tile_config(struct amdgpu_device *adev, · 561 unmodified lines
26352676
26362677 return 0;
26372678 }
2679+
2680+bool amdgpu_amdkfd_bo_mapped_to_dev(struct amdgpu_device *adev, struct kgd_mem *mem)
2681+{
2682+ struct kfd_mem_attachment *entry;
2683+
2684+ list_for_each_entry(entry, &mem->attachments, list) {
2685+ if (entry->is_mapped && entry->adev == adev)
2686+ return true;
2687+ }
2688+ return false;
2689+}
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c+2−0
@@ -1083,6 +1083,7 @@ int amdgpu_atombios_get_clock_dividers(struct amdgpu_device *adev, · 1082 unmodified lines
10831083 return 0;
10841084 }
10851085
1086+#ifdef CONFIG_DRM_AMDGPU_SI
10861087 int amdgpu_atombios_get_memory_pll_dividers(struct amdgpu_device *adev,
10871088 u32 clock,
10881089 bool strobe_mode,
@@ -1503,6 +1504,7 @@ int amdgpu_atombios_init_mc_reg_table(struct amdgpu_device *adev, · 414 unmodified lines
15031504 }
15041505 return -EINVAL;
15051506 }
1507+#endif
15061508
15071509 bool amdgpu_atombios_has_gpu_virtualization_table(struct amdgpu_device *adev)
15081510 {
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h+12−10
@@ -160,6 +160,7 @@ int amdgpu_atombios_get_clock_dividers(struct amdgpu_device *adev, · 159 unmodified lines
160160 bool strobe_mode,
161161 struct atom_clock_dividers *dividers);
162162
163+#ifdef CONFIG_DRM_AMDGPU_SI
163164 int amdgpu_atombios_get_memory_pll_dividers(struct amdgpu_device *adev,
164165 u32 clock,
165166 bool strobe_mode,
@@ -179,6 +180,17 @@ int amdgpu_atombios_get_voltage_table(struct amdgpu_device *adev, · 13 unmodified lines
179180 int amdgpu_atombios_init_mc_reg_table(struct amdgpu_device *adev,
180181 u8 module_index,
181182 struct atom_mc_reg_table *reg_table);
183+int amdgpu_atombios_get_max_vddc(struct amdgpu_device *adev, u8 voltage_type,
184+ u16 voltage_id, u16 *voltage);
185+int amdgpu_atombios_get_leakage_vddc_based_on_leakage_idx(struct amdgpu_device *adev,
186+ u16 *voltage,
187+ u16 leakage_idx);
188+void amdgpu_atombios_get_default_voltages(struct amdgpu_device *adev,
189+ u16 *vddc, u16 *vddci, u16 *mvdd);
190+int amdgpu_atombios_get_svi2_info(struct amdgpu_device *adev,
191+ u8 voltage_type,
192+ u8 *svd_gpio_id, u8 *svc_gpio_id);
193+#endif
182194
183195 bool amdgpu_atombios_has_gpu_virtualization_table(struct amdgpu_device *adev);
184196
@@ -190,21 +202,11 @@ void amdgpu_atombios_scratch_regs_set_backlight_level(struct amdgpu_device *adev · 5 unmodified lines
190202 bool amdgpu_atombios_scratch_need_asic_init(struct amdgpu_device *adev);
191203
192204 void amdgpu_atombios_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le);
193−int amdgpu_atombios_get_max_vddc(struct amdgpu_device *adev, u8 voltage_type,
194− u16 voltage_id, u16 *voltage);
195−int amdgpu_atombios_get_leakage_vddc_based_on_leakage_idx(struct amdgpu_device *adev,
196− u16 *voltage,
197− u16 leakage_idx);
198−void amdgpu_atombios_get_default_voltages(struct amdgpu_device *adev,
199− u16 *vddc, u16 *vddci, u16 *mvdd);
200205 int amdgpu_atombios_get_clock_dividers(struct amdgpu_device *adev,
201206 u8 clock_type,
202207 u32 clock,
203208 bool strobe_mode,
204209 struct atom_clock_dividers *dividers);
205−int amdgpu_atombios_get_svi2_info(struct amdgpu_device *adev,
206− u8 voltage_type,
207− u8 *svd_gpio_id, u8 *svc_gpio_id);
208210
209211 int amdgpu_atombios_get_data_table(struct amdgpu_device *adev,
210212 uint32_t table,
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c+130−114
@@ -29,14 +29,13 @@ · 28 unmodified lines
2929 #define AMDGPU_BENCHMARK_COMMON_MODES_N 17
3030
3131 static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
32− uint64_t saddr, uint64_t daddr, int n)
32+ uint64_t saddr, uint64_t daddr, int n, s64 *time_ms)
3333 {
34− unsigned long start_jiffies;
35− unsigned long end_jiffies;
34+ ktime_t stime, etime;
3635 struct dma_fence *fence;
3736 int i, r;
3837
39− start_jiffies = jiffies;
38+ stime = ktime_get();
4039 for (i = 0; i < n; i++) {
4140 struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
4241 r = amdgpu_copy_buffer(ring, saddr, daddr, size, NULL, &fence,
@@ -48,120 +47,81 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size, · 5 unmodified lines
4847 if (r)
4948 goto exit_do_move;
5049 }
51− end_jiffies = jiffies;
52− r = jiffies_to_msecs(end_jiffies - start_jiffies);
5350
5451 exit_do_move:
52+ etime = ktime_get();
53+ *time_ms = ktime_ms_delta(etime, stime);
54+
5555 return r;
5656 }
5757
5858
59−static void amdgpu_benchmark_log_results(int n, unsigned size,
60− unsigned int time,
59+static void amdgpu_benchmark_log_results(struct amdgpu_device *adev,
60+ int n, unsigned size,
61+ s64 time_ms,
6162 unsigned sdomain, unsigned ddomain,
6263 char *kind)
6364 {
64− unsigned int throughput = (n * (size >> 10)) / time;
65− DRM_INFO("amdgpu: %s %u bo moves of %u kB from"
66− " %d to %d in %u ms, throughput: %u Mb/s or %u MB/s\n",
67− kind, n, size >> 10, sdomain, ddomain, time,
65+ s64 throughput = (n * (size >> 10));
66+
67+ throughput = div64_s64(throughput, time_ms);
68+
69+ dev_info(adev->dev, "amdgpu: %s %u bo moves of %u kB from"
70+ " %d to %d in %lld ms, throughput: %lld Mb/s or %lld MB/s\n",
71+ kind, n, size >> 10, sdomain, ddomain, time_ms,
6872 throughput * 8, throughput);
6973 }
7074
71−static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
72− unsigned sdomain, unsigned ddomain)
75+static int amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
76+ unsigned sdomain, unsigned ddomain)
7377 {
7478 struct amdgpu_bo *dobj = NULL;
7579 struct amdgpu_bo *sobj = NULL;
76− struct amdgpu_bo_param bp;
7780 uint64_t saddr, daddr;
81+ s64 time_ms;
7882 int r, n;
79− int time;
80−
81− memset(&bp, 0, sizeof(bp));
82− bp.size = size;
83− bp.byte_align = PAGE_SIZE;
84− bp.domain = sdomain;
85− bp.flags = 0;
86− bp.type = ttm_bo_type_kernel;
87− bp.resv = NULL;
88− bp.bo_ptr_size = sizeof(struct amdgpu_bo);
8983
9084 n = AMDGPU_BENCHMARK_ITERATIONS;
91− r = amdgpu_bo_create(adev, &bp, &sobj);
92− if (r) {
93− goto out_cleanup;
94− }
95− r = amdgpu_bo_reserve(sobj, false);
96− if (unlikely(r != 0))
97− goto out_cleanup;
98− r = amdgpu_bo_pin(sobj, sdomain);
99− if (r) {
100− amdgpu_bo_unreserve(sobj);
101− goto out_cleanup;
102− }
103− r = amdgpu_ttm_alloc_gart(&sobj->tbo);
104− amdgpu_bo_unreserve(sobj);
105− if (r) {
106− goto out_cleanup;
107− }
108− saddr = amdgpu_bo_gpu_offset(sobj);
109− bp.domain = ddomain;
110− r = amdgpu_bo_create(adev, &bp, &dobj);
111− if (r) {
112− goto out_cleanup;
113− }
114− r = amdgpu_bo_reserve(dobj, false);
115− if (unlikely(r != 0))
116− goto out_cleanup;
117− r = amdgpu_bo_pin(dobj, ddomain);
118− if (r) {
119− amdgpu_bo_unreserve(sobj);
85+
86+ r = amdgpu_bo_create_kernel(adev, size,
87+ PAGE_SIZE, sdomain,
88+ &sobj,
89+ &saddr,
90+ NULL);
91+ if (r)
12092 goto out_cleanup;
121− }
122− r = amdgpu_ttm_alloc_gart(&dobj->tbo);
123− amdgpu_bo_unreserve(dobj);
124− if (r) {
93+ r = amdgpu_bo_create_kernel(adev, size,
94+ PAGE_SIZE, ddomain,
95+ &dobj,
96+ &daddr,
97+ NULL);
98+ if (r)
12599 goto out_cleanup;
126− }
127− daddr = amdgpu_bo_gpu_offset(dobj);
128100
129101 if (adev->mman.buffer_funcs) {
130− time = amdgpu_benchmark_do_move(adev, size, saddr, daddr, n);
131− if (time < 0)
102+ r = amdgpu_benchmark_do_move(adev, size, saddr, daddr, n, &time_ms);
103+ if (r)
132104 goto out_cleanup;
133− if (time > 0)
134− amdgpu_benchmark_log_results(n, size, time,
105+ else
106+ amdgpu_benchmark_log_results(adev, n, size, time_ms,
135107 sdomain, ddomain, "dma");
136108 }
137109
138110 out_cleanup:
139111 /* Check error value now. The value can be overwritten when clean up.*/
140− if (r) {
141− DRM_ERROR("Error while benchmarking BO move.\n");
142− }
112+ if (r < 0)
113+ dev_info(adev->dev, "Error while benchmarking BO move.\n");
143114
144− if (sobj) {
145− r = amdgpu_bo_reserve(sobj, true);
146− if (likely(r == 0)) {
147− amdgpu_bo_unpin(sobj);
148− amdgpu_bo_unreserve(sobj);
149− }
150− amdgpu_bo_unref(&sobj);
151− }
152− if (dobj) {
153− r = amdgpu_bo_reserve(dobj, true);
154− if (likely(r == 0)) {
155− amdgpu_bo_unpin(dobj);
156− amdgpu_bo_unreserve(dobj);
157− }
158− amdgpu_bo_unref(&dobj);
159− }
115+ if (sobj)
116+ amdgpu_bo_free_kernel(&sobj, &saddr, NULL);
117+ if (dobj)
118+ amdgpu_bo_free_kernel(&dobj, &daddr, NULL);
119+ return r;
160120 }
161121
162−void amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
122+int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
163123 {
164− int i;
124+ int i, r;
165125 static const int common_modes[AMDGPU_BENCHMARK_COMMON_MODES_N] = {
166126 640 * 480 * 4,
167127 720 * 480 * 4,
@@ -182,63 +142,119 @@ void amdgpu_benchmark(struct amdgpu_device *adev, int test_number) · 14 unmodified lines
182142 1920 * 1200 * 4
183143 };
184144
145+ mutex_lock(&adev->benchmark_mutex);
185146 switch (test_number) {
186147 case 1:
148+ dev_info(adev->dev,
149+ "benchmark test: %d (simple test, VRAM to GTT and GTT to VRAM)\n",
150+ test_number);
187151 /* simple test, VRAM to GTT and GTT to VRAM */
188− amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_GTT,
189− AMDGPU_GEM_DOMAIN_VRAM);
190− amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_VRAM,
191− AMDGPU_GEM_DOMAIN_GTT);
152+ r = amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_GTT,
153+ AMDGPU_GEM_DOMAIN_VRAM);
154+ if (r)
155+ goto done;
156+ r = amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_VRAM,
157+ AMDGPU_GEM_DOMAIN_GTT);
158+ if (r)
159+ goto done;
192160 break;
193161 case 2:
162+ dev_info(adev->dev,
163+ "benchmark test: %d (simple test, VRAM to VRAM)\n",
164+ test_number);
194165 /* simple test, VRAM to VRAM */
195− amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_VRAM,
196− AMDGPU_GEM_DOMAIN_VRAM);
166+ r = amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_VRAM,
167+ AMDGPU_GEM_DOMAIN_VRAM);
168+ if (r)
169+ goto done;
197170 break;
198171 case 3:
172+ dev_info(adev->dev,
173+ "benchmark test: %d (GTT to VRAM, buffer size sweep, powers of 2)\n",
174+ test_number);
199175 /* GTT to VRAM, buffer size sweep, powers of 2 */
200− for (i = 1; i <= 16384; i <<= 1)
201− amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
202− AMDGPU_GEM_DOMAIN_GTT,
203− AMDGPU_GEM_DOMAIN_VRAM);
176+ for (i = 1; i <= 16384; i <<= 1) {
177+ r = amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
178+ AMDGPU_GEM_DOMAIN_GTT,
179+ AMDGPU_GEM_DOMAIN_VRAM);
180+ if (r)
181+ goto done;
182+ }
204183 break;
205184 case 4:
185+ dev_info(adev->dev,
186+ "benchmark test: %d (VRAM to GTT, buffer size sweep, powers of 2)\n",
187+ test_number);
206188 /* VRAM to GTT, buffer size sweep, powers of 2 */
207− for (i = 1; i <= 16384; i <<= 1)
208− amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
209− AMDGPU_GEM_DOMAIN_VRAM,
210− AMDGPU_GEM_DOMAIN_GTT);
189+ for (i = 1; i <= 16384; i <<= 1) {
190+ r = amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
191+ AMDGPU_GEM_DOMAIN_VRAM,
192+ AMDGPU_GEM_DOMAIN_GTT);
193+ if (r)
194+ goto done;
195+ }
211196 break;
212197 case 5:
198+ dev_info(adev->dev,
199+ "benchmark test: %d (VRAM to VRAM, buffer size sweep, powers of 2)\n",
200+ test_number);
213201 /* VRAM to VRAM, buffer size sweep, powers of 2 */
214− for (i = 1; i <= 16384; i <<= 1)
215− amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
216− AMDGPU_GEM_DOMAIN_VRAM,
217− AMDGPU_GEM_DOMAIN_VRAM);
202+ for (i = 1; i <= 16384; i <<= 1) {
203+ r = amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
204+ AMDGPU_GEM_DOMAIN_VRAM,
205+ AMDGPU_GEM_DOMAIN_VRAM);
206+ if (r)
207+ goto done;
208+ }
218209 break;
219210 case 6:
211+ dev_info(adev->dev,
212+ "benchmark test: %d (GTT to VRAM, buffer size sweep, common modes)\n",
213+ test_number);
220214 /* GTT to VRAM, buffer size sweep, common modes */
221− for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++)
222− amdgpu_benchmark_move(adev, common_modes[i],
223− AMDGPU_GEM_DOMAIN_GTT,
224− AMDGPU_GEM_DOMAIN_VRAM);
215+ for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++) {
216+ r = amdgpu_benchmark_move(adev, common_modes[i],
217+ AMDGPU_GEM_DOMAIN_GTT,
218+ AMDGPU_GEM_DOMAIN_VRAM);
219+ if (r)
220+ goto done;
221+ }
225222 break;
226223 case 7:
224+ dev_info(adev->dev,
225+ "benchmark test: %d (VRAM to GTT, buffer size sweep, common modes)\n",
226+ test_number);
227227 /* VRAM to GTT, buffer size sweep, common modes */
228− for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++)
229− amdgpu_benchmark_move(adev, common_modes[i],
230− AMDGPU_GEM_DOMAIN_VRAM,
231− AMDGPU_GEM_DOMAIN_GTT);
228+ for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++) {
229+ r = amdgpu_benchmark_move(adev, common_modes[i],
230+ AMDGPU_GEM_DOMAIN_VRAM,
231+ AMDGPU_GEM_DOMAIN_GTT);
232+ if (r)
233+ goto done;
234+ }
232235 break;
233236 case 8:
237+ dev_info(adev->dev,
238+ "benchmark test: %d (VRAM to VRAM, buffer size sweep, common modes)\n",
239+ test_number);
234240 /* VRAM to VRAM, buffer size sweep, common modes */
235− for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++)
236− amdgpu_benchmark_move(adev, common_modes[i],
241+ for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++) {
242+ r = amdgpu_benchmark_move(adev, common_modes[i],
237243 AMDGPU_GEM_DOMAIN_VRAM,
238244 AMDGPU_GEM_DOMAIN_VRAM);
245+ if (r)
246+ goto done;
247+ }
239248 break;
240249
241250 default:
242− DRM_ERROR("Unknown benchmark\n");
251+ dev_info(adev->dev, "Unknown benchmark %d\n", test_number);
252+ r = -EINVAL;
253+ break;
243254 }
255+
256+done:
257+ mutex_unlock(&adev->benchmark_mutex);
258+
259+ return r;
244260 }
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c+38−0
@@ -464,3 +464,41 @@ success: · 463 unmodified lines
464464 adev->is_atom_fw = (adev->asic_type >= CHIP_VEGA10) ? true : false;
465465 return true;
466466 }
467+
468+/* helper function for soc15 and onwards to read bios from rom */
469+bool amdgpu_soc15_read_bios_from_rom(struct amdgpu_device *adev,
470+ u8 *bios, u32 length_bytes)
471+{
472+ u32 *dw_ptr;
473+ u32 i, length_dw;
474+ u32 rom_index_offset;
475+ u32 rom_data_offset;
476+
477+ if (bios == NULL)
478+ return false;
479+ if (length_bytes == 0)
480+ return false;
481+ /* APU vbios image is part of sbios image */
482+ if (adev->flags & AMD_IS_APU)
483+ return false;
484+ if (!adev->smuio.funcs ||
485+ !adev->smuio.funcs->get_rom_index_offset ||
486+ !adev->smuio.funcs->get_rom_data_offset)
487+ return false;
488+
489+ dw_ptr = (u32 *)bios;
490+ length_dw = ALIGN(length_bytes, 4) / 4;
491+
492+ rom_index_offset =
493+ adev->smuio.funcs->get_rom_index_offset(adev);
494+ rom_data_offset =
495+ adev->smuio.funcs->get_rom_data_offset(adev);
496+
497+ /* set rom index to 0 */
498+ WREG32(rom_index_offset, 0);
499+ /* read out the rom data */
500+ for (i = 0; i < length_dw; i++)
501+ dw_ptr[i] = RREG32(rom_data_offset);
502+
503+ return true;
504+}
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c+13−6
@@ -127,8 +127,6 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs · 126 unmodified lines
127127 goto free_chunk;
128128 }
129129
130− mutex_lock(&p->ctx->lock);
131−
132130 /* skip guilty context job */
133131 if (atomic_read(&p->ctx->guilty) == 1) {
134132 ret = -ECANCELED;
@@ -314,7 +312,7 @@ static void amdgpu_cs_get_threshold_for_moves(struct amdgpu_device *adev, · 179 unmodified lines
314312 }
315313
316314 total_vram = adev->gmc.real_vram_size - atomic64_read(&adev->vram_pin_size);
317− used_vram = amdgpu_vram_mgr_usage(&adev->mman.vram_mgr);
315+ used_vram = ttm_resource_manager_usage(&adev->mman.vram_mgr.manager);
318316 free_vram = used_vram >= total_vram ? 0 : total_vram - used_vram;
319317
320318 spin_lock(&adev->mm_stats.lock);
@@ -585,6 +583,16 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 264 unmodified lines
585583 }
586584 }
587585
586+ /* Move fence waiting after getting reservation lock of
587+ * PD root. Then there is no need on a ctx mutex lock.
588+ */
589+ r = amdgpu_ctx_wait_prev_fence(p->ctx, p->entity);
590+ if (unlikely(r != 0)) {
591+ if (r != -ERESTARTSYS)
592+ DRM_ERROR("amdgpu_ctx_wait_prev_fence failed.\n");
593+ goto error_validate;
594+ }
595+
588596 amdgpu_cs_get_threshold_for_moves(p->adev, &p->bytes_moved_threshold,
589597 &p->bytes_moved_vis_threshold);
590598 p->bytes_moved = 0;
@@ -700,7 +708,6 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, · 109 unmodified lines
700708 dma_fence_put(parser->fence);
701709
702710 if (parser->ctx) {
703− mutex_unlock(&parser->ctx->lock);
704711 amdgpu_ctx_put(parser->ctx);
705712 }
706713 if (parser->bo_list)
@@ -944,7 +951,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, · 237 unmodified lines
944951 if (parser->job->uf_addr && ring->funcs->no_user_fence)
945952 return -EINVAL;
946953
947− return amdgpu_ctx_wait_prev_fence(parser->ctx, parser->entity);
954+ return 0;
948955 }
949956
950957 static int amdgpu_cs_process_fence_dep(struct amdgpu_cs_parser *p,
@@ -1360,7 +1367,6 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 409 unmodified lines
13601367 goto out;
13611368
13621369 r = amdgpu_cs_submit(&parser, cs);
1363−
13641370 out:
13651371 amdgpu_cs_parser_fini(&parser, r, reserved_buffers);
13661372
@@ -1506,6 +1512,7 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, · 139 unmodified lines
15061512 return 0;
15071513
15081514 default:
1515+ dma_fence_put(fence);
15091516 return -EINVAL;
15101517 }
15111518 }
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c+1−1
@@ -98,7 +98,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 97 unmodified lines
9898
9999 if (r) {
100100 DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r);
101− amdgpu_vm_bo_rmv(adev, *bo_va);
101+ amdgpu_vm_bo_del(adev, *bo_va);
102102 ttm_eu_backoff_reservation(&ticket, &list);
103103 return r;
104104 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c+128−4
@@ -230,13 +230,13 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, · 229 unmodified lines
230230
231231 kref_init(&ctx->refcount);
232232 spin_lock_init(&ctx->ring_lock);
233− mutex_init(&ctx->lock);
234233
235234 ctx->reset_counter = atomic_read(&adev->gpu_reset_counter);
236235 ctx->reset_counter_query = ctx->reset_counter;
237236 ctx->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
238237 ctx->init_priority = priority;
239238 ctx->override_priority = AMDGPU_CTX_PRIORITY_UNSET;
239+ ctx->stable_pstate = AMDGPU_CTX_STABLE_PSTATE_NONE;
240240
241241 return 0;
242242 }
@@ -255,6 +255,86 @@ static void amdgpu_ctx_fini_entity(struct amdgpu_ctx_entity *entity) · 12 unmodified lines
255255 kfree(entity);
256256 }
257257
258+static int amdgpu_ctx_get_stable_pstate(struct amdgpu_ctx *ctx,
259+ u32 *stable_pstate)
260+{
261+ struct amdgpu_device *adev = ctx->adev;
262+ enum amd_dpm_forced_level current_level;
263+
264+ if (!ctx)
265+ return -EINVAL;
266+
267+ current_level = amdgpu_dpm_get_performance_level(adev);
268+
269+ switch (current_level) {
270+ case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD:
271+ *stable_pstate = AMDGPU_CTX_STABLE_PSTATE_STANDARD;
272+ break;
273+ case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK:
274+ *stable_pstate = AMDGPU_CTX_STABLE_PSTATE_MIN_SCLK;
275+ break;
276+ case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK:
277+ *stable_pstate = AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK;
278+ break;
279+ case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK:
280+ *stable_pstate = AMDGPU_CTX_STABLE_PSTATE_PEAK;
281+ break;
282+ default:
283+ *stable_pstate = AMDGPU_CTX_STABLE_PSTATE_NONE;
284+ break;
285+ }
286+ return 0;
287+}
288+
289+static int amdgpu_ctx_set_stable_pstate(struct amdgpu_ctx *ctx,
290+ u32 stable_pstate)
291+{
292+ struct amdgpu_device *adev = ctx->adev;
293+ enum amd_dpm_forced_level level;
294+ int r;
295+
296+ if (!ctx)
297+ return -EINVAL;
298+
299+ mutex_lock(&adev->pm.stable_pstate_ctx_lock);
300+ if (adev->pm.stable_pstate_ctx && adev->pm.stable_pstate_ctx != ctx) {
301+ r = -EBUSY;
302+ goto done;
303+ }
304+
305+ switch (stable_pstate) {
306+ case AMDGPU_CTX_STABLE_PSTATE_NONE:
307+ level = AMD_DPM_FORCED_LEVEL_AUTO;
308+ break;
309+ case AMDGPU_CTX_STABLE_PSTATE_STANDARD:
310+ level = AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD;
311+ break;
312+ case AMDGPU_CTX_STABLE_PSTATE_MIN_SCLK:
313+ level = AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK;
314+ break;
315+ case AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK:
316+ level = AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK;
317+ break;
318+ case AMDGPU_CTX_STABLE_PSTATE_PEAK:
319+ level = AMD_DPM_FORCED_LEVEL_PROFILE_PEAK;
320+ break;
321+ default:
322+ r = -EINVAL;
323+ goto done;
324+ }
325+
326+ r = amdgpu_dpm_force_performance_level(adev, level);
327+
328+ if (level == AMD_DPM_FORCED_LEVEL_AUTO)
329+ adev->pm.stable_pstate_ctx = NULL;
330+ else
331+ adev->pm.stable_pstate_ctx = ctx;
332+done:
333+ mutex_unlock(&adev->pm.stable_pstate_ctx_lock);
334+
335+ return r;
336+}
337+
258338 static void amdgpu_ctx_fini(struct kref *ref)
259339 {
260340 struct amdgpu_ctx *ctx = container_of(ref, struct amdgpu_ctx, refcount);
@@ -270,8 +350,7 @@ static void amdgpu_ctx_fini(struct kref *ref) · 9 unmodified lines
270350 ctx->entities[i][j] = NULL;
271351 }
272352 }
273−
274− mutex_destroy(&ctx->lock);
353+ amdgpu_ctx_set_stable_pstate(ctx, AMDGPU_CTX_STABLE_PSTATE_NONE);
275354 kfree(ctx);
276355 }
277356
@@ -467,11 +546,41 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev, · 189 unmodified lines
467546 return 0;
468547 }
469548
549+
550+
551+static int amdgpu_ctx_stable_pstate(struct amdgpu_device *adev,
552+ struct amdgpu_fpriv *fpriv, uint32_t id,
553+ bool set, u32 *stable_pstate)
554+{
555+ struct amdgpu_ctx *ctx;
556+ struct amdgpu_ctx_mgr *mgr;
557+ int r;
558+
559+ if (!fpriv)
560+ return -EINVAL;
561+
562+ mgr = &fpriv->ctx_mgr;
563+ mutex_lock(&mgr->lock);
564+ ctx = idr_find(&mgr->ctx_handles, id);
565+ if (!ctx) {
566+ mutex_unlock(&mgr->lock);
567+ return -EINVAL;
568+ }
569+
570+ if (set)
571+ r = amdgpu_ctx_set_stable_pstate(ctx, *stable_pstate);
572+ else
573+ r = amdgpu_ctx_get_stable_pstate(ctx, stable_pstate);
574+
575+ mutex_unlock(&mgr->lock);
576+ return r;
577+}
578+
470579 int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
471580 struct drm_file *filp)
472581 {
473582 int r;
474− uint32_t id;
583+ uint32_t id, stable_pstate;
475584 int32_t priority;
476585
477586 union drm_amdgpu_ctx *args = data;
@@ -500,6 +609,21 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, · 22 unmodified lines
500609 case AMDGPU_CTX_OP_QUERY_STATE2:
501610 r = amdgpu_ctx_query2(adev, fpriv, id, &args->out);
502611 break;
612+ case AMDGPU_CTX_OP_GET_STABLE_PSTATE:
613+ if (args->in.flags)
614+ return -EINVAL;
615+ r = amdgpu_ctx_stable_pstate(adev, fpriv, id, false, &stable_pstate);
616+ if (!r)
617+ args->out.pstate.flags = stable_pstate;
618+ break;
619+ case AMDGPU_CTX_OP_SET_STABLE_PSTATE:
620+ if (args->in.flags & ~AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK)
621+ return -EINVAL;
622+ stable_pstate = args->in.flags & AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK;
623+ if (stable_pstate > AMDGPU_CTX_STABLE_PSTATE_PEAK)
624+ return -EINVAL;
625+ r = amdgpu_ctx_stable_pstate(adev, fpriv, id, true, &stable_pstate);
626+ break;
503627 default:
504628 return -EINVAL;
505629 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h+1−1
@@ -49,10 +49,10 @@ struct amdgpu_ctx { · 48 unmodified lines
4949 bool preamble_presented;
5050 int32_t init_priority;
5151 int32_t override_priority;
52− struct mutex lock;
5352 atomic_t guilty;
5453 unsigned long ras_counter_ce;
5554 unsigned long ras_counter_ue;
55+ uint32_t stable_pstate;
5656 };
5757
5858 struct amdgpu_ctx_mgr {
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c+132−17
@@ -37,6 +37,8 @@ · 36 unmodified lines
3737 #include "amdgpu_fw_attestation.h"
3838 #include "amdgpu_umr.h"
3939
40+#include "amdgpu_reset.h"
41+
4042 #if defined(CONFIG_DEBUG_FS)
4143
4244 /**
@@ -728,7 +730,7 @@ static ssize_t amdgpu_debugfs_gca_config_read(struct file *f, char __user *buf, · 685 unmodified lines
728730 return -ENOMEM;
729731
730732 /* version, increment each time something is added */
731− config[no_regs++] = 3;
733+ config[no_regs++] = 4;
732734 config[no_regs++] = adev->gfx.config.max_shader_engines;
733735 config[no_regs++] = adev->gfx.config.max_tile_pipes;
734736 config[no_regs++] = adev->gfx.config.max_cu_per_sh;
@@ -768,6 +770,9 @@ static ssize_t amdgpu_debugfs_gca_config_read(struct file *f, char __user *buf, · 33 unmodified lines
768770 config[no_regs++] = adev->pdev->subsystem_device;
769771 config[no_regs++] = adev->pdev->subsystem_vendor;
770772
773+ /* rev==4 APU flag */
774+ config[no_regs++] = adev->flags & AMD_IS_APU ? 1 : 0;
775+
771776 while (size && (*pos < no_regs * 4)) {
772777 uint32_t value;
773778
@@ -1120,8 +1125,10 @@ static ssize_t amdgpu_debugfs_gfxoff_read(struct file *f, char __user *buf, · 346 unmodified lines
11201125 return -EINVAL;
11211126
11221127 r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
1123− if (r < 0)
1128+ if (r < 0) {
1129+ pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
11241130 return r;
1131+ }
11251132
11261133 while (size) {
11271134 uint32_t value;
@@ -1279,7 +1286,7 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused) · 151 unmodified lines
12791286 }
12801287
12811288 /* Avoid accidently unparking the sched thread during GPU reset */
1282− r = down_write_killable(&adev->reset_sem);
1289+ r = down_write_killable(&adev->reset_domain->sem);
12831290 if (r)
12841291 return r;
12851292
@@ -1308,7 +1315,7 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused) · 22 unmodified lines
13081315 kthread_unpark(ring->sched.thread);
13091316 }
13101317
1311− up_write(&adev->reset_sem);
1318+ up_write(&adev->reset_domain->sem);
13121319
13131320 pm_runtime_mark_last_busy(dev->dev);
13141321 pm_runtime_put_autosuspend(dev->dev);
@@ -1357,6 +1364,25 @@ static int amdgpu_debugfs_evict_gtt(void *data, u64 *val) · 42 unmodified lines
13571364 return 0;
13581365 }
13591366
1367+static int amdgpu_debugfs_benchmark(void *data, u64 val)
1368+{
1369+ struct amdgpu_device *adev = (struct amdgpu_device *)data;
1370+ struct drm_device *dev = adev_to_drm(adev);
1371+ int r;
1372+
1373+ r = pm_runtime_get_sync(dev->dev);
1374+ if (r < 0) {
1375+ pm_runtime_put_autosuspend(dev->dev);
1376+ return r;
1377+ }
1378+
1379+ r = amdgpu_benchmark(adev, val);
1380+
1381+ pm_runtime_mark_last_busy(dev->dev);
1382+ pm_runtime_put_autosuspend(dev->dev);
1383+
1384+ return r;
1385+}
13601386
13611387 static int amdgpu_debugfs_vm_info_show(struct seq_file *m, void *unused)
13621388 {
@@ -1393,6 +1419,8 @@ DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_evict_vram_fops, amdgpu_debugfs_evict_vram, · 30 unmodified lines
13931419 NULL, "%lld\n");
13941420 DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_evict_gtt_fops, amdgpu_debugfs_evict_gtt,
13951421 NULL, "%lld\n");
1422+DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_benchmark_fops, NULL, amdgpu_debugfs_benchmark,
1423+ "%lld\n");
13961424
13971425 static void amdgpu_ib_preempt_fences_swap(struct amdgpu_ring *ring,
13981426 struct dma_fence **fences)
@@ -1517,7 +1545,7 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val) · 118 unmodified lines
15171545 return -ENOMEM;
15181546
15191547 /* Avoid accidently unparking the sched thread during GPU reset */
1520− r = down_read_killable(&adev->reset_sem);
1548+ r = down_read_killable(&adev->reset_domain->sem);
15211549 if (r)
15221550 goto pro_end;
15231551
@@ -1560,7 +1588,7 @@ failure: · 36 unmodified lines
15601588 /* restart the scheduler */
15611589 kthread_unpark(ring->sched.thread);
15621590
1563− up_read(&adev->reset_sem);
1591+ up_read(&adev->reset_domain->sem);
15641592
15651593 ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, resched);
15661594
@@ -1585,22 +1613,25 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val) · 18 unmodified lines
15851613 return ret;
15861614 }
15871615
1588− if (is_support_sw_smu(adev)) {
1589− ret = smu_get_dpm_freq_range(&adev->smu, SMU_SCLK, &min_freq, &max_freq);
1590− if (ret || val > max_freq || val < min_freq)
1591− return -EINVAL;
1592− ret = smu_set_soft_freq_range(&adev->smu, SMU_SCLK, (uint32_t)val, (uint32_t)val);
1593− } else {
1594− return 0;
1616+ ret = amdgpu_dpm_get_dpm_freq_range(adev, PP_SCLK, &min_freq, &max_freq);
1617+ if (ret == -EOPNOTSUPP) {
1618+ ret = 0;
1619+ goto out;
15951620 }
1621+ if (ret || val > max_freq || val < min_freq) {
1622+ ret = -EINVAL;
1623+ goto out;
1624+ }
1625+
1626+ ret = amdgpu_dpm_set_soft_freq_range(adev, PP_SCLK, (uint32_t)val, (uint32_t)val);
1627+ if (ret)
1628+ ret = -EINVAL;
15961629
1630+out:
15971631 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
15981632 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
15991633
1600− if (ret)
1601− return -EINVAL;
1602−
1603− return 0;
1634+ return ret;
16041635 }
16051636
16061637 DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,
@@ -1609,6 +1640,86 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL, · 2 unmodified lines
16091640 DEFINE_DEBUGFS_ATTRIBUTE(fops_sclk_set, NULL,
16101641 amdgpu_debugfs_sclk_set, "%llu\n");
16111642
1643+static ssize_t amdgpu_reset_dump_register_list_read(struct file *f,
1644+ char __user *buf, size_t size, loff_t *pos)
1645+{
1646+ struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
1647+ char reg_offset[12];
1648+ int i, ret, len = 0;
1649+
1650+ if (*pos)
1651+ return 0;
1652+
1653+ memset(reg_offset, 0, 12);
1654+ ret = down_read_killable(&adev->reset_domain->sem);
1655+ if (ret)
1656+ return ret;
1657+
1658+ for (i = 0; i < adev->num_regs; i++) {
1659+ sprintf(reg_offset, "0x%x\n", adev->reset_dump_reg_list[i]);
1660+ up_read(&adev->reset_domain->sem);
1661+ if (copy_to_user(buf + len, reg_offset, strlen(reg_offset)))
1662+ return -EFAULT;
1663+
1664+ len += strlen(reg_offset);
1665+ ret = down_read_killable(&adev->reset_domain->sem);
1666+ if (ret)
1667+ return ret;
1668+ }
1669+
1670+ up_read(&adev->reset_domain->sem);
1671+ *pos += len;
1672+
1673+ return len;
1674+}
1675+
1676+static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
1677+ const char __user *buf, size_t size, loff_t *pos)
1678+{
1679+ struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
1680+ char reg_offset[11];
1681+ uint32_t *tmp;
1682+ int ret, i = 0, len = 0;
1683+
1684+ do {
1685+ memset(reg_offset, 0, 11);
1686+ if (copy_from_user(reg_offset, buf + len,
1687+ min(10, ((int)size-len)))) {
1688+ ret = -EFAULT;
1689+ goto error_free;
1690+ }
1691+
1692+ tmp = krealloc_array(tmp, i + 1, sizeof(uint32_t), GFP_KERNEL);
1693+ if (sscanf(reg_offset, "%X %n", &tmp[i], &ret) != 1) {
1694+ ret = -EINVAL;
1695+ goto error_free;
1696+ }
1697+
1698+ len += ret;
1699+ i++;
1700+ } while (len < size);
1701+
1702+ ret = down_write_killable(&adev->reset_domain->sem);
1703+ if (ret)
1704+ goto error_free;
1705+
1706+ swap(adev->reset_dump_reg_list, tmp);
1707+ adev->num_regs = i;
1708+ up_write(&adev->reset_domain->sem);
1709+ ret = size;
1710+
1711+error_free:
1712+ kfree(tmp);
1713+ return ret;
1714+}
1715+
1716+static const struct file_operations amdgpu_reset_dump_register_list = {
1717+ .owner = THIS_MODULE,
1718+ .read = amdgpu_reset_dump_register_list_read,
1719+ .write = amdgpu_reset_dump_register_list_write,
1720+ .llseek = default_llseek
1721+};
1722+
16121723 int amdgpu_debugfs_init(struct amdgpu_device *adev)
16131724 {
16141725 struct dentry *root = adev_to_drm(adev)->primary->debugfs_root;
@@ -1675,6 +1786,10 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev) · 60 unmodified lines
16751786 &amdgpu_debugfs_test_ib_fops);
16761787 debugfs_create_file("amdgpu_vm_info", 0444, root, adev,
16771788 &amdgpu_debugfs_vm_info_fops);
1789+ debugfs_create_file("amdgpu_benchmark", 0200, root, adev,
1790+ &amdgpu_benchmark_fops);
1791+ debugfs_create_file("amdgpu_reset_dump_register_list", 0644, root, adev,
1792+ &amdgpu_reset_dump_register_list);
16781793
16791794 adev->debugfs_vbios_blob.data = adev->bios;
16801795 adev->debugfs_vbios_blob.size = adev->bios_size;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+285−156
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #include <linux/console.h>
3232 #include <linux/slab.h>
3333 #include <linux/iommu.h>
34+#include <linux/pci.h>
3435
3536 #include <drm/drm_atomic_helper.h>
3637 #include <drm/drm_probe_helper.h>
@@ -55,7 +56,6 @@ · 18 unmodified lines
5556 #include "soc15.h"
5657 #include "nv.h"
5758 #include "bif/bif_4_1_d.h"
58−#include <linux/pci.h>
5959 #include <linux/firmware.h>
6060 #include "amdgpu_vf_error.h"
6161
@@ -88,6 +88,8 @@ MODULE_FIRMWARE("amdgpu/vangogh_gpu_info.bin"); · 26 unmodified lines
8888 MODULE_FIRMWARE("amdgpu/yellow_carp_gpu_info.bin");
8989
9090 #define AMDGPU_RESUME_MS 2000
91+#define AMDGPU_MAX_RETRY_LIMIT 2
92+#define AMDGPU_RETRY_SRIOV_RESET(r) ((r) == -EBUSY || (r) == -ETIMEDOUT || (r) == -EINVAL)
9193
9294 const char *amdgpu_asic_name[] = {
9395 "TAHITI",
@@ -424,10 +426,10 @@ bool amdgpu_device_skip_hw_access(struct amdgpu_device *adev) · 330 unmodified lines
424426 * the lock.
425427 */
426428 if (in_task()) {
427− if (down_read_trylock(&adev->reset_sem))
428− up_read(&adev->reset_sem);
429+ if (down_read_trylock(&adev->reset_domain->sem))
430+ up_read(&adev->reset_domain->sem);
429431 else
430− lockdep_assert_held(&adev->reset_sem);
432+ lockdep_assert_held(&adev->reset_domain->sem);
431433 }
432434 #endif
433435 return false;
@@ -453,9 +455,9 @@ uint32_t amdgpu_device_rreg(struct amdgpu_device *adev, · 19 unmodified lines
453455 if ((reg * 4) < adev->rmmio_size) {
454456 if (!(acc_flags & AMDGPU_REGS_NO_KIQ) &&
455457 amdgpu_sriov_runtime(adev) &&
456− down_read_trylock(&adev->reset_sem)) {
458+ down_read_trylock(&adev->reset_domain->sem)) {
457459 ret = amdgpu_kiq_rreg(adev, reg);
458− up_read(&adev->reset_sem);
460+ up_read(&adev->reset_domain->sem);
459461 } else {
460462 ret = readl(((void __iomem *)adev->rmmio) + (reg * 4));
461463 }
@@ -538,9 +540,9 @@ void amdgpu_device_wreg(struct amdgpu_device *adev, · 76 unmodified lines
538540 if ((reg * 4) < adev->rmmio_size) {
539541 if (!(acc_flags & AMDGPU_REGS_NO_KIQ) &&
540542 amdgpu_sriov_runtime(adev) &&
541− down_read_trylock(&adev->reset_sem)) {
543+ down_read_trylock(&adev->reset_domain->sem)) {
542544 amdgpu_kiq_wreg(adev, reg, v);
543− up_read(&adev->reset_sem);
545+ up_read(&adev->reset_domain->sem);
544546 } else {
545547 writel(v, ((void __iomem *)adev->rmmio) + (reg * 4));
546548 }
@@ -554,7 +556,11 @@ void amdgpu_device_wreg(struct amdgpu_device *adev, · 7 unmodified lines
554556 /**
555557 * amdgpu_mm_wreg_mmio_rlc - write register either with direct/indirect mmio or with RLC path if in range
556558 *
557− * this function is invoked only the debugfs register access
559+ * @adev: amdgpu_device pointer
560+ * @reg: mmio/rlc register
561+ * @v: value to write
562+ *
563+ * this function is invoked only for the debugfs register access
558564 */
559565 void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev,
560566 uint32_t reg, uint32_t v)
@@ -566,7 +572,7 @@ void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev, · 5 unmodified lines
566572 adev->gfx.rlc.funcs &&
567573 adev->gfx.rlc.funcs->is_rlcg_access_range) {
568574 if (adev->gfx.rlc.funcs->is_rlcg_access_range(adev, reg))
569− return adev->gfx.rlc.funcs->sriov_wreg(adev, reg, v, 0, 0);
575+ return amdgpu_sriov_wreg(adev, reg, v, 0, 0);
570576 } else if ((reg * 4) >= adev->rmmio_size) {
571577 adev->pcie_wreg(adev, reg * 4, v);
572578 } else {
@@ -1312,6 +1318,31 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev) · 739 unmodified lines
13121318 return true;
13131319 }
13141320
1321+/**
1322+ * amdgpu_device_should_use_aspm - check if the device should program ASPM
1323+ *
1324+ * @adev: amdgpu_device pointer
1325+ *
1326+ * Confirm whether the module parameter and pcie bridge agree that ASPM should
1327+ * be set for this device.
1328+ *
1329+ * Returns true if it should be used or false if not.
1330+ */
1331+bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
1332+{
1333+ switch (amdgpu_aspm) {
1334+ case -1:
1335+ break;
1336+ case 0:
1337+ return false;
1338+ case 1:
1339+ return true;
1340+ default:
1341+ return false;
1342+ }
1343+ return pcie_aspm_enabled(adev->pdev);
1344+}
1345+
13151346 /* if we get transitioned to only one device, take VGA back */
13161347 /**
13171348 * amdgpu_device_vga_set_decode - enable/disable vga decode
@@ -1446,7 +1477,8 @@ static int amdgpu_device_init_apu_flags(struct amdgpu_device *adev) · 128 unmodified lines
14461477 case CHIP_YELLOW_CARP:
14471478 break;
14481479 case CHIP_CYAN_SKILLFISH:
1449− if (adev->pdev->device == 0x13FE)
1480+ if ((adev->pdev->device == 0x13FE) ||
1481+ (adev->pdev->device == 0x143F))
14501482 adev->apu_flags |= AMD_APU_IS_CYAN_SKILLFISH2;
14511483 break;
14521484 default:
@@ -1507,6 +1539,11 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev) · 54 unmodified lines
15071539 amdgpu_sched_hw_submission = roundup_pow_of_two(amdgpu_sched_hw_submission);
15081540 }
15091541
1542+ if (amdgpu_reset_method < -1 || amdgpu_reset_method > 4) {
1543+ dev_warn(adev->dev, "invalid option for reset method, reverting to default\n");
1544+ amdgpu_reset_method = -1;
1545+ }
1546+
15101547 amdgpu_device_check_smu_prv_buffer_size(adev);
15111548
15121549 amdgpu_device_check_vm_size(adev);
@@ -2073,6 +2110,8 @@ out: · 560 unmodified lines
20732110 */
20742111 static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
20752112 {
2113+ struct drm_device *dev = adev_to_drm(adev);
2114+ struct pci_dev *parent;
20762115 int i, r;
20772116
20782117 amdgpu_device_enable_virtual_display(adev);
@@ -2137,6 +2176,16 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) · 58 unmodified lines
21372176 break;
21382177 }
21392178
2179+ if (amdgpu_has_atpx() &&
2180+ (amdgpu_is_atpx_hybrid() ||
2181+ amdgpu_has_atpx_dgpu_power_cntl()) &&
2182+ ((adev->flags & AMD_IS_APU) == 0) &&
2183+ !pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
2184+ adev->flags |= AMD_IS_PX;
2185+
2186+ parent = pci_upstream_bridge(adev->pdev);
2187+ adev->has_pr3 = parent ? pci_pr3_present(parent) : false;
2188+
21402189 amdgpu_amdkfd_device_probe(adev);
21412190
21422191 adev->pm.pp_feature = amdgpu_pp_feature_mask;
@@ -2287,6 +2336,49 @@ static int amdgpu_device_fw_loading(struct amdgpu_device *adev) · 144 unmodified lines
22872336 return r;
22882337 }
22892338
2339+static int amdgpu_device_init_schedulers(struct amdgpu_device *adev)
2340+{
2341+ long timeout;
2342+ int r, i;
2343+
2344+ for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
2345+ struct amdgpu_ring *ring = adev->rings[i];
2346+
2347+ /* No need to setup the GPU scheduler for rings that don't need it */
2348+ if (!ring || ring->no_scheduler)
2349+ continue;
2350+
2351+ switch (ring->funcs->type) {
2352+ case AMDGPU_RING_TYPE_GFX:
2353+ timeout = adev->gfx_timeout;
2354+ break;
2355+ case AMDGPU_RING_TYPE_COMPUTE:
2356+ timeout = adev->compute_timeout;
2357+ break;
2358+ case AMDGPU_RING_TYPE_SDMA:
2359+ timeout = adev->sdma_timeout;
2360+ break;
2361+ default:
2362+ timeout = adev->video_timeout;
2363+ break;
2364+ }
2365+
2366+ r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
2367+ ring->num_hw_submission, amdgpu_job_hang_limit,
2368+ timeout, adev->reset_domain->wq,
2369+ ring->sched_score, ring->name,
2370+ adev->dev);
2371+ if (r) {
2372+ DRM_ERROR("Failed to create scheduler on ring %s.\n",
2373+ ring->name);
2374+ return r;
2375+ }
2376+ }
2377+
2378+ return 0;
2379+}
2380+
2381+
22902382 /**
22912383 * amdgpu_device_ip_init - run init for hardware IPs
22922384 *
@@ -2398,8 +2490,28 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) · 105 unmodified lines
23982490 if (r)
23992491 goto init_failed;
24002492
2401− if (adev->gmc.xgmi.num_physical_nodes > 1)
2402− amdgpu_xgmi_add_device(adev);
2493+ /**
2494+ * In case of XGMI grab extra reference for reset domain for this device
2495+ */
2496+ if (adev->gmc.xgmi.num_physical_nodes > 1) {
2497+ if (amdgpu_xgmi_add_device(adev) == 0) {
2498+ struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev);
2499+
2500+ if (!hive->reset_domain ||
2501+ !amdgpu_reset_get_reset_domain(hive->reset_domain)) {
2502+ r = -ENOENT;
2503+ goto init_failed;
2504+ }
2505+
2506+ /* Drop the early temporary reset domain we created for device */
2507+ amdgpu_reset_put_reset_domain(adev->reset_domain);
2508+ adev->reset_domain = hive->reset_domain;
2509+ }
2510+ }
2511+
2512+ r = amdgpu_device_init_schedulers(adev);
2513+ if (r)
2514+ goto init_failed;
24032515
24042516 /* Don't init kfd if whole hive need to be reset during init */
24052517 if (!adev->gmc.xgmi.pending_reset)
@@ -2610,6 +2722,12 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev) · 204 unmodified lines
26102722 adev->ip_blocks[i].status.late_initialized = true;
26112723 }
26122724
2725+ r = amdgpu_ras_late_init(adev);
2726+ if (r) {
2727+ DRM_ERROR("amdgpu_ras_late_init failed %d", r);
2728+ return r;
2729+ }
2730+
26132731 amdgpu_ras_set_error_query_ready(adev, true);
26142732
26152733 amdgpu_device_set_cg_state(adev, AMD_CG_STATE_GATE);
@@ -2624,7 +2742,7 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev) · 8 unmodified lines
26242742 /* For passthrough configuration on arcturus and aldebaran, enable special handling SBR */
26252743 if (amdgpu_passthrough(adev) && ((adev->asic_type == CHIP_ARCTURUS && adev->gmc.xgmi.num_physical_nodes > 1)||
26262744 adev->asic_type == CHIP_ALDEBARAN ))
2627− smu_handle_passthrough_sbr(&adev->smu, true);
2745+ amdgpu_dpm_handle_passthrough_sbr(adev, true);
26282746
26292747 if (adev->gmc.xgmi.num_physical_nodes > 1) {
26302748 mutex_lock(&mgpu_info.mutex);
@@ -2708,11 +2826,11 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev) · 77 unmodified lines
27082826 }
27092827 }
27102828
2711− amdgpu_amdkfd_suspend(adev, false);
2712−
27132829 amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
27142830 amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
27152831
2832+ amdgpu_amdkfd_suspend(adev, false);
2833+
27162834 /* Workaroud for ASICs need to disable SMC first */
27172835 amdgpu_device_smu_fini_early(adev);
27182836
@@ -2881,7 +2999,7 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · 162 unmodified lines
28812999 int i, r;
28823000
28833001 if (adev->in_s0ix)
2884− amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry);
3002+ amdgpu_dpm_gfx_state_change(adev, sGpuChangeState_D3Entry);
28853003
28863004 for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
28873005 if (!adev->ip_blocks[i].status.valid)
@@ -3307,9 +3425,9 @@ static void amdgpu_device_xgmi_reset_func(struct work_struct *__work) · 419 unmodified lines
33073425 if (adev->asic_reset_res)
33083426 goto fail;
33093427
3310− if (adev->mmhub.ras_funcs &&
3311− adev->mmhub.ras_funcs->reset_ras_error_count)
3312− adev->mmhub.ras_funcs->reset_ras_error_count(adev);
3428+ if (adev->mmhub.ras && adev->mmhub.ras->ras_block.hw_ops &&
3429+ adev->mmhub.ras->ras_block.hw_ops->reset_ras_error_count)
3430+ adev->mmhub.ras->ras_block.hw_ops->reset_ras_error_count(adev);
33133431 } else {
33143432
33153433 task_barrier_full(&hive->tb);
@@ -3493,12 +3611,12 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 177 unmodified lines
34933611 mutex_init(&adev->mn_lock);
34943612 mutex_init(&adev->virt.vf_errors.lock);
34953613 hash_init(adev->mn_hash);
3496− atomic_set(&adev->in_gpu_reset, 0);
3497− init_rwsem(&adev->reset_sem);
34983614 mutex_init(&adev->psp.mutex);
34993615 mutex_init(&adev->notifier_lock);
3616+ mutex_init(&adev->pm.stable_pstate_ctx_lock);
3617+ mutex_init(&adev->benchmark_mutex);
35003618
3501− amdgpu_device_init_apu_flags(adev);
3619+ amdgpu_device_init_apu_flags(adev);
35023620
35033621 r = amdgpu_device_check_arguments(adev);
35043622 if (r)
@@ -3519,6 +3637,8 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 14 unmodified lines
35193637
35203638 INIT_LIST_HEAD(&adev->reset_list);
35213639
3640+ INIT_LIST_HEAD(&adev->ras_list);
3641+
35223642 INIT_DELAYED_WORK(&adev->delayed_init_work,
35233643 amdgpu_device_delayed_init_work_handler);
35243644 INIT_DELAYED_WORK(&adev->gfx.gfx_off_delay_work,
@@ -3577,6 +3697,15 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 52 unmodified lines
35773697 return r;
35783698 }
35793699
3700+ /*
3701+ * Reset domain needs to be present early, before XGMI hive discovered
3702+ * (if any) and intitialized to use reset sem and in_gpu reset flag
3703+ * early on during init.
3704+ */
3705+ adev->reset_domain = amdgpu_reset_create_reset_domain(SINGLE_DEVICE ,"amdgpu-reset-dev");
3706+ if (!adev->reset_domain)
3707+ return -ENOMEM;
3708+
35803709 /* early init functions */
35813710 r = amdgpu_device_ip_early_init(adev);
35823711 if (r)
@@ -3749,19 +3878,6 @@ fence_driver_init: · 166 unmodified lines
37493878 } else
37503879 adev->ucode_sysfs_en = true;
37513880
3752− if ((amdgpu_testing & 1)) {
3753− if (adev->accel_working)
3754− amdgpu_test_moves(adev);
3755− else
3756− DRM_INFO("amdgpu: acceleration disabled, skipping move tests\n");
3757− }
3758− if (amdgpu_benchmarking) {
3759− if (adev->accel_working)
3760− amdgpu_benchmark(adev, amdgpu_benchmarking);
3761− else
3762− DRM_INFO("amdgpu: acceleration disabled, skipping benchmarks\n");
3763− }
3764−
37653881 /*
37663882 * Register gpu instance before amdgpu_device_enable_mgpu_fan_boost.
37673883 * Otherwise the mgpu fan boost feature will be skipped due to the
@@ -3953,6 +4069,9 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) · 185 unmodified lines
39534069 if (adev->mman.discovery_bin)
39544070 amdgpu_discovery_fini(adev);
39554071
4072+ amdgpu_reset_put_reset_domain(adev->reset_domain);
4073+ adev->reset_domain = NULL;
4074+
39564075 kfree(adev->pci_state);
39574076
39584077 }
@@ -4044,7 +4163,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · 85 unmodified lines
40444163 return 0;
40454164
40464165 if (adev->in_s0ix)
4047− amdgpu_gfx_state_change_set(adev, sGpuChangeState_D0Entry);
4166+ amdgpu_dpm_gfx_state_change(adev, sGpuChangeState_D0Entry);
40484167
40494168 /* post card */
40504169 if (amdgpu_device_need_post(adev)) {
@@ -4347,7 +4466,9 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, · 296 unmodified lines
43474466 {
43484467 int r;
43494468 struct amdgpu_hive_info *hive = NULL;
4469+ int retry_limit = 0;
43504470
4471+retry:
43514472 amdgpu_amdkfd_pre_reset(adev);
43524473
43534474 amdgpu_amdkfd_pre_reset(adev);
@@ -4396,6 +4517,14 @@ error: · 42 unmodified lines
43964517 }
43974518 amdgpu_virt_release_full_gpu(adev, true);
43984519
4520+ if (AMDGPU_RETRY_SRIOV_RESET(r)) {
4521+ if (retry_limit < AMDGPU_MAX_RETRY_LIMIT) {
4522+ retry_limit++;
4523+ goto retry;
4524+ } else
4525+ DRM_ERROR("GPU reset retry is beyond the retry limit\n");
4526+ }
4527+
43994528 return r;
44004529 }
44014530
@@ -4587,6 +4716,22 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, · 185 unmodified lines
45874716 return r;
45884717 }
45894718
4719+static int amdgpu_reset_reg_dumps(struct amdgpu_device *adev)
4720+{
4721+ uint32_t reg_value;
4722+ int i;
4723+
4724+ lockdep_assert_held(&adev->reset_domain->sem);
4725+ dump_stack();
4726+
4727+ for (i = 0; i < adev->num_regs; i++) {
4728+ reg_value = RREG32(adev->reset_dump_reg_list[i]);
4729+ trace_amdgpu_reset_reg_dumps(adev->reset_dump_reg_list[i], reg_value);
4730+ }
4731+
4732+ return 0;
4733+}
4734+
45904735 int amdgpu_do_asic_reset(struct list_head *device_list_handle,
45914736 struct amdgpu_reset_context *reset_context)
45924737 {
@@ -4597,6 +4742,7 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle, · 4 unmodified lines
45974742 /* Try reset handler method first */
45984743 tmp_adev = list_first_entry(device_list_handle, struct amdgpu_device,
45994744 reset_list);
4745+ amdgpu_reset_reg_dumps(tmp_adev);
46004746 r = amdgpu_reset_perform_reset(tmp_adev, reset_context);
46014747 /* If reset handler not implemented, continue; otherwise return */
46024748 if (r == -ENOSYS)
@@ -4645,9 +4791,9 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle, · 42 unmodified lines
46454791
46464792 if (!r && amdgpu_ras_intr_triggered()) {
46474793 list_for_each_entry(tmp_adev, device_list_handle, reset_list) {
4648− if (tmp_adev->mmhub.ras_funcs &&
4649− tmp_adev->mmhub.ras_funcs->reset_ras_error_count)
4650− tmp_adev->mmhub.ras_funcs->reset_ras_error_count(tmp_adev);
4794+ if (tmp_adev->mmhub.ras && tmp_adev->mmhub.ras->ras_block.hw_ops &&
4795+ tmp_adev->mmhub.ras->ras_block.hw_ops->reset_ras_error_count)
4796+ tmp_adev->mmhub.ras->ras_block.hw_ops->reset_ras_error_count(tmp_adev);
46514797 }
46524798
46534799 amdgpu_ras_intr_cleared();
@@ -4754,17 +4900,8 @@ end: · 100 unmodified lines
47544900 return r;
47554901 }
47564902
4757−static bool amdgpu_device_lock_adev(struct amdgpu_device *adev,
4758− struct amdgpu_hive_info *hive)
4903+static void amdgpu_device_set_mp1_state(struct amdgpu_device *adev)
47594904 {
4760− if (atomic_cmpxchg(&adev->in_gpu_reset, 0, 1) != 0)
4761− return false;
4762−
4763− if (hive) {
4764− down_write_nest_lock(&adev->reset_sem, &hive->hive_lock);
4765− } else {
4766− down_write(&adev->reset_sem);
4767− }
47684905
47694906 switch (amdgpu_asic_reset_method(adev)) {
47704907 case AMD_RESET_METHOD_MODE1:
@@ -4777,56 +4914,12 @@ static bool amdgpu_device_lock_adev(struct amdgpu_device *adev, · 6 unmodified lines
47774914 adev->mp1_state = PP_MP1_STATE_NONE;
47784915 break;
47794916 }
4780−
4781− return true;
47824917 }
47834918
4784−static void amdgpu_device_unlock_adev(struct amdgpu_device *adev)
4919+static void amdgpu_device_unset_mp1_state(struct amdgpu_device *adev)
47854920 {
47864921 amdgpu_vf_error_trans_all(adev);
47874922 adev->mp1_state = PP_MP1_STATE_NONE;
4788− atomic_set(&adev->in_gpu_reset, 0);
4789− up_write(&adev->reset_sem);
4790−}
4791−
4792−/*
4793− * to lockup a list of amdgpu devices in a hive safely, if not a hive
4794− * with multiple nodes, it will be similar as amdgpu_device_lock_adev.
4795− *
4796− * unlock won't require roll back.
4797− */
4798−static int amdgpu_device_lock_hive_adev(struct amdgpu_device *adev, struct amdgpu_hive_info *hive)
4799−{
4800− struct amdgpu_device *tmp_adev = NULL;
4801−
4802− if (!amdgpu_sriov_vf(adev) && (adev->gmc.xgmi.num_physical_nodes > 1)) {
4803− if (!hive) {
4804− dev_err(adev->dev, "Hive is NULL while device has multiple xgmi nodes");
4805− return -ENODEV;
4806− }
4807− list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {
4808− if (!amdgpu_device_lock_adev(tmp_adev, hive))
4809− goto roll_back;
4810− }
4811− } else if (!amdgpu_device_lock_adev(adev, hive))
4812− return -EAGAIN;
4813−
4814− return 0;
4815−roll_back:
4816− if (!list_is_first(&tmp_adev->gmc.xgmi.head, &hive->device_list)) {
4817− /*
4818− * if the lockup iteration break in the middle of a hive,
4819− * it may means there may has a race issue,
4820− * or a hive device locked up independently.
4821− * we may be in trouble and may not, so will try to roll back
4822− * the lock and give out a warnning.
4823− */
4824− dev_warn(tmp_adev->dev, "Hive lock iteration broke in the middle. Rolling back to unlock");
4825− list_for_each_entry_continue_reverse(tmp_adev, &hive->device_list, gmc.xgmi.head) {
4826− amdgpu_device_unlock_adev(tmp_adev);
4827− }
4828− }
4829− return -EAGAIN;
48304923 }
48314924
48324925 static void amdgpu_device_resume_display_audio(struct amdgpu_device *adev)
@@ -4960,7 +5053,7 @@ retry: · 127 unmodified lines
49605053 }
49615054
49625055 /**
4963− * amdgpu_device_gpu_recover - reset the asic and recover scheduler
5056+ * amdgpu_device_gpu_recover_imp - reset the asic and recover scheduler
49645057 *
49655058 * @adev: amdgpu_device pointer
49665059 * @job: which job trigger hang
@@ -4970,7 +5063,7 @@ retry: · 3 unmodified lines
49705063 * Returns 0 for success or an error on failure.
49715064 */
49725065
4973−int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
5066+int amdgpu_device_gpu_recover_imp(struct amdgpu_device *adev,
49745067 struct amdgpu_job *job)
49755068 {
49765069 struct list_head device_list, *device_list_handle = NULL;
@@ -5004,26 +5097,10 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 27 unmodified lines
50045097 dev_info(adev->dev, "GPU %s begin!\n",
50055098 need_emergency_restart ? "jobs stop":"reset");
50065099
5007− /*
5008− * Here we trylock to avoid chain of resets executing from
5009− * either trigger by jobs on different adevs in XGMI hive or jobs on
5010− * different schedulers for same device while this TO handler is running.
5011− * We always reset all schedulers for device and all devices for XGMI
5012− * hive so that should take care of them too.
5013− */
50145100 if (!amdgpu_sriov_vf(adev))
50155101 hive = amdgpu_get_xgmi_hive(adev);
5016− if (hive) {
5017− if (atomic_cmpxchg(&hive->in_reset, 0, 1) != 0) {
5018− DRM_INFO("Bailing on TDR for s_job:%llx, hive: %llx as another already in progress",
5019− job ? job->base.id : -1, hive->hive_id);
5020− amdgpu_put_xgmi_hive(hive);
5021− if (job && job->vm)
5022− drm_sched_increase_karma(&job->base);
5023− return 0;
5024− }
5102+ if (hive)
50255103 mutex_lock(&hive->hive_lock);
5026− }
50275104
50285105 reset_context.method = AMD_RESET_METHOD_NONE;
50295106 reset_context.reset_req_dev = adev;
@@ -5031,22 +5108,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 1 unmodified line
50315108 reset_context.hive = hive;
50325109 clear_bit(AMDGPU_NEED_FULL_RESET, &reset_context.flags);
50335110
5034− /*
5035− * lock the device before we try to operate the linked list
5036− * if didn't get the device lock, don't touch the linked list since
5037− * others may iterating it.
5038− */
5039− r = amdgpu_device_lock_hive_adev(adev, hive);
5040− if (r) {
5041− dev_info(adev->dev, "Bailing on TDR for s_job:%llx, as another already in progress",
5042− job ? job->base.id : -1);
5043−
5044− /* even we skipped this reset, still need to set the job to guilty */
5045− if (job && job->vm)
5046− drm_sched_increase_karma(&job->base);
5047− goto skip_recovery;
5048− }
5049−
50505111 /*
50515112 * Build list of devices to reset.
50525113 * In case we are in XGMI hive mode, resort the device list
@@ -5064,8 +5125,16 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 11 unmodified lines
50645125 device_list_handle = &device_list;
50655126 }
50665127
5128+ /* We need to lock reset domain only once both for XGMI and single device */
5129+ tmp_adev = list_first_entry(device_list_handle, struct amdgpu_device,
5130+ reset_list);
5131+ amdgpu_device_lock_reset_domain(tmp_adev->reset_domain);
5132+
50675133 /* block all schedulers and reset given job's ring */
50685134 list_for_each_entry(tmp_adev, device_list_handle, reset_list) {
5135+
5136+ amdgpu_device_set_mp1_state(tmp_adev);
5137+
50695138 /*
50705139 * Try to put the audio codec into suspend state
50715140 * before gpu reset started.
@@ -5187,6 +5256,9 @@ skip_hw_reset: · 115 unmodified lines
51875256 drm_helper_resume_force_mode(adev_to_drm(tmp_adev));
51885257 }
51895258
5259+ if (tmp_adev->asic_reset_res)
5260+ r = tmp_adev->asic_reset_res;
5261+
51905262 tmp_adev->asic_reset_res = 0;
51915263
51925264 if (r) {
@@ -5214,21 +5286,55 @@ skip_sched_resume: · 21 unmodified lines
52145286
52155287 if (audio_suspended)
52165288 amdgpu_device_resume_display_audio(tmp_adev);
5217− amdgpu_device_unlock_adev(tmp_adev);
5289+
5290+ amdgpu_device_unset_mp1_state(tmp_adev);
52185291 }
52195292
5220−skip_recovery:
5293+ tmp_adev = list_first_entry(device_list_handle, struct amdgpu_device,
5294+ reset_list);
5295+ amdgpu_device_unlock_reset_domain(tmp_adev->reset_domain);
5296+
52215297 if (hive) {
5222− atomic_set(&hive->in_reset, 0);
52235298 mutex_unlock(&hive->hive_lock);
52245299 amdgpu_put_xgmi_hive(hive);
52255300 }
52265301
5227− if (r && r != -EAGAIN)
5302+ if (r)
52285303 dev_info(adev->dev, "GPU reset end with ret = %d\n", r);
52295304 return r;
52305305 }
52315306
5307+struct amdgpu_recover_work_struct {
5308+ struct work_struct base;
5309+ struct amdgpu_device *adev;
5310+ struct amdgpu_job *job;
5311+ int ret;
5312+};
5313+
5314+static void amdgpu_device_queue_gpu_recover_work(struct work_struct *work)
5315+{
5316+ struct amdgpu_recover_work_struct *recover_work = container_of(work, struct amdgpu_recover_work_struct, base);
5317+
5318+ recover_work->ret = amdgpu_device_gpu_recover_imp(recover_work->adev, recover_work->job);
5319+}
5320+/*
5321+ * Serialize gpu recover into reset domain single threaded wq
5322+ */
5323+int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
5324+ struct amdgpu_job *job)
5325+{
5326+ struct amdgpu_recover_work_struct work = {.adev = adev, .job = job};
5327+
5328+ INIT_WORK(&work.base, amdgpu_device_queue_gpu_recover_work);
5329+
5330+ if (!amdgpu_reset_domain_schedule(adev->reset_domain, &work.base))
5331+ return -EAGAIN;
5332+
5333+ flush_work(&work.base);
5334+
5335+ return work.ret;
5336+}
5337+
52325338 /**
52335339 * amdgpu_device_get_pcie_info - fence pcie info about the PCIE slot
52345340 *
@@ -5416,20 +5522,6 @@ int amdgpu_device_baco_exit(struct drm_device *dev) · 181 unmodified lines
54165522 return 0;
54175523 }
54185524
5419−static void amdgpu_cancel_all_tdr(struct amdgpu_device *adev)
5420−{
5421− int i;
5422−
5423− for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
5424− struct amdgpu_ring *ring = adev->rings[i];
5425−
5426− if (!ring || !ring->sched.thread)
5427− continue;
5428−
5429− cancel_delayed_work_sync(&ring->sched.work_tdr);
5430− }
5431−}
5432−
54335525 /**
54345526 * amdgpu_pci_error_detected - Called when a PCI error is detected.
54355527 * @pdev: PCI device struct
@@ -5460,14 +5552,11 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta · 24 unmodified lines
54605552 /* Fatal error, prepare for slot reset */
54615553 case pci_channel_io_frozen:
54625554 /*
5463− * Cancel and wait for all TDRs in progress if failing to
5464− * set adev->in_gpu_reset in amdgpu_device_lock_adev
5465− *
5466− * Locking adev->reset_sem will prevent any external access
5555+ * Locking adev->reset_domain->sem will prevent any external access
54675556 * to GPU during PCI error recovery
54685557 */
5469− while (!amdgpu_device_lock_adev(adev, NULL))
5470− amdgpu_cancel_all_tdr(adev);
5558+ amdgpu_device_lock_reset_domain(adev->reset_domain);
5559+ amdgpu_device_set_mp1_state(adev);
54715560
54725561 /*
54735562 * Block any work scheduling as we do for regular GPU reset
@@ -5574,7 +5663,8 @@ out: · 100 unmodified lines
55745663 DRM_INFO("PCIe error recovery succeeded\n");
55755664 } else {
55765665 DRM_ERROR("PCIe error recovery failed, err:%d", r);
5577− amdgpu_device_unlock_adev(adev);
5666+ amdgpu_device_unset_mp1_state(adev);
5667+ amdgpu_device_unlock_reset_domain(adev->reset_domain);
55785668 }
55795669
55805670 return r ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
@@ -5611,7 +5701,8 @@ void amdgpu_pci_resume(struct pci_dev *pdev) · 30 unmodified lines
56115701 drm_sched_start(&ring->sched, true);
56125702 }
56135703
5614− amdgpu_device_unlock_adev(adev);
5704+ amdgpu_device_unset_mp1_state(adev);
5705+ amdgpu_device_unlock_reset_domain(adev->reset_domain);
56155706 }
56165707
56175708 bool amdgpu_device_cache_pci_state(struct pci_dev *pdev)
@@ -5688,6 +5779,11 @@ void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev, · 70 unmodified lines
56885779 amdgpu_asic_invalidate_hdp(adev, ring);
56895780 }
56905781
5782+int amdgpu_in_reset(struct amdgpu_device *adev)
5783+{
5784+ return atomic_read(&adev->reset_domain->in_gpu_reset);
5785+ }
5786+
56915787 /**
56925788 * amdgpu_device_halt() - bring hardware to some kind of halt state
56935789 *
@@ -5726,3 +5822,36 @@ void amdgpu_device_halt(struct amdgpu_device *adev) · 32 unmodified lines
57265822 pci_disable_device(pdev);
57275823 pci_wait_for_pending_transaction(pdev);
57285824 }
5825+
5826+u32 amdgpu_device_pcie_port_rreg(struct amdgpu_device *adev,
5827+ u32 reg)
5828+{
5829+ unsigned long flags, address, data;
5830+ u32 r;
5831+
5832+ address = adev->nbio.funcs->get_pcie_port_index_offset(adev);
5833+ data = adev->nbio.funcs->get_pcie_port_data_offset(adev);
5834+
5835+ spin_lock_irqsave(&adev->pcie_idx_lock, flags);
5836+ WREG32(address, reg * 4);
5837+ (void)RREG32(address);
5838+ r = RREG32(data);
5839+ spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
5840+ return r;
5841+}
5842+
5843+void amdgpu_device_pcie_port_wreg(struct amdgpu_device *adev,
5844+ u32 reg, u32 v)
5845+{
5846+ unsigned long flags, address, data;
5847+
5848+ address = adev->nbio.funcs->get_pcie_port_index_offset(adev);
5849+ data = adev->nbio.funcs->get_pcie_port_data_offset(adev);
5850+
5851+ spin_lock_irqsave(&adev->pcie_idx_lock, flags);
5852+ WREG32(address, reg * 4);
5853+ (void)RREG32(address);
5854+ WREG32(data, v);
5855+ (void)RREG32(data);
5856+ spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
5857+}
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c+651−32
@@ -360,8 +360,11 @@ out: · 359 unmodified lines
360360 return r;
361361 }
362362
363+static void amdgpu_discovery_sysfs_fini(struct amdgpu_device *adev);
364+
363365 void amdgpu_discovery_fini(struct amdgpu_device *adev)
364366 {
367+ amdgpu_discovery_sysfs_fini(adev);
365368 kfree(adev->mman.discovery_bin);
366369 adev->mman.discovery_bin = NULL;
367370 }
@@ -382,6 +385,578 @@ static int amdgpu_discovery_validate_ip(const struct ip *ip) · 14 unmodified lines
382385 return 0;
383386 }
384387
388+static void amdgpu_discovery_read_harvest_bit_per_ip(struct amdgpu_device *adev,
389+ uint32_t *vcn_harvest_count)
390+{
391+ struct binary_header *bhdr;
392+ struct ip_discovery_header *ihdr;
393+ struct die_header *dhdr;
394+ struct ip *ip;
395+ uint16_t die_offset, ip_offset, num_dies, num_ips;
396+ int i, j;
397+
398+ bhdr = (struct binary_header *)adev->mman.discovery_bin;
399+ ihdr = (struct ip_discovery_header *)(adev->mman.discovery_bin +
400+ le16_to_cpu(bhdr->table_list[IP_DISCOVERY].offset));
401+ num_dies = le16_to_cpu(ihdr->num_dies);
402+
403+ /* scan harvest bit of all IP data structures */
404+ for (i = 0; i < num_dies; i++) {
405+ die_offset = le16_to_cpu(ihdr->die_info[i].die_offset);
406+ dhdr = (struct die_header *)(adev->mman.discovery_bin + die_offset);
407+ num_ips = le16_to_cpu(dhdr->num_ips);
408+ ip_offset = die_offset + sizeof(*dhdr);
409+
410+ for (j = 0; j < num_ips; j++) {
411+ ip = (struct ip *)(adev->mman.discovery_bin + ip_offset);
412+
413+ if (amdgpu_discovery_validate_ip(ip))
414+ goto next_ip;
415+
416+ if (le16_to_cpu(ip->harvest) == 1) {
417+ switch (le16_to_cpu(ip->hw_id)) {
418+ case VCN_HWID:
419+ (*vcn_harvest_count)++;
420+ if (ip->number_instance == 0)
421+ adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN0;
422+ else
423+ adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN1;
424+ break;
425+ case DMU_HWID:
426+ adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
427+ break;
428+ default:
429+ break;
430+ }
431+ }
432+next_ip:
433+ ip_offset += sizeof(*ip) + 4 * (ip->num_base_address - 1);
434+ }
435+ }
436+}
437+
438+static void amdgpu_discovery_read_from_harvest_table(struct amdgpu_device *adev,
439+ uint32_t *vcn_harvest_count)
440+{
441+ struct binary_header *bhdr;
442+ struct harvest_table *harvest_info;
443+ int i;
444+
445+ bhdr = (struct binary_header *)adev->mman.discovery_bin;
446+ harvest_info = (struct harvest_table *)(adev->mman.discovery_bin +
447+ le16_to_cpu(bhdr->table_list[HARVEST_INFO].offset));
448+ for (i = 0; i < 32; i++) {
449+ if (le16_to_cpu(harvest_info->list[i].hw_id) == 0)
450+ break;
451+
452+ switch (le16_to_cpu(harvest_info->list[i].hw_id)) {
453+ case VCN_HWID:
454+ (*vcn_harvest_count)++;
455+ if (harvest_info->list[i].number_instance == 0)
456+ adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN0;
457+ else
458+ adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN1;
459+ break;
460+ case DMU_HWID:
461+ adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
462+ break;
463+ default:
464+ break;
465+ }
466+ }
467+}
468+
469+/* ================================================== */
470+
471+struct ip_hw_instance {
472+ struct kobject kobj; /* ip_discovery/die/#die/#hw_id/#instance/<attrs...> */
473+
474+ int hw_id;
475+ u8 num_instance;
476+ u8 major, minor, revision;
477+ u8 harvest;
478+
479+ int num_base_addresses;
480+ u32 base_addr[];
481+};
482+
483+struct ip_hw_id {
484+ struct kset hw_id_kset; /* ip_discovery/die/#die/#hw_id/, contains ip_hw_instance */
485+ int hw_id;
486+};
487+
488+struct ip_die_entry {
489+ struct kset ip_kset; /* ip_discovery/die/#die/, contains ip_hw_id */
490+ u16 num_ips;
491+};
492+
493+/* -------------------------------------------------- */
494+
495+struct ip_hw_instance_attr {
496+ struct attribute attr;
497+ ssize_t (*show)(struct ip_hw_instance *ip_hw_instance, char *buf);
498+};
499+
500+static ssize_t hw_id_show(struct ip_hw_instance *ip_hw_instance, char *buf)
501+{
502+ return sysfs_emit(buf, "%d\n", ip_hw_instance->hw_id);
503+}
504+
505+static ssize_t num_instance_show(struct ip_hw_instance *ip_hw_instance, char *buf)
506+{
507+ return sysfs_emit(buf, "%d\n", ip_hw_instance->num_instance);
508+}
509+
510+static ssize_t major_show(struct ip_hw_instance *ip_hw_instance, char *buf)
511+{
512+ return sysfs_emit(buf, "%d\n", ip_hw_instance->major);
513+}
514+
515+static ssize_t minor_show(struct ip_hw_instance *ip_hw_instance, char *buf)
516+{
517+ return sysfs_emit(buf, "%d\n", ip_hw_instance->minor);
518+}
519+
520+static ssize_t revision_show(struct ip_hw_instance *ip_hw_instance, char *buf)
521+{
522+ return sysfs_emit(buf, "%d\n", ip_hw_instance->revision);
523+}
524+
525+static ssize_t harvest_show(struct ip_hw_instance *ip_hw_instance, char *buf)
526+{
527+ return sysfs_emit(buf, "0x%01X\n", ip_hw_instance->harvest);
528+}
529+
530+static ssize_t num_base_addresses_show(struct ip_hw_instance *ip_hw_instance, char *buf)
531+{
532+ return sysfs_emit(buf, "%d\n", ip_hw_instance->num_base_addresses);
533+}
534+
535+static ssize_t base_addr_show(struct ip_hw_instance *ip_hw_instance, char *buf)
536+{
537+ ssize_t res, at;
538+ int ii;
539+
540+ for (res = at = ii = 0; ii < ip_hw_instance->num_base_addresses; ii++) {
541+ /* Here we satisfy the condition that, at + size <= PAGE_SIZE.
542+ */
543+ if (at + 12 > PAGE_SIZE)
544+ break;
545+ res = sysfs_emit_at(buf, at, "0x%08X\n",
546+ ip_hw_instance->base_addr[ii]);
547+ if (res <= 0)
548+ break;
549+ at += res;
550+ }
551+
552+ return res < 0 ? res : at;
553+}
554+
555+static struct ip_hw_instance_attr ip_hw_attr[] = {
556+ __ATTR_RO(hw_id),
557+ __ATTR_RO(num_instance),
558+ __ATTR_RO(major),
559+ __ATTR_RO(minor),
560+ __ATTR_RO(revision),
561+ __ATTR_RO(harvest),
562+ __ATTR_RO(num_base_addresses),
563+ __ATTR_RO(base_addr),
564+};
565+
566+static struct attribute *ip_hw_instance_attrs[ARRAY_SIZE(ip_hw_attr) + 1];
567+ATTRIBUTE_GROUPS(ip_hw_instance);
568+
569+#define to_ip_hw_instance(x) container_of(x, struct ip_hw_instance, kobj)
570+#define to_ip_hw_instance_attr(x) container_of(x, struct ip_hw_instance_attr, attr)
571+
572+static ssize_t ip_hw_instance_attr_show(struct kobject *kobj,
573+ struct attribute *attr,
574+ char *buf)
575+{
576+ struct ip_hw_instance *ip_hw_instance = to_ip_hw_instance(kobj);
577+ struct ip_hw_instance_attr *ip_hw_attr = to_ip_hw_instance_attr(attr);
578+
579+ if (!ip_hw_attr->show)
580+ return -EIO;
581+
582+ return ip_hw_attr->show(ip_hw_instance, buf);
583+}
584+
585+static const struct sysfs_ops ip_hw_instance_sysfs_ops = {
586+ .show = ip_hw_instance_attr_show,
587+};
588+
589+static void ip_hw_instance_release(struct kobject *kobj)
590+{
591+ struct ip_hw_instance *ip_hw_instance = to_ip_hw_instance(kobj);
592+
593+ kfree(ip_hw_instance);
594+}
595+
596+static struct kobj_type ip_hw_instance_ktype = {
597+ .release = ip_hw_instance_release,
598+ .sysfs_ops = &ip_hw_instance_sysfs_ops,
599+ .default_groups = ip_hw_instance_groups,
600+};
601+
602+/* -------------------------------------------------- */
603+
604+#define to_ip_hw_id(x) container_of(to_kset(x), struct ip_hw_id, hw_id_kset)
605+
606+static void ip_hw_id_release(struct kobject *kobj)
607+{
608+ struct ip_hw_id *ip_hw_id = to_ip_hw_id(kobj);
609+
610+ if (!list_empty(&ip_hw_id->hw_id_kset.list))
611+ DRM_ERROR("ip_hw_id->hw_id_kset is not empty");
612+ kfree(ip_hw_id);
613+}
614+
615+static struct kobj_type ip_hw_id_ktype = {
616+ .release = ip_hw_id_release,
617+ .sysfs_ops = &kobj_sysfs_ops,
618+};
619+
620+/* -------------------------------------------------- */
621+
622+static void die_kobj_release(struct kobject *kobj);
623+static void ip_disc_release(struct kobject *kobj);
624+
625+struct ip_die_entry_attribute {
626+ struct attribute attr;
627+ ssize_t (*show)(struct ip_die_entry *ip_die_entry, char *buf);
628+};
629+
630+#define to_ip_die_entry_attr(x) container_of(x, struct ip_die_entry_attribute, attr)
631+
632+static ssize_t num_ips_show(struct ip_die_entry *ip_die_entry, char *buf)
633+{
634+ return sysfs_emit(buf, "%d\n", ip_die_entry->num_ips);
635+}
636+
637+/* If there are more ip_die_entry attrs, other than the number of IPs,
638+ * we can make this intro an array of attrs, and then initialize
639+ * ip_die_entry_attrs in a loop.
640+ */
641+static struct ip_die_entry_attribute num_ips_attr =
642+ __ATTR_RO(num_ips);
643+
644+static struct attribute *ip_die_entry_attrs[] = {
645+ &num_ips_attr.attr,
646+ NULL,
647+};
648+ATTRIBUTE_GROUPS(ip_die_entry); /* ip_die_entry_groups */
649+
650+#define to_ip_die_entry(x) container_of(to_kset(x), struct ip_die_entry, ip_kset)
651+
652+static ssize_t ip_die_entry_attr_show(struct kobject *kobj,
653+ struct attribute *attr,
654+ char *buf)
655+{
656+ struct ip_die_entry_attribute *ip_die_entry_attr = to_ip_die_entry_attr(attr);
657+ struct ip_die_entry *ip_die_entry = to_ip_die_entry(kobj);
658+
659+ if (!ip_die_entry_attr->show)
660+ return -EIO;
661+
662+ return ip_die_entry_attr->show(ip_die_entry, buf);
663+}
664+
665+static void ip_die_entry_release(struct kobject *kobj)
666+{
667+ struct ip_die_entry *ip_die_entry = to_ip_die_entry(kobj);
668+
669+ if (!list_empty(&ip_die_entry->ip_kset.list))
670+ DRM_ERROR("ip_die_entry->ip_kset is not empty");
671+ kfree(ip_die_entry);
672+}
673+
674+static const struct sysfs_ops ip_die_entry_sysfs_ops = {
675+ .show = ip_die_entry_attr_show,
676+};
677+
678+static struct kobj_type ip_die_entry_ktype = {
679+ .release = ip_die_entry_release,
680+ .sysfs_ops = &ip_die_entry_sysfs_ops,
681+ .default_groups = ip_die_entry_groups,
682+};
683+
684+static struct kobj_type die_kobj_ktype = {
685+ .release = die_kobj_release,
686+ .sysfs_ops = &kobj_sysfs_ops,
687+};
688+
689+static struct kobj_type ip_discovery_ktype = {
690+ .release = ip_disc_release,
691+ .sysfs_ops = &kobj_sysfs_ops,
692+};
693+
694+struct ip_discovery_top {
695+ struct kobject kobj; /* ip_discovery/ */
696+ struct kset die_kset; /* ip_discovery/die/, contains ip_die_entry */
697+ struct amdgpu_device *adev;
698+};
699+
700+static void die_kobj_release(struct kobject *kobj)
701+{
702+ struct ip_discovery_top *ip_top = container_of(to_kset(kobj),
703+ struct ip_discovery_top,
704+ die_kset);
705+ if (!list_empty(&ip_top->die_kset.list))
706+ DRM_ERROR("ip_top->die_kset is not empty");
707+}
708+
709+static void ip_disc_release(struct kobject *kobj)
710+{
711+ struct ip_discovery_top *ip_top = container_of(kobj, struct ip_discovery_top,
712+ kobj);
713+ struct amdgpu_device *adev = ip_top->adev;
714+
715+ adev->ip_top = NULL;
716+ kfree(ip_top);
717+}
718+
719+static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
720+ struct ip_die_entry *ip_die_entry,
721+ const size_t _ip_offset, const int num_ips)
722+{
723+ int ii, jj, kk, res;
724+
725+ DRM_DEBUG("num_ips:%d", num_ips);
726+
727+ /* Find all IPs of a given HW ID, and add their instance to
728+ * #die/#hw_id/#instance/<attributes>
729+ */
730+ for (ii = 0; ii < HW_ID_MAX; ii++) {
731+ struct ip_hw_id *ip_hw_id = NULL;
732+ size_t ip_offset = _ip_offset;
733+
734+ for (jj = 0; jj < num_ips; jj++) {
735+ struct ip *ip;
736+ struct ip_hw_instance *ip_hw_instance;
737+
738+ ip = (struct ip *)(adev->mman.discovery_bin + ip_offset);
739+ if (amdgpu_discovery_validate_ip(ip) ||
740+ le16_to_cpu(ip->hw_id) != ii)
741+ goto next_ip;
742+
743+ DRM_DEBUG("match:%d @ ip_offset:%zu", ii, ip_offset);
744+
745+ /* We have a hw_id match; register the hw
746+ * block if not yet registered.
747+ */
748+ if (!ip_hw_id) {
749+ ip_hw_id = kzalloc(sizeof(*ip_hw_id), GFP_KERNEL);
750+ if (!ip_hw_id)
751+ return -ENOMEM;
752+ ip_hw_id->hw_id = ii;
753+
754+ kobject_set_name(&ip_hw_id->hw_id_kset.kobj, "%d", ii);
755+ ip_hw_id->hw_id_kset.kobj.kset = &ip_die_entry->ip_kset;
756+ ip_hw_id->hw_id_kset.kobj.ktype = &ip_hw_id_ktype;
757+ res = kset_register(&ip_hw_id->hw_id_kset);
758+ if (res) {
759+ DRM_ERROR("Couldn't register ip_hw_id kset");
760+ kfree(ip_hw_id);
761+ return res;
762+ }
763+ if (hw_id_names[ii]) {
764+ res = sysfs_create_link(&ip_die_entry->ip_kset.kobj,
765+ &ip_hw_id->hw_id_kset.kobj,
766+ hw_id_names[ii]);
767+ if (res) {
768+ DRM_ERROR("Couldn't create IP link %s in IP Die:%s\n",
769+ hw_id_names[ii],
770+ kobject_name(&ip_die_entry->ip_kset.kobj));
771+ }
772+ }
773+ }
774+
775+ /* Now register its instance.
776+ */
777+ ip_hw_instance = kzalloc(struct_size(ip_hw_instance,
778+ base_addr,
779+ ip->num_base_address),
780+ GFP_KERNEL);
781+ if (!ip_hw_instance) {
782+ DRM_ERROR("no memory for ip_hw_instance");
783+ return -ENOMEM;
784+ }
785+ ip_hw_instance->hw_id = le16_to_cpu(ip->hw_id); /* == ii */
786+ ip_hw_instance->num_instance = ip->number_instance;
787+ ip_hw_instance->major = ip->major;
788+ ip_hw_instance->minor = ip->minor;
789+ ip_hw_instance->revision = ip->revision;
790+ ip_hw_instance->harvest = ip->harvest;
791+ ip_hw_instance->num_base_addresses = ip->num_base_address;
792+
793+ for (kk = 0; kk < ip_hw_instance->num_base_addresses; kk++)
794+ ip_hw_instance->base_addr[kk] = ip->base_address[kk];
795+
796+ kobject_init(&ip_hw_instance->kobj, &ip_hw_instance_ktype);
797+ ip_hw_instance->kobj.kset = &ip_hw_id->hw_id_kset;
798+ res = kobject_add(&ip_hw_instance->kobj, NULL,
799+ "%d", ip_hw_instance->num_instance);
800+next_ip:
801+ ip_offset += sizeof(*ip) + 4 * (ip->num_base_address - 1);
802+ }
803+ }
804+
805+ return 0;
806+}
807+
808+static int amdgpu_discovery_sysfs_recurse(struct amdgpu_device *adev)
809+{
810+ struct binary_header *bhdr;
811+ struct ip_discovery_header *ihdr;
812+ struct die_header *dhdr;
813+ struct kset *die_kset = &adev->ip_top->die_kset;
814+ u16 num_dies, die_offset, num_ips;
815+ size_t ip_offset;
816+ int ii, res;
817+
818+ bhdr = (struct binary_header *)adev->mman.discovery_bin;
819+ ihdr = (struct ip_discovery_header *)(adev->mman.discovery_bin +
820+ le16_to_cpu(bhdr->table_list[IP_DISCOVERY].offset));
821+ num_dies = le16_to_cpu(ihdr->num_dies);
822+
823+ DRM_DEBUG("number of dies: %d\n", num_dies);
824+
825+ for (ii = 0; ii < num_dies; ii++) {
826+ struct ip_die_entry *ip_die_entry;
827+
828+ die_offset = le16_to_cpu(ihdr->die_info[ii].die_offset);
829+ dhdr = (struct die_header *)(adev->mman.discovery_bin + die_offset);
830+ num_ips = le16_to_cpu(dhdr->num_ips);
831+ ip_offset = die_offset + sizeof(*dhdr);
832+
833+ /* Add the die to the kset.
834+ *
835+ * dhdr->die_id == ii, which was checked in
836+ * amdgpu_discovery_reg_base_init().
837+ */
838+
839+ ip_die_entry = kzalloc(sizeof(*ip_die_entry), GFP_KERNEL);
840+ if (!ip_die_entry)
841+ return -ENOMEM;
842+
843+ ip_die_entry->num_ips = num_ips;
844+
845+ kobject_set_name(&ip_die_entry->ip_kset.kobj, "%d", le16_to_cpu(dhdr->die_id));
846+ ip_die_entry->ip_kset.kobj.kset = die_kset;
847+ ip_die_entry->ip_kset.kobj.ktype = &ip_die_entry_ktype;
848+ res = kset_register(&ip_die_entry->ip_kset);
849+ if (res) {
850+ DRM_ERROR("Couldn't register ip_die_entry kset");
851+ kfree(ip_die_entry);
852+ return res;
853+ }
854+
855+ amdgpu_discovery_sysfs_ips(adev, ip_die_entry, ip_offset, num_ips);
856+ }
857+
858+ return 0;
859+}
860+
861+static int amdgpu_discovery_sysfs_init(struct amdgpu_device *adev)
862+{
863+ struct kset *die_kset;
864+ int res, ii;
865+
866+ adev->ip_top = kzalloc(sizeof(*adev->ip_top), GFP_KERNEL);
867+ if (!adev->ip_top)
868+ return -ENOMEM;
869+
870+ adev->ip_top->adev = adev;
871+
872+ res = kobject_init_and_add(&adev->ip_top->kobj, &ip_discovery_ktype,
873+ &adev->dev->kobj, "ip_discovery");
874+ if (res) {
875+ DRM_ERROR("Couldn't init and add ip_discovery/");
876+ goto Err;
877+ }
878+
879+ die_kset = &adev->ip_top->die_kset;
880+ kobject_set_name(&die_kset->kobj, "%s", "die");
881+ die_kset->kobj.parent = &adev->ip_top->kobj;
882+ die_kset->kobj.ktype = &die_kobj_ktype;
883+ res = kset_register(&adev->ip_top->die_kset);
884+ if (res) {
885+ DRM_ERROR("Couldn't register die_kset");
886+ goto Err;
887+ }
888+
889+ for (ii = 0; ii < ARRAY_SIZE(ip_hw_attr); ii++)
890+ ip_hw_instance_attrs[ii] = &ip_hw_attr[ii].attr;
891+ ip_hw_instance_attrs[ii] = NULL;
892+
893+ res = amdgpu_discovery_sysfs_recurse(adev);
894+
895+ return res;
896+Err:
897+ kobject_put(&adev->ip_top->kobj);
898+ return res;
899+}
900+
901+/* -------------------------------------------------- */
902+
903+#define list_to_kobj(el) container_of(el, struct kobject, entry)
904+
905+static void amdgpu_discovery_sysfs_ip_hw_free(struct ip_hw_id *ip_hw_id)
906+{
907+ struct list_head *el, *tmp;
908+ struct kset *hw_id_kset;
909+
910+ hw_id_kset = &ip_hw_id->hw_id_kset;
911+ spin_lock(&hw_id_kset->list_lock);
912+ list_for_each_prev_safe(el, tmp, &hw_id_kset->list) {
913+ list_del_init(el);
914+ spin_unlock(&hw_id_kset->list_lock);
915+ /* kobject is embedded in ip_hw_instance */
916+ kobject_put(list_to_kobj(el));
917+ spin_lock(&hw_id_kset->list_lock);
918+ }
919+ spin_unlock(&hw_id_kset->list_lock);
920+ kobject_put(&ip_hw_id->hw_id_kset.kobj);
921+}
922+
923+static void amdgpu_discovery_sysfs_die_free(struct ip_die_entry *ip_die_entry)
924+{
925+ struct list_head *el, *tmp;
926+ struct kset *ip_kset;
927+
928+ ip_kset = &ip_die_entry->ip_kset;
929+ spin_lock(&ip_kset->list_lock);
930+ list_for_each_prev_safe(el, tmp, &ip_kset->list) {
931+ list_del_init(el);
932+ spin_unlock(&ip_kset->list_lock);
933+ amdgpu_discovery_sysfs_ip_hw_free(to_ip_hw_id(list_to_kobj(el)));
934+ spin_lock(&ip_kset->list_lock);
935+ }
936+ spin_unlock(&ip_kset->list_lock);
937+ kobject_put(&ip_die_entry->ip_kset.kobj);
938+}
939+
940+static void amdgpu_discovery_sysfs_fini(struct amdgpu_device *adev)
941+{
942+ struct list_head *el, *tmp;
943+ struct kset *die_kset;
944+
945+ die_kset = &adev->ip_top->die_kset;
946+ spin_lock(&die_kset->list_lock);
947+ list_for_each_prev_safe(el, tmp, &die_kset->list) {
948+ list_del_init(el);
949+ spin_unlock(&die_kset->list_lock);
950+ amdgpu_discovery_sysfs_die_free(to_ip_die_entry(list_to_kobj(el)));
951+ spin_lock(&die_kset->list_lock);
952+ }
953+ spin_unlock(&die_kset->list_lock);
954+ kobject_put(&adev->ip_top->die_kset.kobj);
955+ kobject_put(&adev->ip_top->kobj);
956+}
957+
958+/* ================================================== */
959+
385960 int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
386961 {
387962 struct binary_header *bhdr;
@@ -492,6 +1067,8 @@ next_ip: · 104 unmodified lines
4921067 }
4931068 }
4941069
1070+ amdgpu_discovery_sysfs_init(adev);
1071+
4951072 return 0;
4961073 }
4971074
@@ -545,32 +1122,26 @@ int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id, int n · 47 unmodified lines
5451122
5461123 void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
5471124 {
548− struct binary_header *bhdr;
549− struct harvest_table *harvest_info;
550− int i, vcn_harvest_count = 0;
551−
552− bhdr = (struct binary_header *)adev->mman.discovery_bin;
553− harvest_info = (struct harvest_table *)(adev->mman.discovery_bin +
554− le16_to_cpu(bhdr->table_list[HARVEST_INFO].offset));
555−
556− for (i = 0; i < 32; i++) {
557− if (le16_to_cpu(harvest_info->list[i].hw_id) == 0)
558− break;
1125+ int vcn_harvest_count = 0;
5591126
560− switch (le16_to_cpu(harvest_info->list[i].hw_id)) {
561− case VCN_HWID:
562− vcn_harvest_count++;
563− if (harvest_info->list[i].number_instance == 0)
564− adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN0;
565− else
566− adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN1;
567− break;
568− case DMU_HWID:
569− adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
570− break;
571− default:
572− break;
573− }
1127+ /*
1128+ * Harvest table does not fit Navi1x and legacy GPUs,
1129+ * so read harvest bit per IP data structure to set
1130+ * harvest configuration.
1131+ */
1132+ if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0)) {
1133+ if ((adev->pdev->device == 0x731E &&
1134+ (adev->pdev->revision == 0xC6 ||
1135+ adev->pdev->revision == 0xC7)) ||
1136+ (adev->pdev->device == 0x7340 &&
1137+ adev->pdev->revision == 0xC9) ||
1138+ (adev->pdev->device == 0x7360 &&
1139+ adev->pdev->revision == 0xC7))
1140+ amdgpu_discovery_read_harvest_bit_per_ip(adev,
1141+ &vcn_harvest_count);
1142+ } else {
1143+ amdgpu_discovery_read_from_harvest_table(adev,
1144+ &vcn_harvest_count);
5741145 }
5751146
5761147 amdgpu_discovery_harvest_config_quirk(adev);
@@ -674,12 +1245,15 @@ static int amdgpu_discovery_set_common_ip_blocks(struct amdgpu_device *adev) · 97 unmodified lines
6741245 case IP_VERSION(10, 1, 1):
6751246 case IP_VERSION(10, 1, 2):
6761247 case IP_VERSION(10, 1, 3):
1248+ case IP_VERSION(10, 1, 4):
6771249 case IP_VERSION(10, 3, 0):
6781250 case IP_VERSION(10, 3, 1):
6791251 case IP_VERSION(10, 3, 2):
6801252 case IP_VERSION(10, 3, 3):
6811253 case IP_VERSION(10, 3, 4):
6821254 case IP_VERSION(10, 3, 5):
1255+ case IP_VERSION(10, 3, 6):
1256+ case IP_VERSION(10, 3, 7):
6831257 amdgpu_device_ip_block_add(adev, &nv_common_ip_block);
6841258 break;
6851259 default:
@@ -709,12 +1283,15 @@ static int amdgpu_discovery_set_gmc_ip_blocks(struct amdgpu_device *adev) · 23 unmodified lines
7091283 case IP_VERSION(10, 1, 1):
7101284 case IP_VERSION(10, 1, 2):
7111285 case IP_VERSION(10, 1, 3):
1286+ case IP_VERSION(10, 1, 4):
7121287 case IP_VERSION(10, 3, 0):
7131288 case IP_VERSION(10, 3, 1):
7141289 case IP_VERSION(10, 3, 2):
7151290 case IP_VERSION(10, 3, 3):
7161291 case IP_VERSION(10, 3, 4):
7171292 case IP_VERSION(10, 3, 5):
1293+ case IP_VERSION(10, 3, 6):
1294+ case IP_VERSION(10, 3, 7):
7181295 amdgpu_device_ip_block_add(adev, &gmc_v10_0_ip_block);
7191296 break;
7201297 default:
@@ -790,6 +1367,8 @@ static int amdgpu_discovery_set_psp_ip_blocks(struct amdgpu_device *adev) · 69 unmodified lines
7901367 case IP_VERSION(13, 0, 1):
7911368 case IP_VERSION(13, 0, 2):
7921369 case IP_VERSION(13, 0, 3):
1370+ case IP_VERSION(13, 0, 5):
1371+ case IP_VERSION(13, 0, 8):
7931372 amdgpu_device_ip_block_add(adev, &psp_v13_0_ip_block);
7941373 break;
7951374 default:
@@ -831,6 +1410,8 @@ static int amdgpu_discovery_set_smu_ip_blocks(struct amdgpu_device *adev) · 35 unmodified lines
8311410 case IP_VERSION(13, 0, 1):
8321411 case IP_VERSION(13, 0, 2):
8331412 case IP_VERSION(13, 0, 3):
1413+ case IP_VERSION(13, 0, 5):
1414+ case IP_VERSION(13, 0, 8):
8341415 amdgpu_device_ip_block_add(adev, &smu_v13_0_ip_block);
8351416 break;
8361417 default:
@@ -846,8 +1427,14 @@ static int amdgpu_discovery_set_display_ip_blocks(struct amdgpu_device *adev) · 9 unmodified lines
8461427 {
8471428 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev)) {
8481429 amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
1430+ return 0;
1431+ }
1432+
1433+ if (!amdgpu_device_has_dc_support(adev))
1434+ return 0;
1435+
8491436 #if defined(CONFIG_DRM_AMD_DC)
850− } else if (adev->ip_versions[DCE_HWIP][0]) {
1437+ if (adev->ip_versions[DCE_HWIP][0]) {
8511438 switch (adev->ip_versions[DCE_HWIP][0]) {
8521439 case IP_VERSION(1, 0, 0):
8531440 case IP_VERSION(1, 0, 1):
@@ -861,6 +1448,8 @@ static int amdgpu_discovery_set_display_ip_blocks(struct amdgpu_device *adev) · 7 unmodified lines
8611448 case IP_VERSION(3, 0, 1):
8621449 case IP_VERSION(3, 1, 2):
8631450 case IP_VERSION(3, 1, 3):
1451+ case IP_VERSION(3, 1, 5):
1452+ case IP_VERSION(3, 1, 6):
8641453 amdgpu_device_ip_block_add(adev, &dm_ip_block);
8651454 break;
8661455 default:
@@ -882,8 +1471,8 @@ static int amdgpu_discovery_set_display_ip_blocks(struct amdgpu_device *adev) · 15 unmodified lines
8821471 adev->ip_versions[DCI_HWIP][0]);
8831472 return -EINVAL;
8841473 }
885−#endif
8861474 }
1475+#endif
8871476 return 0;
8881477 }
8891478
@@ -904,12 +1493,15 @@ static int amdgpu_discovery_set_gc_ip_blocks(struct amdgpu_device *adev) · 14 unmodified lines
9041493 case IP_VERSION(10, 1, 2):
9051494 case IP_VERSION(10, 1, 1):
9061495 case IP_VERSION(10, 1, 3):
1496+ case IP_VERSION(10, 1, 4):
9071497 case IP_VERSION(10, 3, 0):
9081498 case IP_VERSION(10, 3, 2):
9091499 case IP_VERSION(10, 3, 1):
9101500 case IP_VERSION(10, 3, 4):
9111501 case IP_VERSION(10, 3, 5):
1502+ case IP_VERSION(10, 3, 6):
9121503 case IP_VERSION(10, 3, 3):
1504+ case IP_VERSION(10, 3, 7):
9131505 amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block);
9141506 break;
9151507 default:
@@ -944,8 +1536,10 @@ static int amdgpu_discovery_set_sdma_ip_blocks(struct amdgpu_device *adev) · 28 unmodified lines
9441536 case IP_VERSION(5, 2, 2):
9451537 case IP_VERSION(5, 2, 4):
9461538 case IP_VERSION(5, 2, 5):
1539+ case IP_VERSION(5, 2, 6):
9471540 case IP_VERSION(5, 2, 3):
9481541 case IP_VERSION(5, 2, 1):
1542+ case IP_VERSION(5, 2, 7):
9491543 amdgpu_device_ip_block_add(adev, &sdma_v5_2_ip_block);
9501544 break;
9511545 default:
@@ -1012,6 +1606,7 @@ static int amdgpu_discovery_set_mm_ip_blocks(struct amdgpu_device *adev) · 60 unmodified lines
10121606 case IP_VERSION(3, 0, 0):
10131607 case IP_VERSION(3, 0, 16):
10141608 case IP_VERSION(3, 1, 1):
1609+ case IP_VERSION(3, 1, 2):
10151610 case IP_VERSION(3, 0, 2):
10161611 case IP_VERSION(3, 0, 192):
10171612 amdgpu_device_ip_block_add(adev, &vcn_v3_0_ip_block);
@@ -1038,12 +1633,14 @@ static int amdgpu_discovery_set_mes_ip_blocks(struct amdgpu_device *adev) · 20 unmodified lines
10381633 case IP_VERSION(10, 1, 1):
10391634 case IP_VERSION(10, 1, 2):
10401635 case IP_VERSION(10, 1, 3):
1636+ case IP_VERSION(10, 1, 4):
10411637 case IP_VERSION(10, 3, 0):
10421638 case IP_VERSION(10, 3, 1):
10431639 case IP_VERSION(10, 3, 2):
10441640 case IP_VERSION(10, 3, 3):
10451641 case IP_VERSION(10, 3, 4):
10461642 case IP_VERSION(10, 3, 5):
1643+ case IP_VERSION(10, 3, 6):
10471644 amdgpu_device_ip_block_add(adev, &mes_v10_1_ip_block);
10481645 break;
10491646 default:
@@ -1217,11 +1814,6 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev) · 167 unmodified lines
12171814 return -EINVAL;
12181815
12191816 amdgpu_discovery_harvest_ip(adev);
1220−
1221− if (!adev->mman.discovery_bin) {
1222− DRM_ERROR("ip discovery uninitialized\n");
1223− return -EINVAL;
1224− }
12251817 break;
12261818 }
12271819
@@ -1242,6 +1834,7 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev) · 14 unmodified lines
12421834 case IP_VERSION(10, 1, 1):
12431835 case IP_VERSION(10, 1, 2):
12441836 case IP_VERSION(10, 1, 3):
1837+ case IP_VERSION(10, 1, 4):
12451838 case IP_VERSION(10, 3, 0):
12461839 case IP_VERSION(10, 3, 2):
12471840 case IP_VERSION(10, 3, 4):
@@ -1254,10 +1847,32 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev) · 6 unmodified lines
12541847 case IP_VERSION(10, 3, 3):
12551848 adev->family = AMDGPU_FAMILY_YC;
12561849 break;
1850+ case IP_VERSION(10, 3, 6):
1851+ adev->family = AMDGPU_FAMILY_GC_10_3_6;
1852+ break;
1853+ case IP_VERSION(10, 3, 7):
1854+ adev->family = AMDGPU_FAMILY_GC_10_3_7;
1855+ break;
12571856 default:
12581857 return -EINVAL;
12591858 }
12601859
1860+ switch (adev->ip_versions[GC_HWIP][0]) {
1861+ case IP_VERSION(9, 1, 0):
1862+ case IP_VERSION(9, 2, 2):
1863+ case IP_VERSION(9, 3, 0):
1864+ case IP_VERSION(10, 1, 3):
1865+ case IP_VERSION(10, 1, 4):
1866+ case IP_VERSION(10, 3, 1):
1867+ case IP_VERSION(10, 3, 3):
1868+ case IP_VERSION(10, 3, 6):
1869+ case IP_VERSION(10, 3, 7):
1870+ adev->flags |= AMD_IS_APU;
1871+ break;
1872+ default:
1873+ break;
1874+ }
1875+
12611876 if (adev->ip_versions[XGMI_HWIP][0] == IP_VERSION(4, 8, 0))
12621877 adev->gmc.xgmi.supported = true;
12631878
@@ -1285,7 +1900,9 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev) · 21 unmodified lines
12851900 break;
12861901 case IP_VERSION(7, 2, 0):
12871902 case IP_VERSION(7, 2, 1):
1903+ case IP_VERSION(7, 3, 0):
12881904 case IP_VERSION(7, 5, 0):
1905+ case IP_VERSION(7, 5, 1):
12891906 adev->nbio.funcs = &nbio_v7_2_funcs;
12901907 adev->nbio.hdp_flush_reg = &nbio_v7_2_hdp_flush_reg;
12911908 break;
@@ -1368,6 +1985,8 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev) · 76 unmodified lines
13681985 case IP_VERSION(11, 0, 11):
13691986 case IP_VERSION(11, 5, 0):
13701987 case IP_VERSION(13, 0, 1):
1988+ case IP_VERSION(13, 0, 9):
1989+ case IP_VERSION(13, 0, 10):
13711990 adev->smuio.funcs = &smuio_v11_0_6_funcs;
13721991 break;
13731992 case IP_VERSION(13, 0, 2):
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c+6−25
@@ -506,28 +506,9 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, · 505 unmodified lines
506506 */
507507 if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) &&
508508 amdgpu_bo_support_uswc(bo_flags) &&
509− amdgpu_device_asic_has_dc_support(adev->asic_type)) {
510− switch (adev->asic_type) {
511− case CHIP_CARRIZO:
512− case CHIP_STONEY:
513− domain |= AMDGPU_GEM_DOMAIN_GTT;
514− break;
515− case CHIP_RAVEN:
516− /* enable S/G on PCO and RV2 */
517− if ((adev->apu_flags & AMD_APU_IS_RAVEN2) ||
518− (adev->apu_flags & AMD_APU_IS_PICASSO))
519− domain |= AMDGPU_GEM_DOMAIN_GTT;
520− break;
521− case CHIP_RENOIR:
522− case CHIP_VANGOGH:
523− case CHIP_YELLOW_CARP:
524− domain |= AMDGPU_GEM_DOMAIN_GTT;
525− break;
526−
527− default:
528− break;
529− }
530− }
509+ amdgpu_device_asic_has_dc_support(adev->asic_type) &&
510+ adev->mode_info.gpu_vm_support)
511+ domain |= AMDGPU_GEM_DOMAIN_GTT;
531512 #endif
532513
533514 return domain;
@@ -956,7 +937,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb) · 422 unmodified lines
956937 int ret;
957938 unsigned int i, block_width, block_height, block_size_log2;
958939
959− if (!rfb->base.dev->mode_config.allow_fb_modifiers)
940+ if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
960941 return 0;
961942
962943 for (i = 0; i < format_info->num_planes; ++i) {
@@ -1143,7 +1124,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, · 180 unmodified lines
11431124 if (ret)
11441125 return ret;
11451126
1146− if (!dev->mode_config.allow_fb_modifiers) {
1127+ if (dev->mode_config.fb_modifiers_not_supported && !adev->enable_virtual_display) {
11471128 drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
11481129 "GFX9+ requires FB check based on format modifier\n");
11491130 ret = check_tiling_flags_gfx6(rfb);
@@ -1151,7 +1132,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, · 1 unmodified line
11511132 return ret;
11521133 }
11531134
1154− if (dev->mode_config.allow_fb_modifiers &&
1135+ if (!dev->mode_config.fb_modifiers_not_supported &&
11551136 !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
11561137 ret = convert_tiling_flags_to_modifier(rfb);
11571138 if (ret) {
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+101−53
@@ -99,9 +99,10 @@ · 98 unmodified lines
9999 * - 3.42.0 - Add 16bpc fixed point display support
100100 * - 3.43.0 - Add device hot plug/unplug support
101101 * - 3.44.0 - DCN3 supports DCC independent block settings: !64B && 128B, 64B && 128B
102+ * - 3.45.0 - Add context ioctl stable pstate interface
102103 */
103104 #define KMS_DRIVER_MAJOR 3
104−#define KMS_DRIVER_MINOR 44
105+#define KMS_DRIVER_MINOR 45
105106 #define KMS_DRIVER_PATCHLEVEL 0
106107
107108 int amdgpu_vram_limit;
@@ -109,8 +110,6 @@ int amdgpu_vis_vram_limit; · 1 unmodified line
109110 int amdgpu_gart_size = -1; /* auto */
110111 int amdgpu_gtt_size = -1; /* auto */
111112 int amdgpu_moverate = -1; /* auto */
112−int amdgpu_benchmarking;
113−int amdgpu_testing;
114113 int amdgpu_audio = -1;
115114 int amdgpu_disp_priority;
116115 int amdgpu_hw_i2c;
@@ -174,10 +173,10 @@ int amdgpu_mes; · 57 unmodified lines
174173 int amdgpu_noretry = -1;
175174 int amdgpu_force_asic_type = -1;
176175 int amdgpu_tmz = -1; /* auto */
177−uint amdgpu_freesync_vid_mode;
178176 int amdgpu_reset_method = -1; /* auto */
179177 int amdgpu_num_kcq = -1;
180178 int amdgpu_smartshift_bias;
179+int amdgpu_use_xgmi_p2p = 1;
181180
182181 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
183182
@@ -231,20 +230,6 @@ module_param_named(gttsize, amdgpu_gtt_size, int, 0600); · 47 unmodified lines
231230 MODULE_PARM_DESC(moverate, "Maximum buffer migration rate in MB/s. (32, 64, etc., -1=auto, 0=1=disabled)");
232231 module_param_named(moverate, amdgpu_moverate, int, 0600);
233232
234−/**
235− * DOC: benchmark (int)
236− * Run benchmarks. The default is 0 (Skip benchmarks).
237− */
238−MODULE_PARM_DESC(benchmark, "Run benchmark");
239−module_param_named(benchmark, amdgpu_benchmarking, int, 0444);
240−
241−/**
242− * DOC: test (int)
243− * Test BO GTT->VRAM and VRAM->GTT GPU copies. The default is 0 (Skip test, only set 1 to run test).
244− */
245−MODULE_PARM_DESC(test, "Run tests");
246−module_param_named(test, amdgpu_testing, int, 0444);
247−
248233 /**
249234 * DOC: audio (int)
250235 * Set HDMI/DPAudio. Only affects non-DC display handling. The default is -1 (Enabled), set 0 to disabled it.
@@ -667,6 +652,13 @@ MODULE_PARM_DESC(force_asic_type, · 416 unmodified lines
667652 "A non negative value used to specify the asic type for all supported GPUs");
668653 module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
669654
655+/**
656+ * DOC: use_xgmi_p2p (int)
657+ * Enables/disables XGMI P2P interface (0 = disable, 1 = enable).
658+ */
659+MODULE_PARM_DESC(use_xgmi_p2p,
660+ "Enable XGMI P2P interface (0 = disable; 1 = enable (default))");
661+module_param_named(use_xgmi_p2p, amdgpu_use_xgmi_p2p, int, 0444);
670662
671663
672664 #ifdef CONFIG_HSA_AMD
@@ -740,7 +732,7 @@ MODULE_PARM_DESC(debug_largebar, · 67 unmodified lines
740732 * systems with a broken CRAT table.
741733 *
742734 * Default is auto (according to asic type, iommu_v2, and crat table, to decide
743− * whehter use CRAT)
735+ * whether use CRAT)
744736 */
745737 int ignore_crat;
746738 module_param(ignore_crat, int, 0444);
@@ -843,37 +835,11 @@ module_param_named(backlight, amdgpu_backlight, bint, 0444); · 96 unmodified lines
843835 MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto (default), 0 = off, 1 = on)");
844836 module_param_named(tmz, amdgpu_tmz, int, 0444);
845837
846−/**
847− * DOC: freesync_video (uint)
848− * Enable the optimization to adjust front porch timing to achieve seamless
849− * mode change experience when setting a freesync supported mode for which full
850− * modeset is not needed.
851− *
852− * The Display Core will add a set of modes derived from the base FreeSync
853− * video mode into the corresponding connector's mode list based on commonly
854− * used refresh rates and VRR range of the connected display, when users enable
855− * this feature. From the userspace perspective, they can see a seamless mode
856− * change experience when the change between different refresh rates under the
857− * same resolution. Additionally, userspace applications such as Video playback
858− * can read this modeset list and change the refresh rate based on the video
859− * frame rate. Finally, the userspace can also derive an appropriate mode for a
860− * particular refresh rate based on the FreeSync Mode and add it to the
861− * connector's mode list.
862− *
863− * Note: This is an experimental feature.
864− *
865− * The default value: 0 (off).
866− */
867−MODULE_PARM_DESC(
868− freesync_video,
869− "Enable freesync modesetting optimization feature (0 = off (default), 1 = on)");
870−module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444);
871−
872838 /**
873839 * DOC: reset_method (int)
874− * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco, 5 = pci)
840+ * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco)
875841 */
876−MODULE_PARM_DESC(reset_method, "GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco/bamaco, 5 = pci)");
842+MODULE_PARM_DESC(reset_method, "GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco/bamaco)");
877843 module_param_named(reset_method, amdgpu_reset_method, int, 0444);
878844
879845 /**
@@ -1942,13 +1908,14 @@ static const struct pci_device_id pciidlist[] = { · 1062 unmodified lines
19421908 {0x1002, 0x73FF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_DIMGREY_CAVEFISH},
19431909
19441910 /* Aldebaran */
1945− {0x1002, 0x7408, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT},
1946− {0x1002, 0x740C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT},
1947− {0x1002, 0x740F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT},
1948− {0x1002, 0x7410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT},
1911+ {0x1002, 0x7408, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN},
1912+ {0x1002, 0x740C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN},
1913+ {0x1002, 0x740F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN},
1914+ {0x1002, 0x7410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN},
19491915
19501916 /* CYAN_SKILLFISH */
19511917 {0x1002, 0x13FE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYAN_SKILLFISH|AMD_IS_APU},
1918+ {0x1002, 0x143F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYAN_SKILLFISH|AMD_IS_APU},
19521919
19531920 /* BEIGE_GOBY */
19541921 {0x1002, 0x7420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BEIGE_GOBY},
@@ -1994,6 +1961,28 @@ static bool amdgpu_is_fw_framebuffer(resource_size_t base, · 39 unmodified lines
19941961 return found;
19951962 }
19961963
1964+static void amdgpu_get_secondary_funcs(struct amdgpu_device *adev)
1965+{
1966+ struct pci_dev *p = NULL;
1967+ int i;
1968+
1969+ /* 0 - GPU
1970+ * 1 - audio
1971+ * 2 - USB
1972+ * 3 - UCSI
1973+ */
1974+ for (i = 1; i < 4; i++) {
1975+ p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
1976+ adev->pdev->bus->number, i);
1977+ if (p) {
1978+ pm_runtime_get_sync(&p->dev);
1979+ pm_runtime_mark_last_busy(&p->dev);
1980+ pm_runtime_put_autosuspend(&p->dev);
1981+ pci_dev_put(p);
1982+ }
1983+ }
1984+}
1985+
19971986 static int amdgpu_pci_probe(struct pci_dev *pdev,
19981987 const struct pci_device_id *ent)
19991988 {
@@ -2011,6 +2000,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, · 11 unmodified lines
20112000 return -ENODEV;
20122001 }
20132002
2003+ if (amdgpu_aspm == -1 && !pcie_aspm_enabled(pdev))
2004+ amdgpu_aspm = 0;
2005+
20142006 if (amdgpu_virtual_display ||
20152007 amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
20162008 supports_atomic = true;
@@ -2126,6 +2118,48 @@ retry_init: · 109 unmodified lines
21262118 if (ret)
21272119 DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
21282120
2121+ if (adev->runpm) {
2122+ /* only need to skip on ATPX */
2123+ if (amdgpu_device_supports_px(ddev))
2124+ dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
2125+ /* we want direct complete for BOCO */
2126+ if (amdgpu_device_supports_boco(ddev))
2127+ dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_SMART_PREPARE |
2128+ DPM_FLAG_SMART_SUSPEND |
2129+ DPM_FLAG_MAY_SKIP_RESUME);
2130+ pm_runtime_use_autosuspend(ddev->dev);
2131+ pm_runtime_set_autosuspend_delay(ddev->dev, 5000);
2132+
2133+ pm_runtime_allow(ddev->dev);
2134+
2135+ pm_runtime_mark_last_busy(ddev->dev);
2136+ pm_runtime_put_autosuspend(ddev->dev);
2137+
2138+ /*
2139+ * For runpm implemented via BACO, PMFW will handle the
2140+ * timing for BACO in and out:
2141+ * - put ASIC into BACO state only when both video and
2142+ * audio functions are in D3 state.
2143+ * - pull ASIC out of BACO state when either video or
2144+ * audio function is in D0 state.
2145+ * Also, at startup, PMFW assumes both functions are in
2146+ * D0 state.
2147+ *
2148+ * So if snd driver was loaded prior to amdgpu driver
2149+ * and audio function was put into D3 state, there will
2150+ * be no PMFW-aware D-state transition(D0->D3) on runpm
2151+ * suspend. Thus the BACO will be not correctly kicked in.
2152+ *
2153+ * Via amdgpu_get_secondary_funcs(), the audio dev is put
2154+ * into D0 state. Then there will be a PMFW-aware D-state
2155+ * transition(D0->D3) on runpm suspend.
2156+ */
2157+ if (amdgpu_device_supports_baco(ddev) &&
2158+ !(adev->flags & AMD_IS_APU) &&
2159+ (adev->asic_type >= CHIP_NAVI10))
2160+ amdgpu_get_secondary_funcs(adev);
2161+ }
2162+
21292163 return 0;
21302164
21312165 err_pci:
@@ -2137,8 +2171,15 @@ static void · 5 unmodified lines
21372171 amdgpu_pci_remove(struct pci_dev *pdev)
21382172 {
21392173 struct drm_device *dev = pci_get_drvdata(pdev);
2174+ struct amdgpu_device *adev = drm_to_adev(dev);
21402175
21412176 drm_dev_unplug(dev);
2177+
2178+ if (adev->runpm) {
2179+ pm_runtime_get_sync(dev->dev);
2180+ pm_runtime_forbid(dev->dev);
2181+ }
2182+
21422183 amdgpu_driver_unload_kms(dev);
21432184
21442185 /*
@@ -2246,13 +2287,20 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work) · 101 unmodified lines
22462287 static int amdgpu_pmops_prepare(struct device *dev)
22472288 {
22482289 struct drm_device *drm_dev = dev_get_drvdata(dev);
2290+ struct amdgpu_device *adev = drm_to_adev(drm_dev);
22492291
22502292 /* Return a positive number here so
22512293 * DPM_FLAG_SMART_SUSPEND works properly
22522294 */
22532295 if (amdgpu_device_supports_boco(drm_dev))
2254− return pm_runtime_suspended(dev) &&
2255− pm_suspend_via_firmware();
2296+ return pm_runtime_suspended(dev);
2297+
2298+ /* if we will not support s3 or s2i for the device
2299+ * then skip suspend
2300+ */
2301+ if (!amdgpu_acpi_is_s0ix_active(adev) &&
2302+ !amdgpu_acpi_is_s3_active(adev))
2303+ return 1;
22562304
22572305 return 0;
22582306 }
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c+5−38
@@ -446,24 +446,18 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, · 445 unmodified lines
446446 * for the requested ring.
447447 *
448448 * @ring: ring to init the fence driver on
449− * @num_hw_submission: number of entries on the hardware queue
450− * @sched_score: optional score atomic shared with other schedulers
451449 *
452450 * Init the fence driver for the requested ring (all asics).
453451 * Helper function for amdgpu_fence_driver_init().
454452 */
455−int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
456− unsigned num_hw_submission,
457− atomic_t *sched_score)
453+int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring)
458454 {
459455 struct amdgpu_device *adev = ring->adev;
460− long timeout;
461− int r;
462456
463457 if (!adev)
464458 return -EINVAL;
465459
466− if (!is_power_of_2(num_hw_submission))
460+ if (!is_power_of_2(ring->num_hw_submission))
467461 return -EINVAL;
468462
469463 ring->fence_drv.cpu_addr = NULL;
@@ -474,41 +468,14 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, · 4 unmodified lines
474468
475469 timer_setup(&ring->fence_drv.fallback_timer, amdgpu_fence_fallback, 0);
476470
477− ring->fence_drv.num_fences_mask = num_hw_submission * 2 - 1;
471+ ring->fence_drv.num_fences_mask = ring->num_hw_submission * 2 - 1;
478472 spin_lock_init(&ring->fence_drv.lock);
479− ring->fence_drv.fences = kcalloc(num_hw_submission * 2, sizeof(void *),
473+ ring->fence_drv.fences = kcalloc(ring->num_hw_submission * 2, sizeof(void *),
480474 GFP_KERNEL);
475+
481476 if (!ring->fence_drv.fences)
482477 return -ENOMEM;
483478
484− /* No need to setup the GPU scheduler for rings that don't need it */
485− if (ring->no_scheduler)
486− return 0;
487−
488− switch (ring->funcs->type) {
489− case AMDGPU_RING_TYPE_GFX:
490− timeout = adev->gfx_timeout;
491− break;
492− case AMDGPU_RING_TYPE_COMPUTE:
493− timeout = adev->compute_timeout;
494− break;
495− case AMDGPU_RING_TYPE_SDMA:
496− timeout = adev->sdma_timeout;
497− break;
498− default:
499− timeout = adev->video_timeout;
500− break;
501− }
502−
503− r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
504− num_hw_submission, amdgpu_job_hang_limit,
505− timeout, NULL, sched_score, ring->name);
506− if (r) {
507− DRM_ERROR("Failed to create scheduler on ring %s.\n",
508− ring->name);
509− return r;
510− }
511−
512479 return 0;
513480 }
514481
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c+31−22
@@ -30,7 +30,6 @@ · 29 unmodified lines
3030 #include "amdgpu_eeprom.h"
3131
3232 #define FRU_EEPROM_MADDR 0x60000
33−#define I2C_PRODUCT_INFO_OFFSET 0xC0
3433
3534 static bool is_fru_eeprom_supported(struct amdgpu_device *adev)
3635 {
@@ -40,7 +39,13 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev) · 3 unmodified lines
4039 */
4140 struct atom_context *atom_ctx = adev->mode_info.atom_context;
4241
43− /* VBIOS is of the format ###-DXXXYY-##. For SKU identification,
42+ /* The i2c access is blocked on VF
43+ * TODO: Need other way to get the info
44+ */
45+ if (amdgpu_sriov_vf(adev))
46+ return false;
47+
48+ /* VBIOS is of the format ###-DXXXYYYY-##. For SKU identification,
4449 * we can use just the "DXXX" portion. If there were more models, we
4550 * could convert the 3 characters to a hex integer and use a switch
4651 * for ease/speed/readability. For now, 2 string comparisons are
@@ -59,17 +64,24 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev) · 12 unmodified lines
5964 case CHIP_ALDEBARAN:
6065 /* All Aldebaran SKUs have the FRU */
6166 return true;
67+ case CHIP_SIENNA_CICHLID:
68+ if (strnstr(atom_ctx->vbios_version, "D603",
69+ sizeof(atom_ctx->vbios_version)))
70+ return true;
71+ else
72+ return false;
6273 default:
6374 return false;
6475 }
6576 }
6677
6778 static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,
68− unsigned char *buff)
79+ unsigned char *buf, size_t buf_size)
6980 {
70− int ret, size;
81+ int ret;
82+ u8 size;
7183
72− ret = amdgpu_eeprom_read(&adev->pm.smu_i2c, addrptr, buff, 1);
84+ ret = amdgpu_eeprom_read(adev->pm.fru_eeprom_i2c_bus, addrptr, buf, 1);
7385 if (ret < 1) {
7486 DRM_WARN("FRU: Failed to get size field");
7587 return ret;
@@ -78,9 +90,11 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr, · 2 unmodified lines
7890 /* The size returned by the i2c requires subtraction of 0xC0 since the
7991 * size apparently always reports as 0xC0+actual size.
8092 */
81− size = buff[0] - I2C_PRODUCT_INFO_OFFSET;
93+ size = buf[0] & 0x3F;
94+ size = min_t(size_t, size, buf_size);
8295
83− ret = amdgpu_eeprom_read(&adev->pm.smu_i2c, addrptr + 1, buff, size);
96+ ret = amdgpu_eeprom_read(adev->pm.fru_eeprom_i2c_bus, addrptr + 1,
97+ buf, size);
8498 if (ret < 1) {
8599 DRM_WARN("FRU: Failed to get data field");
86100 return ret;
@@ -91,19 +105,15 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr, · 4 unmodified lines
91105
92106 int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
93107 {
94− unsigned char buff[AMDGPU_PRODUCT_NAME_LEN+2];
108+ unsigned char buf[AMDGPU_PRODUCT_NAME_LEN];
95109 u32 addrptr;
96110 int size, len;
97− int offset = 2;
98111
99112 if (!is_fru_eeprom_supported(adev))
100113 return 0;
101114
102− if (adev->asic_type == CHIP_ALDEBARAN)
103− offset = 0;
104−
105115 /* If algo exists, it means that the i2c_adapter's initialized */
106− if (!adev->pm.smu_i2c.algo) {
116+ if (!adev->pm.fru_eeprom_i2c_bus || !adev->pm.fru_eeprom_i2c_bus->algo) {
107117 DRM_WARN("Cannot access FRU, EEPROM accessor not initialized");
108118 return -ENODEV;
109119 }
@@ -121,7 +131,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 11 unmodified lines
121131 * and the language field, so just start from 0xb, manufacturer size
122132 */
123133 addrptr = FRU_EEPROM_MADDR + 0xb;
124− size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
134+ size = amdgpu_fru_read_eeprom(adev, addrptr, buf, sizeof(buf));
125135 if (size < 1) {
126136 DRM_ERROR("Failed to read FRU Manufacturer, ret:%d", size);
127137 return -EINVAL;
@@ -131,7 +141,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 3 unmodified lines
131141 * size field being 1 byte. This pattern continues below.
132142 */
133143 addrptr += size + 1;
134− size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
144+ size = amdgpu_fru_read_eeprom(adev, addrptr, buf, sizeof(buf));
135145 if (size < 1) {
136146 DRM_ERROR("Failed to read FRU product name, ret:%d", size);
137147 return -EINVAL;
@@ -143,12 +153,11 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 5 unmodified lines
143153 AMDGPU_PRODUCT_NAME_LEN);
144154 len = AMDGPU_PRODUCT_NAME_LEN - 1;
145155 }
146− /* Start at 2 due to buff using fields 0 and 1 for the address */
147− memcpy(adev->product_name, &buff[offset], len);
156+ memcpy(adev->product_name, buf, len);
148157 adev->product_name[len] = '\0';
149158
150159 addrptr += size + 1;
151− size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
160+ size = amdgpu_fru_read_eeprom(adev, addrptr, buf, sizeof(buf));
152161 if (size < 1) {
153162 DRM_ERROR("Failed to read FRU product number, ret:%d", size);
154163 return -EINVAL;
@@ -162,11 +171,11 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 7 unmodified lines
162171 DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake");
163172 len = sizeof(adev->product_number) - 1;
164173 }
165− memcpy(adev->product_number, &buff[offset], len);
174+ memcpy(adev->product_number, buf, len);
166175 adev->product_number[len] = '\0';
167176
168177 addrptr += size + 1;
169− size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
178+ size = amdgpu_fru_read_eeprom(adev, addrptr, buf, sizeof(buf));
170179
171180 if (size < 1) {
172181 DRM_ERROR("Failed to read FRU product version, ret:%d", size);
@@ -174,7 +183,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 1 unmodified line
174183 }
175184
176185 addrptr += size + 1;
177− size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
186+ size = amdgpu_fru_read_eeprom(adev, addrptr, buf, sizeof(buf));
178187
179188 if (size < 1) {
180189 DRM_ERROR("Failed to read FRU serial number, ret:%d", size);
@@ -189,7 +198,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 8 unmodified lines
189198 DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake");
190199 len = sizeof(adev->serial) - 1;
191200 }
192− memcpy(adev->serial, &buff[offset], len);
201+ memcpy(adev->serial, buf, len);
193202 adev->serial[len] = '\0';
194203
195204 return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c+12−24
@@ -150,7 +150,7 @@ void amdgpu_gart_table_vram_free(struct amdgpu_device *adev) · 149 unmodified lines
150150 * replaces them with the dummy page (all asics).
151151 * Returns 0 for success, -EINVAL for failure.
152152 */
153−int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
153+void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
154154 int pages)
155155 {
156156 unsigned t;
@@ -161,13 +161,11 @@ int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset, · 4 unmodified lines
161161 uint64_t flags = 0;
162162 int idx;
163163
164− if (!adev->gart.ready) {
165− WARN(1, "trying to unbind memory from uninitialized GART !\n");
166− return -EINVAL;
167− }
164+ if (!adev->gart.ptr)
165+ return;
168166
169167 if (!drm_dev_enter(adev_to_drm(adev), &idx))
170− return 0;
168+ return;
171169
172170 t = offset / AMDGPU_GPU_PAGE_SIZE;
173171 p = t / AMDGPU_GPU_PAGES_IN_CPU_PAGE;
@@ -188,7 +186,6 @@ int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset, · 14 unmodified lines
188186 amdgpu_gmc_flush_gpu_tlb(adev, 0, i, 0);
189187
190188 drm_dev_exit(idx);
191− return 0;
192189 }
193190
194191 /**
@@ -204,7 +201,7 @@ int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset, · 9 unmodified lines
204201 * Map the dma_addresses into GART entries (all asics).
205202 * Returns 0 for success, -EINVAL for failure.
206203 */
207−int amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
204+void amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
208205 int pages, dma_addr_t *dma_addr, uint64_t flags,
209206 void *dst)
210207 {
@@ -212,13 +209,8 @@ int amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset, · 1 unmodified line
212209 unsigned i, j, t;
213210 int idx;
214211
215− if (!adev->gart.ready) {
216− WARN(1, "trying to bind memory to uninitialized GART !\n");
217− return -EINVAL;
218− }
219−
220212 if (!drm_dev_enter(adev_to_drm(adev), &idx))
221− return 0;
213+ return;
222214
223215 t = offset / AMDGPU_GPU_PAGE_SIZE;
224216
@@ -230,7 +222,6 @@ int amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset, · 5 unmodified lines
230222 }
231223 }
232224 drm_dev_exit(idx);
233− return 0;
234225 }
235226
236227 /**
@@ -246,20 +237,14 @@ int amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset, · 9 unmodified lines
246237 * (all asics).
247238 * Returns 0 for success, -EINVAL for failure.
248239 */
249−int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
240+void amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
250241 int pages, dma_addr_t *dma_addr,
251242 uint64_t flags)
252243 {
253− if (!adev->gart.ready) {
254− WARN(1, "trying to bind memory to uninitialized GART !\n");
255− return -EINVAL;
256− }
257−
258244 if (!adev->gart.ptr)
259− return 0;
245+ return;
260246
261− return amdgpu_gart_map(adev, offset, pages, dma_addr, flags,
262− adev->gart.ptr);
247+ amdgpu_gart_map(adev, offset, pages, dma_addr, flags, adev->gart.ptr);
263248 }
264249
265250 /**
@@ -274,6 +259,9 @@ void amdgpu_gart_invalidate_tlb(struct amdgpu_device *adev) · 8 unmodified lines
274259 {
275260 int i;
276261
262+ if (!adev->gart.ptr)
263+ return;
264+
277265 mb();
278266 amdgpu_device_flush_hdp(adev, NULL);
279267 for (i = 0; i < adev->num_vmhubs; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h+7−8
@@ -46,7 +46,6 @@ struct amdgpu_gart { · 45 unmodified lines
4646 unsigned num_gpu_pages;
4747 unsigned num_cpu_pages;
4848 unsigned table_size;
49− bool ready;
5049
5150 /* Asic default pte flags */
5251 uint64_t gart_pte_flags;
@@ -58,12 +57,12 @@ int amdgpu_gart_table_vram_pin(struct amdgpu_device *adev); · 5 unmodified lines
5857 void amdgpu_gart_table_vram_unpin(struct amdgpu_device *adev);
5958 int amdgpu_gart_init(struct amdgpu_device *adev);
6059 void amdgpu_gart_dummy_page_fini(struct amdgpu_device *adev);
61−int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
62− int pages);
63−int amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
64− int pages, dma_addr_t *dma_addr, uint64_t flags,
65− void *dst);
66−int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
67− int pages, dma_addr_t *dma_addr, uint64_t flags);
60+void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
61+ int pages);
62+void amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
63+ int pages, dma_addr_t *dma_addr, uint64_t flags,
64+ void *dst);
65+void amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
66+ int pages, dma_addr_t *dma_addr, uint64_t flags);
6867 void amdgpu_gart_invalidate_tlb(struct amdgpu_device *adev);
6968 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+1−1
@@ -222,7 +222,7 @@ static void amdgpu_gem_object_close(struct drm_gem_object *obj, · 221 unmodified lines
222222 if (!bo_va || --bo_va->ref_count)
223223 goto out_unlock;
224224
225− amdgpu_vm_bo_rmv(adev, bo_va);
225+ amdgpu_vm_bo_del(adev, bo_va);
226226 if (!amdgpu_vm_ready(vm))
227227 goto out_unlock;
228228
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c+11−59
@@ -615,72 +615,40 @@ int amdgpu_get_gfx_off_status(struct amdgpu_device *adev, uint32_t *value) · 614 unmodified lines
615615
616616 mutex_lock(&adev->gfx.gfx_off_mutex);
617617
618− r = smu_get_status_gfxoff(adev, value);
618+ r = amdgpu_dpm_get_status_gfxoff(adev, value);
619619
620620 mutex_unlock(&adev->gfx.gfx_off_mutex);
621621
622622 return r;
623623 }
624624
625−int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev)
625+int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block)
626626 {
627627 int r;
628− struct ras_fs_if fs_info = {
629− .sysfs_name = "gfx_err_count",
630− };
631− struct ras_ih_if ih_info = {
632− .cb = amdgpu_gfx_process_ras_data_cb,
633− };
634−
635− if (!adev->gfx.ras_if) {
636− adev->gfx.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
637− if (!adev->gfx.ras_if)
638− return -ENOMEM;
639− adev->gfx.ras_if->block = AMDGPU_RAS_BLOCK__GFX;
640− adev->gfx.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
641− adev->gfx.ras_if->sub_block_index = 0;
642− }
643− fs_info.head = ih_info.head = *adev->gfx.ras_if;
644− r = amdgpu_ras_late_init(adev, adev->gfx.ras_if,
645− &fs_info, &ih_info);
628+ r = amdgpu_ras_block_late_init(adev, ras_block);
646629 if (r)
647− goto free;
630+ return r;
648631
649− if (amdgpu_ras_is_supported(adev, adev->gfx.ras_if->block)) {
632+ if (amdgpu_ras_is_supported(adev, ras_block->block)) {
650633 if (!amdgpu_persistent_edc_harvesting_supported(adev))
651634 amdgpu_ras_reset_error_status(adev, AMDGPU_RAS_BLOCK__GFX);
652635
653636 r = amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0);
654637 if (r)
655638 goto late_fini;
656− } else {
657− /* free gfx ras_if if ras is not supported */
658− r = 0;
659− goto free;
660639 }
661640
662641 return 0;
663642 late_fini:
664− amdgpu_ras_late_fini(adev, adev->gfx.ras_if, &ih_info);
665−free:
666− kfree(adev->gfx.ras_if);
667− adev->gfx.ras_if = NULL;
643+ amdgpu_ras_block_late_fini(adev, ras_block);
668644 return r;
669645 }
670646
671647 void amdgpu_gfx_ras_fini(struct amdgpu_device *adev)
672648 {
673649 if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX) &&
674− adev->gfx.ras_if) {
675− struct ras_common_if *ras_if = adev->gfx.ras_if;
676− struct ras_ih_if ih_info = {
677− .head = *ras_if,
678− .cb = amdgpu_gfx_process_ras_data_cb,
679− };
680−
681− amdgpu_ras_late_fini(adev, ras_if, &ih_info);
682− kfree(ras_if);
683− }
650+ adev->gfx.ras_if)
651+ amdgpu_ras_block_late_fini(adev, adev->gfx.ras_if);
684652 }
685653
686654 int amdgpu_gfx_process_ras_data_cb(struct amdgpu_device *adev,
@@ -695,9 +663,9 @@ int amdgpu_gfx_process_ras_data_cb(struct amdgpu_device *adev, · 8 unmodified lines
695663 */
696664 if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) {
697665 kgd2kfd_set_sram_ecc_flag(adev->kfd.dev);
698− if (adev->gfx.ras_funcs &&
699− adev->gfx.ras_funcs->query_ras_error_count)
700− adev->gfx.ras_funcs->query_ras_error_count(adev, err_data);
666+ if (adev->gfx.ras && adev->gfx.ras->ras_block.hw_ops &&
667+ adev->gfx.ras->ras_block.hw_ops->query_ras_error_count)
668+ adev->gfx.ras->ras_block.hw_ops->query_ras_error_count(adev, err_data);
701669 amdgpu_ras_reset_gpu(adev);
702670 }
703671 return AMDGPU_RAS_SUCCESS;
@@ -852,19 +820,3 @@ int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev) · 148 unmodified lines
852820 }
853821 return amdgpu_num_kcq;
854822 }
855−
856−/* amdgpu_gfx_state_change_set - Handle gfx power state change set
857− * @adev: amdgpu_device pointer
858− * @state: gfx power state(1 -sGpuChangeState_D0Entry and 2 -sGpuChangeState_D3Entry)
859− *
860− */
861−
862−void amdgpu_gfx_state_change_set(struct amdgpu_device *adev, enum gfx_change_state state)
863−{
864− mutex_lock(&adev->pm.mutex);
865− if (adev->powerplay.pp_funcs &&
866− adev->powerplay.pp_funcs->gfx_state_change_set)
867− ((adev)->powerplay.pp_funcs->gfx_state_change_set(
868− (adev)->powerplay.pp_handle, state));
869− mutex_unlock(&adev->pm.mutex);
870−}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h+5−19
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #include "amdgpu_ring.h"
3232 #include "amdgpu_rlc.h"
3333 #include "soc15.h"
34+#include "amdgpu_ras.h"
3435
3536 /* GFX current status */
3637 #define AMDGPU_GFX_NORMAL_MODE 0x00000000L
@@ -47,12 +48,6 @@ enum amdgpu_gfx_pipe_priority { · 10 unmodified lines
4748 AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2
4849 };
4950
50−/* Argument for PPSMC_MSG_GpuChangeState */
51−enum gfx_change_state {
52− sGpuChangeState_D0Entry = 1,
53− sGpuChangeState_D3Entry,
54−};
55−
5651 #define AMDGPU_GFX_QUEUE_PRIORITY_MINIMUM 0
5752 #define AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM 15
5853
@@ -204,16 +199,8 @@ struct amdgpu_cu_info { · 145 unmodified lines
204199 uint32_t bitmap[4][4];
205200 };
206201
207−struct amdgpu_gfx_ras_funcs {
208− int (*ras_late_init)(struct amdgpu_device *adev);
209− void (*ras_fini)(struct amdgpu_device *adev);
210− int (*ras_error_inject)(struct amdgpu_device *adev,
211− void *inject_if);
212− int (*query_ras_error_count)(struct amdgpu_device *adev,
213− void *ras_error_status);
214− void (*reset_ras_error_count)(struct amdgpu_device *adev);
215− void (*query_ras_error_status)(struct amdgpu_device *adev);
216− void (*reset_ras_error_status)(struct amdgpu_device *adev);
202+struct amdgpu_gfx_ras {
203+ struct amdgpu_ras_block_object ras_block;
217204 void (*enable_watchdog_timer)(struct amdgpu_device *adev);
218205 };
219206
@@ -337,7 +324,7 @@ struct amdgpu_gfx { · 117 unmodified lines
337324
338325 /*ras */
339326 struct ras_common_if *ras_if;
340− const struct amdgpu_gfx_ras_funcs *ras_funcs;
327+ struct amdgpu_gfx_ras *ras;
341328 };
342329
343330 #define amdgpu_gfx_get_gpu_clock_counter(adev) (adev)->gfx.funcs->get_gpu_clock_counter((adev))
@@ -399,7 +386,7 @@ bool amdgpu_gfx_is_me_queue_enabled(struct amdgpu_device *adev, int me, · 55 unmodified lines
399386 int pipe, int queue);
400387 void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable);
401388 int amdgpu_get_gfx_off_status(struct amdgpu_device *adev, uint32_t *value);
402−int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev);
389+int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block);
403390 void amdgpu_gfx_ras_fini(struct amdgpu_device *adev);
404391 int amdgpu_gfx_process_ras_data_cb(struct amdgpu_device *adev,
405392 void *err_data,
@@ -410,5 +397,4 @@ int amdgpu_gfx_cp_ecc_error_irq(struct amdgpu_device *adev, · 4 unmodified lines
410397 uint32_t amdgpu_kiq_rreg(struct amdgpu_device *adev, uint32_t reg);
411398 void amdgpu_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v);
412399 int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev);
413−void amdgpu_gfx_state_change_set(struct amdgpu_device *adev, enum gfx_change_state state);
414400 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c+64−64
@@ -436,82 +436,35 @@ void amdgpu_gmc_filter_faults_remove(struct amdgpu_device *adev, uint64_t addr, · 435 unmodified lines
436436 } while (fault->timestamp < tmp);
437437 }
438438
439−int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev)
439+int amdgpu_gmc_ras_early_init(struct amdgpu_device *adev)
440440 {
441− int r;
442−
443− if (adev->umc.ras_funcs &&
444− adev->umc.ras_funcs->ras_late_init) {
445− r = adev->umc.ras_funcs->ras_late_init(adev);
446− if (r)
447− return r;
448− }
449−
450− if (adev->mmhub.ras_funcs &&
451− adev->mmhub.ras_funcs->ras_late_init) {
452− r = adev->mmhub.ras_funcs->ras_late_init(adev);
453− if (r)
454− return r;
455− }
456−
457− if (!adev->gmc.xgmi.connected_to_cpu)
458− adev->gmc.xgmi.ras_funcs = &xgmi_ras_funcs;
459−
460− if (adev->gmc.xgmi.ras_funcs &&
461− adev->gmc.xgmi.ras_funcs->ras_late_init) {
462− r = adev->gmc.xgmi.ras_funcs->ras_late_init(adev);
463− if (r)
464− return r;
465− }
466−
467− if (adev->hdp.ras_funcs &&
468− adev->hdp.ras_funcs->ras_late_init) {
469− r = adev->hdp.ras_funcs->ras_late_init(adev);
470− if (r)
471− return r;
472− }
473−
474− if (adev->mca.mp0.ras_funcs &&
475− adev->mca.mp0.ras_funcs->ras_late_init) {
476− r = adev->mca.mp0.ras_funcs->ras_late_init(adev);
477− if (r)
478− return r;
479− }
480−
481− if (adev->mca.mp1.ras_funcs &&
482− adev->mca.mp1.ras_funcs->ras_late_init) {
483− r = adev->mca.mp1.ras_funcs->ras_late_init(adev);
484− if (r)
485− return r;
441+ if (!adev->gmc.xgmi.connected_to_cpu) {
442+ adev->gmc.xgmi.ras = &xgmi_ras;
443+ amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras->ras_block);
444+ adev->gmc.xgmi.ras_if = &adev->gmc.xgmi.ras->ras_block.ras_comm;
486445 }
487446
488− if (adev->mca.mpio.ras_funcs &&
489− adev->mca.mpio.ras_funcs->ras_late_init) {
490− r = adev->mca.mpio.ras_funcs->ras_late_init(adev);
491− if (r)
492− return r;
493− }
447+ return 0;
448+}
494449
450+int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev)
451+{
495452 return 0;
496453 }
497454
498455 void amdgpu_gmc_ras_fini(struct amdgpu_device *adev)
499456 {
500− if (adev->umc.ras_funcs &&
501− adev->umc.ras_funcs->ras_fini)
502− adev->umc.ras_funcs->ras_fini(adev);
457+ if (adev->umc.ras && adev->umc.ras->ras_block.ras_fini)
458+ adev->umc.ras->ras_block.ras_fini(adev);
503459
504− if (adev->mmhub.ras_funcs &&
505− adev->mmhub.ras_funcs->ras_fini)
506− adev->mmhub.ras_funcs->ras_fini(adev);
460+ if (adev->mmhub.ras && adev->mmhub.ras->ras_block.ras_fini)
461+ adev->mmhub.ras->ras_block.ras_fini(adev);
507462
508− if (adev->gmc.xgmi.ras_funcs &&
509− adev->gmc.xgmi.ras_funcs->ras_fini)
510− adev->gmc.xgmi.ras_funcs->ras_fini(adev);
463+ if (adev->gmc.xgmi.ras && adev->gmc.xgmi.ras->ras_block.ras_fini)
464+ adev->gmc.xgmi.ras->ras_block.ras_fini(adev);
511465
512− if (adev->hdp.ras_funcs &&
513− adev->hdp.ras_funcs->ras_fini)
514− adev->hdp.ras_funcs->ras_fini(adev);
466+ if (adev->hdp.ras && adev->hdp.ras->ras_block.ras_fini)
467+ adev->hdp.ras->ras_block.ras_fini(adev);
515468 }
516469
517470 /*
@@ -584,6 +537,7 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev) · 66 unmodified lines
584537 case CHIP_NAVI12:
585538 case CHIP_VANGOGH:
586539 case CHIP_YELLOW_CARP:
540+ case CHIP_IP_DISCOVERY:
587541 /* Don't enable it by default yet.
588542 */
589543 if (amdgpu_tmz < 1) {
@@ -831,3 +785,49 @@ void amdgpu_gmc_get_reserved_allocation(struct amdgpu_device *adev) · 241 unmodified lines
831785 break;
832786 }
833787 }
788+
789+int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)
790+{
791+ struct amdgpu_bo *vram_bo = NULL;
792+ uint64_t vram_gpu = 0;
793+ void *vram_ptr = NULL;
794+
795+ int ret, size = 0x100000;
796+ uint8_t cptr[10];
797+
798+ ret = amdgpu_bo_create_kernel(adev, size, PAGE_SIZE,
799+ AMDGPU_GEM_DOMAIN_VRAM,
800+ &vram_bo,
801+ &vram_gpu,
802+ &vram_ptr);
803+ if (ret)
804+ return ret;
805+
806+ memset(vram_ptr, 0x86, size);
807+ memset(cptr, 0x86, 10);
808+
809+ /**
810+ * Check the start, the mid, and the end of the memory if the content of
811+ * each byte is the pattern "0x86". If yes, we suppose the vram bo is
812+ * workable.
813+ *
814+ * Note: If check the each byte of whole 1M bo, it will cost too many
815+ * seconds, so here, we just pick up three parts for emulation.
816+ */
817+ ret = memcmp(vram_ptr, cptr, 10);
818+ if (ret)
819+ return ret;
820+
821+ ret = memcmp(vram_ptr + (size / 2), cptr, 10);
822+ if (ret)
823+ return ret;
824+
825+ ret = memcmp(vram_ptr + size - 10, cptr, 10);
826+ if (ret)
827+ return ret;
828+
829+ amdgpu_bo_free_kernel(&vram_bo, &vram_gpu,
830+ &vram_ptr);
831+
832+ return 0;
833+}
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h+6−7
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/types.h>
3030
3131 #include "amdgpu_irq.h"
32+#include "amdgpu_ras.h"
3233
3334 /* VA hole for 48bit addresses on Vega10 */
3435 #define AMDGPU_GMC_HOLE_START 0x0000800000000000ULL
@@ -135,12 +136,8 @@ struct amdgpu_gmc_funcs { · 100 unmodified lines
135136 unsigned int (*get_vbios_fb_size)(struct amdgpu_device *adev);
136137 };
137138
138−struct amdgpu_xgmi_ras_funcs {
139− int (*ras_late_init)(struct amdgpu_device *adev);
140− void (*ras_fini)(struct amdgpu_device *adev);
141− int (*query_ras_error_count)(struct amdgpu_device *adev,
142− void *ras_error_status);
143− void (*reset_ras_error_count)(struct amdgpu_device *adev);
139+struct amdgpu_xgmi_ras {
140+ struct amdgpu_ras_block_object ras_block;
144141 };
145142
146143 struct amdgpu_xgmi {
@@ -159,7 +156,7 @@ struct amdgpu_xgmi { · 12 unmodified lines
159156 struct ras_common_if *ras_if;
160157 bool connected_to_cpu;
161158 bool pending_reset;
162− const struct amdgpu_xgmi_ras_funcs *ras_funcs;
159+ struct amdgpu_xgmi_ras *ras;
163160 };
164161
165162 struct amdgpu_gmc {
@@ -321,6 +318,7 @@ bool amdgpu_gmc_filter_faults(struct amdgpu_device *adev, · 155 unmodified lines
321318 uint16_t pasid, uint64_t timestamp);
322319 void amdgpu_gmc_filter_faults_remove(struct amdgpu_device *adev, uint64_t addr,
323320 uint16_t pasid);
321+int amdgpu_gmc_ras_early_init(struct amdgpu_device *adev);
324322 int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev);
325323 void amdgpu_gmc_ras_fini(struct amdgpu_device *adev);
326324 int amdgpu_gmc_allocate_vm_inv_eng(struct amdgpu_device *adev);
@@ -339,4 +337,5 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev); · 12 unmodified lines
339337 uint64_t amdgpu_gmc_vram_mc2pa(struct amdgpu_device *adev, uint64_t mc_addr);
340338 uint64_t amdgpu_gmc_vram_pa(struct amdgpu_device *adev, struct amdgpu_bo *bo);
341339 uint64_t amdgpu_gmc_vram_cpu_pa(struct amdgpu_device *adev, struct amdgpu_bo *bo);
340+int amdgpu_gmc_vram_checking(struct amdgpu_device *adev);
342341 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c+13−45
@@ -60,7 +60,7 @@ static ssize_t amdgpu_mem_info_gtt_total_show(struct device *dev, · 59 unmodified lines
6060 struct ttm_resource_manager *man;
6161
6262 man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
63− return sysfs_emit(buf, "%llu\n", man->size * PAGE_SIZE);
63+ return sysfs_emit(buf, "%llu\n", man->size);
6464 }
6565
6666 /**
@@ -77,8 +77,9 @@ static ssize_t amdgpu_mem_info_gtt_used_show(struct device *dev, · 10 unmodified lines
7777 {
7878 struct drm_device *ddev = dev_get_drvdata(dev);
7979 struct amdgpu_device *adev = drm_to_adev(ddev);
80+ struct ttm_resource_manager *man = &adev->mman.gtt_mgr.manager;
8081
81− return sysfs_emit(buf, "%llu\n", amdgpu_gtt_mgr_usage(&adev->mman.gtt_mgr));
82+ return sysfs_emit(buf, "%llu\n", ttm_resource_manager_usage(man));
8283 }
8384
8485 static DEVICE_ATTR(mem_info_gtt_total, S_IRUGO,
@@ -130,20 +131,17 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, · 45 unmodified lines
130131 struct amdgpu_gtt_node *node;
131132 int r;
132133
133− if (!(place->flags & TTM_PL_FLAG_TEMPORARY) &&
134− atomic64_add_return(num_pages, &mgr->used) > man->size) {
135− atomic64_sub(num_pages, &mgr->used);
136− return -ENOSPC;
137− }
138−
139134 node = kzalloc(struct_size(node, base.mm_nodes, 1), GFP_KERNEL);
140− if (!node) {
141− r = -ENOMEM;
142− goto err_out;
143− }
135+ if (!node)
136+ return -ENOMEM;
144137
145138 node->tbo = tbo;
146139 ttm_resource_init(tbo, place, &node->base.base);
140+ if (!(place->flags & TTM_PL_FLAG_TEMPORARY) &&
141+ ttm_resource_manager_usage(man) > man->size) {
142+ r = -ENOSPC;
143+ goto err_free;
144+ }
147145
148146 if (place->lpfn) {
149147 spin_lock(&mgr->lock);
@@ -169,11 +167,6 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, · 19 unmodified lines
169167 err_free:
170168 ttm_resource_fini(man, &node->base.base);
171169 kfree(node);
172−
173−err_out:
174− if (!(place->flags & TTM_PL_FLAG_TEMPORARY))
175− atomic64_sub(num_pages, &mgr->used);
176−
177170 return r;
178171 }
179172
@@ -196,25 +189,10 @@ static void amdgpu_gtt_mgr_del(struct ttm_resource_manager *man, · 16 unmodified lines
196189 drm_mm_remove_node(&node->base.mm_nodes[0]);
197190 spin_unlock(&mgr->lock);
198191
199− if (!(res->placement & TTM_PL_FLAG_TEMPORARY))
200− atomic64_sub(res->num_pages, &mgr->used);
201−
202192 ttm_resource_fini(man, res);
203193 kfree(node);
204194 }
205195
206−/**
207− * amdgpu_gtt_mgr_usage - return usage of GTT domain
208− *
209− * @mgr: amdgpu_gtt_mgr pointer
210− *
211− * Return how many bytes are used in the GTT domain
212− */
213−uint64_t amdgpu_gtt_mgr_usage(struct amdgpu_gtt_mgr *mgr)
214−{
215− return atomic64_read(&mgr->used) * PAGE_SIZE;
216−}
217−
218196 /**
219197 * amdgpu_gtt_mgr_recover - re-init gart
220198 *
@@ -222,26 +200,21 @@ uint64_t amdgpu_gtt_mgr_usage(struct amdgpu_gtt_mgr *mgr) · 1 unmodified line
222200 *
223201 * Re-init the gart for each known BO in the GTT.
224202 */
225−int amdgpu_gtt_mgr_recover(struct amdgpu_gtt_mgr *mgr)
203+void amdgpu_gtt_mgr_recover(struct amdgpu_gtt_mgr *mgr)
226204 {
227205 struct amdgpu_gtt_node *node;
228206 struct drm_mm_node *mm_node;
229207 struct amdgpu_device *adev;
230− int r = 0;
231208
232209 adev = container_of(mgr, typeof(*adev), mman.gtt_mgr);
233210 spin_lock(&mgr->lock);
234211 drm_mm_for_each_node(mm_node, &mgr->mm) {
235212 node = container_of(mm_node, typeof(*node), base.mm_nodes[0]);
236− r = amdgpu_ttm_recover_gart(node->tbo);
237− if (r)
238− break;
213+ amdgpu_ttm_recover_gart(node->tbo);
239214 }
240215 spin_unlock(&mgr->lock);
241216
242217 amdgpu_gart_invalidate_tlb(adev);
243−
244− return r;
245218 }
246219
247220 /**
@@ -260,9 +233,6 @@ static void amdgpu_gtt_mgr_debug(struct ttm_resource_manager *man, · 12 unmodified lines
260233 spin_lock(&mgr->lock);
261234 drm_mm_print(&mgr->mm, printer);
262235 spin_unlock(&mgr->lock);
263−
264− drm_printf(printer, "man size:%llu pages, gtt used:%llu pages\n",
265− man->size, atomic64_read(&mgr->used));
266236 }
267237
268238 static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func = {
@@ -288,14 +258,12 @@ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size) · 19 unmodified lines
288258 man->use_tt = true;
289259 man->func = &amdgpu_gtt_mgr_func;
290260
291− ttm_resource_manager_init(man, &adev->mman.bdev,
292− gtt_size >> PAGE_SHIFT);
261+ ttm_resource_manager_init(man, &adev->mman.bdev, gtt_size);
293262
294263 start = AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS;
295264 size = (adev->gmc.gart_size >> PAGE_SHIFT) - start;
296265 drm_mm_init(&mgr->mm, start, size);
297266 spin_lock_init(&mgr->lock);
298− atomic64_set(&mgr->used, 0);
299267
300268 ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_TT, &mgr->manager);
301269 ttm_resource_manager_set_used(man, true);
drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c+2−38
@@ -24,45 +24,9 @@ · 23 unmodified lines
2424 #include "amdgpu.h"
2525 #include "amdgpu_ras.h"
2626
27−int amdgpu_hdp_ras_late_init(struct amdgpu_device *adev)
28−{
29− int r;
30− struct ras_ih_if ih_info = {
31− .cb = NULL,
32− };
33− struct ras_fs_if fs_info = {
34− .sysfs_name = "hdp_err_count",
35− };
36−
37− if (!adev->hdp.ras_if) {
38− adev->hdp.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
39− if (!adev->hdp.ras_if)
40− return -ENOMEM;
41− adev->hdp.ras_if->block = AMDGPU_RAS_BLOCK__HDP;
42− adev->hdp.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
43− adev->hdp.ras_if->sub_block_index = 0;
44− }
45− ih_info.head = fs_info.head = *adev->hdp.ras_if;
46− r = amdgpu_ras_late_init(adev, adev->hdp.ras_if,
47− &fs_info, &ih_info);
48− if (r || !amdgpu_ras_is_supported(adev, adev->hdp.ras_if->block)) {
49− kfree(adev->hdp.ras_if);
50− adev->hdp.ras_if = NULL;
51− }
52−
53− return r;
54−}
55−
5627 void amdgpu_hdp_ras_fini(struct amdgpu_device *adev)
5728 {
5829 if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__HDP) &&
59− adev->hdp.ras_if) {
60− struct ras_common_if *ras_if = adev->hdp.ras_if;
61− struct ras_ih_if ih_info = {
62− .cb = NULL,
63− };
64−
65− amdgpu_ras_late_fini(adev, ras_if, &ih_info);
66− kfree(ras_if);
67− }
30+ adev->hdp.ras_if)
31+ amdgpu_ras_block_late_fini(adev, adev->hdp.ras_if);
6832 }
drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h+5−8
@@ -22,13 +22,10 @@ · 21 unmodified lines
2222 */
2323 #ifndef __AMDGPU_HDP_H__
2424 #define __AMDGPU_HDP_H__
25+#include "amdgpu_ras.h"
2526
26−struct amdgpu_hdp_ras_funcs {
27− int (*ras_late_init)(struct amdgpu_device *adev);
28− void (*ras_fini)(struct amdgpu_device *adev);
29− void (*query_ras_error_count)(struct amdgpu_device *adev,
30− void *ras_error_status);
31− void (*reset_ras_error_count)(struct amdgpu_device *adev);
27+struct amdgpu_hdp_ras {
28+ struct amdgpu_ras_block_object ras_block;
3229 };
3330
3431 struct amdgpu_hdp_funcs {
@@ -43,9 +40,9 @@ struct amdgpu_hdp_funcs { · 8 unmodified lines
4340 struct amdgpu_hdp {
4441 struct ras_common_if *ras_if;
4542 const struct amdgpu_hdp_funcs *funcs;
46− const struct amdgpu_hdp_ras_funcs *ras_funcs;
43+ struct amdgpu_hdp_ras *ras;
4744 };
4845
49−int amdgpu_hdp_ras_late_init(struct amdgpu_device *adev);
46+int amdgpu_hdp_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block);
5047 void amdgpu_hdp_ras_fini(struct amdgpu_device *adev);
5148 #endif /* __AMDGPU_HDP_H__ */
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c+6−6
@@ -199,13 +199,13 @@ static irqreturn_t amdgpu_irq_handler(int irq, void *arg) · 198 unmodified lines
199199 * ack the interrupt if it is there
200200 */
201201 if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__PCIE_BIF)) {
202− if (adev->nbio.ras_funcs &&
203− adev->nbio.ras_funcs->handle_ras_controller_intr_no_bifring)
204− adev->nbio.ras_funcs->handle_ras_controller_intr_no_bifring(adev);
202+ if (adev->nbio.ras &&
203+ adev->nbio.ras->handle_ras_controller_intr_no_bifring)
204+ adev->nbio.ras->handle_ras_controller_intr_no_bifring(adev);
205205
206− if (adev->nbio.ras_funcs &&
207− adev->nbio.ras_funcs->handle_ras_err_event_athub_intr_no_bifring)
208− adev->nbio.ras_funcs->handle_ras_err_event_athub_intr_no_bifring(adev);
206+ if (adev->nbio.ras &&
207+ adev->nbio.ras->handle_ras_err_event_athub_intr_no_bifring)
208+ adev->nbio.ras->handle_ras_err_event_athub_intr_no_bifring(adev);
209209 }
210210
211211 return ret;
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c+4−1
@@ -37,6 +37,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) · 36 unmodified lines
3737 struct amdgpu_task_info ti;
3838 struct amdgpu_device *adev = ring->adev;
3939 int idx;
40+ int r;
4041
4142 if (!drm_dev_enter(adev_to_drm(adev), &idx)) {
4243 DRM_INFO("%s - device unplugged skipping recovery on scheduler:%s",
@@ -63,7 +64,9 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) · 20 unmodified lines
6364 ti.process_name, ti.tgid, ti.task_name, ti.pid);
6465
6566 if (amdgpu_device_should_recover_gpu(ring->adev)) {
66− amdgpu_device_gpu_recover(ring->adev, job);
67+ r = amdgpu_device_gpu_recover_imp(ring->adev, job);
68+ if (r)
69+ DRM_ERROR("GPU Recovery Failed: %d\n", r);
6770 } else {
6871 drm_sched_suspend_timeout(&ring->sched);
6972 if (amdgpu_sriov_vf(adev))
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+33−93
@@ -87,11 +87,6 @@ void amdgpu_driver_unload_kms(struct drm_device *dev) · 86 unmodified lines
8787 if (adev->rmmio == NULL)
8888 return;
8989
90− if (adev->runpm) {
91− pm_runtime_get_sync(dev->dev);
92− pm_runtime_forbid(dev->dev);
93− }
94−
9590 if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DRV_UNLOAD))
9691 DRM_WARN("smart shift update failed\n");
9792
@@ -124,22 +119,6 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev) · 26 unmodified lines
124119 mutex_unlock(&mgpu_info.mutex);
125120 }
126121
127−static void amdgpu_get_audio_func(struct amdgpu_device *adev)
128−{
129− struct pci_dev *p = NULL;
130−
131− p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
132− adev->pdev->bus->number, 1);
133− if (p) {
134− pm_runtime_get_sync(&p->dev);
135−
136− pm_runtime_mark_last_busy(&p->dev);
137− pm_runtime_put_autosuspend(&p->dev);
138−
139− pci_dev_put(p);
140− }
141−}
142−
143122 /**
144123 * amdgpu_driver_load_kms - Main load function for KMS.
145124 *
@@ -152,21 +131,10 @@ static void amdgpu_get_audio_func(struct amdgpu_device *adev) · 6 unmodified lines
152131 int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
153132 {
154133 struct drm_device *dev;
155− struct pci_dev *parent;
156134 int r, acpi_status;
157135
158136 dev = adev_to_drm(adev);
159137
160− if (amdgpu_has_atpx() &&
161− (amdgpu_is_atpx_hybrid() ||
162− amdgpu_has_atpx_dgpu_power_cntl()) &&
163− ((flags & AMD_IS_APU) == 0) &&
164− !pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
165− flags |= AMD_IS_PX;
166−
167− parent = pci_upstream_bridge(adev->pdev);
168− adev->has_pr3 = parent ? pci_pr3_present(parent) : false;
169−
170138 /* amdgpu_device_init should report only fatal error
171139 * like memory allocation failure or iomapping failure,
172140 * or memory manager initialization failure, it must
@@ -224,58 +192,12 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · 51 unmodified lines
224192 if (acpi_status)
225193 dev_dbg(dev->dev, "Error during ACPI methods call\n");
226194
227− if (adev->runpm) {
228− /* only need to skip on ATPX */
229− if (amdgpu_device_supports_px(dev))
230− dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
231− /* we want direct complete for BOCO */
232− if (amdgpu_device_supports_boco(dev))
233− dev_pm_set_driver_flags(dev->dev, DPM_FLAG_SMART_PREPARE |
234− DPM_FLAG_SMART_SUSPEND |
235− DPM_FLAG_MAY_SKIP_RESUME);
236− pm_runtime_use_autosuspend(dev->dev);
237− pm_runtime_set_autosuspend_delay(dev->dev, 5000);
238−
239− pm_runtime_allow(dev->dev);
240−
241− pm_runtime_mark_last_busy(dev->dev);
242− pm_runtime_put_autosuspend(dev->dev);
243−
244− /*
245− * For runpm implemented via BACO, PMFW will handle the
246− * timing for BACO in and out:
247− * - put ASIC into BACO state only when both video and
248− * audio functions are in D3 state.
249− * - pull ASIC out of BACO state when either video or
250− * audio function is in D0 state.
251− * Also, at startup, PMFW assumes both functions are in
252− * D0 state.
253− *
254− * So if snd driver was loaded prior to amdgpu driver
255− * and audio function was put into D3 state, there will
256− * be no PMFW-aware D-state transition(D0->D3) on runpm
257− * suspend. Thus the BACO will be not correctly kicked in.
258− *
259− * Via amdgpu_get_audio_func(), the audio dev is put
260− * into D0 state. Then there will be a PMFW-aware D-state
261− * transition(D0->D3) on runpm suspend.
262− */
263− if (amdgpu_device_supports_baco(dev) &&
264− !(adev->flags & AMD_IS_APU) &&
265− (adev->asic_type >= CHIP_NAVI10))
266− amdgpu_get_audio_func(adev);
267− }
268−
269195 if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DRV_LOAD))
270196 DRM_WARN("smart shift update failed\n");
271197
272198 out:
273− if (r) {
274− /* balance pm_runtime_get_sync in amdgpu_driver_unload_kms */
275− if (adev->rmmio && adev->runpm)
276− pm_runtime_put_noidle(dev->dev);
199+ if (r)
277200 amdgpu_driver_unload_kms(dev);
278− }
279201
280202 return r;
281203 }
@@ -406,6 +328,10 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info, · 124 unmodified lines
406328 fw_info->ver = adev->psp.toc.fw_version;
407329 fw_info->feature = adev->psp.toc.feature_version;
408330 break;
331+ case AMDGPU_INFO_FW_CAP:
332+ fw_info->ver = adev->psp.cap_fw_version;
333+ fw_info->feature = adev->psp.cap_feature_version;
334+ break;
409335 default:
410336 return -EINVAL;
411337 }
@@ -678,13 +604,13 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 266 unmodified lines
678604 ui64 = atomic64_read(&adev->num_vram_cpu_page_faults);
679605 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0;
680606 case AMDGPU_INFO_VRAM_USAGE:
681− ui64 = amdgpu_vram_mgr_usage(&adev->mman.vram_mgr);
607+ ui64 = ttm_resource_manager_usage(&adev->mman.vram_mgr.manager);
682608 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0;
683609 case AMDGPU_INFO_VIS_VRAM_USAGE:
684610 ui64 = amdgpu_vram_mgr_vis_usage(&adev->mman.vram_mgr);
685611 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0;
686612 case AMDGPU_INFO_GTT_USAGE:
687− ui64 = amdgpu_gtt_mgr_usage(&adev->mman.gtt_mgr);
613+ ui64 = ttm_resource_manager_usage(&adev->mman.gtt_mgr.manager);
688614 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0;
689615 case AMDGPU_INFO_GDS_CONFIG: {
690616 struct drm_amdgpu_info_gds gds_info;
@@ -716,14 +642,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 25 unmodified lines
716642 case AMDGPU_INFO_MEMORY: {
717643 struct drm_amdgpu_memory_info mem;
718644 struct ttm_resource_manager *gtt_man =
719− ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
645+ &adev->mman.gtt_mgr.manager;
646+ struct ttm_resource_manager *vram_man =
647+ &adev->mman.vram_mgr.manager;
648+
720649 memset(&mem, 0, sizeof(mem));
721650 mem.vram.total_heap_size = adev->gmc.real_vram_size;
722651 mem.vram.usable_heap_size = adev->gmc.real_vram_size -
723652 atomic64_read(&adev->vram_pin_size) -
724653 AMDGPU_VM_RESERVED_VRAM;
725654 mem.vram.heap_usage =
726− amdgpu_vram_mgr_usage(&adev->mman.vram_mgr);
655+ ttm_resource_manager_usage(vram_man);
727656 mem.vram.max_allocation = mem.vram.usable_heap_size * 3 / 4;
728657
729658 mem.cpu_accessible_vram.total_heap_size =
@@ -741,8 +670,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 11 unmodified lines
741670 mem.gtt.total_heap_size *= PAGE_SIZE;
742671 mem.gtt.usable_heap_size = mem.gtt.total_heap_size -
743672 atomic64_read(&adev->gart_pin_size);
744− mem.gtt.heap_usage =
745− amdgpu_gtt_mgr_usage(&adev->mman.gtt_mgr);
673+ mem.gtt.heap_usage = ttm_resource_manager_usage(gtt_man);
746674 mem.gtt.max_allocation = mem.gtt.usable_heap_size * 3 / 4;
747675
748676 return copy_to_user(out, &mem,
@@ -1268,18 +1196,20 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev, · 519 unmodified lines
12681196 if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_VCE) != NULL)
12691197 amdgpu_vce_free_handles(adev, file_priv);
12701198
1271− amdgpu_vm_bo_rmv(adev, fpriv->prt_va);
1272−
12731199 if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
12741200 /* TODO: how to handle reserve failure */
12751201 BUG_ON(amdgpu_bo_reserve(adev->virt.csa_obj, true));
1276− amdgpu_vm_bo_rmv(adev, fpriv->csa_va);
1202+ amdgpu_vm_bo_del(adev, fpriv->csa_va);
12771203 fpriv->csa_va = NULL;
12781204 amdgpu_bo_unreserve(adev->virt.csa_obj);
12791205 }
12801206
12811207 pasid = fpriv->vm.pasid;
12821208 pd = amdgpu_bo_ref(fpriv->vm.root.bo);
1209+ if (!WARN_ON(amdgpu_bo_reserve(pd, true))) {
1210+ amdgpu_vm_bo_del(adev, fpriv->prt_va);
1211+ amdgpu_bo_unreserve(pd);
1212+ }
12831213
12841214 amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr);
12851215 amdgpu_vm_fini(adev, &fpriv->vm);
@@ -1427,8 +1357,7 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused) · 141 unmodified lines
14271357 struct drm_amdgpu_info_firmware fw_info;
14281358 struct drm_amdgpu_query_fw query_fw;
14291359 struct atom_context *ctx = adev->mode_info.atom_context;
1430− uint8_t smu_minor, smu_debug;
1431− uint16_t smu_major;
1360+ uint8_t smu_program, smu_major, smu_minor, smu_debug;
14321361 int ret, i;
14331362
14341363 static const char *ta_fw_name[TA_FW_TYPE_MAX_INDEX] = {
@@ -1574,11 +1503,12 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused) · 139 unmodified lines
15741503 ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
15751504 if (ret)
15761505 return ret;
1577− smu_major = (fw_info.ver >> 16) & 0xffff;
1506+ smu_program = (fw_info.ver >> 24) & 0xff;
1507+ smu_major = (fw_info.ver >> 16) & 0xff;
15781508 smu_minor = (fw_info.ver >> 8) & 0xff;
15791509 smu_debug = (fw_info.ver >> 0) & 0xff;
1580− seq_printf(m, "SMC feature version: %u, firmware version: 0x%08x (%d.%d.%d)\n",
1581− fw_info.feature, fw_info.ver, smu_major, smu_minor, smu_debug);
1510+ seq_printf(m, "SMC feature version: %u, program: %d, firmware version: 0x%08x (%d.%d.%d)\n",
1511+ fw_info.feature, smu_program, fw_info.ver, smu_major, smu_minor, smu_debug);
15821512
15831513 /* SDMA */
15841514 query_fw.fw_type = AMDGPU_INFO_FW_SDMA;
@@ -1623,6 +1553,16 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused) · 38 unmodified lines
16231553 seq_printf(m, "TOC feature version: %u, firmware version: 0x%08x\n",
16241554 fw_info.feature, fw_info.ver);
16251555
1556+ /* CAP */
1557+ if (adev->psp.cap_fw) {
1558+ query_fw.fw_type = AMDGPU_INFO_FW_CAP;
1559+ ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
1560+ if (ret)
1561+ return ret;
1562+ seq_printf(m, "CAP feature version: %u, firmware version: 0x%08x\n",
1563+ fw_info.feature, fw_info.ver);
1564+ }
1565+
16261566 seq_printf(m, "VBIOS version: %s\n", ctx->vbios_version);
16271567
16281568 return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c+1−40
@@ -71,47 +71,8 @@ void amdgpu_mca_query_ras_error_count(struct amdgpu_device *adev, · 70 unmodified lines
7171 amdgpu_mca_reset_error_count(adev, mc_status_addr);
7272 }
7373
74−int amdgpu_mca_ras_late_init(struct amdgpu_device *adev,
75− struct amdgpu_mca_ras *mca_dev)
76−{
77− int r;
78− struct ras_ih_if ih_info = {
79− .cb = NULL,
80− };
81− struct ras_fs_if fs_info = {
82− .sysfs_name = mca_dev->ras_funcs->sysfs_name,
83− };
84−
85− if (!mca_dev->ras_if) {
86− mca_dev->ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
87− if (!mca_dev->ras_if)
88− return -ENOMEM;
89− mca_dev->ras_if->block = mca_dev->ras_funcs->ras_block;
90− mca_dev->ras_if->sub_block_index = mca_dev->ras_funcs->ras_sub_block;
91− mca_dev->ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
92− }
93− ih_info.head = fs_info.head = *mca_dev->ras_if;
94− r = amdgpu_ras_late_init(adev, mca_dev->ras_if,
95− &fs_info, &ih_info);
96− if (r || !amdgpu_ras_is_supported(adev, mca_dev->ras_if->block)) {
97− kfree(mca_dev->ras_if);
98− mca_dev->ras_if = NULL;
99− }
100−
101− return r;
102−}
103−
10474 void amdgpu_mca_ras_fini(struct amdgpu_device *adev,
10575 struct amdgpu_mca_ras *mca_dev)
10676 {
107− struct ras_ih_if ih_info = {
108− .cb = NULL,
109− };
110−
111− if (!mca_dev->ras_if)
112− return;
113−
114− amdgpu_ras_late_fini(adev, mca_dev->ras_if, &ih_info);
115− kfree(mca_dev->ras_if);
116− mca_dev->ras_if = NULL;
77+ amdgpu_ras_block_late_fini(adev, mca_dev->ras_if);
11778 }
drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h+3−14
@@ -21,21 +21,13 @@ · 20 unmodified lines
2121 #ifndef __AMDGPU_MCA_H__
2222 #define __AMDGPU_MCA_H__
2323
24−struct amdgpu_mca_ras_funcs {
25− int (*ras_late_init)(struct amdgpu_device *adev);
26− void (*ras_fini)(struct amdgpu_device *adev);
27− void (*query_ras_error_count)(struct amdgpu_device *adev,
28− void *ras_error_status);
29− void (*query_ras_error_address)(struct amdgpu_device *adev,
30− void *ras_error_status);
31− uint32_t ras_block;
32− uint32_t ras_sub_block;
33− const char* sysfs_name;
24+struct amdgpu_mca_ras_block {
25+ struct amdgpu_ras_block_object ras_block;
3426 };
3527
3628 struct amdgpu_mca_ras {
3729 struct ras_common_if *ras_if;
38− const struct amdgpu_mca_ras_funcs *ras_funcs;
30+ struct amdgpu_mca_ras_block *ras;
3931 };
4032
4133 struct amdgpu_mca_funcs {
@@ -64,9 +56,6 @@ void amdgpu_mca_query_ras_error_count(struct amdgpu_device *adev, · 22 unmodified lines
6456 uint64_t mc_status_addr,
6557 void *ras_error_status);
6658
67−int amdgpu_mca_ras_late_init(struct amdgpu_device *adev,
68− struct amdgpu_mca_ras *mca_dev);
69−
7059 void amdgpu_mca_ras_fini(struct amdgpu_device *adev,
7160 struct amdgpu_mca_ras *mca_dev);
7261
drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c+2−38
@@ -24,45 +24,9 @@ · 23 unmodified lines
2424 #include "amdgpu.h"
2525 #include "amdgpu_ras.h"
2626
27−int amdgpu_mmhub_ras_late_init(struct amdgpu_device *adev)
28−{
29− int r;
30− struct ras_ih_if ih_info = {
31− .cb = NULL,
32− };
33− struct ras_fs_if fs_info = {
34− .sysfs_name = "mmhub_err_count",
35− };
36−
37− if (!adev->mmhub.ras_if) {
38− adev->mmhub.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
39− if (!adev->mmhub.ras_if)
40− return -ENOMEM;
41− adev->mmhub.ras_if->block = AMDGPU_RAS_BLOCK__MMHUB;
42− adev->mmhub.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
43− adev->mmhub.ras_if->sub_block_index = 0;
44− }
45− ih_info.head = fs_info.head = *adev->mmhub.ras_if;
46− r = amdgpu_ras_late_init(adev, adev->mmhub.ras_if,
47− &fs_info, &ih_info);
48− if (r || !amdgpu_ras_is_supported(adev, adev->mmhub.ras_if->block)) {
49− kfree(adev->mmhub.ras_if);
50− adev->mmhub.ras_if = NULL;
51− }
52−
53− return r;
54−}
55−
5627 void amdgpu_mmhub_ras_fini(struct amdgpu_device *adev)
5728 {
5829 if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__MMHUB) &&
59− adev->mmhub.ras_if) {
60− struct ras_common_if *ras_if = adev->mmhub.ras_if;
61− struct ras_ih_if ih_info = {
62− .cb = NULL,
63− };
64−
65− amdgpu_ras_late_fini(adev, ras_if, &ih_info);
66− kfree(ras_if);
67− }
30+ adev->mmhub.ras_if)
31+ amdgpu_ras_block_late_fini(adev, adev->mmhub.ras_if);
6832 }
drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h+3−10
@@ -21,14 +21,8 @@ · 20 unmodified lines
2121 #ifndef __AMDGPU_MMHUB_H__
2222 #define __AMDGPU_MMHUB_H__
2323
24−struct amdgpu_mmhub_ras_funcs {
25− int (*ras_late_init)(struct amdgpu_device *adev);
26− void (*ras_fini)(struct amdgpu_device *adev);
27− void (*query_ras_error_count)(struct amdgpu_device *adev,
28− void *ras_error_status);
29− void (*query_ras_error_status)(struct amdgpu_device *adev);
30− void (*reset_ras_error_count)(struct amdgpu_device *adev);
31− void (*reset_ras_error_status)(struct amdgpu_device *adev);
24+struct amdgpu_mmhub_ras {
25+ struct amdgpu_ras_block_object ras_block;
3226 };
3327
3428 struct amdgpu_mmhub_funcs {
@@ -50,10 +44,9 @@ struct amdgpu_mmhub_funcs { · 15 unmodified lines
5044 struct amdgpu_mmhub {
5145 struct ras_common_if *ras_if;
5246 const struct amdgpu_mmhub_funcs *funcs;
53− const struct amdgpu_mmhub_ras_funcs *ras_funcs;
47+ struct amdgpu_mmhub_ras *ras;
5448 };
5549
56−int amdgpu_mmhub_ras_late_init(struct amdgpu_device *adev);
5750 void amdgpu_mmhub_ras_fini(struct amdgpu_device *adev);
5851 #endif
5952
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h+1−0
@@ -341,6 +341,7 @@ struct amdgpu_mode_info { · 340 unmodified lines
341341 int num_crtc; /* number of crtcs */
342342 int num_hpd; /* number of hpd pins */
343343 int num_dig; /* number of dig blocks */
344+ bool gpu_vm_support; /* supports display from GTT */
344345 int disp_priority;
345346 const struct amdgpu_display_funcs *funcs;
346347 const enum drm_plane_type *plane_type;
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c+7−37
@@ -22,61 +22,31 @@ · 21 unmodified lines
2222 #include "amdgpu.h"
2323 #include "amdgpu_ras.h"
2424
25−int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev)
25+int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block)
2626 {
2727 int r;
28− struct ras_ih_if ih_info = {
29− .cb = NULL,
30− };
31− struct ras_fs_if fs_info = {
32− .sysfs_name = "pcie_bif_err_count",
33− };
34−
35− if (!adev->nbio.ras_if) {
36− adev->nbio.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
37− if (!adev->nbio.ras_if)
38− return -ENOMEM;
39− adev->nbio.ras_if->block = AMDGPU_RAS_BLOCK__PCIE_BIF;
40− adev->nbio.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
41− adev->nbio.ras_if->sub_block_index = 0;
42− }
43− ih_info.head = fs_info.head = *adev->nbio.ras_if;
44− r = amdgpu_ras_late_init(adev, adev->nbio.ras_if,
45− &fs_info, &ih_info);
28+ r = amdgpu_ras_block_late_init(adev, ras_block);
4629 if (r)
47− goto free;
30+ return r;
4831
49− if (amdgpu_ras_is_supported(adev, adev->nbio.ras_if->block)) {
32+ if (amdgpu_ras_is_supported(adev, ras_block->block)) {
5033 r = amdgpu_irq_get(adev, &adev->nbio.ras_controller_irq, 0);
5134 if (r)
5235 goto late_fini;
5336 r = amdgpu_irq_get(adev, &adev->nbio.ras_err_event_athub_irq, 0);
5437 if (r)
5538 goto late_fini;
56− } else {
57− r = 0;
58− goto free;
5939 }
6040
6141 return 0;
6242 late_fini:
63− amdgpu_ras_late_fini(adev, adev->nbio.ras_if, &ih_info);
64−free:
65− kfree(adev->nbio.ras_if);
66− adev->nbio.ras_if = NULL;
43+ amdgpu_ras_block_late_fini(adev, ras_block);
6744 return r;
6845 }
6946
7047 void amdgpu_nbio_ras_fini(struct amdgpu_device *adev)
7148 {
7249 if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__PCIE_BIF) &&
73− adev->nbio.ras_if) {
74− struct ras_common_if *ras_if = adev->nbio.ras_if;
75− struct ras_ih_if ih_info = {
76− .cb = NULL,
77− };
78−
79− amdgpu_ras_late_fini(adev, ras_if, &ih_info);
80− kfree(ras_if);
81− }
50+ adev->nbio.ras_if)
51+ amdgpu_ras_block_late_fini(adev, adev->nbio.ras_if);
8252 }
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h+4−7
@@ -47,15 +47,12 @@ struct nbio_hdp_flush_reg { · 46 unmodified lines
4747 u32 ref_and_mask_sdma7;
4848 };
4949
50−struct amdgpu_nbio_ras_funcs {
50+struct amdgpu_nbio_ras {
51+ struct amdgpu_ras_block_object ras_block;
5152 void (*handle_ras_controller_intr_no_bifring)(struct amdgpu_device *adev);
5253 void (*handle_ras_err_event_athub_intr_no_bifring)(struct amdgpu_device *adev);
5354 int (*init_ras_controller_interrupt)(struct amdgpu_device *adev);
5455 int (*init_ras_err_event_athub_interrupt)(struct amdgpu_device *adev);
55− void (*query_ras_error_count)(struct amdgpu_device *adev,
56− void *ras_error_status);
57− int (*ras_late_init)(struct amdgpu_device *adev);
58− void (*ras_fini)(struct amdgpu_device *adev);
5956 };
6057
6158 struct amdgpu_nbio_funcs {
@@ -104,9 +101,9 @@ struct amdgpu_nbio { · 42 unmodified lines
104101 struct amdgpu_irq_src ras_err_event_athub_irq;
105102 struct ras_common_if *ras_if;
106103 const struct amdgpu_nbio_funcs *funcs;
107− const struct amdgpu_nbio_ras_funcs *ras_funcs;
104+ struct amdgpu_nbio_ras *ras;
108105 };
109106
110−int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev);
107+int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block);
111108 void amdgpu_nbio_ras_fini(struct amdgpu_device *adev);
112109 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+7−3
@@ -451,7 +451,7 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev, · 450 unmodified lines
451451 if (domain & AMDGPU_GEM_DOMAIN_GTT) {
452452 man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
453453
454− if (size < (man->size << PAGE_SHIFT))
454+ if (size < man->size)
455455 return true;
456456 else
457457 goto fail;
@@ -460,7 +460,7 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev, · 2 unmodified lines
460460 if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
461461 man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
462462
463− if (size < (man->size << PAGE_SHIFT))
463+ if (size < man->size)
464464 return true;
465465 else
466466 goto fail;
@@ -575,6 +575,9 @@ int amdgpu_bo_create(struct amdgpu_device *adev, · 108 unmodified lines
575575 if (!amdgpu_bo_support_uswc(bo->flags))
576576 bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
577577
578+ if (adev->ras_enabled)
579+ bo->flags |= AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE;
580+
578581 bo->tbo.bdev = &adev->mman.bdev;
579582 if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA |
580583 AMDGPU_GEM_DOMAIN_GDS))
@@ -1303,7 +1306,8 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo) · 722 unmodified lines
13031306 !(abo->flags & AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE))
13041307 return;
13051308
1306− dma_resv_lock(bo->base.resv, NULL);
1309+ if (WARN_ON_ONCE(!dma_resv_trylock(bo->base.resv)))
1310+ return;
13071311
13081312 r = amdgpu_fill_buffer(abo, AMDGPU_POISON, bo->base.resv, &fence);
13091313 if (!WARN_ON(r)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c+5−57
@@ -25,12 +25,6 @@ · 24 unmodified lines
2525
2626 #include "amdgpu.h"
2727
28−static inline struct amdgpu_preempt_mgr *
29−to_preempt_mgr(struct ttm_resource_manager *man)
30−{
31− return container_of(man, struct amdgpu_preempt_mgr, manager);
32−}
33−
3428 /**
3529 * DOC: mem_info_preempt_used
3630 *
@@ -45,10 +39,9 @@ static ssize_t mem_info_preempt_used_show(struct device *dev, · 8 unmodified lines
4539 {
4640 struct drm_device *ddev = dev_get_drvdata(dev);
4741 struct amdgpu_device *adev = drm_to_adev(ddev);
48− struct ttm_resource_manager *man;
42+ struct ttm_resource_manager *man = &adev->mman.preempt_mgr;
4943
50− man = ttm_manager_type(&adev->mman.bdev, AMDGPU_PL_PREEMPT);
51− return sysfs_emit(buf, "%llu\n", amdgpu_preempt_mgr_usage(man));
44+ return sysfs_emit(buf, "%llu\n", ttm_resource_manager_usage(man));
5245 }
5346
5447 static DEVICE_ATTR_RO(mem_info_preempt_used);
@@ -68,16 +61,12 @@ static int amdgpu_preempt_mgr_new(struct ttm_resource_manager *man, · 13 unmodified lines
6861 const struct ttm_place *place,
6962 struct ttm_resource **res)
7063 {
71− struct amdgpu_preempt_mgr *mgr = to_preempt_mgr(man);
72−
7364 *res = kzalloc(sizeof(**res), GFP_KERNEL);
7465 if (!*res)
7566 return -ENOMEM;
7667
7768 ttm_resource_init(tbo, place, *res);
7869 (*res)->start = AMDGPU_BO_INVALID_OFFSET;
79−
80− atomic64_add((*res)->num_pages, &mgr->used);
8170 return 0;
8271 }
8372
@@ -92,49 +81,13 @@ static int amdgpu_preempt_mgr_new(struct ttm_resource_manager *man, · 8 unmodified lines
9281 static void amdgpu_preempt_mgr_del(struct ttm_resource_manager *man,
9382 struct ttm_resource *res)
9483 {
95− struct amdgpu_preempt_mgr *mgr = to_preempt_mgr(man);
96−
97− atomic64_sub(res->num_pages, &mgr->used);
9884 ttm_resource_fini(man, res);
9985 kfree(res);
10086 }
10187
102−/**
103− * amdgpu_preempt_mgr_usage - return usage of PREEMPT domain
104− *
105− * @man: TTM memory type manager
106− *
107− * Return how many bytes are used in the GTT domain
108− */
109−uint64_t amdgpu_preempt_mgr_usage(struct ttm_resource_manager *man)
110−{
111− struct amdgpu_preempt_mgr *mgr = to_preempt_mgr(man);
112− s64 result = atomic64_read(&mgr->used);
113−
114− return (result > 0 ? result : 0) * PAGE_SIZE;
115−}
116−
117−/**
118− * amdgpu_preempt_mgr_debug - dump VRAM table
119− *
120− * @man: TTM memory type manager
121− * @printer: DRM printer to use
122− *
123− * Dump the table content using printk.
124− */
125−static void amdgpu_preempt_mgr_debug(struct ttm_resource_manager *man,
126− struct drm_printer *printer)
127−{
128− struct amdgpu_preempt_mgr *mgr = to_preempt_mgr(man);
129−
130− drm_printf(printer, "man size:%llu pages, preempt used:%lld pages\n",
131− man->size, (u64)atomic64_read(&mgr->used));
132−}
133−
13488 static const struct ttm_resource_manager_func amdgpu_preempt_mgr_func = {
13589 .alloc = amdgpu_preempt_mgr_new,
13690 .free = amdgpu_preempt_mgr_del,
137− .debug = amdgpu_preempt_mgr_debug
13891 };
13992
14093 /**
@@ -146,8 +99,7 @@ static const struct ttm_resource_manager_func amdgpu_preempt_mgr_func = { · 5 unmodified lines
14699 */
147100 int amdgpu_preempt_mgr_init(struct amdgpu_device *adev)
148101 {
149− struct amdgpu_preempt_mgr *mgr = &adev->mman.preempt_mgr;
150− struct ttm_resource_manager *man = &mgr->manager;
102+ struct ttm_resource_manager *man = &adev->mman.preempt_mgr;
151103 int ret;
152104
153105 man->use_tt = true;
@@ -155,16 +107,13 @@ int amdgpu_preempt_mgr_init(struct amdgpu_device *adev) · 1 unmodified line
155107
156108 ttm_resource_manager_init(man, &adev->mman.bdev, (1 << 30));
157109
158− atomic64_set(&mgr->used, 0);
159−
160110 ret = device_create_file(adev->dev, &dev_attr_mem_info_preempt_used);
161111 if (ret) {
162112 DRM_ERROR("Failed to create device file mem_info_preempt_used\n");
163113 return ret;
164114 }
165115
166− ttm_set_driver_manager(&adev->mman.bdev, AMDGPU_PL_PREEMPT,
167− &mgr->manager);
116+ ttm_set_driver_manager(&adev->mman.bdev, AMDGPU_PL_PREEMPT, man);
168117 ttm_resource_manager_set_used(man, true);
169118 return 0;
170119 }
@@ -179,8 +128,7 @@ int amdgpu_preempt_mgr_init(struct amdgpu_device *adev) · 8 unmodified lines
179128 */
180129 void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev)
181130 {
182− struct amdgpu_preempt_mgr *mgr = &adev->mman.preempt_mgr;
183− struct ttm_resource_manager *man = &mgr->manager;
131+ struct ttm_resource_manager *man = &adev->mman.preempt_mgr;
184132 int ret;
185133
186134 ttm_resource_manager_set_used(man, false);
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c+106−19
@@ -133,6 +133,8 @@ static int psp_early_init(void *handle) · 132 unmodified lines
133133 break;
134134 case IP_VERSION(13, 0, 1):
135135 case IP_VERSION(13, 0, 3):
136+ case IP_VERSION(13, 0, 5):
137+ case IP_VERSION(13, 0, 8):
136138 psp_v13_0_set_psp_funcs(psp);
137139 psp->autoload_supported = true;
138140 break;
@@ -259,6 +261,32 @@ static bool psp_get_runtime_db_entry(struct amdgpu_device *adev, · 120 unmodified lines
259261 return ret;
260262 }
261263
264+static int psp_init_sriov_microcode(struct psp_context *psp)
265+{
266+ struct amdgpu_device *adev = psp->adev;
267+ int ret = 0;
268+
269+ switch (adev->ip_versions[MP0_HWIP][0]) {
270+ case IP_VERSION(9, 0, 0):
271+ ret = psp_init_cap_microcode(psp, "vega10");
272+ break;
273+ case IP_VERSION(11, 0, 9):
274+ ret = psp_init_cap_microcode(psp, "navi12");
275+ break;
276+ case IP_VERSION(11, 0, 7):
277+ ret = psp_init_cap_microcode(psp, "sienna_cichlid");
278+ break;
279+ case IP_VERSION(13, 0, 2):
280+ ret = psp_init_ta_microcode(psp, "aldebaran");
281+ break;
282+ default:
283+ BUG();
284+ break;
285+ }
286+
287+ return ret;
288+}
289+
262290 static int psp_sw_init(void *handle)
263291 {
264292 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -273,19 +301,13 @@ static int psp_sw_init(void *handle) · 8 unmodified lines
273301 ret = -ENOMEM;
274302 }
275303
276− if (!amdgpu_sriov_vf(adev)) {
304+ if (amdgpu_sriov_vf(adev))
305+ ret = psp_init_sriov_microcode(psp);
306+ else
277307 ret = psp_init_microcode(psp);
278− if (ret) {
279− DRM_ERROR("Failed to load psp firmware!\n");
280− return ret;
281− }
282− } else if (amdgpu_sriov_vf(adev) &&
283− adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2)) {
284− ret = psp_init_ta_microcode(psp, "aldebaran");
285− if (ret) {
286− DRM_ERROR("Failed to initialize ta microcode!\n");
287− return ret;
288− }
308+ if (ret) {
309+ DRM_ERROR("Failed to load psp firmware!\n");
310+ return ret;
289311 }
290312
291313 memset(&boot_cfg_entry, 0, sizeof(boot_cfg_entry));
@@ -353,6 +375,10 @@ static int psp_sw_fini(void *handle) · 61 unmodified lines
353375 release_firmware(psp->ta_fw);
354376 psp->ta_fw = NULL;
355377 }
378+ if (adev->psp.cap_fw) {
379+ release_firmware(psp->cap_fw);
380+ psp->cap_fw = NULL;
381+ }
356382
357383 if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
358384 adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
@@ -491,7 +517,10 @@ psp_cmd_submit_buf(struct psp_context *psp, · 132 unmodified lines
491517 DRM_WARN("psp gfx command %s(0x%X) failed and response status is (0x%X)\n",
492518 psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id), psp->cmd_buf_mem->cmd_id,
493519 psp->cmd_buf_mem->resp.status);
494− if (!timeout) {
520+ /* If we load CAP FW, PSP must return 0 under SRIOV
521+ * also return failure in case of timeout
522+ */
523+ if ((ucode && (ucode->ucode_id == AMDGPU_UCODE_ID_CAP)) || !timeout) {
495524 ret = -EINVAL;
496525 goto exit;
497526 }
@@ -914,19 +943,15 @@ static void psp_prep_ta_load_cmd_buf(struct psp_gfx_cmd_resp *cmd, · 416 unmodified lines
914943 static int psp_ta_init_shared_buf(struct psp_context *psp,
915944 struct ta_mem_context *mem_ctx)
916945 {
917− int ret;
918−
919946 /*
920947 * Allocate 16k memory aligned to 4k from Frame Buffer (local
921948 * physical) for ta to host memory
922949 */
923− ret = amdgpu_bo_create_kernel(psp->adev, mem_ctx->shared_mem_size,
950+ return amdgpu_bo_create_kernel(psp->adev, mem_ctx->shared_mem_size,
924951 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
925952 &mem_ctx->shared_bo,
926953 &mem_ctx->shared_mc_addr,
927954 &mem_ctx->shared_buf);
928−
929− return ret;
930955 }
931956
932957 static void psp_ta_free_shared_buf(struct ta_mem_context *mem_ctx)
@@ -1308,6 +1333,11 @@ static void psp_ras_ta_check_status(struct psp_context *psp) · 375 unmodified lines
13081333 break;
13091334 case TA_RAS_STATUS__SUCCESS:
13101335 break;
1336+ case TA_RAS_STATUS__TEE_ERROR_ACCESS_DENIED:
1337+ if (ras_cmd->cmd_id == TA_RAS_COMMAND__TRIGGER_ERROR)
1338+ dev_warn(psp->adev->dev,
1339+ "RAS WARNING: Inject error to critical region is not allowed\n");
1340+ break;
13111341 default:
13121342 dev_warn(psp->adev->dev,
13131343 "RAS WARNING: ras status = 0x%X\n", ras_cmd->ras_status);
@@ -1520,7 +1550,9 @@ int psp_ras_trigger_error(struct psp_context *psp, · 206 unmodified lines
15201550 if (amdgpu_ras_intr_triggered())
15211551 return 0;
15221552
1523− if (ras_cmd->ras_status)
1553+ if (ras_cmd->ras_status == TA_RAS_STATUS__TEE_ERROR_ACCESS_DENIED)
1554+ return -EACCES;
1555+ else if (ras_cmd->ras_status)
15241556 return -EINVAL;
15251557
15261558 return 0;
@@ -2051,6 +2083,9 @@ static int psp_get_fw_type(struct amdgpu_firmware_info *ucode, · 524 unmodified lines
20512083 enum psp_gfx_fw_type *type)
20522084 {
20532085 switch (ucode->ucode_id) {
2086+ case AMDGPU_UCODE_ID_CAP:
2087+ *type = GFX_FW_TYPE_CAP;
2088+ break;
20542089 case AMDGPU_UCODE_ID_SDMA0:
20552090 *type = GFX_FW_TYPE_SDMA0;
20562091 break;
@@ -3217,6 +3252,58 @@ out: · 1160 unmodified lines
32173252 return err;
32183253 }
32193254
3255+int psp_init_cap_microcode(struct psp_context *psp,
3256+ const char *chip_name)
3257+{
3258+ struct amdgpu_device *adev = psp->adev;
3259+ char fw_name[PSP_FW_NAME_LEN];
3260+ const struct psp_firmware_header_v1_0 *cap_hdr_v1_0;
3261+ struct amdgpu_firmware_info *info = NULL;
3262+ int err = 0;
3263+
3264+ if (!chip_name) {
3265+ dev_err(adev->dev, "invalid chip name for cap microcode\n");
3266+ return -EINVAL;
3267+ }
3268+
3269+ if (!amdgpu_sriov_vf(adev)) {
3270+ dev_err(adev->dev, "cap microcode should only be loaded under SRIOV\n");
3271+ return -EINVAL;
3272+ }
3273+
3274+ snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_cap.bin", chip_name);
3275+ err = request_firmware(&adev->psp.cap_fw, fw_name, adev->dev);
3276+ if (err) {
3277+ dev_warn(adev->dev, "cap microcode does not exist, skip\n");
3278+ err = 0;
3279+ goto out;
3280+ }
3281+
3282+ err = amdgpu_ucode_validate(adev->psp.cap_fw);
3283+ if (err) {
3284+ dev_err(adev->dev, "fail to initialize cap microcode\n");
3285+ goto out;
3286+ }
3287+
3288+ info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CAP];
3289+ info->ucode_id = AMDGPU_UCODE_ID_CAP;
3290+ info->fw = adev->psp.cap_fw;
3291+ cap_hdr_v1_0 = (const struct psp_firmware_header_v1_0 *)
3292+ adev->psp.cap_fw->data;
3293+ adev->firmware.fw_size += ALIGN(
3294+ le32_to_cpu(cap_hdr_v1_0->header.ucode_size_bytes), PAGE_SIZE);
3295+ adev->psp.cap_fw_version = le32_to_cpu(cap_hdr_v1_0->header.ucode_version);
3296+ adev->psp.cap_feature_version = le32_to_cpu(cap_hdr_v1_0->sos.fw_version);
3297+ adev->psp.cap_ucode_size = le32_to_cpu(cap_hdr_v1_0->header.ucode_size_bytes);
3298+
3299+ return 0;
3300+
3301+out:
3302+ release_firmware(adev->psp.cap_fw);
3303+ adev->psp.cap_fw = NULL;
3304+ return err;
3305+}
3306+
32203307 static int psp_set_clockgating_state(void *handle,
32213308 enum amd_clockgating_state state)
32223309 {
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h+9−0
@@ -306,6 +306,9 @@ struct psp_context · 305 unmodified lines
306306 /* toc firmware */
307307 const struct firmware *toc_fw;
308308
309+ /* cap firmware */
310+ const struct firmware *cap_fw;
311+
309312 /* fence buffer */
310313 struct amdgpu_bo *fence_buf_bo;
311314 uint64_t fence_buf_mc_addr;
@@ -327,6 +330,10 @@ struct psp_context · 15 unmodified lines
327330 const struct firmware *ta_fw;
328331 uint32_t ta_fw_version;
329332
333+ uint32_t cap_fw_version;
334+ uint32_t cap_feature_version;
335+ uint32_t cap_ucode_size;
336+
330337 struct ta_context asd_context;
331338 struct psp_xgmi_context xgmi_context;
332339 struct psp_ras_context ras_context;
@@ -440,6 +447,8 @@ int psp_init_sos_microcode(struct psp_context *psp, · 107 unmodified lines
440447 const char *chip_name);
441448 int psp_init_ta_microcode(struct psp_context *psp,
442449 const char *chip_name);
450+int psp_init_cap_microcode(struct psp_context *psp,
451+ const char *chip_name);
443452 int psp_get_fw_attestation_records_addr(struct psp_context *psp,
444453 uint64_t *output_ptr);
445454
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c+285−240
@@ -75,6 +75,13 @@ const char *ras_mca_block_string[] = { · 74 unmodified lines
7575 "mca_iohc",
7676 };
7777
78+struct amdgpu_ras_block_list {
79+ /* ras block link */
80+ struct list_head node;
81+
82+ struct amdgpu_ras_block_object *ras_obj;
83+};
84+
7885 const char *get_ras_block_str(struct ras_common_if *ras_block)
7986 {
8087 if (!ras_block)
@@ -89,6 +96,9 @@ const char *get_ras_block_str(struct ras_common_if *ras_block) · 8 unmodified lines
8996 return ras_block_string[ras_block->block];
9097 }
9198
99+#define ras_block_str(_BLOCK_) \
100+ (((_BLOCK_) < ARRAY_SIZE(ras_block_string)) ? ras_block_string[_BLOCK_] : "Out Of Range")
101+
92102 #define ras_err_str(i) (ras_error_string[ffs(i)])
93103
94104 #define RAS_DEFAULT_FLAGS (AMDGPU_RAS_FLAG_INIT_BY_VBIOS)
@@ -155,14 +165,9 @@ static int amdgpu_reserve_page_direct(struct amdgpu_device *adev, uint64_t addre · 60 unmodified lines
155165 }
156166
157167 memset(&err_rec, 0x0, sizeof(struct eeprom_table_record));
158−
159− err_rec.address = address;
160− err_rec.retired_page = address >> AMDGPU_GPU_PAGE_SHIFT;
161− err_rec.ts = (uint64_t)ktime_get_real_seconds();
162− err_rec.err_type = AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE;
163−
164168 err_data.err_addr = &err_rec;
165− err_data.err_addr_cnt = 1;
169+ amdgpu_umc_fill_error_record(&err_data, address,
170+ (address >> AMDGPU_GPU_PAGE_SHIFT), 0, 0);
166171
167172 if (amdgpu_bad_page_threshold != 0) {
168173 amdgpu_ras_add_bad_pages(adev, err_data.err_addr,
@@ -452,7 +457,7 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, · 283 unmodified lines
452457 }
453458
454459 if (ret)
455− return -EINVAL;
460+ return ret;
456461
457462 return size;
458463 }
@@ -866,30 +871,47 @@ static int amdgpu_ras_enable_all_features(struct amdgpu_device *adev, · 407 unmodified lines
866871 }
867872 /* feature ctl end */
868873
874+static int amdgpu_ras_block_match_default(struct amdgpu_ras_block_object *block_obj,
875+ enum amdgpu_ras_block block)
876+{
877+ if (!block_obj)
878+ return -EINVAL;
879+
880+ if (block_obj->ras_comm.block == block)
881+ return 0;
882+
883+ return -EINVAL;
884+}
869885
870−static void amdgpu_ras_mca_query_error_status(struct amdgpu_device *adev,
871− struct ras_common_if *ras_block,
872− struct ras_err_data *err_data)
886+static struct amdgpu_ras_block_object *amdgpu_ras_get_ras_block(struct amdgpu_device *adev,
887+ enum amdgpu_ras_block block, uint32_t sub_block_index)
873888 {
874− switch (ras_block->sub_block_index) {
875− case AMDGPU_RAS_MCA_BLOCK__MP0:
876− if (adev->mca.mp0.ras_funcs &&
877− adev->mca.mp0.ras_funcs->query_ras_error_count)
878− adev->mca.mp0.ras_funcs->query_ras_error_count(adev, &err_data);
879− break;
880− case AMDGPU_RAS_MCA_BLOCK__MP1:
881− if (adev->mca.mp1.ras_funcs &&
882− adev->mca.mp1.ras_funcs->query_ras_error_count)
883− adev->mca.mp1.ras_funcs->query_ras_error_count(adev, &err_data);
884− break;
885− case AMDGPU_RAS_MCA_BLOCK__MPIO:
886− if (adev->mca.mpio.ras_funcs &&
887− adev->mca.mpio.ras_funcs->query_ras_error_count)
888− adev->mca.mpio.ras_funcs->query_ras_error_count(adev, &err_data);
889− break;
890− default:
891− break;
889+ struct amdgpu_ras_block_list *node, *tmp;
890+ struct amdgpu_ras_block_object *obj;
891+
892+ if (block >= AMDGPU_RAS_BLOCK__LAST)
893+ return NULL;
894+
895+ if (!amdgpu_ras_is_supported(adev, block))
896+ return NULL;
897+
898+ list_for_each_entry_safe(node, tmp, &adev->ras_list, node) {
899+ if (!node->ras_obj) {
900+ dev_warn(adev->dev, "Warning: abnormal ras list node.\n");
901+ continue;
902+ }
903+
904+ obj = node->ras_obj;
905+ if (obj->ras_block_match) {
906+ if (obj->ras_block_match(obj, block, sub_block_index) == 0)
907+ return obj;
908+ } else {
909+ if (amdgpu_ras_block_match_default(obj, block) == 0)
910+ return obj;
911+ }
892912 }
913+
914+ return NULL;
893915 }
894916
895917 static void amdgpu_ras_get_ecc_info(struct amdgpu_device *adev, struct ras_err_data *err_data)
@@ -901,26 +923,26 @@ static void amdgpu_ras_get_ecc_info(struct amdgpu_device *adev, struct ras_err_d · 5 unmodified lines
901923 * choosing right query method according to
902924 * whether smu support query error information
903925 */
904− ret = smu_get_ecc_info(&adev->smu, (void *)&(ras->umc_ecc));
926+ ret = amdgpu_dpm_get_ecc_info(adev, (void *)&(ras->umc_ecc));
905927 if (ret == -EOPNOTSUPP) {
906− if (adev->umc.ras_funcs &&
907− adev->umc.ras_funcs->query_ras_error_count)
908− adev->umc.ras_funcs->query_ras_error_count(adev, err_data);
928+ if (adev->umc.ras && adev->umc.ras->ras_block.hw_ops &&
929+ adev->umc.ras->ras_block.hw_ops->query_ras_error_count)
930+ adev->umc.ras->ras_block.hw_ops->query_ras_error_count(adev, err_data);
909931
910932 /* umc query_ras_error_address is also responsible for clearing
911933 * error status
912934 */
913− if (adev->umc.ras_funcs &&
914− adev->umc.ras_funcs->query_ras_error_address)
915− adev->umc.ras_funcs->query_ras_error_address(adev, err_data);
935+ if (adev->umc.ras && adev->umc.ras->ras_block.hw_ops &&
936+ adev->umc.ras->ras_block.hw_ops->query_ras_error_address)
937+ adev->umc.ras->ras_block.hw_ops->query_ras_error_address(adev, err_data);
916938 } else if (!ret) {
917− if (adev->umc.ras_funcs &&
918− adev->umc.ras_funcs->ecc_info_query_ras_error_count)
919− adev->umc.ras_funcs->ecc_info_query_ras_error_count(adev, err_data);
939+ if (adev->umc.ras &&
940+ adev->umc.ras->ecc_info_query_ras_error_count)
941+ adev->umc.ras->ecc_info_query_ras_error_count(adev, err_data);
920942
921− if (adev->umc.ras_funcs &&
922− adev->umc.ras_funcs->ecc_info_query_ras_error_address)
923− adev->umc.ras_funcs->ecc_info_query_ras_error_address(adev, err_data);
943+ if (adev->umc.ras &&
944+ adev->umc.ras->ecc_info_query_ras_error_address)
945+ adev->umc.ras->ecc_info_query_ras_error_address(adev, err_data);
924946 }
925947 }
926948
@@ -928,62 +950,32 @@ static void amdgpu_ras_get_ecc_info(struct amdgpu_device *adev, struct ras_err_d · 1 unmodified line
928950 int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
929951 struct ras_query_if *info)
930952 {
953+ struct amdgpu_ras_block_object *block_obj = NULL;
931954 struct ras_manager *obj = amdgpu_ras_find_obj(adev, &info->head);
932955 struct ras_err_data err_data = {0, 0, 0, NULL};
933− int i;
934956
935957 if (!obj)
936958 return -EINVAL;
937959
938− switch (info->head.block) {
939− case AMDGPU_RAS_BLOCK__UMC:
960+ if (info->head.block == AMDGPU_RAS_BLOCK__UMC) {
940961 amdgpu_ras_get_ecc_info(adev, &err_data);
941− break;
942− case AMDGPU_RAS_BLOCK__SDMA:
943− if (adev->sdma.funcs->query_ras_error_count) {
944− for (i = 0; i < adev->sdma.num_instances; i++)
945− adev->sdma.funcs->query_ras_error_count(adev, i,
946− &err_data);
962+ } else {
963+ block_obj = amdgpu_ras_get_ras_block(adev, info->head.block, 0);
964+ if (!block_obj || !block_obj->hw_ops) {
965+ dev_dbg_once(adev->dev, "%s doesn't config RAS function\n",
966+ get_ras_block_str(&info->head));
967+ return -EINVAL;
947968 }
948− break;
949− case AMDGPU_RAS_BLOCK__GFX:
950− if (adev->gfx.ras_funcs &&
951− adev->gfx.ras_funcs->query_ras_error_count)
952− adev->gfx.ras_funcs->query_ras_error_count(adev, &err_data);
953−
954− if (adev->gfx.ras_funcs &&
955− adev->gfx.ras_funcs->query_ras_error_status)
956− adev->gfx.ras_funcs->query_ras_error_status(adev);
957− break;
958− case AMDGPU_RAS_BLOCK__MMHUB:
959− if (adev->mmhub.ras_funcs &&
960− adev->mmhub.ras_funcs->query_ras_error_count)
961− adev->mmhub.ras_funcs->query_ras_error_count(adev, &err_data);
962−
963− if (adev->mmhub.ras_funcs &&
964− adev->mmhub.ras_funcs->query_ras_error_status)
965− adev->mmhub.ras_funcs->query_ras_error_status(adev);
966− break;
967− case AMDGPU_RAS_BLOCK__PCIE_BIF:
968− if (adev->nbio.ras_funcs &&
969− adev->nbio.ras_funcs->query_ras_error_count)
970− adev->nbio.ras_funcs->query_ras_error_count(adev, &err_data);
971− break;
972− case AMDGPU_RAS_BLOCK__XGMI_WAFL:
973− if (adev->gmc.xgmi.ras_funcs &&
974− adev->gmc.xgmi.ras_funcs->query_ras_error_count)
975− adev->gmc.xgmi.ras_funcs->query_ras_error_count(adev, &err_data);
976− break;
977− case AMDGPU_RAS_BLOCK__HDP:
978− if (adev->hdp.ras_funcs &&
979− adev->hdp.ras_funcs->query_ras_error_count)
980− adev->hdp.ras_funcs->query_ras_error_count(adev, &err_data);
981− break;
982− case AMDGPU_RAS_BLOCK__MCA:
983− amdgpu_ras_mca_query_error_status(adev, &info->head, &err_data);
984− break;
985− default:
986− break;
969+
970+ if (block_obj->hw_ops->query_ras_error_count)
971+ block_obj->hw_ops->query_ras_error_count(adev, &err_data);
972+
973+ if ((info->head.block == AMDGPU_RAS_BLOCK__SDMA) ||
974+ (info->head.block == AMDGPU_RAS_BLOCK__GFX) ||
975+ (info->head.block == AMDGPU_RAS_BLOCK__MMHUB)) {
976+ if (block_obj->hw_ops->query_ras_error_status)
977+ block_obj->hw_ops->query_ras_error_status(adev);
978+ }
987979 }
988980
989981 obj->err_data.ue_count += err_data.ue_count;
@@ -1040,68 +1032,27 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev, · 50 unmodified lines
10401032 int amdgpu_ras_reset_error_status(struct amdgpu_device *adev,
10411033 enum amdgpu_ras_block block)
10421034 {
1035+ struct amdgpu_ras_block_object *block_obj = amdgpu_ras_get_ras_block(adev, block, 0);
1036+
10431037 if (!amdgpu_ras_is_supported(adev, block))
10441038 return -EINVAL;
10451039
1046− switch (block) {
1047− case AMDGPU_RAS_BLOCK__GFX:
1048− if (adev->gfx.ras_funcs &&
1049− adev->gfx.ras_funcs->reset_ras_error_count)
1050− adev->gfx.ras_funcs->reset_ras_error_count(adev);
1051−
1052− if (adev->gfx.ras_funcs &&
1053− adev->gfx.ras_funcs->reset_ras_error_status)
1054− adev->gfx.ras_funcs->reset_ras_error_status(adev);
1055− break;
1056− case AMDGPU_RAS_BLOCK__MMHUB:
1057− if (adev->mmhub.ras_funcs &&
1058− adev->mmhub.ras_funcs->reset_ras_error_count)
1059− adev->mmhub.ras_funcs->reset_ras_error_count(adev);
1060−
1061− if (adev->mmhub.ras_funcs &&
1062− adev->mmhub.ras_funcs->reset_ras_error_status)
1063− adev->mmhub.ras_funcs->reset_ras_error_status(adev);
1064− break;
1065− case AMDGPU_RAS_BLOCK__SDMA:
1066− if (adev->sdma.funcs->reset_ras_error_count)
1067− adev->sdma.funcs->reset_ras_error_count(adev);
1068− break;
1069− case AMDGPU_RAS_BLOCK__HDP:
1070− if (adev->hdp.ras_funcs &&
1071− adev->hdp.ras_funcs->reset_ras_error_count)
1072− adev->hdp.ras_funcs->reset_ras_error_count(adev);
1073− break;
1074− default:
1075− break;
1040+ if (!block_obj || !block_obj->hw_ops) {
1041+ dev_dbg_once(adev->dev, "%s doesn't config RAS function\n",
1042+ ras_block_str(block));
1043+ return -EINVAL;
10761044 }
10771045
1078− return 0;
1079−}
1080−
1081−/* Trigger XGMI/WAFL error */
1082−static int amdgpu_ras_error_inject_xgmi(struct amdgpu_device *adev,
1083− struct ta_ras_trigger_error_input *block_info)
1084−{
1085− int ret;
1046+ if (block_obj->hw_ops->reset_ras_error_count)
1047+ block_obj->hw_ops->reset_ras_error_count(adev);
10861048
1087− if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_DISALLOW))
1088− dev_warn(adev->dev, "Failed to disallow df cstate");
1089−
1090− if (amdgpu_dpm_allow_xgmi_power_down(adev, false))
1091− dev_warn(adev->dev, "Failed to disallow XGMI power down");
1092−
1093− ret = psp_ras_trigger_error(&adev->psp, block_info);
1094−
1095− if (amdgpu_ras_intr_triggered())
1096− return ret;
1097−
1098− if (amdgpu_dpm_allow_xgmi_power_down(adev, true))
1099− dev_warn(adev->dev, "Failed to allow XGMI power down");
1100−
1101− if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_ALLOW))
1102− dev_warn(adev->dev, "Failed to allow df cstate");
1049+ if ((block == AMDGPU_RAS_BLOCK__GFX) ||
1050+ (block == AMDGPU_RAS_BLOCK__MMHUB)) {
1051+ if (block_obj->hw_ops->reset_ras_error_status)
1052+ block_obj->hw_ops->reset_ras_error_status(adev);
1053+ }
11031054
1104− return ret;
1055+ return 0;
11051056 }
11061057
11071058 /* wrapper of psp_ras_trigger_error */
@@ -1116,11 +1067,20 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev, · 8 unmodified lines
11161067 .address = info->address,
11171068 .value = info->value,
11181069 };
1119− int ret = 0;
1070+ int ret = -EINVAL;
1071+ struct amdgpu_ras_block_object *block_obj = amdgpu_ras_get_ras_block(adev,
1072+ info->head.block,
1073+ info->head.sub_block_index);
11201074
11211075 if (!obj)
11221076 return -EINVAL;
11231077
1078+ if (!block_obj || !block_obj->hw_ops) {
1079+ dev_dbg_once(adev->dev, "%s doesn't config RAS function\n",
1080+ get_ras_block_str(&info->head));
1081+ return -EINVAL;
1082+ }
1083+
11241084 /* Calculate XGMI relative offset */
11251085 if (adev->gmc.xgmi.num_physical_nodes > 1) {
11261086 block_info.address =
@@ -1128,28 +1088,15 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev, · 1 unmodified line
11281088 block_info.address);
11291089 }
11301090
1131− switch (info->head.block) {
1132− case AMDGPU_RAS_BLOCK__GFX:
1133− if (adev->gfx.ras_funcs &&
1134− adev->gfx.ras_funcs->ras_error_inject)
1135− ret = adev->gfx.ras_funcs->ras_error_inject(adev, info);
1136− else
1137− ret = -EINVAL;
1138− break;
1139− case AMDGPU_RAS_BLOCK__UMC:
1140− case AMDGPU_RAS_BLOCK__SDMA:
1141− case AMDGPU_RAS_BLOCK__MMHUB:
1142− case AMDGPU_RAS_BLOCK__PCIE_BIF:
1143− case AMDGPU_RAS_BLOCK__MCA:
1144− ret = psp_ras_trigger_error(&adev->psp, &block_info);
1145− break;
1146− case AMDGPU_RAS_BLOCK__XGMI_WAFL:
1147− ret = amdgpu_ras_error_inject_xgmi(adev, &block_info);
1148− break;
1149− default:
1150− dev_info(adev->dev, "%s error injection is not supported yet\n",
1151− get_ras_block_str(&info->head));
1152− ret = -EINVAL;
1091+ if (info->head.block == AMDGPU_RAS_BLOCK__GFX) {
1092+ if (block_obj->hw_ops->ras_error_inject)
1093+ ret = block_obj->hw_ops->ras_error_inject(adev, info);
1094+ } else {
1095+ /* If defined special ras_error_inject(e.g: xgmi), implement special ras_error_inject */
1096+ if (block_obj->hw_ops->ras_error_inject)
1097+ ret = block_obj->hw_ops->ras_error_inject(adev, &block_info);
1098+ else /*If not defined .ras_error_inject, use default ras_error_inject*/
1099+ ret = psp_ras_trigger_error(&adev->psp, &block_info);
11531100 }
11541101
11551102 if (ret)
@@ -1329,18 +1276,17 @@ static int amdgpu_ras_sysfs_remove_feature_node(struct amdgpu_device *adev) · 173 unmodified lines
13291276 }
13301277
13311278 int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
1332− struct ras_fs_if *head)
1279+ struct ras_common_if *head)
13331280 {
1334− struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head->head);
1281+ struct ras_manager *obj = amdgpu_ras_find_obj(adev, head);
13351282
13361283 if (!obj || obj->attr_inuse)
13371284 return -EINVAL;
13381285
13391286 get_obj(obj);
13401287
1341− memcpy(obj->fs_data.sysfs_name,
1342− head->sysfs_name,
1343− sizeof(obj->fs_data.sysfs_name));
1288+ snprintf(obj->fs_data.sysfs_name, sizeof(obj->fs_data.sysfs_name),
1289+ "%s_err_count", head->name);
13441290
13451291 obj->sysfs_attr = (struct device_attribute){
13461292 .attr = {
@@ -1647,9 +1593,9 @@ int amdgpu_ras_interrupt_dispatch(struct amdgpu_device *adev, · 300 unmodified lines
16471593 }
16481594
16491595 int amdgpu_ras_interrupt_remove_handler(struct amdgpu_device *adev,
1650− struct ras_ih_if *info)
1596+ struct ras_common_if *head)
16511597 {
1652− struct ras_manager *obj = amdgpu_ras_find_obj(adev, &info->head);
1598+ struct ras_manager *obj = amdgpu_ras_find_obj(adev, head);
16531599 struct ras_ih_data *data;
16541600
16551601 if (!obj)
@@ -1669,24 +1615,27 @@ int amdgpu_ras_interrupt_remove_handler(struct amdgpu_device *adev, · 13 unmodified lines
16691615 }
16701616
16711617 int amdgpu_ras_interrupt_add_handler(struct amdgpu_device *adev,
1672− struct ras_ih_if *info)
1618+ struct ras_common_if *head)
16731619 {
1674− struct ras_manager *obj = amdgpu_ras_find_obj(adev, &info->head);
1620+ struct ras_manager *obj = amdgpu_ras_find_obj(adev, head);
16751621 struct ras_ih_data *data;
1622+ struct amdgpu_ras_block_object *ras_obj;
16761623
16771624 if (!obj) {
16781625 /* in case we registe the IH before enable ras feature */
1679− obj = amdgpu_ras_create_obj(adev, &info->head);
1626+ obj = amdgpu_ras_create_obj(adev, head);
16801627 if (!obj)
16811628 return -EINVAL;
16821629 } else
16831630 get_obj(obj);
16841631
1632+ ras_obj = container_of(head, struct amdgpu_ras_block_object, ras_comm);
1633+
16851634 data = &obj->ih_data;
16861635 /* add the callback.etc */
16871636 *data = (struct ras_ih_data) {
16881637 .inuse = 0,
1689− .cb = info->cb,
1638+ .cb = ras_obj->ras_cb,
16901639 .element_size = sizeof(struct amdgpu_iv_entry),
16911640 .rptr = 0,
16921641 .wptr = 0,
@@ -1715,10 +1664,7 @@ static int amdgpu_ras_interrupt_remove_all(struct amdgpu_device *adev) · 22 unmodified lines
17151664 struct ras_manager *obj, *tmp;
17161665
17171666 list_for_each_entry_safe(obj, tmp, &con->head, node) {
1718− struct ras_ih_if info = {
1719− .head = obj->head,
1720− };
1721− amdgpu_ras_interrupt_remove_handler(adev, &info);
1667+ amdgpu_ras_interrupt_remove_handler(adev, &obj->head);
17221668 }
17231669
17241670 return 0;
@@ -1766,24 +1712,28 @@ static void amdgpu_ras_log_on_err_counter(struct amdgpu_device *adev) · 41 unmodified lines
17661712 static void amdgpu_ras_error_status_query(struct amdgpu_device *adev,
17671713 struct ras_query_if *info)
17681714 {
1715+ struct amdgpu_ras_block_object *block_obj;
17691716 /*
17701717 * Only two block need to query read/write
17711718 * RspStatus at current state
17721719 */
1773− switch (info->head.block) {
1774− case AMDGPU_RAS_BLOCK__GFX:
1775− if (adev->gfx.ras_funcs &&
1776− adev->gfx.ras_funcs->query_ras_error_status)
1777− adev->gfx.ras_funcs->query_ras_error_status(adev);
1778− break;
1779− case AMDGPU_RAS_BLOCK__MMHUB:
1780− if (adev->mmhub.ras_funcs &&
1781− adev->mmhub.ras_funcs->query_ras_error_status)
1782− adev->mmhub.ras_funcs->query_ras_error_status(adev);
1783− break;
1784− default:
1785− break;
1720+ if ((info->head.block != AMDGPU_RAS_BLOCK__GFX) &&
1721+ (info->head.block != AMDGPU_RAS_BLOCK__MMHUB))
1722+ return;
1723+
1724+ block_obj = amdgpu_ras_get_ras_block(adev,
1725+ info->head.block,
1726+ info->head.sub_block_index);
1727+
1728+ if (!block_obj || !block_obj->hw_ops) {
1729+ dev_dbg_once(adev->dev, "%s doesn't config RAS function\n",
1730+ get_ras_block_str(&info->head));
1731+ return;
17861732 }
1733+
1734+ if (block_obj->hw_ops->query_ras_error_status)
1735+ block_obj->hw_ops->query_ras_error_status(adev);
1736+
17871737 }
17881738
17891739 static void amdgpu_ras_query_err_status(struct amdgpu_device *adev)
@@ -2141,8 +2091,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) · 351 unmodified lines
21412091 if (ret)
21422092 goto free;
21432093
2144− if (adev->smu.ppt_funcs && adev->smu.ppt_funcs->send_hbm_bad_pages_num)
2145− adev->smu.ppt_funcs->send_hbm_bad_pages_num(&adev->smu, con->eeprom_control.ras_num_recs);
2094+ amdgpu_dpm_send_hbm_bad_pages_num(adev, con->eeprom_control.ras_num_recs);
21462095 }
21472096
21482097 #ifdef CONFIG_X86_MCE_AMD
@@ -2348,24 +2297,27 @@ int amdgpu_ras_init(struct amdgpu_device *adev) · 199 unmodified lines
23482297 case CHIP_VEGA20:
23492298 case CHIP_ARCTURUS:
23502299 case CHIP_ALDEBARAN:
2351− if (!adev->gmc.xgmi.connected_to_cpu)
2352− adev->nbio.ras_funcs = &nbio_v7_4_ras_funcs;
2300+ if (!adev->gmc.xgmi.connected_to_cpu) {
2301+ adev->nbio.ras = &nbio_v7_4_ras;
2302+ amdgpu_ras_register_ras_block(adev, &adev->nbio.ras->ras_block);
2303+ adev->nbio.ras_if = &adev->nbio.ras->ras_block.ras_comm;
2304+ }
23532305 break;
23542306 default:
23552307 /* nbio ras is not available */
23562308 break;
23572309 }
23582310
2359− if (adev->nbio.ras_funcs &&
2360− adev->nbio.ras_funcs->init_ras_controller_interrupt) {
2361− r = adev->nbio.ras_funcs->init_ras_controller_interrupt(adev);
2311+ if (adev->nbio.ras &&
2312+ adev->nbio.ras->init_ras_controller_interrupt) {
2313+ r = adev->nbio.ras->init_ras_controller_interrupt(adev);
23622314 if (r)
23632315 goto release_con;
23642316 }
23652317
2366− if (adev->nbio.ras_funcs &&
2367− adev->nbio.ras_funcs->init_ras_err_event_athub_interrupt) {
2368− r = adev->nbio.ras_funcs->init_ras_err_event_athub_interrupt(adev);
2318+ if (adev->nbio.ras &&
2319+ adev->nbio.ras->init_ras_err_event_athub_interrupt) {
2320+ r = adev->nbio.ras->init_ras_err_event_athub_interrupt(adev);
23692321 if (r)
23702322 goto release_con;
23712323 }
@@ -2377,12 +2329,12 @@ int amdgpu_ras_init(struct amdgpu_device *adev) · 5 unmodified lines
23772329 }
23782330 else if (adev->df.funcs &&
23792331 adev->df.funcs->query_ras_poison_mode &&
2380− adev->umc.ras_funcs &&
2381− adev->umc.ras_funcs->query_ras_poison_mode) {
2332+ adev->umc.ras &&
2333+ adev->umc.ras->query_ras_poison_mode) {
23822334 df_poison =
23832335 adev->df.funcs->query_ras_poison_mode(adev);
23842336 umc_poison =
2385− adev->umc.ras_funcs->query_ras_poison_mode(adev);
2337+ adev->umc.ras->query_ras_poison_mode(adev);
23862338 /* Only poison is set in both DF and UMC, we can support it */
23872339 if (df_poison && umc_poison)
23882340 con->poison_supported = true;
@@ -2445,11 +2397,10 @@ bool amdgpu_ras_is_poison_mode_supported(struct amdgpu_device *adev) · 56 unmodified lines
24452397 }
24462398
24472399 /* helper function to handle common stuff in ip late init phase */
2448−int amdgpu_ras_late_init(struct amdgpu_device *adev,
2449− struct ras_common_if *ras_block,
2450− struct ras_fs_if *fs_info,
2451− struct ras_ih_if *ih_info)
2400+int amdgpu_ras_block_late_init(struct amdgpu_device *adev,
2401+ struct ras_common_if *ras_block)
24522402 {
2403+ struct amdgpu_ras_block_object *ras_obj = NULL;
24532404 struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
24542405 unsigned long ue_count, ce_count;
24552406 int r;
@@ -2477,15 +2428,16 @@ int amdgpu_ras_late_init(struct amdgpu_device *adev, · 21 unmodified lines
24772428 if (adev->in_suspend || amdgpu_in_reset(adev))
24782429 return 0;
24792430
2480− if (ih_info->cb) {
2481− r = amdgpu_ras_interrupt_add_handler(adev, ih_info);
2431+ ras_obj = container_of(ras_block, struct amdgpu_ras_block_object, ras_comm);
2432+ if (ras_obj->ras_cb) {
2433+ r = amdgpu_ras_interrupt_add_handler(adev, ras_block);
24822434 if (r)
2483− goto interrupt;
2435+ goto cleanup;
24842436 }
24852437
2486− r = amdgpu_ras_sysfs_create(adev, fs_info);
2438+ r = amdgpu_ras_sysfs_create(adev, ras_block);
24872439 if (r)
2488− goto sysfs;
2440+ goto interrupt;
24892441
24902442 /* Those are the cached values at init.
24912443 */
@@ -2495,27 +2447,34 @@ int amdgpu_ras_late_init(struct amdgpu_device *adev, · 3 unmodified lines
24952447 }
24962448
24972449 return 0;
2498−cleanup:
2499− amdgpu_ras_sysfs_remove(adev, ras_block);
2500−sysfs:
2501− if (ih_info->cb)
2502− amdgpu_ras_interrupt_remove_handler(adev, ih_info);
2450+
25032451 interrupt:
2452+ if (ras_obj->ras_cb)
2453+ amdgpu_ras_interrupt_remove_handler(adev, ras_block);
2454+cleanup:
25042455 amdgpu_ras_feature_enable(adev, ras_block, 0);
25052456 return r;
25062457 }
25072458
2459+static int amdgpu_ras_block_late_init_default(struct amdgpu_device *adev,
2460+ struct ras_common_if *ras_block)
2461+{
2462+ return amdgpu_ras_block_late_init(adev, ras_block);
2463+}
2464+
25082465 /* helper function to remove ras fs node and interrupt handler */
2509−void amdgpu_ras_late_fini(struct amdgpu_device *adev,
2510− struct ras_common_if *ras_block,
2511− struct ras_ih_if *ih_info)
2466+void amdgpu_ras_block_late_fini(struct amdgpu_device *adev,
2467+ struct ras_common_if *ras_block)
25122468 {
2513− if (!ras_block || !ih_info)
2469+ struct amdgpu_ras_block_object *ras_obj;
2470+ if (!ras_block)
25142471 return;
25152472
25162473 amdgpu_ras_sysfs_remove(adev, ras_block);
2517− if (ih_info->cb)
2518− amdgpu_ras_interrupt_remove_handler(adev, ih_info);
2474+
2475+ ras_obj = container_of(ras_block, struct amdgpu_ras_block_object, ras_comm);
2476+ if (ras_obj->ras_cb)
2477+ amdgpu_ras_interrupt_remove_handler(adev, ras_block);
25192478 }
25202479
25212480 /* do some init work after IP late init as dependence.
@@ -2568,6 +2527,33 @@ void amdgpu_ras_suspend(struct amdgpu_device *adev) · 46 unmodified lines
25682527 amdgpu_ras_disable_all_features(adev, 1);
25692528 }
25702529
2530+int amdgpu_ras_late_init(struct amdgpu_device *adev)
2531+{
2532+ struct amdgpu_ras_block_list *node, *tmp;
2533+ struct amdgpu_ras_block_object *obj;
2534+ int r;
2535+
2536+ list_for_each_entry_safe(node, tmp, &adev->ras_list, node) {
2537+ if (!node->ras_obj) {
2538+ dev_warn(adev->dev, "Warning: abnormal ras list node.\n");
2539+ continue;
2540+ }
2541+
2542+ obj = node->ras_obj;
2543+ if (obj->ras_late_init) {
2544+ r = obj->ras_late_init(adev, &obj->ras_comm);
2545+ if (r) {
2546+ dev_err(adev->dev, "%s failed to execute ras_late_init! ret:%d\n",
2547+ obj->ras_comm.name, r);
2548+ return r;
2549+ }
2550+ } else
2551+ amdgpu_ras_block_late_init_default(adev, &obj->ras_comm);
2552+ }
2553+
2554+ return 0;
2555+}
2556+
25712557 /* do some fini work before IP fini as dependence */
25722558 int amdgpu_ras_pre_fini(struct amdgpu_device *adev)
25732559 {
@@ -2585,6 +2571,7 @@ int amdgpu_ras_pre_fini(struct amdgpu_device *adev) · 11 unmodified lines
25852571
25862572 int amdgpu_ras_fini(struct amdgpu_device *adev)
25872573 {
2574+ struct amdgpu_ras_block_list *ras_node, *tmp;
25882575 struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
25892576
25902577 if (!adev->ras_enabled || !con)
@@ -2603,6 +2590,12 @@ int amdgpu_ras_fini(struct amdgpu_device *adev) · 12 unmodified lines
26032590 amdgpu_ras_set_context(adev, NULL);
26042591 kfree(con);
26052592
2593+ /* Clear ras blocks from ras_list and free ras block list node */
2594+ list_for_each_entry_safe(ras_node, tmp, &adev->ras_list, node) {
2595+ list_del(&ras_node->node);
2596+ kfree(ras_node);
2597+ }
2598+
26062599 return 0;
26072600 }
26082601
@@ -2717,8 +2710,6 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb, · 108 unmodified lines
27172710 dev_info(adev->dev, "Uncorrectable error detected in UMC inst: %d, chan_idx: %d",
27182711 umc_inst, ch_inst);
27192712
2720− memset(&err_rec, 0x0, sizeof(struct eeprom_table_record));
2721−
27222713 /*
27232714 * Translate UMC channel address to Physical address
27242715 */
@@ -2730,16 +2721,10 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb, · 5 unmodified lines
27302721 ADDR_OF_256B_BLOCK(channel_index) |
27312722 OFFSET_IN_256B_BLOCK(m->addr);
27322723
2733− err_rec.address = m->addr;
2734− err_rec.retired_page = retired_page >> AMDGPU_GPU_PAGE_SHIFT;
2735− err_rec.ts = (uint64_t)ktime_get_real_seconds();
2736− err_rec.err_type = AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE;
2737− err_rec.cu = 0;
2738− err_rec.mem_channel = channel_index;
2739− err_rec.mcumc_id = umc_inst;
2740−
2724+ memset(&err_rec, 0x0, sizeof(struct eeprom_table_record));
27412725 err_data.err_addr = &err_rec;
2742− err_data.err_addr_cnt = 1;
2726+ amdgpu_umc_fill_error_record(&err_data, m->addr,
2727+ retired_page, channel_index, umc_inst);
27432728
27442729 if (amdgpu_bad_page_threshold != 0) {
27452730 amdgpu_ras_add_bad_pages(adev, err_data.err_addr,
@@ -2777,3 +2762,63 @@ static void amdgpu_register_bad_pages_mca_notifier(struct amdgpu_device *adev) · 31 unmodified lines
27772762 }
27782763 }
27792764 #endif
2765+
2766+struct amdgpu_ras *amdgpu_ras_get_context(struct amdgpu_device *adev)
2767+{
2768+ if (!adev)
2769+ return NULL;
2770+
2771+ return adev->psp.ras_context.ras;
2772+}
2773+
2774+int amdgpu_ras_set_context(struct amdgpu_device *adev, struct amdgpu_ras *ras_con)
2775+{
2776+ if (!adev)
2777+ return -EINVAL;
2778+
2779+ adev->psp.ras_context.ras = ras_con;
2780+ return 0;
2781+}
2782+
2783+/* check if ras is supported on block, say, sdma, gfx */
2784+int amdgpu_ras_is_supported(struct amdgpu_device *adev,
2785+ unsigned int block)
2786+{
2787+ struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
2788+
2789+ if (block >= AMDGPU_RAS_BLOCK_COUNT)
2790+ return 0;
2791+ return ras && (adev->ras_enabled & (1 << block));
2792+}
2793+
2794+int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)
2795+{
2796+ struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
2797+
2798+ if (atomic_cmpxchg(&ras->in_recovery, 0, 1) == 0)
2799+ schedule_work(&ras->recovery_work);
2800+ return 0;
2801+}
2802+
2803+
2804+/* Register each ip ras block into amdgpu ras */
2805+int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,
2806+ struct amdgpu_ras_block_object *ras_block_obj)
2807+{
2808+ struct amdgpu_ras_block_list *ras_node;
2809+ if (!adev || !ras_block_obj)
2810+ return -EINVAL;
2811+
2812+ if (!amdgpu_ras_asic_supported(adev))
2813+ return 0;
2814+
2815+ ras_node = kzalloc(sizeof(*ras_node), GFP_KERNEL);
2816+ if (!ras_node)
2817+ return -ENOMEM;
2818+
2819+ INIT_LIST_HEAD(&ras_node->node);
2820+ ras_node->ras_obj = ras_block_obj;
2821+ list_add_tail(&ras_node->node, &adev->ras_list);
2822+
2823+ return 0;
2824+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h+43−34
@@ -26,11 +26,11 @@ · 25 unmodified lines
2626
2727 #include <linux/debugfs.h>
2828 #include <linux/list.h>
29−#include "amdgpu.h"
30−#include "amdgpu_psp.h"
3129 #include "ta_ras_if.h"
3230 #include "amdgpu_ras_eeprom.h"
3331
32+struct amdgpu_iv_entry;
33+
3434 #define AMDGPU_RAS_FLAG_INIT_BY_VBIOS (0x1 << 0)
3535
3636 enum amdgpu_ras_block {
@@ -484,6 +484,27 @@ struct ras_debug_if { · 447 unmodified lines
484484 };
485485 int op;
486486 };
487+
488+struct amdgpu_ras_block_object {
489+ struct ras_common_if ras_comm;
490+
491+ int (*ras_block_match)(struct amdgpu_ras_block_object *block_obj,
492+ enum amdgpu_ras_block block, uint32_t sub_block_index);
493+ int (*ras_late_init)(struct amdgpu_device *adev, struct ras_common_if *ras_block);
494+ void (*ras_fini)(struct amdgpu_device *adev);
495+ ras_ih_cb ras_cb;
496+ const struct amdgpu_ras_block_hw_ops *hw_ops;
497+};
498+
499+struct amdgpu_ras_block_hw_ops {
500+ int (*ras_error_inject)(struct amdgpu_device *adev, void *inject_if);
501+ void (*query_ras_error_count)(struct amdgpu_device *adev, void *ras_error_status);
502+ void (*query_ras_error_status)(struct amdgpu_device *adev);
503+ void (*query_ras_error_address)(struct amdgpu_device *adev, void *ras_error_status);
504+ void (*reset_ras_error_count)(struct amdgpu_device *adev);
505+ void (*reset_ras_error_status)(struct amdgpu_device *adev);
506+};
507+
487508 /* work flow
488509 * vbios
489510 * 1: ras feature enable (enabled by default)
@@ -498,19 +519,6 @@ struct ras_debug_if { · 8 unmodified lines
498519 * 8: feature disable
499520 */
500521
501−#define amdgpu_ras_get_context(adev) ((adev)->psp.ras_context.ras)
502−#define amdgpu_ras_set_context(adev, ras_con) ((adev)->psp.ras_context.ras = (ras_con))
503−
504−/* check if ras is supported on block, say, sdma, gfx */
505−static inline int amdgpu_ras_is_supported(struct amdgpu_device *adev,
506− unsigned int block)
507−{
508− struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
509−
510− if (block >= AMDGPU_RAS_BLOCK_COUNT)
511− return 0;
512− return ras && (adev->ras_enabled & (1 << block));
513−}
514522
515523 int amdgpu_ras_recovery_init(struct amdgpu_device *adev);
516524
@@ -527,15 +535,6 @@ int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev, · 10 unmodified lines
527535
528536 int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev);
529537
530−static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)
531−{
532− struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
533−
534− if (atomic_cmpxchg(&ras->in_recovery, 0, 1) == 0)
535− schedule_work(&ras->recovery_work);
536− return 0;
537−}
538−
539538 static inline enum ta_ras_block
540539 amdgpu_ras_block_to_ta(enum amdgpu_ras_block block) {
541540 switch (block) {
@@ -596,15 +595,15 @@ amdgpu_ras_error_to_ta(enum amdgpu_ras_error_type error) { · 54 unmodified lines
596595
597596 /* called in ip_init and ip_fini */
598597 int amdgpu_ras_init(struct amdgpu_device *adev);
598+int amdgpu_ras_late_init(struct amdgpu_device *adev);
599599 int amdgpu_ras_fini(struct amdgpu_device *adev);
600600 int amdgpu_ras_pre_fini(struct amdgpu_device *adev);
601−int amdgpu_ras_late_init(struct amdgpu_device *adev,
602− struct ras_common_if *ras_block,
603− struct ras_fs_if *fs_info,
604− struct ras_ih_if *ih_info);
605−void amdgpu_ras_late_fini(struct amdgpu_device *adev,
606− struct ras_common_if *ras_block,
607− struct ras_ih_if *ih_info);
601+
602+int amdgpu_ras_block_late_init(struct amdgpu_device *adev,
603+ struct ras_common_if *ras_block);
604+
605+void amdgpu_ras_block_late_fini(struct amdgpu_device *adev,
606+ struct ras_common_if *ras_block);
608607
609608 int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
610609 struct ras_common_if *head, bool enable);
@@ -613,7 +612,7 @@ int amdgpu_ras_feature_enable_on_boot(struct amdgpu_device *adev, · 2 unmodified lines
613612 struct ras_common_if *head, bool enable);
614613
615614 int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
616− struct ras_fs_if *head);
615+ struct ras_common_if *head);
617616
618617 int amdgpu_ras_sysfs_remove(struct amdgpu_device *adev,
619618 struct ras_common_if *head);
@@ -630,10 +629,10 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev, · 10 unmodified lines
630629 struct ras_inject_if *info);
631630
632631 int amdgpu_ras_interrupt_add_handler(struct amdgpu_device *adev,
633− struct ras_ih_if *info);
632+ struct ras_common_if *head);
634633
635634 int amdgpu_ras_interrupt_remove_handler(struct amdgpu_device *adev,
636− struct ras_ih_if *info);
635+ struct ras_common_if *head);
637636
638637 int amdgpu_ras_interrupt_dispatch(struct amdgpu_device *adev,
639638 struct ras_dispatch_if *info);
@@ -667,4 +666,14 @@ const char *get_ras_block_str(struct ras_common_if *ras_block); · 27 unmodified lines
667666
668667 bool amdgpu_ras_is_poison_mode_supported(struct amdgpu_device *adev);
669668
669+int amdgpu_ras_is_supported(struct amdgpu_device *adev, unsigned int block);
670+
671+int amdgpu_ras_reset_gpu(struct amdgpu_device *adev);
672+
673+struct amdgpu_ras* amdgpu_ras_get_context(struct amdgpu_device *adev);
674+
675+int amdgpu_ras_set_context(struct amdgpu_device *adev, struct amdgpu_ras *ras_con);
676+
677+int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,
678+ struct amdgpu_ras_block_object *ras_block_obj);
670679 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c+20−15
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #include <linux/debugfs.h>
3232 #include <linux/uaccess.h>
3333
34+#include "amdgpu_reset.h"
35+
3436 #define EEPROM_I2C_MADDR_VEGA20 0x0
3537 #define EEPROM_I2C_MADDR_ARCTURUS 0x40000
3638 #define EEPROM_I2C_MADDR_ARCTURUS_D342 0x0
@@ -193,12 +195,12 @@ static int __write_table_header(struct amdgpu_ras_eeprom_control *control) · 156 unmodified lines
193195 __encode_table_header_to_buf(&control->tbl_hdr, buf);
194196
195197 /* i2c may be unstable in gpu reset */
196− down_read(&adev->reset_sem);
197− res = amdgpu_eeprom_write(&adev->pm.smu_i2c,
198+ down_read(&adev->reset_domain->sem);
199+ res = amdgpu_eeprom_write(adev->pm.ras_eeprom_i2c_bus,
198200 control->i2c_address +
199201 control->ras_header_offset,
200202 buf, RAS_TABLE_HEADER_SIZE);
201− up_read(&adev->reset_sem);
203+ up_read(&adev->reset_domain->sem);
202204
203205 if (res < 0) {
204206 DRM_ERROR("Failed to write EEPROM table header:%d", res);
@@ -263,6 +265,7 @@ static int amdgpu_ras_eeprom_correct_header_tag( · 58 unmodified lines
263265 */
264266 int amdgpu_ras_eeprom_reset_table(struct amdgpu_ras_eeprom_control *control)
265267 {
268+ struct amdgpu_device *adev = to_amdgpu_device(control);
266269 struct amdgpu_ras_eeprom_table_header *hdr = &control->tbl_hdr;
267270 u8 csum;
268271 int res;
@@ -282,6 +285,8 @@ int amdgpu_ras_eeprom_reset_table(struct amdgpu_ras_eeprom_control *control) · 13 unmodified lines
282285 control->ras_num_recs = 0;
283286 control->ras_fri = 0;
284287
288+ amdgpu_dpm_send_hbm_bad_pages_num(adev, control->ras_num_recs);
289+
285290 amdgpu_ras_debugfs_set_ret_size(control);
286291
287292 mutex_unlock(&control->ras_tbl_mutex);
@@ -387,13 +392,13 @@ static int __amdgpu_ras_eeprom_write(struct amdgpu_ras_eeprom_control *control, · 99 unmodified lines
387392 int res;
388393
389394 /* i2c may be unstable in gpu reset */
390− down_read(&adev->reset_sem);
395+ down_read(&adev->reset_domain->sem);
391396 buf_size = num * RAS_TABLE_RECORD_SIZE;
392− res = amdgpu_eeprom_write(&adev->pm.smu_i2c,
397+ res = amdgpu_eeprom_write(adev->pm.ras_eeprom_i2c_bus,
393398 control->i2c_address +
394399 RAS_INDEX_TO_OFFSET(control, fri),
395400 buf, buf_size);
396− up_read(&adev->reset_sem);
401+ up_read(&adev->reset_domain->sem);
397402 if (res < 0) {
398403 DRM_ERROR("Writing %d EEPROM table records error:%d",
399404 num, res);
@@ -547,12 +552,12 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control) · 147 unmodified lines
547552 goto Out;
548553 }
549554
550− down_read(&adev->reset_sem);
551− res = amdgpu_eeprom_read(&adev->pm.smu_i2c,
555+ down_read(&adev->reset_domain->sem);
556+ res = amdgpu_eeprom_read(adev->pm.ras_eeprom_i2c_bus,
552557 control->i2c_address +
553558 control->ras_record_offset,
554559 buf, buf_size);
555− up_read(&adev->reset_sem);
560+ up_read(&adev->reset_domain->sem);
556561 if (res < 0) {
557562 DRM_ERROR("EEPROM failed reading records:%d\n",
558563 res);
@@ -642,13 +647,13 @@ static int __amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control, · 83 unmodified lines
642647 int res;
643648
644649 /* i2c may be unstable in gpu reset */
645− down_read(&adev->reset_sem);
650+ down_read(&adev->reset_domain->sem);
646651 buf_size = num * RAS_TABLE_RECORD_SIZE;
647− res = amdgpu_eeprom_read(&adev->pm.smu_i2c,
652+ res = amdgpu_eeprom_read(adev->pm.ras_eeprom_i2c_bus,
648653 control->i2c_address +
649654 RAS_INDEX_TO_OFFSET(control, fri),
650655 buf, buf_size);
651− up_read(&adev->reset_sem);
656+ up_read(&adev->reset_domain->sem);
652657 if (res < 0) {
653658 DRM_ERROR("Reading %d EEPROM table records error:%d",
654659 num, res);
@@ -1009,7 +1014,7 @@ static int __verify_ras_table_checksum(struct amdgpu_ras_eeprom_control *control · 354 unmodified lines
10091014 return -ENOMEM;
10101015 }
10111016
1012− res = amdgpu_eeprom_read(&adev->pm.smu_i2c,
1017+ res = amdgpu_eeprom_read(adev->pm.ras_eeprom_i2c_bus,
10131018 control->i2c_address +
10141019 control->ras_header_offset,
10151020 buf, buf_size);
@@ -1045,7 +1050,7 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · 29 unmodified lines
10451050 return 0;
10461051
10471052 /* Verify i2c adapter is initialized */
1048− if (!adev->pm.smu_i2c.algo)
1053+ if (!adev->pm.ras_eeprom_i2c_bus || !adev->pm.ras_eeprom_i2c_bus->algo)
10491054 return -ENOENT;
10501055
10511056 if (!__get_eeprom_i2c_addr(adev, control))
@@ -1057,7 +1062,7 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · 5 unmodified lines
10571062 mutex_init(&control->ras_tbl_mutex);
10581063
10591064 /* Read the table header from EEPROM address */
1060− res = amdgpu_eeprom_read(&adev->pm.smu_i2c,
1065+ res = amdgpu_eeprom_read(adev->pm.ras_eeprom_i2c_bus,
10611066 control->i2c_address + control->ras_header_offset,
10621067 buf, RAS_TABLE_HEADER_SIZE);
10631068 if (res < RAS_TABLE_HEADER_SIZE) {
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c+56−0
@@ -96,3 +96,59 @@ int amdgpu_reset_perform_reset(struct amdgpu_device *adev, · 95 unmodified lines
9696 return reset_handler->restore_hwcontext(adev->reset_cntl,
9797 reset_context);
9898 }
99+
100+
101+void amdgpu_reset_destroy_reset_domain(struct kref *ref)
102+{
103+ struct amdgpu_reset_domain *reset_domain = container_of(ref,
104+ struct amdgpu_reset_domain,
105+ refcount);
106+ if (reset_domain->wq)
107+ destroy_workqueue(reset_domain->wq);
108+
109+ kvfree(reset_domain);
110+}
111+
112+struct amdgpu_reset_domain *amdgpu_reset_create_reset_domain(enum amdgpu_reset_domain_type type,
113+ char *wq_name)
114+{
115+ struct amdgpu_reset_domain *reset_domain;
116+
117+ reset_domain = kvzalloc(sizeof(struct amdgpu_reset_domain), GFP_KERNEL);
118+ if (!reset_domain) {
119+ DRM_ERROR("Failed to allocate amdgpu_reset_domain!");
120+ return NULL;
121+ }
122+
123+ reset_domain->type = type;
124+ kref_init(&reset_domain->refcount);
125+
126+ reset_domain->wq = create_singlethread_workqueue(wq_name);
127+ if (!reset_domain->wq) {
128+ DRM_ERROR("Failed to allocate wq for amdgpu_reset_domain!");
129+ amdgpu_reset_put_reset_domain(reset_domain);
130+ return NULL;
131+
132+ }
133+
134+ atomic_set(&reset_domain->in_gpu_reset, 0);
135+ init_rwsem(&reset_domain->sem);
136+
137+ return reset_domain;
138+}
139+
140+void amdgpu_device_lock_reset_domain(struct amdgpu_reset_domain *reset_domain)
141+{
142+ atomic_set(&reset_domain->in_gpu_reset, 1);
143+ down_write(&reset_domain->sem);
144+}
145+
146+
147+void amdgpu_device_unlock_reset_domain(struct amdgpu_reset_domain *reset_domain)
148+{
149+ atomic_set(&reset_domain->in_gpu_reset, 0);
150+ up_write(&reset_domain->sem);
151+}
152+
153+
154+
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h+40−0
@@ -70,6 +70,21 @@ struct amdgpu_reset_control { · 69 unmodified lines
7070 void (*async_reset)(struct work_struct *work);
7171 };
7272
73+
74+enum amdgpu_reset_domain_type {
75+ SINGLE_DEVICE,
76+ XGMI_HIVE
77+};
78+
79+struct amdgpu_reset_domain {
80+ struct kref refcount;
81+ struct workqueue_struct *wq;
82+ enum amdgpu_reset_domain_type type;
83+ struct rw_semaphore sem;
84+ atomic_t in_gpu_reset;
85+};
86+
87+
7388 int amdgpu_reset_init(struct amdgpu_device *adev);
7489 int amdgpu_reset_fini(struct amdgpu_device *adev);
7590
@@ -82,4 +97,29 @@ int amdgpu_reset_perform_reset(struct amdgpu_device *adev, · 6 unmodified lines
8297 int amdgpu_reset_add_handler(struct amdgpu_reset_control *reset_ctl,
8398 struct amdgpu_reset_handler *handler);
8499
100+struct amdgpu_reset_domain *amdgpu_reset_create_reset_domain(enum amdgpu_reset_domain_type type,
101+ char *wq_name);
102+
103+void amdgpu_reset_destroy_reset_domain(struct kref *ref);
104+
105+static inline bool amdgpu_reset_get_reset_domain(struct amdgpu_reset_domain *domain)
106+{
107+ return kref_get_unless_zero(&domain->refcount) != 0;
108+}
109+
110+static inline void amdgpu_reset_put_reset_domain(struct amdgpu_reset_domain *domain)
111+{
112+ kref_put(&domain->refcount, amdgpu_reset_destroy_reset_domain);
113+}
114+
115+static inline bool amdgpu_reset_domain_schedule(struct amdgpu_reset_domain *domain,
116+ struct work_struct *work)
117+{
118+ return queue_work(domain->wq, work);
119+}
120+
121+void amdgpu_device_lock_reset_domain(struct amdgpu_reset_domain *reset_domain);
122+
123+void amdgpu_device_unlock_reset_domain(struct amdgpu_reset_domain *reset_domain);
124+
85125 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c+3−2
@@ -191,8 +191,9 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, · 190 unmodified lines
191191 ring->adev = adev;
192192 ring->idx = adev->num_rings++;
193193 adev->rings[ring->idx] = ring;
194− r = amdgpu_fence_driver_init_ring(ring, sched_hw_submission,
195− sched_score);
194+ ring->num_hw_submission = sched_hw_submission;
195+ ring->sched_score = sched_score;
196+ r = amdgpu_fence_driver_init_ring(ring);
196197 if (r)
197198 return r;
198199 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h+3−3
@@ -114,9 +114,7 @@ struct amdgpu_fence_driver { · 113 unmodified lines
114114 void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring);
115115 void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring);
116116
117−int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
118− unsigned num_hw_submission,
119− atomic_t *sched_score);
117+int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring);
120118 int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
121119 struct amdgpu_irq_src *irq_src,
122120 unsigned irq_type);
@@ -251,6 +249,8 @@ struct amdgpu_ring { · 128 unmodified lines
251249 bool has_compute_vm_bug;
252250 bool no_scheduler;
253251 int hw_prio;
252+ unsigned num_hw_submission;
253+ atomic_t *sched_score;
254254 };
255255
256256 #define amdgpu_ring_parse_cs(r, p, ib) ((r)->funcs->parse_cs((p), (ib)))
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h+14−2
@@ -127,11 +127,19 @@ struct amdgpu_rlc_funcs { · 126 unmodified lines
127127 void (*reset)(struct amdgpu_device *adev);
128128 void (*start)(struct amdgpu_device *adev);
129129 void (*update_spm_vmid)(struct amdgpu_device *adev, unsigned vmid);
130− void (*sriov_wreg)(struct amdgpu_device *adev, u32 offset, u32 v, u32 acc_flags, u32 hwip);
131− u32 (*sriov_rreg)(struct amdgpu_device *adev, u32 offset, u32 acc_flags, u32 hwip);
132130 bool (*is_rlcg_access_range)(struct amdgpu_device *adev, uint32_t reg);
133131 };
134132
133+struct amdgpu_rlcg_reg_access_ctrl {
134+ uint32_t scratch_reg0;
135+ uint32_t scratch_reg1;
136+ uint32_t scratch_reg2;
137+ uint32_t scratch_reg3;
138+ uint32_t grbm_cntl;
139+ uint32_t grbm_idx;
140+ uint32_t spare_int;
141+};
142+
135143 struct amdgpu_rlc {
136144 /* for power gating */
137145 struct amdgpu_bo *save_restore_obj;
@@ -191,6 +199,10 @@ struct amdgpu_rlc { · 53 unmodified lines
191199 struct amdgpu_bo *rlc_toc_bo;
192200 uint64_t rlc_toc_gpu_addr;
193201 void *rlc_toc_buf;
202+
203+ bool rlcg_reg_access_supported;
204+ /* registers for rlcg indirect reg access */
205+ struct amdgpu_rlcg_reg_access_ctrl reg_access_ctrl;
194206 };
195207
196208 void amdgpu_gfx_rlc_enter_safe_mode(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c+7−43
@@ -87,71 +87,35 @@ uint64_t amdgpu_sdma_get_csa_mc_addr(struct amdgpu_ring *ring, · 86 unmodified lines
8787 }
8888
8989 int amdgpu_sdma_ras_late_init(struct amdgpu_device *adev,
90− void *ras_ih_info)
90+ struct ras_common_if *ras_block)
9191 {
9292 int r, i;
93− struct ras_ih_if *ih_info = (struct ras_ih_if *)ras_ih_info;
94− struct ras_fs_if fs_info = {
95− .sysfs_name = "sdma_err_count",
96− };
97−
98− if (!ih_info)
99− return -EINVAL;
10093
101− if (!adev->sdma.ras_if) {
102− adev->sdma.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
103− if (!adev->sdma.ras_if)
104− return -ENOMEM;
105− adev->sdma.ras_if->block = AMDGPU_RAS_BLOCK__SDMA;
106− adev->sdma.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
107− adev->sdma.ras_if->sub_block_index = 0;
108− }
109− fs_info.head = ih_info->head = *adev->sdma.ras_if;
110−
111− r = amdgpu_ras_late_init(adev, adev->sdma.ras_if,
112− &fs_info, ih_info);
94+ r = amdgpu_ras_block_late_init(adev, ras_block);
11395 if (r)
114− goto free;
96+ return r;
11597
116− if (amdgpu_ras_is_supported(adev, adev->sdma.ras_if->block)) {
98+ if (amdgpu_ras_is_supported(adev, ras_block->block)) {
11799 for (i = 0; i < adev->sdma.num_instances; i++) {
118100 r = amdgpu_irq_get(adev, &adev->sdma.ecc_irq,
119101 AMDGPU_SDMA_IRQ_INSTANCE0 + i);
120102 if (r)
121103 goto late_fini;
122104 }
123− } else {
124− r = 0;
125− goto free;
126105 }
127106
128107 return 0;
129108
130109 late_fini:
131− amdgpu_ras_late_fini(adev, adev->sdma.ras_if, ih_info);
132−free:
133− kfree(adev->sdma.ras_if);
134− adev->sdma.ras_if = NULL;
110+ amdgpu_ras_block_late_fini(adev, ras_block);
135111 return r;
136112 }
137113
138114 void amdgpu_sdma_ras_fini(struct amdgpu_device *adev)
139115 {
140116 if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__SDMA) &&
141− adev->sdma.ras_if) {
142− struct ras_common_if *ras_if = adev->sdma.ras_if;
143− struct ras_ih_if ih_info = {
144− .head = *ras_if,
145− /* the cb member will not be used by
146− * amdgpu_ras_interrupt_remove_handler, init it only
147− * to cheat the check in ras_late_fini
148− */
149− .cb = amdgpu_sdma_process_ras_data_cb,
150− };
151−
152− amdgpu_ras_late_fini(adev, ras_if, &ih_info);
153− kfree(ras_if);
154− }
117+ adev->sdma.ras_if)
118+ amdgpu_ras_block_late_fini(adev, adev->sdma.ras_if);
155119 }
156120
157121 int amdgpu_sdma_process_ras_data_cb(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h+5−9
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323
2424 #ifndef __AMDGPU_SDMA_H__
2525 #define __AMDGPU_SDMA_H__
26+#include "amdgpu_ras.h"
2627
2728 /* max number of IP instances */
2829 #define AMDGPU_MAX_SDMA_INSTANCES 8
@@ -50,13 +51,8 @@ struct amdgpu_sdma_instance { · 21 unmodified lines
5051 bool burst_nop;
5152 };
5253
53−struct amdgpu_sdma_ras_funcs {
54− int (*ras_late_init)(struct amdgpu_device *adev,
55− void *ras_ih_info);
56− void (*ras_fini)(struct amdgpu_device *adev);
57− int (*query_ras_error_count)(struct amdgpu_device *adev,
58− uint32_t instance, void *ras_error_status);
59− void (*reset_ras_error_count)(struct amdgpu_device *adev);
54+struct amdgpu_sdma_ras {
55+ struct amdgpu_ras_block_object ras_block;
6056 };
6157
6258 struct amdgpu_sdma {
@@ -73,7 +69,7 @@ struct amdgpu_sdma { · 10 unmodified lines
7369 uint32_t srbm_soft_reset;
7470 bool has_page_queue;
7571 struct ras_common_if *ras_if;
76− const struct amdgpu_sdma_ras_funcs *funcs;
72+ struct amdgpu_sdma_ras *ras;
7773 };
7874
7975 /*
@@ -121,7 +117,7 @@ amdgpu_sdma_get_instance_from_ring(struct amdgpu_ring *ring); · 41 unmodified lines
121117 int amdgpu_sdma_get_index_from_ring(struct amdgpu_ring *ring, uint32_t *index);
122118 uint64_t amdgpu_sdma_get_csa_mc_addr(struct amdgpu_ring *ring, unsigned vmid);
123119 int amdgpu_sdma_ras_late_init(struct amdgpu_device *adev,
124− void *ras_ih_info);
120+ struct ras_common_if *ras_block);
125121 void amdgpu_sdma_ras_fini(struct amdgpu_device *adev);
126122 int amdgpu_sdma_process_ras_data_cb(struct amdgpu_device *adev,
127123 void *err_data,
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c+2−3
@@ -261,10 +261,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync, · 260 unmodified lines
261261
262262 dma_resv_for_each_fence(&cursor, resv, true, f) {
263263 dma_fence_chain_for_each(f, f) {
264− struct dma_fence_chain *chain = to_dma_fence_chain(f);
264+ struct dma_fence *tmp = dma_fence_chain_contained(f);
265265
266− if (amdgpu_sync_test_fence(adev, mode, owner, chain ?
267− chain->fence : f)) {
266+ if (amdgpu_sync_test_fence(adev, mode, owner, tmp)) {
268267 r = amdgpu_sync_fence(sync, f);
269268 dma_fence_put(f);
270269 if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c+0−250
@@ -1,250 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0 OR MIT
2−/*
3− * Copyright 2009 VMware, Inc.
4− *
5− * Permission is hereby granted, free of charge, to any person obtaining a
6− * copy of this software and associated documentation files (the "Software"),
7− * to deal in the Software without restriction, including without limitation
8− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9− * and/or sell copies of the Software, and to permit persons to whom the
10− * Software is furnished to do so, subject to the following conditions:
11− *
12− * The above copyright notice and this permission notice shall be included in
13− * all copies or substantial portions of the Software.
14− *
15− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18− * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21− * OTHER DEALINGS IN THE SOFTWARE.
22− *
23− * Authors: Michel Dänzer
24− */
25−
26−#include <drm/amdgpu_drm.h>
27−#include "amdgpu.h"
28−#include "amdgpu_uvd.h"
29−#include "amdgpu_vce.h"
30−
31−/* Test BO GTT->VRAM and VRAM->GTT GPU copies across the whole GTT aperture */
32−static void amdgpu_do_test_moves(struct amdgpu_device *adev)
33−{
34− struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
35− struct amdgpu_bo *vram_obj = NULL;
36− struct amdgpu_bo **gtt_obj = NULL;
37− struct amdgpu_bo_param bp;
38− uint64_t gart_addr, vram_addr;
39− unsigned n, size;
40− int i, r;
41−
42− size = 1024 * 1024;
43−
44− /* Number of tests =
45− * (Total GTT - gart_pin_size - (2 transfer windows for buffer moves)) / test size
46− */
47− n = adev->gmc.gart_size - atomic64_read(&adev->gart_pin_size);
48− n -= AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS *
49− AMDGPU_GPU_PAGE_SIZE;
50− n /= size;
51−
52− gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);
53− if (!gtt_obj) {
54− DRM_ERROR("Failed to allocate %d pointers\n", n);
55− r = 1;
56− goto out_cleanup;
57− }
58− memset(&bp, 0, sizeof(bp));
59− bp.size = size;
60− bp.byte_align = PAGE_SIZE;
61− bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
62− bp.flags = 0;
63− bp.type = ttm_bo_type_kernel;
64− bp.resv = NULL;
65− bp.bo_ptr_size = sizeof(struct amdgpu_bo);
66−
67− r = amdgpu_bo_create(adev, &bp, &vram_obj);
68− if (r) {
69− DRM_ERROR("Failed to create VRAM object\n");
70− goto out_cleanup;
71− }
72− r = amdgpu_bo_reserve(vram_obj, false);
73− if (unlikely(r != 0))
74− goto out_unref;
75− r = amdgpu_bo_pin(vram_obj, AMDGPU_GEM_DOMAIN_VRAM);
76− if (r) {
77− DRM_ERROR("Failed to pin VRAM object\n");
78− goto out_unres;
79− }
80− vram_addr = amdgpu_bo_gpu_offset(vram_obj);
81− for (i = 0; i < n; i++) {
82− void *gtt_map, *vram_map;
83− void **gart_start, **gart_end;
84− void **vram_start, **vram_end;
85− struct dma_fence *fence = NULL;
86−
87− bp.domain = AMDGPU_GEM_DOMAIN_GTT;
88− r = amdgpu_bo_create(adev, &bp, gtt_obj + i);
89− if (r) {
90− DRM_ERROR("Failed to create GTT object %d\n", i);
91− goto out_lclean;
92− }
93−
94− r = amdgpu_bo_reserve(gtt_obj[i], false);
95− if (unlikely(r != 0))
96− goto out_lclean_unref;
97− r = amdgpu_bo_pin(gtt_obj[i], AMDGPU_GEM_DOMAIN_GTT);
98− if (r) {
99− DRM_ERROR("Failed to pin GTT object %d\n", i);
100− goto out_lclean_unres;
101− }
102− r = amdgpu_ttm_alloc_gart(&gtt_obj[i]->tbo);
103− if (r) {
104− DRM_ERROR("%p bind failed\n", gtt_obj[i]);
105− goto out_lclean_unpin;
106− }
107− gart_addr = amdgpu_bo_gpu_offset(gtt_obj[i]);
108−
109− r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
110− if (r) {
111− DRM_ERROR("Failed to map GTT object %d\n", i);
112− goto out_lclean_unpin;
113− }
114−
115− for (gart_start = gtt_map, gart_end = gtt_map + size;
116− gart_start < gart_end;
117− gart_start++)
118− *gart_start = gart_start;
119−
120− amdgpu_bo_kunmap(gtt_obj[i]);
121−
122− r = amdgpu_copy_buffer(ring, gart_addr, vram_addr,
123− size, NULL, &fence, false, false, false);
124−
125− if (r) {
126− DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
127− goto out_lclean_unpin;
128− }
129−
130− r = dma_fence_wait(fence, false);
131− if (r) {
132− DRM_ERROR("Failed to wait for GTT->VRAM fence %d\n", i);
133− goto out_lclean_unpin;
134− }
135−
136− dma_fence_put(fence);
137− fence = NULL;
138−
139− r = amdgpu_bo_kmap(vram_obj, &vram_map);
140− if (r) {
141− DRM_ERROR("Failed to map VRAM object after copy %d\n", i);
142− goto out_lclean_unpin;
143− }
144−
145− for (gart_start = gtt_map, gart_end = gtt_map + size,
146− vram_start = vram_map, vram_end = vram_map + size;
147− vram_start < vram_end;
148− gart_start++, vram_start++) {
149− if (*vram_start != gart_start) {
150− DRM_ERROR("Incorrect GTT->VRAM copy %d: Got 0x%p, "
151− "expected 0x%p (GTT/VRAM offset "
152− "0x%16llx/0x%16llx)\n",
153− i, *vram_start, gart_start,
154− (unsigned long long)
155− (gart_addr - adev->gmc.gart_start +
156− (void *)gart_start - gtt_map),
157− (unsigned long long)
158− (vram_addr - adev->gmc.vram_start +
159− (void *)gart_start - gtt_map));
160− amdgpu_bo_kunmap(vram_obj);
161− goto out_lclean_unpin;
162− }
163− *vram_start = vram_start;
164− }
165−
166− amdgpu_bo_kunmap(vram_obj);
167−
168− r = amdgpu_copy_buffer(ring, vram_addr, gart_addr,
169− size, NULL, &fence, false, false, false);
170−
171− if (r) {
172− DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
173− goto out_lclean_unpin;
174− }
175−
176− r = dma_fence_wait(fence, false);
177− if (r) {
178− DRM_ERROR("Failed to wait for VRAM->GTT fence %d\n", i);
179− goto out_lclean_unpin;
180− }
181−
182− dma_fence_put(fence);
183− fence = NULL;
184−
185− r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
186− if (r) {
187− DRM_ERROR("Failed to map GTT object after copy %d\n", i);
188− goto out_lclean_unpin;
189− }
190−
191− for (gart_start = gtt_map, gart_end = gtt_map + size,
192− vram_start = vram_map, vram_end = vram_map + size;
193− gart_start < gart_end;
194− gart_start++, vram_start++) {
195− if (*gart_start != vram_start) {
196− DRM_ERROR("Incorrect VRAM->GTT copy %d: Got 0x%p, "
197− "expected 0x%p (VRAM/GTT offset "
198− "0x%16llx/0x%16llx)\n",
199− i, *gart_start, vram_start,
200− (unsigned long long)
201− (vram_addr - adev->gmc.vram_start +
202− (void *)vram_start - vram_map),
203− (unsigned long long)
204− (gart_addr - adev->gmc.gart_start +
205− (void *)vram_start - vram_map));
206− amdgpu_bo_kunmap(gtt_obj[i]);
207− goto out_lclean_unpin;
208− }
209− }
210−
211− amdgpu_bo_kunmap(gtt_obj[i]);
212−
213− DRM_INFO("Tested GTT->VRAM and VRAM->GTT copy for GTT offset 0x%llx\n",
214− gart_addr - adev->gmc.gart_start);
215− continue;
216−
217−out_lclean_unpin:
218− amdgpu_bo_unpin(gtt_obj[i]);
219−out_lclean_unres:
220− amdgpu_bo_unreserve(gtt_obj[i]);
221−out_lclean_unref:
222− amdgpu_bo_unref(&gtt_obj[i]);
223−out_lclean:
224− for (--i; i >= 0; --i) {
225− amdgpu_bo_unpin(gtt_obj[i]);
226− amdgpu_bo_unreserve(gtt_obj[i]);
227− amdgpu_bo_unref(&gtt_obj[i]);
228− }
229− if (fence)
230− dma_fence_put(fence);
231− break;
232− }
233−
234− amdgpu_bo_unpin(vram_obj);
235−out_unres:
236− amdgpu_bo_unreserve(vram_obj);
237−out_unref:
238− amdgpu_bo_unref(&vram_obj);
239−out_cleanup:
240− kfree(gtt_obj);
241− if (r) {
242− pr_warn("Error while testing BO move\n");
243− }
244−}
245−
246−void amdgpu_test_moves(struct amdgpu_device *adev)
247−{
248− if (adev->mman.buffer_funcs)
249− amdgpu_do_test_moves(adev);
250−}
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h+18−3
@@ -358,11 +358,10 @@ TRACE_EVENT(amdgpu_vm_update_ptes, · 357 unmodified lines
358358 }
359359 ),
360360 TP_printk("pid:%u vm_ctx:0x%llx start:0x%010llx end:0x%010llx,"
361− " flags:0x%llx, incr:%llu, dst:\n%s%s", __entry->pid,
361+ " flags:0x%llx, incr:%llu, dst:\n%s", __entry->pid,
362362 __entry->vm_ctx, __entry->start, __entry->end,
363363 __entry->flags, __entry->incr, __print_array(
364− __get_dynamic_array(dst), min(__entry->nptes, 32u), 8),
365− __entry->nptes > 32 ? "..." : "")
364+ __get_dynamic_array(dst), __entry->nptes, 8))
366365 );
367366
368367 TRACE_EVENT(amdgpu_vm_set_ptes,
@@ -537,6 +536,22 @@ TRACE_EVENT(amdgpu_ib_pipe_sync, · 168 unmodified lines
537536 __entry->seqno)
538537 );
539538
539+TRACE_EVENT(amdgpu_reset_reg_dumps,
540+ TP_PROTO(uint32_t address, uint32_t value),
541+ TP_ARGS(address, value),
542+ TP_STRUCT__entry(
543+ __field(uint32_t, address)
544+ __field(uint32_t, value)
545+ ),
546+ TP_fast_assign(
547+ __entry->address = address;
548+ __entry->value = value;
549+ ),
550+ TP_printk("amdgpu register dump 0x%x: 0x%x",
551+ __entry->address,
552+ __entry->value)
553+);
554+
540555 #undef AMDGPU_JOB_GET_TIMELINE_NAME
541556 #endif
542557
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+246−165
@@ -50,6 +50,7 @@ · 49 unmodified lines
5050 #include <drm/ttm/ttm_range_manager.h>
5151
5252 #include <drm/amdgpu_drm.h>
53+#include <drm/drm_drv.h>
5354
5455 #include "amdgpu.h"
5556 #include "amdgpu_object.h"
@@ -170,10 +171,10 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, · 114 unmodified lines
170171 * @bo: buffer object to map
171172 * @mem: memory object to map
172173 * @mm_cur: range to map
173− * @num_pages: number of pages to map
174174 * @window: which GART window to use
175175 * @ring: DMA ring to use for the copy
176176 * @tmz: if we should setup a TMZ enabled mapping
177+ * @size: in number of bytes to map, out number of bytes mapped
177178 * @addr: resulting address inside the MC address space
178179 *
179180 * Setup one of the GART windows to access a specific piece of memory or return
@@ -182,15 +183,14 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, · 2 unmodified lines
182183 static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,
183184 struct ttm_resource *mem,
184185 struct amdgpu_res_cursor *mm_cur,
185− unsigned num_pages, unsigned window,
186− struct amdgpu_ring *ring, bool tmz,
187− uint64_t *addr)
186+ unsigned window, struct amdgpu_ring *ring,
187+ bool tmz, uint64_t *size, uint64_t *addr)
188188 {
189189 struct amdgpu_device *adev = ring->adev;
190− struct amdgpu_job *job;
191− unsigned num_dw, num_bytes;
192− struct dma_fence *fence;
190+ unsigned offset, num_pages, num_dw, num_bytes;
193191 uint64_t src_addr, dst_addr;
192+ struct dma_fence *fence;
193+ struct amdgpu_job *job;
194194 void *cpu_addr;
195195 uint64_t flags;
196196 unsigned int i;
@@ -198,7 +198,9 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · 1 unmodified line
198198
199199 BUG_ON(adev->mman.buffer_funcs->copy_max_bytes <
200200 AMDGPU_GTT_MAX_TRANSFER_SIZE * 8);
201− BUG_ON(mem->mem_type == AMDGPU_PL_PREEMPT);
201+
202+ if (WARN_ON(mem->mem_type == AMDGPU_PL_PREEMPT))
203+ return -EINVAL;
202204
203205 /* Map only what can't be accessed directly */
204206 if (!tmz && mem->start != AMDGPU_BO_INVALID_OFFSET) {
@@ -207,10 +209,22 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · 2 unmodified lines
207209 return 0;
208210 }
209211
212+
213+ /*
214+ * If start begins at an offset inside the page, then adjust the size
215+ * and addr accordingly
216+ */
217+ offset = mm_cur->start & ~PAGE_MASK;
218+
219+ num_pages = PFN_UP(*size + offset);
220+ num_pages = min_t(uint32_t, num_pages, AMDGPU_GTT_MAX_TRANSFER_SIZE);
221+
222+ *size = min(*size, (uint64_t)num_pages * PAGE_SIZE - offset);
223+
210224 *addr = adev->gmc.gart_start;
211225 *addr += (u64)window * AMDGPU_GTT_MAX_TRANSFER_SIZE *
212226 AMDGPU_GPU_PAGE_SIZE;
213− *addr += mm_cur->start & ~PAGE_MASK;
227+ *addr += offset;
214228
215229 num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
216230 num_bytes = num_pages * 8 * AMDGPU_GPU_PAGES_IN_CPU_PAGE;
@@ -241,10 +255,7 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · 24 unmodified lines
241255 dma_addr_t *dma_addr;
242256
243257 dma_addr = &bo->ttm->dma_address[mm_cur->start >> PAGE_SHIFT];
244− r = amdgpu_gart_map(adev, 0, num_pages, dma_addr, flags,
245− cpu_addr);
246− if (r)
247− goto error_free;
258+ amdgpu_gart_map(adev, 0, num_pages, dma_addr, flags, cpu_addr);
248259 } else {
249260 dma_addr_t dma_address;
250261
@@ -252,11 +263,8 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · 1 unmodified line
252263 dma_address += adev->vm_manager.vram_base_offset;
253264
254265 for (i = 0; i < num_pages; ++i) {
255− r = amdgpu_gart_map(adev, i << PAGE_SHIFT, 1,
256− &dma_address, flags, cpu_addr);
257− if (r)
258− goto error_free;
259−
266+ amdgpu_gart_map(adev, i << PAGE_SHIFT, 1, &dma_address,
267+ flags, cpu_addr);
260268 dma_address += PAGE_SIZE;
261269 }
262270 }
@@ -297,9 +305,6 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, · 34 unmodified lines
297305 struct dma_resv *resv,
298306 struct dma_fence **f)
299307 {
300− const uint32_t GTT_MAX_BYTES = (AMDGPU_GTT_MAX_TRANSFER_SIZE *
301− AMDGPU_GPU_PAGE_SIZE);
302−
303308 struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
304309 struct amdgpu_res_cursor src_mm, dst_mm;
305310 struct dma_fence *fence = NULL;
@@ -315,29 +320,20 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, · 9 unmodified lines
315320
316321 mutex_lock(&adev->mman.gtt_window_lock);
317322 while (src_mm.remaining) {
318− uint32_t src_page_offset = src_mm.start & ~PAGE_MASK;
319− uint32_t dst_page_offset = dst_mm.start & ~PAGE_MASK;
323+ uint64_t from, to, cur_size;
320324 struct dma_fence *next;
321− uint32_t cur_size;
322− uint64_t from, to;
323325
324− /* Copy size cannot exceed GTT_MAX_BYTES. So if src or dst
325− * begins at an offset, then adjust the size accordingly
326− */
327− cur_size = max(src_page_offset, dst_page_offset);
328− cur_size = min(min3(src_mm.size, dst_mm.size, size),
329− (uint64_t)(GTT_MAX_BYTES - cur_size));
326+ /* Never copy more than 256MiB at once to avoid a timeout */
327+ cur_size = min3(src_mm.size, dst_mm.size, 256ULL << 20);
330328
331329 /* Map src to window 0 and dst to window 1. */
332330 r = amdgpu_ttm_map_buffer(src->bo, src->mem, &src_mm,
333− PFN_UP(cur_size + src_page_offset),
334− 0, ring, tmz, &from);
331+ 0, ring, tmz, &cur_size, &from);
335332 if (r)
336333 goto error;
337334
338335 r = amdgpu_ttm_map_buffer(dst->bo, dst->mem, &dst_mm,
339− PFN_UP(cur_size + dst_page_offset),
340− 1, ring, tmz, &to);
336+ 1, ring, tmz, &cur_size, &to);
341337 if (r)
342338 goto error;
343339
@@ -396,8 +392,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo, · 52 unmodified lines
396392 (abo->flags & AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE)) {
397393 struct dma_fence *wipe_fence = NULL;
398394
399− r = amdgpu_fill_buffer(ttm_to_amdgpu_bo(bo), AMDGPU_POISON,
400− NULL, &wipe_fence);
395+ r = amdgpu_fill_buffer(abo, AMDGPU_POISON, NULL, &wipe_fence);
401396 if (r) {
402397 goto error;
403398 } else if (wipe_fence) {
@@ -821,14 +816,13 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_device *bdev, · 417 unmodified lines
821816 #endif
822817 }
823818
824−static int amdgpu_ttm_gart_bind(struct amdgpu_device *adev,
825− struct ttm_buffer_object *tbo,
826− uint64_t flags)
819+static void amdgpu_ttm_gart_bind(struct amdgpu_device *adev,
820+ struct ttm_buffer_object *tbo,
821+ uint64_t flags)
827822 {
828823 struct amdgpu_bo *abo = ttm_to_amdgpu_bo(tbo);
829824 struct ttm_tt *ttm = tbo->ttm;
830825 struct amdgpu_ttm_tt *gtt = (void *)ttm;
831− int r;
832826
833827 if (amdgpu_bo_encrypted(abo))
834828 flags |= AMDGPU_PTE_TMZ;
@@ -836,10 +830,8 @@ static int amdgpu_ttm_gart_bind(struct amdgpu_device *adev, · 1 unmodified line
836830 if (abo->flags & AMDGPU_GEM_CREATE_CP_MQD_GFX9) {
837831 uint64_t page_idx = 1;
838832
839− r = amdgpu_gart_bind(adev, gtt->offset, page_idx,
840− gtt->ttm.dma_address, flags);
841− if (r)
842− goto gart_bind_fail;
833+ amdgpu_gart_bind(adev, gtt->offset, page_idx,
834+ gtt->ttm.dma_address, flags);
843835
844836 /* The memory type of the first page defaults to UC. Now
845837 * modify the memory type to NC from the second page of
@@ -848,21 +840,13 @@ static int amdgpu_ttm_gart_bind(struct amdgpu_device *adev, · 2 unmodified lines
848840 flags &= ~AMDGPU_PTE_MTYPE_VG10_MASK;
849841 flags |= AMDGPU_PTE_MTYPE_VG10(AMDGPU_MTYPE_NC);
850842
851− r = amdgpu_gart_bind(adev,
852− gtt->offset + (page_idx << PAGE_SHIFT),
853− ttm->num_pages - page_idx,
854− &(gtt->ttm.dma_address[page_idx]), flags);
843+ amdgpu_gart_bind(adev, gtt->offset + (page_idx << PAGE_SHIFT),
844+ ttm->num_pages - page_idx,
845+ &(gtt->ttm.dma_address[page_idx]), flags);
855846 } else {
856− r = amdgpu_gart_bind(adev, gtt->offset, ttm->num_pages,
857− gtt->ttm.dma_address, flags);
847+ amdgpu_gart_bind(adev, gtt->offset, ttm->num_pages,
848+ gtt->ttm.dma_address, flags);
858849 }
859−
860−gart_bind_fail:
861− if (r)
862− DRM_ERROR("failed to bind %u pages at 0x%08llX\n",
863− ttm->num_pages, gtt->offset);
864−
865− return r;
866850 }
867851
868852 /*
@@ -878,7 +862,7 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev, · 9 unmodified lines
878862 struct amdgpu_device *adev = amdgpu_ttm_adev(bdev);
879863 struct amdgpu_ttm_tt *gtt = (void*)ttm;
880864 uint64_t flags;
881− int r = 0;
865+ int r;
882866
883867 if (!bo_mem)
884868 return -EINVAL;
@@ -925,14 +909,10 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev, · 40 unmodified lines
925909
926910 /* bind pages into GART page tables */
927911 gtt->offset = (u64)bo_mem->start << PAGE_SHIFT;
928− r = amdgpu_gart_bind(adev, gtt->offset, ttm->num_pages,
929− gtt->ttm.dma_address, flags);
930−
931− if (r)
932− DRM_ERROR("failed to bind %u pages at 0x%08llX\n",
933− ttm->num_pages, gtt->offset);
912+ amdgpu_gart_bind(adev, gtt->offset, ttm->num_pages,
913+ gtt->ttm.dma_address, flags);
934914 gtt->bound = true;
935− return r;
915+ return 0;
936916 }
937917
938918 /*
@@ -982,12 +962,7 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo) · 43 unmodified lines
982962
983963 /* Bind pages */
984964 gtt->offset = (u64)tmp->start << PAGE_SHIFT;
985− r = amdgpu_ttm_gart_bind(adev, bo, flags);
986− if (unlikely(r)) {
987− ttm_resource_free(bo, &tmp);
988− return r;
989− }
990−
965+ amdgpu_ttm_gart_bind(adev, bo, flags);
991966 amdgpu_gart_invalidate_tlb(adev);
992967 ttm_resource_free(bo, &bo->resource);
993968 ttm_bo_assign_mem(bo, tmp);
@@ -1001,19 +976,16 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo) · 7 unmodified lines
1001976 * Called by amdgpu_gtt_mgr_recover() from amdgpu_device_reset() to
1002977 * rebind GTT pages during a GPU reset.
1003978 */
1004−int amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo)
979+void amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo)
1005980 {
1006981 struct amdgpu_device *adev = amdgpu_ttm_adev(tbo->bdev);
1007982 uint64_t flags;
1008− int r;
1009983
1010984 if (!tbo->ttm)
1011− return 0;
985+ return;
1012986
1013987 flags = amdgpu_ttm_tt_pte_flags(adev, tbo->ttm, tbo->resource);
1014− r = amdgpu_ttm_gart_bind(adev, tbo, flags);
1015−
1016− return r;
988+ amdgpu_ttm_gart_bind(adev, tbo, flags);
1017989 }
1018990
1019991 /*
@@ -1027,7 +999,6 @@ static void amdgpu_ttm_backend_unbind(struct ttm_device *bdev, · 7 unmodified lines
1027999 {
10281000 struct amdgpu_device *adev = amdgpu_ttm_adev(bdev);
10291001 struct amdgpu_ttm_tt *gtt = (void *)ttm;
1030− int r;
10311002
10321003 /* if the pages have userptr pinning then clear that first */
10331004 if (gtt->userptr) {
@@ -1047,10 +1018,7 @@ static void amdgpu_ttm_backend_unbind(struct ttm_device *bdev, · 13 unmodified lines
10471018 return;
10481019
10491020 /* unbind shouldn't be done for GDS/GWS/OA in ttm_bo_clean_mm */
1050− r = amdgpu_gart_unbind(adev, gtt->offset, ttm->num_pages);
1051− if (r)
1052− DRM_ERROR("failed to unbind %u pages at 0x%08llX\n",
1053− gtt->ttm.num_pages, gtt->offset);
1021+ amdgpu_gart_unbind(adev, gtt->offset, ttm->num_pages);
10541022 gtt->bound = false;
10551023 }
10561024
@@ -1168,6 +1136,26 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_device *bdev, · 111 unmodified lines
11681136 return ttm_pool_free(&adev->mman.bdev.pool, ttm);
11691137 }
11701138
1139+/**
1140+ * amdgpu_ttm_tt_get_userptr - Return the userptr GTT ttm_tt for the current
1141+ * task
1142+ *
1143+ * @tbo: The ttm_buffer_object that contains the userptr
1144+ * @user_addr: The returned value
1145+ */
1146+int amdgpu_ttm_tt_get_userptr(const struct ttm_buffer_object *tbo,
1147+ uint64_t *user_addr)
1148+{
1149+ struct amdgpu_ttm_tt *gtt;
1150+
1151+ if (!tbo->ttm)
1152+ return -EINVAL;
1153+
1154+ gtt = (void *)tbo->ttm;
1155+ *user_addr = gtt->userptr;
1156+ return 0;
1157+}
1158+
11711159 /**
11721160 * amdgpu_ttm_tt_set_userptr - Initialize userptr GTT ttm_tt for the current
11731161 * task
@@ -1433,6 +1421,63 @@ static void amdgpu_ttm_vram_mm_access(struct amdgpu_device *adev, loff_t pos, · 259 unmodified lines
14331421 }
14341422 }
14351423
1424+static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo,
1425+ unsigned long offset, void *buf, int len, int write)
1426+{
1427+ struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);
1428+ struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
1429+ struct amdgpu_res_cursor src_mm;
1430+ struct amdgpu_job *job;
1431+ struct dma_fence *fence;
1432+ uint64_t src_addr, dst_addr;
1433+ unsigned int num_dw;
1434+ int r, idx;
1435+
1436+ if (len != PAGE_SIZE)
1437+ return -EINVAL;
1438+
1439+ if (!adev->mman.sdma_access_ptr)
1440+ return -EACCES;
1441+
1442+ if (!drm_dev_enter(adev_to_drm(adev), &idx))
1443+ return -ENODEV;
1444+
1445+ if (write)
1446+ memcpy(adev->mman.sdma_access_ptr, buf, len);
1447+
1448+ num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
1449+ r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, AMDGPU_IB_POOL_DELAYED, &job);
1450+ if (r)
1451+ goto out;
1452+
1453+ amdgpu_res_first(abo->tbo.resource, offset, len, &src_mm);
1454+ src_addr = amdgpu_ttm_domain_start(adev, bo->resource->mem_type) + src_mm.start;
1455+ dst_addr = amdgpu_bo_gpu_offset(adev->mman.sdma_access_bo);
1456+ if (write)
1457+ swap(src_addr, dst_addr);
1458+
1459+ amdgpu_emit_copy_buffer(adev, &job->ibs[0], src_addr, dst_addr, PAGE_SIZE, false);
1460+
1461+ amdgpu_ring_pad_ib(adev->mman.buffer_funcs_ring, &job->ibs[0]);
1462+ WARN_ON(job->ibs[0].length_dw > num_dw);
1463+
1464+ r = amdgpu_job_submit(job, &adev->mman.entity, AMDGPU_FENCE_OWNER_UNDEFINED, &fence);
1465+ if (r) {
1466+ amdgpu_job_free(job);
1467+ goto out;
1468+ }
1469+
1470+ if (!dma_fence_wait_timeout(fence, false, adev->sdma_timeout))
1471+ r = -ETIMEDOUT;
1472+ dma_fence_put(fence);
1473+
1474+ if (!(r || write))
1475+ memcpy(buf, adev->mman.sdma_access_ptr, len);
1476+out:
1477+ drm_dev_exit(idx);
1478+ return r;
1479+}
1480+
14361481 /**
14371482 * amdgpu_ttm_access_memory - Read or Write memory that backs a buffer object.
14381483 *
@@ -1457,6 +1502,10 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, · 18 unmodified lines
14571502 if (bo->resource->mem_type != TTM_PL_VRAM)
14581503 return -EIO;
14591504
1505+ if (amdgpu_device_has_timeouts_enabled(adev) &&
1506+ !amdgpu_ttm_access_memory_sdma(bo, offset, buf, len, write))
1507+ return len;
1508+
14601509 amdgpu_res_first(bo->resource, offset, len, &cursor);
14611510 while (cursor.remaining) {
14621511 size_t count, size = cursor.size;
@@ -1797,6 +1846,12 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) · 334 unmodified lines
17971846 return r;
17981847 }
17991848
1849+ if (amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
1850+ AMDGPU_GEM_DOMAIN_GTT,
1851+ &adev->mman.sdma_access_bo, NULL,
1852+ &adev->mman.sdma_access_ptr))
1853+ DRM_WARN("Debug VRAM access will use slowpath MM access\n");
1854+
18001855 return 0;
18011856 }
18021857
@@ -1818,6 +1873,8 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev) · 15 unmodified lines
18181873 if (adev->mman.stolen_reserved_size)
18191874 amdgpu_bo_free_kernel(&adev->mman.stolen_reserved_memory,
18201875 NULL, NULL);
1876+ amdgpu_bo_free_kernel(&adev->mman.sdma_access_bo, NULL,
1877+ &adev->mman.sdma_access_ptr);
18211878 amdgpu_ttm_fw_reserve_vram_fini(adev);
18221879
18231880 if (drm_dev_enter(adev_to_drm(adev), &idx)) {
@@ -1884,27 +1941,59 @@ void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable) · 60 unmodified lines
18841941 size = adev->gmc.real_vram_size;
18851942 else
18861943 size = adev->gmc.visible_vram_size;
1887− man->size = size >> PAGE_SHIFT;
1944+ man->size = size;
18881945 adev->mman.buffer_funcs_enabled = enable;
18891946 }
18901947
1948+static int amdgpu_ttm_prepare_job(struct amdgpu_device *adev,
1949+ bool direct_submit,
1950+ unsigned int num_dw,
1951+ struct dma_resv *resv,
1952+ bool vm_needs_flush,
1953+ struct amdgpu_job **job)
1954+{
1955+ enum amdgpu_ib_pool_type pool = direct_submit ?
1956+ AMDGPU_IB_POOL_DIRECT :
1957+ AMDGPU_IB_POOL_DELAYED;
1958+ int r;
1959+
1960+ r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, pool, job);
1961+ if (r)
1962+ return r;
1963+
1964+ if (vm_needs_flush) {
1965+ (*job)->vm_pd_addr = amdgpu_gmc_pd_addr(adev->gmc.pdb0_bo ?
1966+ adev->gmc.pdb0_bo :
1967+ adev->gart.bo);
1968+ (*job)->vm_needs_flush = true;
1969+ }
1970+ if (resv) {
1971+ r = amdgpu_sync_resv(adev, &(*job)->sync, resv,
1972+ AMDGPU_SYNC_ALWAYS,
1973+ AMDGPU_FENCE_OWNER_UNDEFINED);
1974+ if (r) {
1975+ DRM_ERROR("sync failed (%d).\n", r);
1976+ amdgpu_job_free(*job);
1977+ return r;
1978+ }
1979+ }
1980+ return 0;
1981+}
1982+
18911983 int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
18921984 uint64_t dst_offset, uint32_t byte_count,
18931985 struct dma_resv *resv,
18941986 struct dma_fence **fence, bool direct_submit,
18951987 bool vm_needs_flush, bool tmz)
18961988 {
1897− enum amdgpu_ib_pool_type pool = direct_submit ? AMDGPU_IB_POOL_DIRECT :
1898− AMDGPU_IB_POOL_DELAYED;
18991989 struct amdgpu_device *adev = ring->adev;
1990+ unsigned num_loops, num_dw;
19001991 struct amdgpu_job *job;
1901−
19021992 uint32_t max_bytes;
1903− unsigned num_loops, num_dw;
19041993 unsigned i;
19051994 int r;
19061995
1907− if (direct_submit && !ring->sched.ready) {
1996+ if (!direct_submit && !ring->sched.ready) {
19081997 DRM_ERROR("Trying to move memory with ring turned off.\n");
19091998 return -EINVAL;
19101999 }
@@ -1912,26 +2001,11 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, · 1 unmodified line
19122001 max_bytes = adev->mman.buffer_funcs->copy_max_bytes;
19132002 num_loops = DIV_ROUND_UP(byte_count, max_bytes);
19142003 num_dw = ALIGN(num_loops * adev->mman.buffer_funcs->copy_num_dw, 8);
1915−
1916− r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, pool, &job);
2004+ r = amdgpu_ttm_prepare_job(adev, direct_submit, num_dw,
2005+ resv, vm_needs_flush, &job);
19172006 if (r)
19182007 return r;
19192008
1920− if (vm_needs_flush) {
1921− job->vm_pd_addr = amdgpu_gmc_pd_addr(adev->gmc.pdb0_bo ?
1922− adev->gmc.pdb0_bo : adev->gart.bo);
1923− job->vm_needs_flush = true;
1924− }
1925− if (resv) {
1926− r = amdgpu_sync_resv(adev, &job->sync, resv,
1927− AMDGPU_SYNC_ALWAYS,
1928− AMDGPU_FENCE_OWNER_UNDEFINED);
1929− if (r) {
1930− DRM_ERROR("sync failed (%d).\n", r);
1931− goto error_free;
1932− }
1933− }
1934−
19352009 for (i = 0; i < num_loops; i++) {
19362010 uint32_t cur_size_in_bytes = min(byte_count, max_bytes);
19372011
@@ -1961,77 +2035,35 @@ error_free: · 23 unmodified lines
19612035 return r;
19622036 }
19632037
1964−int amdgpu_fill_buffer(struct amdgpu_bo *bo,
1965− uint32_t src_data,
1966− struct dma_resv *resv,
1967− struct dma_fence **fence)
2038+static int amdgpu_ttm_fill_mem(struct amdgpu_ring *ring, uint32_t src_data,
2039+ uint64_t dst_addr, uint32_t byte_count,
2040+ struct dma_resv *resv,
2041+ struct dma_fence **fence,
2042+ bool vm_needs_flush)
19682043 {
1969− struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
1970− uint32_t max_bytes = adev->mman.buffer_funcs->fill_max_bytes;
1971− struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
1972−
1973− struct amdgpu_res_cursor cursor;
2044+ struct amdgpu_device *adev = ring->adev;
19742045 unsigned int num_loops, num_dw;
1975− uint64_t num_bytes;
1976−
19772046 struct amdgpu_job *job;
2047+ uint32_t max_bytes;
2048+ unsigned int i;
19782049 int r;
19792050
1980− if (!adev->mman.buffer_funcs_enabled) {
1981− DRM_ERROR("Trying to clear memory with ring turned off.\n");
1982− return -EINVAL;
1983− }
1984−
1985− if (bo->tbo.resource->mem_type == AMDGPU_PL_PREEMPT) {
1986− DRM_ERROR("Trying to clear preemptible memory.\n");
1987− return -EINVAL;
1988− }
1989−
1990− if (bo->tbo.resource->mem_type == TTM_PL_TT) {
1991− r = amdgpu_ttm_alloc_gart(&bo->tbo);
1992− if (r)
1993− return r;
1994− }
1995−
1996− num_bytes = bo->tbo.resource->num_pages << PAGE_SHIFT;
1997− num_loops = 0;
1998−
1999− amdgpu_res_first(bo->tbo.resource, 0, num_bytes, &cursor);
2000− while (cursor.remaining) {
2001− num_loops += DIV_ROUND_UP_ULL(cursor.size, max_bytes);
2002− amdgpu_res_next(&cursor, cursor.size);
2003− }
2004− num_dw = num_loops * adev->mman.buffer_funcs->fill_num_dw;
2005−
2006− /* for IB padding */
2007− num_dw += 64;
2008−
2009− r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, AMDGPU_IB_POOL_DELAYED,
2010− &job);
2051+ max_bytes = adev->mman.buffer_funcs->fill_max_bytes;
2052+ num_loops = DIV_ROUND_UP_ULL(byte_count, max_bytes);
2053+ num_dw = ALIGN(num_loops * adev->mman.buffer_funcs->fill_num_dw, 8);
2054+ r = amdgpu_ttm_prepare_job(adev, false, num_dw, resv, vm_needs_flush,
2055+ &job);
20112056 if (r)
20122057 return r;
20132058
2014− if (resv) {
2015− r = amdgpu_sync_resv(adev, &job->sync, resv,
2016− AMDGPU_SYNC_ALWAYS,
2017− AMDGPU_FENCE_OWNER_UNDEFINED);
2018− if (r) {
2019− DRM_ERROR("sync failed (%d).\n", r);
2020− goto error_free;
2021− }
2022− }
2023−
2024− amdgpu_res_first(bo->tbo.resource, 0, num_bytes, &cursor);
2025− while (cursor.remaining) {
2026− uint32_t cur_size = min_t(uint64_t, cursor.size, max_bytes);
2027− uint64_t dst_addr = cursor.start;
2059+ for (i = 0; i < num_loops; i++) {
2060+ uint32_t cur_size = min(byte_count, max_bytes);
20282061
2029− dst_addr += amdgpu_ttm_domain_start(adev,
2030− bo->tbo.resource->mem_type);
20312062 amdgpu_emit_fill_buffer(adev, &job->ibs[0], src_data, dst_addr,
20322063 cur_size);
20332064
2034− amdgpu_res_next(&cursor, cur_size);
2065+ dst_addr += cur_size;
2066+ byte_count -= cur_size;
20352067 }
20362068
20372069 amdgpu_ring_pad_ib(ring, &job->ibs[0]);
@@ -2048,6 +2080,55 @@ error_free: · 10 unmodified lines
20482080 return r;
20492081 }
20502082
2083+int amdgpu_fill_buffer(struct amdgpu_bo *bo,
2084+ uint32_t src_data,
2085+ struct dma_resv *resv,
2086+ struct dma_fence **f)
2087+{
2088+ struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
2089+ struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
2090+ struct dma_fence *fence = NULL;
2091+ struct amdgpu_res_cursor dst;
2092+ int r;
2093+
2094+ if (!adev->mman.buffer_funcs_enabled) {
2095+ DRM_ERROR("Trying to clear memory with ring turned off.\n");
2096+ return -EINVAL;
2097+ }
2098+
2099+ amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &dst);
2100+
2101+ mutex_lock(&adev->mman.gtt_window_lock);
2102+ while (dst.remaining) {
2103+ struct dma_fence *next;
2104+ uint64_t cur_size, to;
2105+
2106+ /* Never fill more than 256MiB at once to avoid timeouts */
2107+ cur_size = min(dst.size, 256ULL << 20);
2108+
2109+ r = amdgpu_ttm_map_buffer(&bo->tbo, bo->tbo.resource, &dst,
2110+ 1, ring, false, &cur_size, &to);
2111+ if (r)
2112+ goto error;
2113+
2114+ r = amdgpu_ttm_fill_mem(ring, src_data, to, cur_size, resv,
2115+ &next, true);
2116+ if (r)
2117+ goto error;
2118+
2119+ dma_fence_put(fence);
2120+ fence = next;
2121+
2122+ amdgpu_res_next(&dst, cur_size);
2123+ }
2124+error:
2125+ mutex_unlock(&adev->mman.gtt_window_lock);
2126+ if (f)
2127+ *f = dma_fence_get(fence);
2128+ dma_fence_put(fence);
2129+ return r;
2130+}
2131+
20512132 /**
20522133 * amdgpu_ttm_evict_resources - evict memory buffers
20532134 * @adev: amdgpu device object
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h+9−12
@@ -44,7 +44,6 @@ struct amdgpu_vram_mgr { · 43 unmodified lines
4444 spinlock_t lock;
4545 struct list_head reservations_pending;
4646 struct list_head reserved_pages;
47− atomic64_t usage;
4847 atomic64_t vis_usage;
4948 };
5049
@@ -52,12 +51,6 @@ struct amdgpu_gtt_mgr { · 1 unmodified line
5251 struct ttm_resource_manager manager;
5352 struct drm_mm mm;
5453 spinlock_t lock;
55− atomic64_t used;
56−};
57−
58−struct amdgpu_preempt_mgr {
59− struct ttm_resource_manager manager;
60− atomic64_t used;
6154 };
6255
6356 struct amdgpu_mman {
@@ -76,7 +69,7 @@ struct amdgpu_mman { · 12 unmodified lines
7669
7770 struct amdgpu_vram_mgr vram_mgr;
7871 struct amdgpu_gtt_mgr gtt_mgr;
79− struct amdgpu_preempt_mgr preempt_mgr;
72+ struct ttm_resource_manager preempt_mgr;
8073
8174 uint64_t stolen_vga_size;
8275 struct amdgpu_bo *stolen_vga_memory;
@@ -98,6 +91,10 @@ struct amdgpu_mman { · 15 unmodified lines
9891 u64 fw_vram_usage_size;
9992 struct amdgpu_bo *fw_vram_usage_reserved_bo;
10093 void *fw_vram_usage_va;
94+
95+ /* PAGE_SIZE'd BO for process memory r/w over SDMA. */
96+ struct amdgpu_bo *sdma_access_bo;
97+ void *sdma_access_ptr;
10198 };
10299
103100 struct amdgpu_copy_mem {
@@ -114,8 +111,7 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev); · 10 unmodified lines
114111 void amdgpu_vram_mgr_fini(struct amdgpu_device *adev);
115112
116113 bool amdgpu_gtt_mgr_has_gart_addr(struct ttm_resource *mem);
117−uint64_t amdgpu_gtt_mgr_usage(struct amdgpu_gtt_mgr *mgr);
118−int amdgpu_gtt_mgr_recover(struct amdgpu_gtt_mgr *mgr);
114+void amdgpu_gtt_mgr_recover(struct amdgpu_gtt_mgr *mgr);
119115
120116 uint64_t amdgpu_preempt_mgr_usage(struct ttm_resource_manager *man);
121117
@@ -129,7 +125,6 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev, · 7 unmodified lines
129125 void amdgpu_vram_mgr_free_sgt(struct device *dev,
130126 enum dma_data_direction dir,
131127 struct sg_table *sgt);
132−uint64_t amdgpu_vram_mgr_usage(struct amdgpu_vram_mgr *mgr);
133128 uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr);
134129 int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr,
135130 uint64_t start, uint64_t size);
@@ -158,7 +153,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, · 22 unmodified lines
158153 struct dma_fence **fence);
159154
160155 int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo);
161−int amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo);
156+void amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo);
162157 uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type);
163158
164159 #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
@@ -177,6 +172,8 @@ static inline bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm) · 12 unmodified lines
177172 #endif
178173
179174 void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages);
175+int amdgpu_ttm_tt_get_userptr(const struct ttm_buffer_object *tbo,
176+ uint64_t *user_addr);
180177 int amdgpu_ttm_tt_set_userptr(struct ttm_buffer_object *bo,
181178 uint64_t addr, uint32_t flags);
182179 bool amdgpu_ttm_tt_has_userptr(struct ttm_tt *ttm);
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h+1−0
@@ -378,6 +378,7 @@ enum AMDGPU_UCODE_ID { · 377 unmodified lines
378378 AMDGPU_UCODE_ID_VCN0_RAM,
379379 AMDGPU_UCODE_ID_VCN1_RAM,
380380 AMDGPU_UCODE_ID_DMCUB,
381+ AMDGPU_UCODE_ID_CAP,
381382 AMDGPU_UCODE_ID_MAXIMUM,
382383 };
383384
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c+47−59
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 *
2222 */
2323
24−#include "amdgpu_ras.h"
24+#include "amdgpu.h"
2525
2626 static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev,
2727 void *ras_error_status,
@@ -33,14 +33,14 @@ static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev, · 5 unmodified lines
3333 int ret = 0;
3434
3535 kgd2kfd_set_sram_ecc_flag(adev->kfd.dev);
36− ret = smu_get_ecc_info(&adev->smu, (void *)&(con->umc_ecc));
36+ ret = amdgpu_dpm_get_ecc_info(adev, (void *)&(con->umc_ecc));
3737 if (ret == -EOPNOTSUPP) {
38− if (adev->umc.ras_funcs &&
39− adev->umc.ras_funcs->query_ras_error_count)
40− adev->umc.ras_funcs->query_ras_error_count(adev, ras_error_status);
38+ if (adev->umc.ras && adev->umc.ras->ras_block.hw_ops &&
39+ adev->umc.ras->ras_block.hw_ops->query_ras_error_count)
40+ adev->umc.ras->ras_block.hw_ops->query_ras_error_count(adev, ras_error_status);
4141
42− if (adev->umc.ras_funcs &&
43− adev->umc.ras_funcs->query_ras_error_address &&
42+ if (adev->umc.ras && adev->umc.ras->ras_block.hw_ops &&
43+ adev->umc.ras->ras_block.hw_ops->query_ras_error_address &&
4444 adev->umc.max_ras_err_cnt_per_query) {
4545 err_data->err_addr =
4646 kcalloc(adev->umc.max_ras_err_cnt_per_query,
@@ -56,15 +56,15 @@ static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev, · 9 unmodified lines
5656 /* umc query_ras_error_address is also responsible for clearing
5757 * error status
5858 */
59− adev->umc.ras_funcs->query_ras_error_address(adev, ras_error_status);
59+ adev->umc.ras->ras_block.hw_ops->query_ras_error_address(adev, ras_error_status);
6060 }
6161 } else if (!ret) {
62− if (adev->umc.ras_funcs &&
63− adev->umc.ras_funcs->ecc_info_query_ras_error_count)
64− adev->umc.ras_funcs->ecc_info_query_ras_error_count(adev, ras_error_status);
62+ if (adev->umc.ras &&
63+ adev->umc.ras->ecc_info_query_ras_error_count)
64+ adev->umc.ras->ecc_info_query_ras_error_count(adev, ras_error_status);
6565
66− if (adev->umc.ras_funcs &&
67− adev->umc.ras_funcs->ecc_info_query_ras_error_address &&
66+ if (adev->umc.ras &&
67+ adev->umc.ras->ecc_info_query_ras_error_address &&
6868 adev->umc.max_ras_err_cnt_per_query) {
6969 err_data->err_addr =
7070 kcalloc(adev->umc.max_ras_err_cnt_per_query,
@@ -80,7 +80,7 @@ static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev, · 9 unmodified lines
8080 /* umc query_ras_error_address is also responsible for clearing
8181 * error status
8282 */
83− adev->umc.ras_funcs->ecc_info_query_ras_error_address(adev, ras_error_status);
83+ adev->umc.ras->ecc_info_query_ras_error_address(adev, ras_error_status);
8484 }
8585 }
8686
@@ -96,8 +96,7 @@ static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev, · 9 unmodified lines
9696 err_data->err_addr_cnt);
9797 amdgpu_ras_save_bad_pages(adev);
9898
99− if (adev->smu.ppt_funcs && adev->smu.ppt_funcs->send_hbm_bad_pages_num)
100− adev->smu.ppt_funcs->send_hbm_bad_pages_num(&adev->smu, con->eeprom_control.ras_num_recs);
99+ amdgpu_dpm_send_hbm_bad_pages_num(adev, con->eeprom_control.ras_num_recs);
101100 }
102101
103102 if (reset)
@@ -130,76 +129,44 @@ int amdgpu_umc_poison_handler(struct amdgpu_device *adev, · 26 unmodified lines
130129 return ret;
131130 }
132131
133−static int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev,
132+int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev,
134133 void *ras_error_status,
135134 struct amdgpu_iv_entry *entry)
136135 {
137136 return amdgpu_umc_do_page_retirement(adev, ras_error_status, entry, true);
138137 }
139138
140−int amdgpu_umc_ras_late_init(struct amdgpu_device *adev)
139+int amdgpu_umc_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block)
141140 {
142141 int r;
143− struct ras_fs_if fs_info = {
144− .sysfs_name = "umc_err_count",
145− };
146− struct ras_ih_if ih_info = {
147− .cb = amdgpu_umc_process_ras_data_cb,
148− };
149−
150− if (!adev->umc.ras_if) {
151− adev->umc.ras_if =
152− kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
153− if (!adev->umc.ras_if)
154− return -ENOMEM;
155− adev->umc.ras_if->block = AMDGPU_RAS_BLOCK__UMC;
156− adev->umc.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
157− adev->umc.ras_if->sub_block_index = 0;
158− }
159− ih_info.head = fs_info.head = *adev->umc.ras_if;
160142
161− r = amdgpu_ras_late_init(adev, adev->umc.ras_if,
162− &fs_info, &ih_info);
143+ r = amdgpu_ras_block_late_init(adev, ras_block);
163144 if (r)
164− goto free;
145+ return r;
165146
166− if (amdgpu_ras_is_supported(adev, adev->umc.ras_if->block)) {
147+ if (amdgpu_ras_is_supported(adev, ras_block->block)) {
167148 r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0);
168149 if (r)
169150 goto late_fini;
170− } else {
171− r = 0;
172− goto free;
173151 }
174152
175153 /* ras init of specific umc version */
176− if (adev->umc.ras_funcs &&
177− adev->umc.ras_funcs->err_cnt_init)
178− adev->umc.ras_funcs->err_cnt_init(adev);
154+ if (adev->umc.ras &&
155+ adev->umc.ras->err_cnt_init)
156+ adev->umc.ras->err_cnt_init(adev);
179157
180158 return 0;
181159
182160 late_fini:
183− amdgpu_ras_late_fini(adev, adev->umc.ras_if, &ih_info);
184−free:
185− kfree(adev->umc.ras_if);
186− adev->umc.ras_if = NULL;
161+ amdgpu_ras_block_late_fini(adev, ras_block);
187162 return r;
188163 }
189164
190165 void amdgpu_umc_ras_fini(struct amdgpu_device *adev)
191166 {
192167 if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) &&
193− adev->umc.ras_if) {
194− struct ras_common_if *ras_if = adev->umc.ras_if;
195− struct ras_ih_if ih_info = {
196− .head = *ras_if,
197− .cb = amdgpu_umc_process_ras_data_cb,
198− };
199−
200− amdgpu_ras_late_fini(adev, ras_if, &ih_info);
201− kfree(ras_if);
202− }
168+ adev->umc.ras_if)
169+ amdgpu_ras_block_late_fini(adev, adev->umc.ras_if);
203170 }
204171
205172 int amdgpu_umc_process_ecc_irq(struct amdgpu_device *adev,
@@ -219,3 +186,24 @@ int amdgpu_umc_process_ecc_irq(struct amdgpu_device *adev, · 13 unmodified lines
219186 amdgpu_ras_interrupt_dispatch(adev, &ih_data);
220187 return 0;
221188 }
189+
190+void amdgpu_umc_fill_error_record(struct ras_err_data *err_data,
191+ uint64_t err_addr,
192+ uint64_t retired_page,
193+ uint32_t channel_index,
194+ uint32_t umc_inst)
195+{
196+ struct eeprom_table_record *err_rec =
197+ &err_data->err_addr[err_data->err_addr_cnt];
198+
199+ err_rec->address = err_addr;
200+ /* page frame address is saved */
201+ err_rec->retired_page = retired_page >> AMDGPU_GPU_PAGE_SHIFT;
202+ err_rec->ts = (uint64_t)ktime_get_real_seconds();
203+ err_rec->err_type = AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE;
204+ err_rec->cu = 0;
205+ err_rec->mem_channel = channel_index;
206+ err_rec->mcumc_id = umc_inst;
207+
208+ err_data->err_addr_cnt++;
209+}
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h+14−9
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 */
2121 #ifndef __AMDGPU_UMC_H__
2222 #define __AMDGPU_UMC_H__
23+#include "amdgpu_ras.h"
2324
2425 /*
2526 * (addr / 256) * 4096, the higher 26 bits in ErrorAddr
@@ -40,14 +41,9 @@ · 14 unmodified lines
4041 #define LOOP_UMC_CH_INST(ch_inst) for ((ch_inst) = 0; (ch_inst) < adev->umc.channel_inst_num; (ch_inst)++)
4142 #define LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) LOOP_UMC_INST((umc_inst)) LOOP_UMC_CH_INST((ch_inst))
4243
43−struct amdgpu_umc_ras_funcs {
44+struct amdgpu_umc_ras {
45+ struct amdgpu_ras_block_object ras_block;
4446 void (*err_cnt_init)(struct amdgpu_device *adev);
45− int (*ras_late_init)(struct amdgpu_device *adev);
46− void (*ras_fini)(struct amdgpu_device *adev);
47− void (*query_ras_error_count)(struct amdgpu_device *adev,
48− void *ras_error_status);
49− void (*query_ras_error_address)(struct amdgpu_device *adev,
50− void *ras_error_status);
5147 bool (*query_ras_poison_mode)(struct amdgpu_device *adev);
5248 void (*ecc_info_query_ras_error_count)(struct amdgpu_device *adev,
5349 void *ras_error_status);
@@ -73,10 +69,10 @@ struct amdgpu_umc { · 19 unmodified lines
7369 struct ras_common_if *ras_if;
7470
7571 const struct amdgpu_umc_funcs *funcs;
76− const struct amdgpu_umc_ras_funcs *ras_funcs;
72+ struct amdgpu_umc_ras *ras;
7773 };
7874
79−int amdgpu_umc_ras_late_init(struct amdgpu_device *adev);
75+int amdgpu_umc_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block);
8076 void amdgpu_umc_ras_fini(struct amdgpu_device *adev);
8177 int amdgpu_umc_poison_handler(struct amdgpu_device *adev,
8278 void *ras_error_status,
@@ -84,4 +80,13 @@ int amdgpu_umc_poison_handler(struct amdgpu_device *adev, · 1 unmodified line
8480 int amdgpu_umc_process_ecc_irq(struct amdgpu_device *adev,
8581 struct amdgpu_irq_src *source,
8682 struct amdgpu_iv_entry *entry);
83+void amdgpu_umc_fill_error_record(struct ras_err_data *err_data,
84+ uint64_t err_addr,
85+ uint64_t retired_page,
86+ uint32_t channel_index,
87+ uint32_t umc_inst);
88+
89+int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev,
90+ void *ras_error_status,
91+ struct amdgpu_iv_entry *entry);
8792 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c+2−0
@@ -834,6 +834,7 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx, · 833 unmodified lines
834834 handle = msg[2];
835835
836836 if (handle == 0) {
837+ amdgpu_bo_kunmap(bo);
837838 DRM_ERROR("Invalid UVD handle!\n");
838839 return -EINVAL;
839840 }
@@ -892,6 +893,7 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx, · 52 unmodified lines
892893 DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
893894 }
894895
896+ amdgpu_bo_kunmap(bo);
895897 return -EINVAL;
896898 }
897899
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c+8−0
@@ -51,6 +51,7 @@ · 50 unmodified lines
5151 #define FIRMWARE_ALDEBARAN "amdgpu/aldebaran_vcn.bin"
5252 #define FIRMWARE_BEIGE_GOBY "amdgpu/beige_goby_vcn.bin"
5353 #define FIRMWARE_YELLOW_CARP "amdgpu/yellow_carp_vcn.bin"
54+#define FIRMWARE_VCN_3_1_2 "amdgpu/vcn_3_1_2_vcn.bin"
5455
5556 MODULE_FIRMWARE(FIRMWARE_RAVEN);
5657 MODULE_FIRMWARE(FIRMWARE_PICASSO);
@@ -68,6 +69,7 @@ MODULE_FIRMWARE(FIRMWARE_VANGOGH); · 11 unmodified lines
6869 MODULE_FIRMWARE(FIRMWARE_DIMGREY_CAVEFISH);
6970 MODULE_FIRMWARE(FIRMWARE_BEIGE_GOBY);
7071 MODULE_FIRMWARE(FIRMWARE_YELLOW_CARP);
72+MODULE_FIRMWARE(FIRMWARE_VCN_3_1_2);
7173
7274 static void amdgpu_vcn_idle_work_handler(struct work_struct *work);
7375
@@ -165,6 +167,12 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) · 91 unmodified lines
165167 (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
166168 adev->vcn.indirect_sram = true;
167169 break;
170+ case IP_VERSION(3, 1, 2):
171+ fw_name = FIRMWARE_VCN_3_1_2;
172+ if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
173+ (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
174+ adev->vcn.indirect_sram = true;
175+ break;
168176 default:
169177 return -EINVAL;
170178 }
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c+149−2
@@ -575,8 +575,10 @@ static int amdgpu_virt_write_vf2pf_data(struct amdgpu_device *adev) · 574 unmodified lines
575575 vf2pf_info->driver_cert = 0;
576576 vf2pf_info->os_info.all = 0;
577577
578− vf2pf_info->fb_usage = amdgpu_vram_mgr_usage(&adev->mman.vram_mgr) >> 20;
579− vf2pf_info->fb_vis_usage = amdgpu_vram_mgr_vis_usage(&adev->mman.vram_mgr) >> 20;
578+ vf2pf_info->fb_usage =
579+ ttm_resource_manager_usage(&adev->mman.vram_mgr.manager) >> 20;
580+ vf2pf_info->fb_vis_usage =
581+ amdgpu_vram_mgr_vis_usage(&adev->mman.vram_mgr) >> 20;
580582 vf2pf_info->fb_size = adev->gmc.real_vram_size >> 20;
581583 vf2pf_info->fb_vis_size = adev->gmc.visible_vram_size >> 20;
582584
@@ -820,3 +822,148 @@ void amdgpu_virt_update_sriov_video_codec(struct amdgpu_device *adev, · 237 unmodified lines
820822 }
821823 }
822824 }
825+
826+static bool amdgpu_virt_get_rlcg_reg_access_flag(struct amdgpu_device *adev,
827+ u32 acc_flags, u32 hwip,
828+ bool write, u32 *rlcg_flag)
829+{
830+ bool ret = false;
831+
832+ switch (hwip) {
833+ case GC_HWIP:
834+ if (amdgpu_sriov_reg_indirect_gc(adev)) {
835+ *rlcg_flag =
836+ write ? AMDGPU_RLCG_GC_WRITE : AMDGPU_RLCG_GC_READ;
837+ ret = true;
838+ /* only in new version, AMDGPU_REGS_NO_KIQ and
839+ * AMDGPU_REGS_RLC are enabled simultaneously */
840+ } else if ((acc_flags & AMDGPU_REGS_RLC) &&
841+ !(acc_flags & AMDGPU_REGS_NO_KIQ) && write) {
842+ *rlcg_flag = AMDGPU_RLCG_GC_WRITE_LEGACY;
843+ ret = true;
844+ }
845+ break;
846+ case MMHUB_HWIP:
847+ if (amdgpu_sriov_reg_indirect_mmhub(adev) &&
848+ (acc_flags & AMDGPU_REGS_RLC) && write) {
849+ *rlcg_flag = AMDGPU_RLCG_MMHUB_WRITE;
850+ ret = true;
851+ }
852+ break;
853+ default:
854+ break;
855+ }
856+ return ret;
857+}
858+
859+static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 flag)
860+{
861+ struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
862+ uint32_t timeout = 50000;
863+ uint32_t i, tmp;
864+ uint32_t ret = 0;
865+ static void *scratch_reg0;
866+ static void *scratch_reg1;
867+ static void *scratch_reg2;
868+ static void *scratch_reg3;
869+ static void *spare_int;
870+
871+ if (!adev->gfx.rlc.rlcg_reg_access_supported) {
872+ dev_err(adev->dev,
873+ "indirect registers access through rlcg is not available\n");
874+ return 0;
875+ }
876+
877+ reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl;
878+ scratch_reg0 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg0;
879+ scratch_reg1 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg1;
880+ scratch_reg2 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg2;
881+ scratch_reg3 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg3;
882+ if (reg_access_ctrl->spare_int)
883+ spare_int = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->spare_int;
884+
885+ if (offset == reg_access_ctrl->grbm_cntl) {
886+ /* if the target reg offset is grbm_cntl, write to scratch_reg2 */
887+ writel(v, scratch_reg2);
888+ writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
889+ } else if (offset == reg_access_ctrl->grbm_idx) {
890+ /* if the target reg offset is grbm_idx, write to scratch_reg3 */
891+ writel(v, scratch_reg3);
892+ writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
893+ } else {
894+ /*
895+ * SCRATCH_REG0 = read/write value
896+ * SCRATCH_REG1[30:28] = command
897+ * SCRATCH_REG1[19:0] = address in dword
898+ * SCRATCH_REG1[26:24] = Error reporting
899+ */
900+ writel(v, scratch_reg0);
901+ writel((offset | flag), scratch_reg1);
902+ if (reg_access_ctrl->spare_int)
903+ writel(1, spare_int);
904+
905+ for (i = 0; i < timeout; i++) {
906+ tmp = readl(scratch_reg1);
907+ if (!(tmp & AMDGPU_RLCG_SCRATCH1_ADDRESS_MASK))
908+ break;
909+ udelay(10);
910+ }
911+
912+ if (i >= timeout) {
913+ if (amdgpu_sriov_rlcg_error_report_enabled(adev)) {
914+ if (tmp & AMDGPU_RLCG_VFGATE_DISABLED) {
915+ dev_err(adev->dev,
916+ "vfgate is disabled, rlcg failed to program reg: 0x%05x\n", offset);
917+ } else if (tmp & AMDGPU_RLCG_WRONG_OPERATION_TYPE) {
918+ dev_err(adev->dev,
919+ "wrong operation type, rlcg failed to program reg: 0x%05x\n", offset);
920+ } else if (tmp & AMDGPU_RLCG_REG_NOT_IN_RANGE) {
921+ dev_err(adev->dev,
922+ "regiser is not in range, rlcg failed to program reg: 0x%05x\n", offset);
923+ } else {
924+ dev_err(adev->dev,
925+ "unknown error type, rlcg failed to program reg: 0x%05x\n", offset);
926+ }
927+ } else {
928+ dev_err(adev->dev,
929+ "timeout: rlcg faled to program reg: 0x%05x\n", offset);
930+ }
931+ }
932+ }
933+
934+ ret = readl(scratch_reg0);
935+ return ret;
936+}
937+
938+void amdgpu_sriov_wreg(struct amdgpu_device *adev,
939+ u32 offset, u32 value,
940+ u32 acc_flags, u32 hwip)
941+{
942+ u32 rlcg_flag;
943+
944+ if (!amdgpu_sriov_runtime(adev) &&
945+ amdgpu_virt_get_rlcg_reg_access_flag(adev, acc_flags, hwip, true, &rlcg_flag)) {
946+ amdgpu_virt_rlcg_reg_rw(adev, offset, value, rlcg_flag);
947+ return;
948+ }
949+
950+ if (acc_flags & AMDGPU_REGS_NO_KIQ)
951+ WREG32_NO_KIQ(offset, value);
952+ else
953+ WREG32(offset, value);
954+}
955+
956+u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
957+ u32 offset, u32 acc_flags, u32 hwip)
958+{
959+ u32 rlcg_flag;
960+
961+ if (!amdgpu_sriov_runtime(adev) &&
962+ amdgpu_virt_get_rlcg_reg_access_flag(adev, acc_flags, hwip, false, &rlcg_flag))
963+ return amdgpu_virt_rlcg_reg_rw(adev, offset, 0, rlcg_flag);
964+
965+ if (acc_flags & AMDGPU_REGS_NO_KIQ)
966+ return RREG32_NO_KIQ(offset);
967+ else
968+ return RREG32(offset);
969+}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h+24−2
@@ -32,6 +32,19 @@ · 31 unmodified lines
3232 #define AMDGPU_PASSTHROUGH_MODE (1 << 3) /* thw whole GPU is pass through for VM */
3333 #define AMDGPU_SRIOV_CAPS_RUNTIME (1 << 4) /* is out of full access mode */
3434
35+/* flags for indirect register access path supported by rlcg for sriov */
36+#define AMDGPU_RLCG_GC_WRITE_LEGACY (0x8 << 28)
37+#define AMDGPU_RLCG_GC_WRITE (0x0 << 28)
38+#define AMDGPU_RLCG_GC_READ (0x1 << 28)
39+#define AMDGPU_RLCG_MMHUB_WRITE (0x2 << 28)
40+
41+/* error code for indirect register access path supported by rlcg for sriov */
42+#define AMDGPU_RLCG_VFGATE_DISABLED 0x4000000
43+#define AMDGPU_RLCG_WRONG_OPERATION_TYPE 0x2000000
44+#define AMDGPU_RLCG_REG_NOT_IN_RANGE 0x1000000
45+
46+#define AMDGPU_RLCG_SCRATCH1_ADDRESS_MASK 0xFFFFF
47+
3548 /* all asic after AI use this offset */
3649 #define mmRCC_IOV_FUNC_IDENTIFIER 0xDE5
3750 /* tonga/fiji use this offset */
@@ -275,13 +288,18 @@ struct amdgpu_video_codec_info; · 237 unmodified lines
275288 (amdgpu_sriov_vf((adev)) && \
276289 ((adev)->virt.reg_access & (AMDGIM_FEATURE_GC_REG_RLC_EN)))
277290
291+#define amdgpu_sriov_rlcg_error_report_enabled(adev) \
292+ (amdgpu_sriov_reg_indirect_mmhub(adev) || amdgpu_sriov_reg_indirect_gc(adev))
293+
278294 #define amdgpu_passthrough(adev) \
279295 ((adev)->virt.caps & AMDGPU_PASSTHROUGH_MODE)
280296
281297 static inline bool is_virtual_machine(void)
282298 {
283−#ifdef CONFIG_X86
299+#if defined(CONFIG_X86)
284300 return boot_cpu_has(X86_FEATURE_HYPERVISOR);
301+#elif defined(CONFIG_ARM64)
302+ return !is_kernel_in_hyp_mode();
285303 #else
286304 return false;
287305 #endif
@@ -293,7 +311,6 @@ static inline bool is_virtual_machine(void) · 5 unmodified lines
293311 ((!amdgpu_in_reset(adev)) && adev->virt.tdr_debug)
294312 #define amdgpu_sriov_is_normal(adev) \
295313 ((!amdgpu_in_reset(adev)) && (!adev->virt.tdr_debug))
296−
297314 bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev);
298315 void amdgpu_virt_init_setting(struct amdgpu_device *adev);
299316 void amdgpu_virt_kiq_reg_write_reg_wait(struct amdgpu_device *adev,
@@ -321,4 +338,9 @@ enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *ad · 21 unmodified lines
321338 void amdgpu_virt_update_sriov_video_codec(struct amdgpu_device *adev,
322339 struct amdgpu_video_codec_info *encode, uint32_t encode_array_size,
323340 struct amdgpu_video_codec_info *decode, uint32_t decode_array_size);
341+void amdgpu_sriov_wreg(struct amdgpu_device *adev,
342+ u32 offset, u32 value,
343+ u32 acc_flags, u32 hwip);
344+u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
345+ u32 offset, u32 acc_flags, u32 hwip);
324346 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c+1−2
@@ -391,7 +391,6 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev, · 390 unmodified lines
391391 int index)
392392 {
393393 struct drm_plane *plane;
394− uint64_t modifiers[] = {DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID};
395394 int ret;
396395
397396 plane = kzalloc(sizeof(*plane), GFP_KERNEL);
@@ -402,7 +401,7 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev, · 4 unmodified lines
402401 &amdgpu_vkms_plane_funcs,
403402 amdgpu_vkms_formats,
404403 ARRAY_SIZE(amdgpu_vkms_formats),
405− modifiers, type, NULL);
404+ NULL, type, NULL);
406405 if (ret) {
407406 kfree(plane);
408407 return ERR_PTR(ret);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+16−5
@@ -375,6 +375,8 @@ static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base, · 374 unmodified lines
375375 if (bo->tbo.base.resv != vm->root.bo->tbo.base.resv)
376376 return;
377377
378+ dma_resv_assert_held(vm->root.bo->tbo.base.resv);
379+
378380 vm->bulk_moveable = false;
379381 if (bo->tbo.type == ttm_bo_type_kernel && bo->parent)
380382 amdgpu_vm_bo_relocated(base);
@@ -768,11 +770,16 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 387 unmodified lines
768770 * Check if all VM PDs/PTs are ready for updates
769771 *
770772 * Returns:
771− * True if eviction list is empty.
773+ * True if VM is not evicting.
772774 */
773775 bool amdgpu_vm_ready(struct amdgpu_vm *vm)
774776 {
775− return list_empty(&vm->evicted);
777+ bool ret;
778+
779+ amdgpu_vm_eviction_lock(vm);
780+ ret = !vm->evicting;
781+ amdgpu_vm_eviction_unlock(vm);
782+ return ret;
776783 }
777784
778785 /**
@@ -1634,7 +1641,7 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, · 855 unmodified lines
16341641 nptes = max(nptes, 1u);
16351642
16361643 trace_amdgpu_vm_update_ptes(params, frag_start, upd_end,
1637− nptes, dst, incr, upd_flags,
1644+ min(nptes, 32u), dst, incr, upd_flags,
16381645 vm->task_info.pid,
16391646 vm->immediate.fence_context);
16401647 amdgpu_vm_update_flags(params, to_amdgpu_bo_vm(pt),
@@ -2257,6 +2264,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, · 616 unmodified lines
22572264 if (!bo)
22582265 return bo_va;
22592266
2267+ dma_resv_assert_held(bo->tbo.base.resv);
22602268 if (amdgpu_dmabuf_is_xgmi_accessible(adev, bo)) {
22612269 bo_va->is_xgmi = true;
22622270 /* Power up XGMI if it can be potentially used */
@@ -2634,7 +2642,7 @@ void amdgpu_vm_bo_trace_cs(struct amdgpu_vm *vm, struct ww_acquire_ctx *ticket) · 371 unmodified lines
26342642 }
26352643
26362644 /**
2637− * amdgpu_vm_bo_rmv - remove a bo to a specific vm
2645+ * amdgpu_vm_bo_del - remove a bo from a specific vm
26382646 *
26392647 * @adev: amdgpu_device pointer
26402648 * @bo_va: requested bo_va
@@ -2643,7 +2651,7 @@ void amdgpu_vm_bo_trace_cs(struct amdgpu_vm *vm, struct ww_acquire_ctx *ticket) · 2 unmodified lines
26432651 *
26442652 * Object have to be reserved!
26452653 */
2646−void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
2654+void amdgpu_vm_bo_del(struct amdgpu_device *adev,
26472655 struct amdgpu_bo_va *bo_va)
26482656 {
26492657 struct amdgpu_bo_va_mapping *mapping, *next;
@@ -2651,7 +2659,10 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev, · 1 unmodified line
26512659 struct amdgpu_vm *vm = bo_va->base.vm;
26522660 struct amdgpu_vm_bo_base **base;
26532661
2662+ dma_resv_assert_held(vm->root.bo->tbo.base.resv);
2663+
26542664 if (bo) {
2665+ dma_resv_assert_held(bo->tbo.base.resv);
26552666 if (bo->tbo.base.resv == vm->root.bo->tbo.base.resv)
26562667 vm->bulk_moveable = false;
26572668
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h+1−1
@@ -435,7 +435,7 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, · 434 unmodified lines
435435 struct amdgpu_bo_va_mapping *amdgpu_vm_bo_lookup_mapping(struct amdgpu_vm *vm,
436436 uint64_t addr);
437437 void amdgpu_vm_bo_trace_cs(struct amdgpu_vm *vm, struct ww_acquire_ctx *ticket);
438−void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
438+void amdgpu_vm_bo_del(struct amdgpu_device *adev,
439439 struct amdgpu_bo_va *bo_va);
440440 void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t min_vm_size,
441441 uint32_t fragment_size_default, unsigned max_level,
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c+22−38
@@ -96,9 +96,9 @@ static ssize_t amdgpu_mem_info_vram_used_show(struct device *dev, · 95 unmodified lines
9696 {
9797 struct drm_device *ddev = dev_get_drvdata(dev);
9898 struct amdgpu_device *adev = drm_to_adev(ddev);
99+ struct ttm_resource_manager *man = &adev->mman.vram_mgr.manager;
99100
100− return sysfs_emit(buf, "%llu\n",
101− amdgpu_vram_mgr_usage(&adev->mman.vram_mgr));
101+ return sysfs_emit(buf, "%llu\n", ttm_resource_manager_usage(man));
102102 }
103103
104104 /**
@@ -253,7 +253,9 @@ static void amdgpu_vram_mgr_do_reserve(struct ttm_resource_manager *man) · 148 unmodified lines
253253
254254 vis_usage = amdgpu_vram_mgr_vis_size(adev, &rsv->mm_node);
255255 atomic64_add(vis_usage, &mgr->vis_usage);
256− atomic64_add(rsv->mm_node.size << PAGE_SHIFT, &mgr->usage);
256+ spin_lock(&man->bdev->lru_lock);
257+ man->usage += rsv->mm_node.size << PAGE_SHIFT;
258+ spin_unlock(&man->bdev->lru_lock);
257259 list_move(&rsv->node, &mgr->reserved_pages);
258260 }
259261 }
@@ -281,7 +283,7 @@ int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, · 21 unmodified lines
281283 rsv->mm_node.size = size >> PAGE_SHIFT;
282284
283285 spin_lock(&mgr->lock);
284− list_add_tail(&mgr->reservations_pending, &rsv->node);
286+ list_add_tail(&rsv->node, &mgr->reservations_pending);
285287 amdgpu_vram_mgr_do_reserve(&mgr->manager);
286288 spin_unlock(&mgr->lock);
287289
@@ -378,19 +380,13 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, · 90 unmodified lines
378380
379381 lpfn = place->lpfn;
380382 if (!lpfn)
381− lpfn = man->size;
383+ lpfn = man->size >> PAGE_SHIFT;
382384
383385 max_bytes = adev->gmc.mc_vram_size;
384386 if (tbo->type != ttm_bo_type_kernel)
385387 max_bytes -= AMDGPU_VM_RESERVED_VRAM;
386388
387− /* bail out quickly if there's likely not enough VRAM for this BO */
388389 mem_bytes = tbo->base.size;
389− if (atomic64_add_return(mem_bytes, &mgr->usage) > max_bytes) {
390− r = -ENOSPC;
391− goto error_sub;
392− }
393−
394390 if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
395391 pages_per_node = ~0ul;
396392 num_nodes = 1;
@@ -408,13 +404,17 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, · 11 unmodified lines
408404
409405 node = kvmalloc(struct_size(node, mm_nodes, num_nodes),
410406 GFP_KERNEL | __GFP_ZERO);
411− if (!node) {
412− r = -ENOMEM;
413− goto error_sub;
414− }
407+ if (!node)
408+ return -ENOMEM;
415409
416410 ttm_resource_init(tbo, place, &node->base);
417411
412+ /* bail out quickly if there's likely not enough VRAM for this BO */
413+ if (ttm_resource_manager_usage(man) > max_bytes) {
414+ r = -ENOSPC;
415+ goto error_fini;
416+ }
417+
418418 mode = DRM_MM_INSERT_BEST;
419419 if (place->flags & TTM_PL_FLAG_TOPDOWN)
420420 mode = DRM_MM_INSERT_HIGH;
@@ -472,11 +472,10 @@ error_free: · 51 unmodified lines
472472 while (i--)
473473 drm_mm_remove_node(&node->mm_nodes[i]);
474474 spin_unlock(&mgr->lock);
475+error_fini:
475476 ttm_resource_fini(man, &node->base);
476477 kvfree(node);
477478
478−error_sub:
479− atomic64_sub(mem_bytes, &mgr->usage);
480479 return r;
481480 }
482481
@@ -494,7 +493,7 @@ static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man, · 11 unmodified lines
494493 struct ttm_range_mgr_node *node = to_ttm_range_mgr_node(res);
495494 struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
496495 struct amdgpu_device *adev = to_amdgpu_device(mgr);
497− uint64_t usage = 0, vis_usage = 0;
496+ uint64_t vis_usage = 0;
498497 unsigned i, pages;
499498
500499 spin_lock(&mgr->lock);
@@ -503,13 +502,11 @@ static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man, · 2 unmodified lines
503502 struct drm_mm_node *mm = &node->mm_nodes[i];
504503
505504 drm_mm_remove_node(mm);
506− usage += mm->size << PAGE_SHIFT;
507505 vis_usage += amdgpu_vram_mgr_vis_size(adev, mm);
508506 }
509507 amdgpu_vram_mgr_do_reserve(man);
510508 spin_unlock(&mgr->lock);
511509
512− atomic64_sub(usage, &mgr->usage);
513510 atomic64_sub(vis_usage, &mgr->vis_usage);
514511
515512 ttm_resource_fini(man, res);
@@ -627,18 +624,6 @@ void amdgpu_vram_mgr_free_sgt(struct device *dev, · 111 unmodified lines
627624 kfree(sgt);
628625 }
629626
630−/**
631− * amdgpu_vram_mgr_usage - how many bytes are used in this domain
632− *
633− * @mgr: amdgpu_vram_mgr pointer
634− *
635− * Returns how many bytes are used in this domain.
636− */
637−uint64_t amdgpu_vram_mgr_usage(struct amdgpu_vram_mgr *mgr)
638−{
639− return atomic64_read(&mgr->usage);
640−}
641−
642627 /**
643628 * amdgpu_vram_mgr_vis_usage - how many bytes are used in the visible part
644629 *
@@ -664,13 +649,12 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man, · 19 unmodified lines
664649 {
665650 struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
666651
652+ drm_printf(printer, " vis usage:%llu\n",
653+ amdgpu_vram_mgr_vis_usage(mgr));
654+
667655 spin_lock(&mgr->lock);
668656 drm_mm_print(&mgr->mm, printer);
669657 spin_unlock(&mgr->lock);
670−
671− drm_printf(printer, "man size:%llu pages, ram usage:%lluMB, vis usage:%lluMB\n",
672− man->size, amdgpu_vram_mgr_usage(mgr) >> 20,
673− amdgpu_vram_mgr_vis_usage(mgr) >> 20);
674658 }
675659
676660 static const struct ttm_resource_manager_func amdgpu_vram_mgr_func = {
@@ -692,11 +676,11 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev) · 15 unmodified lines
692676 struct ttm_resource_manager *man = &mgr->manager;
693677
694678 ttm_resource_manager_init(man, &adev->mman.bdev,
695− adev->gmc.real_vram_size >> PAGE_SHIFT);
679+ adev->gmc.real_vram_size);
696680
697681 man->func = &amdgpu_vram_mgr_func;
698682
699− drm_mm_init(&mgr->mm, 0, man->size);
683+ drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT);
700684 spin_lock_init(&mgr->lock);
701685 INIT_LIST_HEAD(&mgr->reservations_pending);
702686 INIT_LIST_HEAD(&mgr->reserved_pages);
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c+75−44
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 #include "wafl/wafl2_4_0_0_smn.h"
3333 #include "wafl/wafl2_4_0_0_sh_mask.h"
3434
35+#include "amdgpu_reset.h"
36+
3537 #define smnPCS_XGMI23_PCS_ERROR_STATUS 0x11a01210
3638 #define smnPCS_XGMI3X16_PCS_ERROR_STATUS 0x11a0020c
3739 #define smnPCS_GOPX1_PCS_ERROR_STATUS 0x12200210
@@ -227,6 +229,9 @@ static void amdgpu_xgmi_hive_release(struct kobject *kobj) · 189 unmodified lines
227229 struct amdgpu_hive_info *hive = container_of(
228230 kobj, struct amdgpu_hive_info, kobj);
229231
232+ amdgpu_reset_put_reset_domain(hive->reset_domain);
233+ hive->reset_domain = NULL;
234+
230235 mutex_destroy(&hive->hive_lock);
231236 kfree(hive);
232237 }
@@ -398,15 +403,35 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev) · 165 unmodified lines
398403 goto pro_end;
399404 }
400405
406+ /**
407+ * Avoid recreating reset domain when hive is reconstructed for the case
408+ * of reset the devices in the XGMI hive during probe for SRIOV
409+ * See https://www.spinics.net/lists/amd-gfx/msg58836.html
410+ */
411+ if (adev->reset_domain->type != XGMI_HIVE) {
412+ hive->reset_domain = amdgpu_reset_create_reset_domain(XGMI_HIVE, "amdgpu-reset-hive");
413+ if (!hive->reset_domain) {
414+ dev_err(adev->dev, "XGMI: failed initializing reset domain for xgmi hive\n");
415+ ret = -ENOMEM;
416+ kobject_put(&hive->kobj);
417+ kfree(hive);
418+ hive = NULL;
419+ goto pro_end;
420+ }
421+ } else {
422+ amdgpu_reset_get_reset_domain(adev->reset_domain);
423+ hive->reset_domain = adev->reset_domain;
424+ }
425+
401426 hive->hive_id = adev->gmc.xgmi.hive_id;
402427 INIT_LIST_HEAD(&hive->device_list);
403428 INIT_LIST_HEAD(&hive->node);
404429 mutex_init(&hive->hive_lock);
405− atomic_set(&hive->in_reset, 0);
406430 atomic_set(&hive->number_devices, 0);
407431 task_barrier_init(&hive->tb);
408432 hive->pstate = AMDGPU_XGMI_PSTATE_UNKNOWN;
409433 hive->hi_req_gpu = NULL;
434+
410435 /*
411436 * hive pstate on boot is high in vega20 so we have to go to low
412437 * pstate on after boot.
@@ -732,53 +757,22 @@ int amdgpu_xgmi_remove_device(struct amdgpu_device *adev) · 319 unmodified lines
732757 return psp_xgmi_terminate(&adev->psp);
733758 }
734759
735−static int amdgpu_xgmi_ras_late_init(struct amdgpu_device *adev)
760+static int amdgpu_xgmi_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block)
736761 {
737− int r;
738− struct ras_ih_if ih_info = {
739− .cb = NULL,
740− };
741− struct ras_fs_if fs_info = {
742− .sysfs_name = "xgmi_wafl_err_count",
743− };
744−
745762 if (!adev->gmc.xgmi.supported ||
746763 adev->gmc.xgmi.num_physical_nodes == 0)
747764 return 0;
748765
749− adev->gmc.xgmi.ras_funcs->reset_ras_error_count(adev);
750−
751− if (!adev->gmc.xgmi.ras_if) {
752− adev->gmc.xgmi.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
753− if (!adev->gmc.xgmi.ras_if)
754− return -ENOMEM;
755− adev->gmc.xgmi.ras_if->block = AMDGPU_RAS_BLOCK__XGMI_WAFL;
756− adev->gmc.xgmi.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
757− adev->gmc.xgmi.ras_if->sub_block_index = 0;
758− }
759− ih_info.head = fs_info.head = *adev->gmc.xgmi.ras_if;
760− r = amdgpu_ras_late_init(adev, adev->gmc.xgmi.ras_if,
761− &fs_info, &ih_info);
762− if (r || !amdgpu_ras_is_supported(adev, adev->gmc.xgmi.ras_if->block)) {
763− kfree(adev->gmc.xgmi.ras_if);
764− adev->gmc.xgmi.ras_if = NULL;
765− }
766+ adev->gmc.xgmi.ras->ras_block.hw_ops->reset_ras_error_count(adev);
766767
767− return r;
768+ return amdgpu_ras_block_late_init(adev, ras_block);
768769 }
769770
770771 static void amdgpu_xgmi_ras_fini(struct amdgpu_device *adev)
771772 {
772773 if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__XGMI_WAFL) &&
773− adev->gmc.xgmi.ras_if) {
774− struct ras_common_if *ras_if = adev->gmc.xgmi.ras_if;
775− struct ras_ih_if ih_info = {
776− .cb = NULL,
777− };
778−
779− amdgpu_ras_late_fini(adev, ras_if, &ih_info);
780− kfree(ras_if);
781− }
774+ adev->gmc.xgmi.ras_if)
775+ amdgpu_ras_block_late_fini(adev, adev->gmc.xgmi.ras_if);
782776 }
783777
784778 uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev,
@@ -865,7 +859,7 @@ static int amdgpu_xgmi_query_pcs_error_status(struct amdgpu_device *adev, · 80 unmodified lines
865859 return 0;
866860 }
867861
868−static int amdgpu_xgmi_query_ras_error_count(struct amdgpu_device *adev,
862+static void amdgpu_xgmi_query_ras_error_count(struct amdgpu_device *adev,
869863 void *ras_error_status)
870864 {
871865 struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
@@ -874,7 +868,7 @@ static int amdgpu_xgmi_query_ras_error_count(struct amdgpu_device *adev, · 2 unmodified lines
874868 uint32_t ue_cnt = 0, ce_cnt = 0;
875869
876870 if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__XGMI_WAFL))
877− return -EINVAL;
871+ return ;
878872
879873 err_data->ue_count = 0;
880874 err_data->ce_count = 0;
@@ -940,17 +934,54 @@ static int amdgpu_xgmi_query_ras_error_count(struct amdgpu_device *adev, · 59 unmodified lines
940934 break;
941935 }
942936
943− adev->gmc.xgmi.ras_funcs->reset_ras_error_count(adev);
937+ adev->gmc.xgmi.ras->ras_block.hw_ops->reset_ras_error_count(adev);
944938
945939 err_data->ue_count += ue_cnt;
946940 err_data->ce_count += ce_cnt;
941+}
947942
948− return 0;
943+/* Trigger XGMI/WAFL error */
944+static int amdgpu_ras_error_inject_xgmi(struct amdgpu_device *adev, void *inject_if)
945+{
946+ int ret = 0;
947+ struct ta_ras_trigger_error_input *block_info =
948+ (struct ta_ras_trigger_error_input *)inject_if;
949+
950+ if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_DISALLOW))
951+ dev_warn(adev->dev, "Failed to disallow df cstate");
952+
953+ if (amdgpu_dpm_allow_xgmi_power_down(adev, false))
954+ dev_warn(adev->dev, "Failed to disallow XGMI power down");
955+
956+ ret = psp_ras_trigger_error(&adev->psp, block_info);
957+
958+ if (amdgpu_ras_intr_triggered())
959+ return ret;
960+
961+ if (amdgpu_dpm_allow_xgmi_power_down(adev, true))
962+ dev_warn(adev->dev, "Failed to allow XGMI power down");
963+
964+ if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_ALLOW))
965+ dev_warn(adev->dev, "Failed to allow df cstate");
966+
967+ return ret;
949968 }
950969
951−const struct amdgpu_xgmi_ras_funcs xgmi_ras_funcs = {
952− .ras_late_init = amdgpu_xgmi_ras_late_init,
953− .ras_fini = amdgpu_xgmi_ras_fini,
970+struct amdgpu_ras_block_hw_ops xgmi_ras_hw_ops = {
954971 .query_ras_error_count = amdgpu_xgmi_query_ras_error_count,
955972 .reset_ras_error_count = amdgpu_xgmi_reset_ras_error_count,
973+ .ras_error_inject = amdgpu_ras_error_inject_xgmi,
974+};
975+
976+struct amdgpu_xgmi_ras xgmi_ras = {
977+ .ras_block = {
978+ .ras_comm = {
979+ .name = "xgmi_wafl",
980+ .block = AMDGPU_RAS_BLOCK__XGMI_WAFL,
981+ .type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE,
982+ },
983+ .hw_ops = &xgmi_ras_hw_ops,
984+ .ras_late_init = amdgpu_xgmi_ras_late_init,
985+ .ras_fini = amdgpu_xgmi_ras_fini,
986+ },
956987 };
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h+6−4
@@ -24,7 +24,7 @@ · 23 unmodified lines
2424
2525 #include <drm/task_barrier.h>
2626 #include "amdgpu_psp.h"
27−
27+#include "amdgpu_ras.h"
2828
2929 struct amdgpu_hive_info {
3030 struct kobject kobj;
@@ -33,7 +33,6 @@ struct amdgpu_hive_info { · 2 unmodified lines
3333 struct list_head node;
3434 atomic_t number_devices;
3535 struct mutex hive_lock;
36− atomic_t in_reset;
3736 int hi_req_count;
3837 struct amdgpu_device *hi_req_gpu;
3938 struct task_barrier tb;
@@ -42,6 +41,8 @@ struct amdgpu_hive_info { · 2 unmodified lines
4241 AMDGPU_XGMI_PSTATE_MAX_VEGA20,
4342 AMDGPU_XGMI_PSTATE_UNKNOWN
4443 } pstate;
44+
45+ struct amdgpu_reset_domain *reset_domain;
4546 };
4647
4748 struct amdgpu_pcs_ras_field {
@@ -50,7 +51,7 @@ struct amdgpu_pcs_ras_field { · 2 unmodified lines
5051 uint32_t pcs_err_shift;
5152 };
5253
53−extern const struct amdgpu_xgmi_ras_funcs xgmi_ras_funcs;
54+extern struct amdgpu_xgmi_ras xgmi_ras;
5455 struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev);
5556 void amdgpu_put_xgmi_hive(struct amdgpu_hive_info *hive);
5657 int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_device *adev);
@@ -66,7 +67,8 @@ uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev, · 9 unmodified lines
6667 static inline bool amdgpu_xgmi_same_hive(struct amdgpu_device *adev,
6768 struct amdgpu_device *bo_adev)
6869 {
69− return (adev != bo_adev &&
70+ return (amdgpu_use_xgmi_p2p &&
71+ adev != bo_adev &&
7072 adev->gmc.xgmi.hive_id &&
7173 adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id);
7274 }
drivers/gpu/drm/amd/amdgpu/athub_v1_0.c+7−6
@@ -68,12 +68,13 @@ int athub_v1_0_set_clockgating(struct amdgpu_device *adev, · 67 unmodified lines
6868 if (amdgpu_sriov_vf(adev))
6969 return 0;
7070
71− switch (adev->asic_type) {
72− case CHIP_VEGA10:
73− case CHIP_VEGA12:
74− case CHIP_VEGA20:
75− case CHIP_RAVEN:
76− case CHIP_RENOIR:
71+ switch (adev->ip_versions[ATHUB_HWIP][0]) {
72+ case IP_VERSION(9, 0, 0):
73+ case IP_VERSION(9, 1, 0):
74+ case IP_VERSION(9, 2, 0):
75+ case IP_VERSION(9, 3, 0):
76+ case IP_VERSION(9, 4, 0):
77+ case IP_VERSION(1, 5, 0):
7778 athub_update_medium_grain_clock_gating(adev,
7879 state == AMD_CG_STATE_GATE);
7980 athub_update_medium_grain_light_sleep(adev,
drivers/gpu/drm/amd/amdgpu/athub_v2_0.c+1−0
@@ -78,6 +78,7 @@ int athub_v2_0_set_clockgating(struct amdgpu_device *adev, · 77 unmodified lines
7878 return 0;
7979
8080 switch (adev->ip_versions[ATHUB_HWIP][0]) {
81+ case IP_VERSION(1, 3, 1):
8182 case IP_VERSION(2, 0, 0):
8283 case IP_VERSION(2, 0, 2):
8384 athub_v2_0_update_medium_grain_clock_gating(adev,
drivers/gpu/drm/amd/amdgpu/athub_v2_1.c+1−0
@@ -74,6 +74,7 @@ int athub_v2_1_set_clockgating(struct amdgpu_device *adev, · 73 unmodified lines
7474 case IP_VERSION(2, 1, 0):
7575 case IP_VERSION(2, 1, 1):
7676 case IP_VERSION(2, 1, 2):
77+ case IP_VERSION(2, 4, 0):
7778 athub_v2_1_update_medium_grain_clock_gating(adev, state == AMD_CG_STATE_GATE);
7879 athub_v2_1_update_medium_grain_light_sleep(adev, state == AMD_CG_STATE_GATE);
7980 break;
drivers/gpu/drm/amd/amdgpu/atom.c+3−1
@@ -25,6 +25,8 @@ · 24 unmodified lines
2525 #include <linux/module.h>
2626 #include <linux/sched.h>
2727 #include <linux/slab.h>
28+#include <linux/string_helpers.h>
29+
2830 #include <asm/unaligned.h>
2931
3032 #include <drm/drm_util.h>
@@ -740,7 +742,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) · 709 unmodified lines
740742 break;
741743 }
742744 if (arg != ATOM_COND_ALWAYS)
743− SDEBUG(" taken: %s\n", execute ? "yes" : "no");
745+ SDEBUG(" taken: %s\n", str_yes_no(execute));
744746 SDEBUG(" target: 0x%04X\n", target);
745747 if (execute) {
746748 if (ctx->last_jump == (ctx->start + target)) {
drivers/gpu/drm/amd/amdgpu/cik.c+1−1
@@ -1719,7 +1719,7 @@ static void cik_program_aspm(struct amdgpu_device *adev) · 1718 unmodified lines
17191719 bool disable_l0s = false, disable_l1 = false, disable_plloff_in_l1 = false;
17201720 bool disable_clkreq = false;
17211721
1722− if (amdgpu_aspm == 0)
1722+ if (!amdgpu_device_should_use_aspm(adev))
17231723 return;
17241724
17251725 if (pci_is_root_bus(adev->pdev->bus))
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c+3−1
@@ -2532,7 +2532,7 @@ static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode) · 2531 unmodified lines
25322532 break;
25332533 }
25342534 /* adjust pm to dpms */
2535− amdgpu_pm_compute_clocks(adev);
2535+ amdgpu_dpm_compute_clocks(adev);
25362536 }
25372537
25382538 static void dce_v10_0_crtc_prepare(struct drm_crtc *crtc)
@@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle) · 259 unmodified lines
27982798 adev_to_drm(adev)->mode_config.preferred_depth = 24;
27992799 adev_to_drm(adev)->mode_config.prefer_shadow = 1;
28002800
2801+ adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
2802+
28012803 adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
28022804
28032805 r = amdgpu_display_modeset_create_props(adev);
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c+3−1
@@ -2608,7 +2608,7 @@ static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode) · 2607 unmodified lines
26082608 break;
26092609 }
26102610 /* adjust pm to dpms */
2611− amdgpu_pm_compute_clocks(adev);
2611+ amdgpu_dpm_compute_clocks(adev);
26122612 }
26132613
26142614 static void dce_v11_0_crtc_prepare(struct drm_crtc *crtc)
@@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle) · 301 unmodified lines
29162916 adev_to_drm(adev)->mode_config.preferred_depth = 24;
29172917 adev_to_drm(adev)->mode_config.prefer_shadow = 1;
29182918
2919+ adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
2920+
29192921 adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
29202922
29212923 r = amdgpu_display_modeset_create_props(adev);
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c+2−1
@@ -2424,7 +2424,7 @@ static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode) · 2423 unmodified lines
24242424 break;
24252425 }
24262426 /* adjust pm to dpms */
2427− amdgpu_pm_compute_clocks(adev);
2427+ amdgpu_dpm_compute_clocks(adev);
24282428 }
24292429
24302430 static void dce_v6_0_crtc_prepare(struct drm_crtc *crtc)
@@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle) · 243 unmodified lines
26742674 adev_to_drm(adev)->mode_config.max_height = 16384;
26752675 adev_to_drm(adev)->mode_config.preferred_depth = 24;
26762676 adev_to_drm(adev)->mode_config.prefer_shadow = 1;
2677+ adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
26772678 adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
26782679
26792680 r = amdgpu_display_modeset_create_props(adev);
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c+3−1
@@ -2433,7 +2433,7 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode) · 2432 unmodified lines
24332433 break;
24342434 }
24352435 /* adjust pm to dpms */
2436− amdgpu_pm_compute_clocks(adev);
2436+ amdgpu_dpm_compute_clocks(adev);
24372437 }
24382438
24392439 static void dce_v8_0_crtc_prepare(struct drm_crtc *crtc)
@@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle) · 255 unmodified lines
26952695 adev_to_drm(adev)->mode_config.preferred_depth = 24;
26962696 adev_to_drm(adev)->mode_config.prefer_shadow = 1;
26972697
2698+ adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
2699+
26982700 adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
26992701
27002702 r = amdgpu_display_modeset_create_props(adev);
drivers/gpu/drm/amd/amdgpu/df_v3_6.c+3−3
@@ -458,7 +458,7 @@ static int df_v3_6_pmc_add_cntr(struct amdgpu_device *adev, · 457 unmodified lines
458458
459459 #define DEFERRED_ARM_MASK (1 << 31)
460460 static int df_v3_6_pmc_set_deferred(struct amdgpu_device *adev,
461− int counter_idx, uint64_t config,
461+ uint64_t config, int counter_idx,
462462 bool is_deferred)
463463 {
464464
@@ -476,8 +476,8 @@ static int df_v3_6_pmc_set_deferred(struct amdgpu_device *adev, · 11 unmodified lines
476476 }
477477
478478 static bool df_v3_6_pmc_is_deferred(struct amdgpu_device *adev,
479− int counter_idx,
480− uint64_t config)
479+ uint64_t config,
480+ int counter_idx)
481481 {
482482 return (df_v3_6_pmc_has_counter(adev, config, counter_idx) &&
483483 (adev->df_perfmon_config_assign_mask[counter_idx]
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+177−157
@@ -56,10 +56,6 @@ · 55 unmodified lines
5656 #define GFX10_NUM_GFX_RINGS_Sienna_Cichlid 1
5757 #define GFX10_MEC_HPD_SIZE 2048
5858
59−#define RLCG_VFGATE_DISABLED 0x4000000
60−#define RLCG_WRONG_OPERATION_TYPE 0x2000000
61−#define RLCG_NOT_IN_RANGE 0x1000000
62−
6359 #define F32_CE_PROGRAM_RAM_SIZE 65536
6460 #define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L
6561
@@ -110,6 +106,12 @@ · 44 unmodified lines
110106 #define mmGOLDEN_TSC_COUNT_UPPER_Vangogh_BASE_IDX 1
111107 #define mmGOLDEN_TSC_COUNT_LOWER_Vangogh 0x0026
112108 #define mmGOLDEN_TSC_COUNT_LOWER_Vangogh_BASE_IDX 1
109+
110+#define mmGOLDEN_TSC_COUNT_UPPER_GC_10_3_6 0x002d
111+#define mmGOLDEN_TSC_COUNT_UPPER_GC_10_3_6_BASE_IDX 1
112+#define mmGOLDEN_TSC_COUNT_LOWER_GC_10_3_6 0x002e
113+#define mmGOLDEN_TSC_COUNT_LOWER_GC_10_3_6_BASE_IDX 1
114+
113115 #define mmSPI_CONFIG_CNTL_1_Vangogh 0x2441
114116 #define mmSPI_CONFIG_CNTL_1_Vangogh_BASE_IDX 1
115117 #define mmVGT_TF_MEMORY_BASE_HI_Vangogh 0x2261
@@ -180,14 +182,6 @@ · 64 unmodified lines
180182 #define mmRLC_SPARE_INT_0_Sienna_Cichlid 0x4ca5
181183 #define mmRLC_SPARE_INT_0_Sienna_Cichlid_BASE_IDX 1
182184
183−#define GFX_RLCG_GC_WRITE_OLD (0x8 << 28)
184−#define GFX_RLCG_GC_WRITE (0x0 << 28)
185−#define GFX_RLCG_GC_READ (0x1 << 28)
186−#define GFX_RLCG_MMHUB_WRITE (0x2 << 28)
187−
188−#define RLCG_ERROR_REPORT_ENABLED(adev) \
189− (amdgpu_sriov_reg_indirect_mmhub(adev) || amdgpu_sriov_reg_indirect_gc(adev))
190−
191185 MODULE_FIRMWARE("amdgpu/navi10_ce.bin");
192186 MODULE_FIRMWARE("amdgpu/navi10_pfp.bin");
193187 MODULE_FIRMWARE("amdgpu/navi10_me.bin");
@@ -270,6 +264,20 @@ MODULE_FIRMWARE("amdgpu/cyan_skillfish2_mec.bin"); · 76 unmodified lines
270264 MODULE_FIRMWARE("amdgpu/cyan_skillfish2_mec2.bin");
271265 MODULE_FIRMWARE("amdgpu/cyan_skillfish2_rlc.bin");
272266
267+MODULE_FIRMWARE("amdgpu/gc_10_3_6_ce.bin");
268+MODULE_FIRMWARE("amdgpu/gc_10_3_6_pfp.bin");
269+MODULE_FIRMWARE("amdgpu/gc_10_3_6_me.bin");
270+MODULE_FIRMWARE("amdgpu/gc_10_3_6_mec.bin");
271+MODULE_FIRMWARE("amdgpu/gc_10_3_6_mec2.bin");
272+MODULE_FIRMWARE("amdgpu/gc_10_3_6_rlc.bin");
273+
274+MODULE_FIRMWARE("amdgpu/gc_10_3_7_ce.bin");
275+MODULE_FIRMWARE("amdgpu/gc_10_3_7_pfp.bin");
276+MODULE_FIRMWARE("amdgpu/gc_10_3_7_me.bin");
277+MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
278+MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
279+MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
280+
273281 static const struct soc15_reg_golden golden_settings_gc_10_1[] =
274282 {
275283 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
@@ -1463,143 +1471,6 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2[] = · 1187 unmodified lines
14631471 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00c00000)
14641472 };
14651473
1466−static bool gfx_v10_get_rlcg_flag(struct amdgpu_device *adev, u32 acc_flags, u32 hwip,
1467− int write, u32 *rlcg_flag)
1468−{
1469− switch (hwip) {
1470− case GC_HWIP:
1471− if (amdgpu_sriov_reg_indirect_gc(adev)) {
1472− *rlcg_flag = write ? GFX_RLCG_GC_WRITE : GFX_RLCG_GC_READ;
1473−
1474− return true;
1475− /* only in new version, AMDGPU_REGS_NO_KIQ and AMDGPU_REGS_RLC enabled simultaneously */
1476− } else if ((acc_flags & AMDGPU_REGS_RLC) && !(acc_flags & AMDGPU_REGS_NO_KIQ)) {
1477− *rlcg_flag = GFX_RLCG_GC_WRITE_OLD;
1478−
1479− return true;
1480− }
1481−
1482− break;
1483− case MMHUB_HWIP:
1484− if (amdgpu_sriov_reg_indirect_mmhub(adev) &&
1485− (acc_flags & AMDGPU_REGS_RLC) && write) {
1486− *rlcg_flag = GFX_RLCG_MMHUB_WRITE;
1487− return true;
1488− }
1489−
1490− break;
1491− default:
1492− DRM_DEBUG("Not program register by RLCG\n");
1493− }
1494−
1495− return false;
1496−}
1497−
1498−static u32 gfx_v10_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32_t flag)
1499−{
1500− static void *scratch_reg0;
1501− static void *scratch_reg1;
1502− static void *scratch_reg2;
1503− static void *scratch_reg3;
1504− static void *spare_int;
1505− static uint32_t grbm_cntl;
1506− static uint32_t grbm_idx;
1507− uint32_t i = 0;
1508− uint32_t retries = 50000;
1509− u32 ret = 0;
1510− u32 tmp;
1511−
1512− scratch_reg0 = adev->rmmio +
1513− (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG0) * 4;
1514− scratch_reg1 = adev->rmmio +
1515− (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG1) * 4;
1516− scratch_reg2 = adev->rmmio +
1517− (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG2) * 4;
1518− scratch_reg3 = adev->rmmio +
1519− (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG3) * 4;
1520−
1521− if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0)) {
1522− spare_int = adev->rmmio +
1523− (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_0_Sienna_Cichlid_BASE_IDX]
1524− + mmRLC_SPARE_INT_0_Sienna_Cichlid) * 4;
1525− } else {
1526− spare_int = adev->rmmio +
1527− (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_BASE_IDX] + mmRLC_SPARE_INT) * 4;
1528− }
1529−
1530− grbm_cntl = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_CNTL_BASE_IDX] + mmGRBM_GFX_CNTL;
1531− grbm_idx = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_INDEX_BASE_IDX] + mmGRBM_GFX_INDEX;
1532−
1533− if (offset == grbm_cntl || offset == grbm_idx) {
1534− if (offset == grbm_cntl)
1535− writel(v, scratch_reg2);
1536− else if (offset == grbm_idx)
1537− writel(v, scratch_reg3);
1538−
1539− writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
1540− } else {
1541− writel(v, scratch_reg0);
1542− writel(offset | flag, scratch_reg1);
1543− writel(1, spare_int);
1544−
1545− for (i = 0; i < retries; i++) {
1546− tmp = readl(scratch_reg1);
1547− if (!(tmp & flag))
1548− break;
1549−
1550− udelay(10);
1551− }
1552−
1553− if (i >= retries) {
1554− if (RLCG_ERROR_REPORT_ENABLED(adev)) {
1555− if (tmp & RLCG_VFGATE_DISABLED)
1556− pr_err("The vfgate is disabled, program reg:0x%05x failed!\n", offset);
1557− else if (tmp & RLCG_WRONG_OPERATION_TYPE)
1558− pr_err("Wrong operation type, program reg:0x%05x failed!\n", offset);
1559− else if (tmp & RLCG_NOT_IN_RANGE)
1560− pr_err("The register is not in range, program reg:0x%05x failed!\n", offset);
1561− else
1562− pr_err("Unknown error type, program reg:0x%05x failed!\n", offset);
1563− } else
1564− pr_err("timeout: rlcg program reg:0x%05x failed!\n", offset);
1565− }
1566− }
1567−
1568− ret = readl(scratch_reg0);
1569−
1570− return ret;
1571−}
1572−
1573−static void gfx_v10_sriov_wreg(struct amdgpu_device *adev, u32 offset, u32 value, u32 acc_flags, u32 hwip)
1574−{
1575− u32 rlcg_flag;
1576−
1577− if (!amdgpu_sriov_runtime(adev) &&
1578− gfx_v10_get_rlcg_flag(adev, acc_flags, hwip, 1, &rlcg_flag)) {
1579− gfx_v10_rlcg_rw(adev, offset, value, rlcg_flag);
1580− return;
1581− }
1582−
1583− if (acc_flags & AMDGPU_REGS_NO_KIQ)
1584− WREG32_NO_KIQ(offset, value);
1585− else
1586− WREG32(offset, value);
1587−}
1588−
1589−static u32 gfx_v10_sriov_rreg(struct amdgpu_device *adev, u32 offset, u32 acc_flags, u32 hwip)
1590−{
1591− u32 rlcg_flag;
1592−
1593− if (!amdgpu_sriov_runtime(adev) &&
1594− gfx_v10_get_rlcg_flag(adev, acc_flags, hwip, 0, &rlcg_flag))
1595− return gfx_v10_rlcg_rw(adev, offset, 0, rlcg_flag);
1596−
1597− if (acc_flags & AMDGPU_REGS_NO_KIQ)
1598− return RREG32_NO_KIQ(offset);
1599− else
1600− return RREG32(offset);
1601−}
1602−
16031474 static const struct soc15_reg_golden golden_settings_gc_10_1_nv14[] =
16041475 {
16051476 /* Pending on emulation bring up */
@@ -3557,6 +3428,57 @@ static const struct soc15_reg_golden golden_settings_gc_10_0_cyan_skillfish[] = · 1951 unmodified lines
35573428 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x00800000, 0x00800000)
35583429 };
35593430
3431+static const struct soc15_reg_golden golden_settings_gc_10_3_6[] =
3432+{
3433+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CS_CLK_CTRL, 0xff7f0fff, 0x78000100),
3434+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCH_PIPE_STEER, 0x000000ff, 0x00000044),
3435+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCPF_GCR_CNTL, 0x0007ffff, 0x0000c200),
3436+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG3, 0xffffffff, 0x00000280),
3437+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0xffffffff, 0x00800000),
3438+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0x0c1807ff, 0x00000042),
3439+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL, 0x1ff1ffff, 0x00000500),
3440+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL1_PIPE_STEER, 0x000000ff, 0x00000044),
3441+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_0, 0x77777777, 0x32103210),
3442+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_1, 0x77777777, 0x32103210),
3443+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2A_ADDR_MATCH_MASK, 0xffffffff, 0xfffffff3),
3444+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_ADDR_MATCH_MASK, 0xffffffff, 0xfffffff3),
3445+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CM_CTRL1, 0xff8fff0f, 0x580f1008),
3446+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CTRL3, 0xf7ffffff, 0x00f80988),
3447+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG, 0x000001ff, 0x00000020),
3448+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_CL_ENHANCE, 0xf17fffff, 0x01200007),
3449+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_BINNER_TIMEOUT_COUNTER, 0xffffffff, 0x00000800),
3450+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE_2, 0xffffffbf, 0x00000820),
3451+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQG_CONFIG, 0x000017ff, 0x00001000),
3452+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0xffffff7f, 0x00010020),
3453+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000),
3454+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00100000)
3455+};
3456+
3457+static const struct soc15_reg_golden golden_settings_gc_10_3_7[] = {
3458+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CS_CLK_CTRL, 0xff7f0fff, 0x78000100),
3459+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCH_PIPE_STEER, 0x000000ff, 0x000000e4),
3460+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCPF_GCR_CNTL, 0x0007ffff, 0x0000c200),
3461+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG3, 0xffffffff, 0x00000280),
3462+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0xffffffff, 0x00800000),
3463+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0x0c1807ff, 0x00000041),
3464+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL, 0x1ff1ffff, 0x00000500),
3465+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL1_PIPE_STEER, 0x000000ff, 0x000000e4),
3466+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_0, 0x77777777, 0x32103210),
3467+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_1, 0x77777777, 0x32103210),
3468+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2A_ADDR_MATCH_MASK, 0xffffffff, 0xffffffff),
3469+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_ADDR_MATCH_MASK, 0xffffffff, 0xffffffff),
3470+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CM_CTRL1, 0xff8fff0f, 0x580f1008),
3471+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CTRL3, 0xf7ffffff, 0x00f80988),
3472+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG, 0x000001ff, 0x00000020),
3473+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_CL_ENHANCE, 0xf000003f, 0x01200007),
3474+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_BINNER_TIMEOUT_COUNTER, 0xffffffff, 0x00000800),
3475+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE_2, 0xffffffbf, 0x00000820),
3476+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQG_CONFIG, 0x000017ff, 0x00001000),
3477+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0xffffff7f, 0x00010020),
3478+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000),
3479+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00100000)
3480+};
3481+
35603482 #define DEFAULT_SH_MEM_CONFIG \
35613483 ((SH_MEM_ADDRESS_MODE_64 << SH_MEM_CONFIG__ADDRESS_MODE__SHIFT) | \
35623484 (SH_MEM_ALIGNMENT_MODE_UNALIGNED << SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | \
@@ -3790,10 +3712,21 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev) · 227 unmodified lines
37903712 (const u32)ARRAY_SIZE(golden_settings_gc_10_3_5));
37913713 break;
37923714 case IP_VERSION(10, 1, 3):
3715+ case IP_VERSION(10, 1, 4):
37933716 soc15_program_register_sequence(adev,
37943717 golden_settings_gc_10_0_cyan_skillfish,
37953718 (const u32)ARRAY_SIZE(golden_settings_gc_10_0_cyan_skillfish));
37963719 break;
3720+ case IP_VERSION(10, 3, 6):
3721+ soc15_program_register_sequence(adev,
3722+ golden_settings_gc_10_3_6,
3723+ (const u32)ARRAY_SIZE(golden_settings_gc_10_3_6));
3724+ break;
3725+ case IP_VERSION(10, 3, 7):
3726+ soc15_program_register_sequence(adev,
3727+ golden_settings_gc_10_3_7,
3728+ (const u32)ARRAY_SIZE(golden_settings_gc_10_3_7));
3729+ break;
37973730 default:
37983731 break;
37993732 }
@@ -3968,6 +3901,7 @@ static void gfx_v10_0_check_fw_write_wait(struct amdgpu_device *adev) · 168 unmodified lines
39683901 case IP_VERSION(10, 1, 2):
39693902 case IP_VERSION(10, 1, 1):
39703903 case IP_VERSION(10, 1, 3):
3904+ case IP_VERSION(10, 1, 4):
39713905 if ((adev->gfx.me_fw_version >= 0x00000046) &&
39723906 (adev->gfx.me_feature_version >= 27) &&
39733907 (adev->gfx.pfp_fw_version >= 0x00000068) &&
@@ -3981,7 +3915,9 @@ static void gfx_v10_0_check_fw_write_wait(struct amdgpu_device *adev) · 7 unmodified lines
39813915 case IP_VERSION(10, 3, 1):
39823916 case IP_VERSION(10, 3, 4):
39833917 case IP_VERSION(10, 3, 5):
3918+ case IP_VERSION(10, 3, 6):
39843919 case IP_VERSION(10, 3, 3):
3920+ case IP_VERSION(10, 3, 7):
39853921 adev->gfx.cp_fw_write_wait = true;
39863922 break;
39873923 default:
@@ -4102,12 +4038,19 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) · 114 unmodified lines
41024038 case IP_VERSION(10, 3, 3):
41034039 chip_name = "yellow_carp";
41044040 break;
4041+ case IP_VERSION(10, 3, 6):
4042+ chip_name = "gc_10_3_6";
4043+ break;
41054044 case IP_VERSION(10, 1, 3):
4045+ case IP_VERSION(10, 1, 4):
41064046 if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2)
41074047 chip_name = "cyan_skillfish2";
41084048 else
41094049 chip_name = "cyan_skillfish";
41104050 break;
4051+ case IP_VERSION(10, 3, 7):
4052+ chip_name = "gc_10_3_7";
4053+ break;
41114054 default:
41124055 BUG();
41134056 }
@@ -4448,6 +4391,30 @@ static void gfx_v10_0_rlc_fini(struct amdgpu_device *adev) · 334 unmodified lines
44484391 (void **)&adev->gfx.rlc.cp_table_ptr);
44494392 }
44504393
4394+static void gfx_v10_0_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)
4395+{
4396+ struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
4397+
4398+ reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl;
4399+ reg_access_ctrl->scratch_reg0 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG0);
4400+ reg_access_ctrl->scratch_reg1 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG1);
4401+ reg_access_ctrl->scratch_reg2 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG2);
4402+ reg_access_ctrl->scratch_reg3 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG3);
4403+ reg_access_ctrl->grbm_cntl = SOC15_REG_OFFSET(GC, 0, mmGRBM_GFX_CNTL);
4404+ reg_access_ctrl->grbm_idx = SOC15_REG_OFFSET(GC, 0, mmGRBM_GFX_INDEX);
4405+ switch (adev->ip_versions[GC_HWIP][0]) {
4406+ case IP_VERSION(10, 3, 0):
4407+ reg_access_ctrl->spare_int =
4408+ SOC15_REG_OFFSET(GC, 0, mmRLC_SPARE_INT_0_Sienna_Cichlid);
4409+ break;
4410+ default:
4411+ reg_access_ctrl->spare_int =
4412+ SOC15_REG_OFFSET(GC, 0, mmRLC_SPARE_INT);
4413+ break;
4414+ }
4415+ adev->gfx.rlc.rlcg_reg_access_supported = true;
4416+}
4417+
44514418 static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
44524419 {
44534420 const struct cs_section_def *cs_data;
@@ -4468,6 +4435,7 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev) · 14 unmodified lines
44684435 if (adev->gfx.rlc.funcs->update_spm_vmid)
44694436 adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf);
44704437
4438+
44714439 return 0;
44724440 }
44734441
@@ -4678,7 +4646,9 @@ static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev) · 204 unmodified lines
46784646 case IP_VERSION(10, 3, 1):
46794647 case IP_VERSION(10, 3, 4):
46804648 case IP_VERSION(10, 3, 5):
4649+ case IP_VERSION(10, 3, 6):
46814650 case IP_VERSION(10, 3, 3):
4651+ case IP_VERSION(10, 3, 7):
46824652 adev->gfx.config.max_hw_contexts = 8;
46834653 adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
46844654 adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
@@ -4689,6 +4659,7 @@ static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev) · 4 unmodified lines
46894659 1 << REG_GET_FIELD(gb_addr_config, GB_ADDR_CONFIG, NUM_PKRS);
46904660 break;
46914661 case IP_VERSION(10, 1, 3):
4662+ case IP_VERSION(10, 1, 4):
46924663 adev->gfx.config.max_hw_contexts = 8;
46934664 adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
46944665 adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
@@ -4801,6 +4772,7 @@ static int gfx_v10_0_sw_init(void *handle) · 106 unmodified lines
48014772 case IP_VERSION(10, 1, 1):
48024773 case IP_VERSION(10, 1, 2):
48034774 case IP_VERSION(10, 1, 3):
4775+ case IP_VERSION(10, 1, 4):
48044776 adev->gfx.me.num_me = 1;
48054777 adev->gfx.me.num_pipe_per_me = 1;
48064778 adev->gfx.me.num_queue_per_pipe = 1;
@@ -4813,7 +4785,9 @@ static int gfx_v10_0_sw_init(void *handle) · 6 unmodified lines
48134785 case IP_VERSION(10, 3, 1):
48144786 case IP_VERSION(10, 3, 4):
48154787 case IP_VERSION(10, 3, 5):
4788+ case IP_VERSION(10, 3, 6):
48164789 case IP_VERSION(10, 3, 3):
4790+ case IP_VERSION(10, 3, 7):
48174791 adev->gfx.me.num_me = 1;
48184792 adev->gfx.me.num_pipe_per_me = 1;
48194793 adev->gfx.me.num_queue_per_pipe = 1;
@@ -4865,10 +4839,14 @@ static int gfx_v10_0_sw_init(void *handle) · 45 unmodified lines
48654839 if (r)
48664840 return r;
48674841
4868− r = gfx_v10_0_rlc_init(adev);
4869− if (r) {
4870− DRM_ERROR("Failed to init rlc BOs!\n");
4871− return r;
4842+ if (adev->gfx.rlc.funcs) {
4843+ if (adev->gfx.rlc.funcs->init) {
4844+ r = adev->gfx.rlc.funcs->init(adev);
4845+ if (r) {
4846+ dev_err(adev->dev, "Failed to init rlc BOs!\n");
4847+ return r;
4848+ }
4849+ }
48724850 }
48734851
48744852 r = gfx_v10_0_mec_init(adev);
@@ -5047,7 +5025,8 @@ static void gfx_v10_0_setup_rb(struct amdgpu_device *adev) · 172 unmodified lines
50475025 for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
50485026 bitmap = i * adev->gfx.config.max_sh_per_se + j;
50495027 if (((adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) ||
5050− (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 3))) &&
5028+ (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 3)) ||
5029+ (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 6))) &&
50515030 ((gfx_v10_3_get_disabled_sa(adev) >> bitmap) & 1))
50525031 continue;
50535032 gfx_v10_0_select_se_sh(adev, i, j, 0xffffffff);
@@ -6321,7 +6300,9 @@ static void gfx_v10_0_cp_gfx_set_doorbell(struct amdgpu_device *adev, · 1267 unmodified lines
63216300 case IP_VERSION(10, 3, 1):
63226301 case IP_VERSION(10, 3, 4):
63236302 case IP_VERSION(10, 3, 5):
6303+ case IP_VERSION(10, 3, 6):
63246304 case IP_VERSION(10, 3, 3):
6305+ case IP_VERSION(10, 3, 7):
63256306 tmp = REG_SET_FIELD(0, CP_RB_DOORBELL_RANGE_LOWER,
63266307 DOORBELL_RANGE_LOWER_Sienna_Cichlid, ring->doorbell_index);
63276308 WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
@@ -6458,7 +6439,9 @@ static void gfx_v10_0_cp_compute_enable(struct amdgpu_device *adev, bool enable) · 130 unmodified lines
64586439 case IP_VERSION(10, 3, 1):
64596440 case IP_VERSION(10, 3, 4):
64606441 case IP_VERSION(10, 3, 5):
6442+ case IP_VERSION(10, 3, 6):
64616443 case IP_VERSION(10, 3, 3):
6444+ case IP_VERSION(10, 3, 7):
64626445 WREG32_SOC15(GC, 0, mmCP_MEC_CNTL_Sienna_Cichlid, 0);
64636446 break;
64646447 default:
@@ -6472,7 +6455,9 @@ static void gfx_v10_0_cp_compute_enable(struct amdgpu_device *adev, bool enable) · 7 unmodified lines
64726455 case IP_VERSION(10, 3, 1):
64736456 case IP_VERSION(10, 3, 4):
64746457 case IP_VERSION(10, 3, 5):
6458+ case IP_VERSION(10, 3, 6):
64756459 case IP_VERSION(10, 3, 3):
6460+ case IP_VERSION(10, 3, 7):
64766461 WREG32_SOC15(GC, 0, mmCP_MEC_CNTL_Sienna_Cichlid,
64776462 (CP_MEC_CNTL__MEC_ME1_HALT_MASK |
64786463 CP_MEC_CNTL__MEC_ME2_HALT_MASK));
@@ -6570,6 +6555,7 @@ static void gfx_v10_0_kiq_setting(struct amdgpu_ring *ring) · 91 unmodified lines
65706555 case IP_VERSION(10, 3, 1):
65716556 case IP_VERSION(10, 3, 4):
65726557 case IP_VERSION(10, 3, 5):
6558+ case IP_VERSION(10, 3, 6):
65736559 case IP_VERSION(10, 3, 3):
65746560 tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid);
65756561 tmp &= 0xffffff00;
@@ -7300,6 +7286,8 @@ static bool gfx_v10_0_check_grbm_cam_remapping(struct amdgpu_device *adev) · 724 unmodified lines
73007286 break;
73017287 case IP_VERSION(10, 3, 1):
73027288 case IP_VERSION(10, 3, 3):
7289+ case IP_VERSION(10, 3, 6):
7290+ case IP_VERSION(10, 3, 7):
73037291 return true;
73047292 default:
73057293 data = RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE);
@@ -7334,7 +7322,9 @@ static void gfx_v10_0_setup_grbm_cam_remapping(struct amdgpu_device *adev) · 28 unmodified lines
73347322 case IP_VERSION(10, 3, 1):
73357323 case IP_VERSION(10, 3, 4):
73367324 case IP_VERSION(10, 3, 5):
7325+ case IP_VERSION(10, 3, 6):
73377326 case IP_VERSION(10, 3, 3):
7327+ case IP_VERSION(10, 3, 7):
73387328 /* mmVGT_TF_RING_SIZE_UMD -> mmVGT_TF_RING_SIZE */
73397329 data = (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_RING_SIZE_UMD) <<
73407330 GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
@@ -7654,6 +7644,7 @@ static int gfx_v10_0_soft_reset(void *handle) · 313 unmodified lines
76547644 case IP_VERSION(10, 3, 1):
76557645 case IP_VERSION(10, 3, 4):
76567646 case IP_VERSION(10, 3, 5):
7647+ case IP_VERSION(10, 3, 6):
76577648 case IP_VERSION(10, 3, 3):
76587649 if (REG_GET_FIELD(tmp, GRBM_STATUS2, RLC_BUSY_Sienna_Cichlid))
76597650 grbm_soft_reset = REG_SET_FIELD(grbm_soft_reset,
@@ -7721,6 +7712,21 @@ static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev) · 61 unmodified lines
77217712 preempt_enable();
77227713 clock = clock_lo | (clock_hi << 32ULL);
77237714 break;
7715+ case IP_VERSION(10, 3, 6):
7716+ preempt_disable();
7717+ clock_hi = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER_GC_10_3_6);
7718+ clock_lo = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER_GC_10_3_6);
7719+ hi_check = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER_GC_10_3_6);
7720+ /* The SMUIO TSC clock frequency is 100MHz, which sets 32-bit carry over
7721+ * roughly every 42 seconds.
7722+ */
7723+ if (hi_check != clock_hi) {
7724+ clock_lo = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER_GC_10_3_6);
7725+ clock_hi = hi_check;
7726+ }
7727+ preempt_enable();
7728+ clock = clock_lo | (clock_hi << 32ULL);
7729+ break;
77247730 default:
77257731 preempt_disable();
77267732 clock_hi = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER);
@@ -7778,6 +7784,7 @@ static int gfx_v10_0_early_init(void *handle) · 51 unmodified lines
77787784 case IP_VERSION(10, 1, 1):
77797785 case IP_VERSION(10, 1, 2):
77807786 case IP_VERSION(10, 1, 3):
7787+ case IP_VERSION(10, 1, 4):
77817788 adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS_NV1X;
77827789 break;
77837790 case IP_VERSION(10, 3, 0):
@@ -7785,7 +7792,9 @@ static int gfx_v10_0_early_init(void *handle) · 1 unmodified line
77857792 case IP_VERSION(10, 3, 1):
77867793 case IP_VERSION(10, 3, 4):
77877794 case IP_VERSION(10, 3, 5):
7795+ case IP_VERSION(10, 3, 6):
77887796 case IP_VERSION(10, 3, 3):
7797+ case IP_VERSION(10, 3, 7):
77897798 adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS_Sienna_Cichlid;
77907799 break;
77917800 default:
@@ -7801,6 +7810,9 @@ static int gfx_v10_0_early_init(void *handle) · 9 unmodified lines
78017810 gfx_v10_0_set_gds_init(adev);
78027811 gfx_v10_0_set_rlc_funcs(adev);
78037812
7813+ /* init rlcg reg access ctrl */
7814+ gfx_v10_0_init_rlcg_reg_access_ctrl(adev);
7815+
78047816 return 0;
78057817 }
78067818
@@ -7843,6 +7855,7 @@ static void gfx_v10_0_set_safe_mode(struct amdgpu_device *adev) · 36 unmodified lines
78437855 case IP_VERSION(10, 3, 1):
78447856 case IP_VERSION(10, 3, 4):
78457857 case IP_VERSION(10, 3, 5):
7858+ case IP_VERSION(10, 3, 6):
78467859 case IP_VERSION(10, 3, 3):
78477860 WREG32_SOC15(GC, 0, mmRLC_SAFE_MODE_Sienna_Cichlid, data);
78487861
@@ -7879,6 +7892,7 @@ static void gfx_v10_0_unset_safe_mode(struct amdgpu_device *adev) · 30 unmodified lines
78797892 case IP_VERSION(10, 3, 1):
78807893 case IP_VERSION(10, 3, 4):
78817894 case IP_VERSION(10, 3, 5):
7895+ case IP_VERSION(10, 3, 6):
78827896 case IP_VERSION(10, 3, 3):
78837897 WREG32_SOC15(GC, 0, mmRLC_SAFE_MODE_Sienna_Cichlid, data);
78847898 break;
@@ -8333,6 +8347,7 @@ static void gfx_v10_cntl_power_gating(struct amdgpu_device *adev, bool enable) · 448 unmodified lines
83338347 switch (adev->ip_versions[GC_HWIP][0]) {
83348348 case IP_VERSION(10, 3, 1):
83358349 case IP_VERSION(10, 3, 3):
8350+ case IP_VERSION(10, 3, 6):
83368351 data = 0x4E20 & RLC_PG_DELAY_3__CGCG_ACTIVE_BEFORE_CGPG_MASK_Vangogh;
83378352 WREG32_SOC15(GC, 0, mmRLC_PG_DELAY_3, data);
83388353 break;
@@ -8377,8 +8392,6 @@ static const struct amdgpu_rlc_funcs gfx_v10_0_rlc_funcs_sriov = { · 38 unmodified lines
83778392 .reset = gfx_v10_0_rlc_reset,
83788393 .start = gfx_v10_0_rlc_start,
83798394 .update_spm_vmid = gfx_v10_0_update_spm_vmid,
8380− .sriov_wreg = gfx_v10_sriov_wreg,
8381− .sriov_rreg = gfx_v10_sriov_rreg,
83828395 .is_rlcg_access_range = gfx_v10_0_is_rlcg_access_range,
83838396 };
83848397
@@ -8403,6 +8416,7 @@ static int gfx_v10_0_set_powergating_state(void *handle, · 18 unmodified lines
84038416 break;
84048417 case IP_VERSION(10, 3, 1):
84058418 case IP_VERSION(10, 3, 3):
8419+ case IP_VERSION(10, 3, 6):
84068420 gfx_v10_cntl_pg(adev, enable);
84078421 amdgpu_gfx_off_ctrl(adev, enable);
84088422 break;
@@ -8429,6 +8443,7 @@ static int gfx_v10_0_set_clockgating_state(void *handle, · 20 unmodified lines
84298443 case IP_VERSION(10, 3, 1):
84308444 case IP_VERSION(10, 3, 4):
84318445 case IP_VERSION(10, 3, 5):
8446+ case IP_VERSION(10, 3, 6):
84328447 case IP_VERSION(10, 3, 3):
84338448 gfx_v10_0_update_gfx_clock_gating(adev,
84348449 state == AMD_CG_STATE_GATE);
@@ -9537,11 +9552,14 @@ static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev) · 1102 unmodified lines
95379552 case IP_VERSION(10, 1, 10):
95389553 case IP_VERSION(10, 1, 1):
95399554 case IP_VERSION(10, 1, 3):
9555+ case IP_VERSION(10, 1, 4):
95409556 case IP_VERSION(10, 3, 2):
95419557 case IP_VERSION(10, 3, 1):
95429558 case IP_VERSION(10, 3, 4):
95439559 case IP_VERSION(10, 3, 5):
9560+ case IP_VERSION(10, 3, 6):
95449561 case IP_VERSION(10, 3, 3):
9562+ case IP_VERSION(10, 3, 7):
95459563 adev->gfx.rlc.funcs = &gfx_v10_0_rlc_funcs;
95469564 break;
95479565 case IP_VERSION(10, 1, 2):
@@ -9634,7 +9652,9 @@ static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev, · 86 unmodified lines
96349652 for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
96359653 bitmap = i * adev->gfx.config.max_sh_per_se + j;
96369654 if (((adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) ||
9637− (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 3))) &&
9655+ (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 3)) ||
9656+ (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 6)) ||
9657+ (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 7))) &&
96389658 ((gfx_v10_3_get_disabled_sa(adev) >> bitmap) & 1))
96399659 continue;
96409660 mask = 1;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+72−162
@@ -63,13 +63,6 @@ · 62 unmodified lines
6363 #define mmGCEA_PROBE_MAP 0x070c
6464 #define mmGCEA_PROBE_MAP_BASE_IDX 0
6565
66−#define GFX9_RLCG_GC_WRITE_OLD (0x8 << 28)
67−#define GFX9_RLCG_GC_WRITE (0x0 << 28)
68−#define GFX9_RLCG_GC_READ (0x1 << 28)
69−#define GFX9_RLCG_VFGATE_DISABLED 0x4000000
70−#define GFX9_RLCG_WRONG_OPERATION_TYPE 0x2000000
71−#define GFX9_RLCG_NOT_IN_RANGE 0x1000000
72−
7366 MODULE_FIRMWARE("amdgpu/vega10_ce.bin");
7467 MODULE_FIRMWARE("amdgpu/vega10_pfp.bin");
7568 MODULE_FIRMWARE("amdgpu/vega10_me.bin");
@@ -746,128 +739,6 @@ static const u32 GFX_RLC_SRM_INDEX_CNTL_DATA_OFFSETS[] = · 670 unmodified lines
746739 mmRLC_SRM_INDEX_CNTL_DATA_7 - mmRLC_SRM_INDEX_CNTL_DATA_0,
747740 };
748741
749−static u32 gfx_v9_0_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32_t flag)
750−{
751− static void *scratch_reg0;
752− static void *scratch_reg1;
753− static void *scratch_reg2;
754− static void *scratch_reg3;
755− static void *spare_int;
756− static uint32_t grbm_cntl;
757− static uint32_t grbm_idx;
758− uint32_t i = 0;
759− uint32_t retries = 50000;
760− u32 ret = 0;
761− u32 tmp;
762−
763− scratch_reg0 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG0)*4;
764− scratch_reg1 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG1)*4;
765− scratch_reg2 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG2_BASE_IDX] + mmSCRATCH_REG2)*4;
766− scratch_reg3 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG3_BASE_IDX] + mmSCRATCH_REG3)*4;
767− spare_int = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_BASE_IDX] + mmRLC_SPARE_INT)*4;
768−
769− grbm_cntl = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_CNTL_BASE_IDX] + mmGRBM_GFX_CNTL;
770− grbm_idx = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_INDEX_BASE_IDX] + mmGRBM_GFX_INDEX;
771−
772− if (offset == grbm_cntl || offset == grbm_idx) {
773− if (offset == grbm_cntl)
774− writel(v, scratch_reg2);
775− else if (offset == grbm_idx)
776− writel(v, scratch_reg3);
777−
778− writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
779− } else {
780− /*
781− * SCRATCH_REG0 = read/write value
782− * SCRATCH_REG1[30:28] = command
783− * SCRATCH_REG1[19:0] = address in dword
784− * SCRATCH_REG1[26:24] = Error reporting
785− */
786− writel(v, scratch_reg0);
787− writel(offset | flag, scratch_reg1);
788− writel(1, spare_int);
789−
790− for (i = 0; i < retries; i++) {
791− tmp = readl(scratch_reg1);
792− if (!(tmp & flag))
793− break;
794−
795− udelay(10);
796− }
797−
798− if (i >= retries) {
799− if (amdgpu_sriov_reg_indirect_gc(adev)) {
800− if (tmp & GFX9_RLCG_VFGATE_DISABLED)
801− pr_err("The vfgate is disabled, program reg:0x%05x failed!\n", offset);
802− else if (tmp & GFX9_RLCG_WRONG_OPERATION_TYPE)
803− pr_err("Wrong operation type, program reg:0x%05x failed!\n", offset);
804− else if (tmp & GFX9_RLCG_NOT_IN_RANGE)
805− pr_err("The register is not in range, program reg:0x%05x failed!\n", offset);
806− else
807− pr_err("Unknown error type, program reg:0x%05x failed!\n", offset);
808− } else
809− pr_err("timeout: rlcg program reg:0x%05x failed!\n", offset);
810− }
811− }
812−
813− ret = readl(scratch_reg0);
814−
815− return ret;
816−}
817−
818−static bool gfx_v9_0_get_rlcg_flag(struct amdgpu_device *adev, u32 acc_flags, u32 hwip,
819− int write, u32 *rlcg_flag)
820−{
821−
822− switch (hwip) {
823− case GC_HWIP:
824− if (amdgpu_sriov_reg_indirect_gc(adev)) {
825− *rlcg_flag = write ? GFX9_RLCG_GC_WRITE : GFX9_RLCG_GC_READ;
826−
827− return true;
828− /* only in new version, AMDGPU_REGS_NO_KIQ and AMDGPU_REGS_RLC enabled simultaneously */
829− } else if ((acc_flags & AMDGPU_REGS_RLC) && !(acc_flags & AMDGPU_REGS_NO_KIQ) && write) {
830− *rlcg_flag = GFX9_RLCG_GC_WRITE_OLD;
831− return true;
832− }
833−
834− break;
835− default:
836− return false;
837− }
838−
839− return false;
840−}
841−
842−static u32 gfx_v9_0_sriov_rreg(struct amdgpu_device *adev, u32 offset, u32 acc_flags, u32 hwip)
843−{
844− u32 rlcg_flag;
845−
846− if (!amdgpu_sriov_runtime(adev) && gfx_v9_0_get_rlcg_flag(adev, acc_flags, hwip, 0, &rlcg_flag))
847− return gfx_v9_0_rlcg_rw(adev, offset, 0, rlcg_flag);
848−
849− if (acc_flags & AMDGPU_REGS_NO_KIQ)
850− return RREG32_NO_KIQ(offset);
851− else
852− return RREG32(offset);
853−}
854−
855−static void gfx_v9_0_sriov_wreg(struct amdgpu_device *adev, u32 offset,
856− u32 value, u32 acc_flags, u32 hwip)
857−{
858− u32 rlcg_flag;
859−
860− if (!amdgpu_sriov_runtime(adev) && gfx_v9_0_get_rlcg_flag(adev, acc_flags, hwip, 1, &rlcg_flag)) {
861− gfx_v9_0_rlcg_rw(adev, offset, value, rlcg_flag);
862− return;
863− }
864−
865− if (acc_flags & AMDGPU_REGS_NO_KIQ)
866− WREG32_NO_KIQ(offset, value);
867− else
868− WREG32(offset, value);
869−}
870−
871742 #define VEGA10_GB_ADDR_CONFIG_GOLDEN 0x2a114042
872743 #define VEGA12_GB_ADDR_CONFIG_GOLDEN 0x24104041
873744 #define RAVEN_GB_ADDR_CONFIG_GOLDEN 0x24000042
@@ -882,7 +753,7 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev, · 8 unmodified lines
882753 static uint64_t gfx_v9_0_get_gpu_clock_counter(struct amdgpu_device *adev);
883754 static void gfx_v9_0_ring_emit_de_meta(struct amdgpu_ring *ring);
884755 static u64 gfx_v9_0_ring_get_rptr_compute(struct amdgpu_ring *ring);
885−static int gfx_v9_0_query_ras_error_count(struct amdgpu_device *adev,
756+static void gfx_v9_0_query_ras_error_count(struct amdgpu_device *adev,
886757 void *ras_error_status);
887758 static int gfx_v9_0_ras_error_inject(struct amdgpu_device *adev,
888759 void *inject_if);
@@ -2008,6 +1879,21 @@ static int gfx_v9_0_cp_jump_table_num(struct amdgpu_device *adev) · 1119 unmodified lines
20081879 return 4;
20091880 }
20101881
1882+static void gfx_v9_0_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)
1883+{
1884+ struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
1885+
1886+ reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl;
1887+ reg_access_ctrl->scratch_reg0 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG0);
1888+ reg_access_ctrl->scratch_reg1 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG1);
1889+ reg_access_ctrl->scratch_reg2 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG2);
1890+ reg_access_ctrl->scratch_reg3 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG3);
1891+ reg_access_ctrl->grbm_cntl = SOC15_REG_OFFSET(GC, 0, mmGRBM_GFX_CNTL);
1892+ reg_access_ctrl->grbm_idx = SOC15_REG_OFFSET(GC, 0, mmGRBM_GFX_INDEX);
1893+ reg_access_ctrl->spare_int = SOC15_REG_OFFSET(GC, 0, mmRLC_SPARE_INT);
1894+ adev->gfx.rlc.rlcg_reg_access_supported = true;
1895+}
1896+
20111897 static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
20121898 {
20131899 const struct cs_section_def *cs_data;
@@ -2197,12 +2083,16 @@ static const struct amdgpu_gfx_funcs gfx_v9_0_gfx_funcs = { · 183 unmodified lines
21972083 .select_me_pipe_q = &gfx_v9_0_select_me_pipe_q,
21982084 };
21992085
2200−static const struct amdgpu_gfx_ras_funcs gfx_v9_0_ras_funcs = {
2201− .ras_late_init = amdgpu_gfx_ras_late_init,
2202− .ras_fini = amdgpu_gfx_ras_fini,
2203− .ras_error_inject = &gfx_v9_0_ras_error_inject,
2204− .query_ras_error_count = &gfx_v9_0_query_ras_error_count,
2205− .reset_ras_error_count = &gfx_v9_0_reset_ras_error_count,
2086+const struct amdgpu_ras_block_hw_ops gfx_v9_0_ras_ops = {
2087+ .ras_error_inject = &gfx_v9_0_ras_error_inject,
2088+ .query_ras_error_count = &gfx_v9_0_query_ras_error_count,
2089+ .reset_ras_error_count = &gfx_v9_0_reset_ras_error_count,
2090+};
2091+
2092+static struct amdgpu_gfx_ras gfx_v9_0_ras = {
2093+ .ras_block = {
2094+ .hw_ops = &gfx_v9_0_ras_ops,
2095+ },
22062096 };
22072097
22082098 static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
@@ -2231,7 +2121,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev) · 22 unmodified lines
22312121 DRM_INFO("fix gfx.config for vega12\n");
22322122 break;
22332123 case IP_VERSION(9, 4, 0):
2234− adev->gfx.ras_funcs = &gfx_v9_0_ras_funcs;
2124+ adev->gfx.ras = &gfx_v9_0_ras;
22352125 adev->gfx.config.max_hw_contexts = 8;
22362126 adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
22372127 adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
@@ -2258,7 +2148,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev) · 20 unmodified lines
22582148 gb_addr_config = RAVEN_GB_ADDR_CONFIG_GOLDEN;
22592149 break;
22602150 case IP_VERSION(9, 4, 1):
2261− adev->gfx.ras_funcs = &gfx_v9_4_ras_funcs;
2151+ adev->gfx.ras = &gfx_v9_4_ras;
22622152 adev->gfx.config.max_hw_contexts = 8;
22632153 adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
22642154 adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
@@ -2279,7 +2169,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev) · 14 unmodified lines
22792169 gb_addr_config |= 0x22010042;
22802170 break;
22812171 case IP_VERSION(9, 4, 2):
2282− adev->gfx.ras_funcs = &gfx_v9_4_2_ras_funcs;
2172+ adev->gfx.ras = &gfx_v9_4_2_ras;
22832173 adev->gfx.config.max_hw_contexts = 8;
22842174 adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
22852175 adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
@@ -2298,6 +2188,31 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev) · 12 unmodified lines
22982188 break;
22992189 }
23002190
2191+ if (adev->gfx.ras) {
2192+ err = amdgpu_ras_register_ras_block(adev, &adev->gfx.ras->ras_block);
2193+ if (err) {
2194+ DRM_ERROR("Failed to register gfx ras block!\n");
2195+ return err;
2196+ }
2197+
2198+ strcpy(adev->gfx.ras->ras_block.ras_comm.name, "gfx");
2199+ adev->gfx.ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__GFX;
2200+ adev->gfx.ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
2201+ adev->gfx.ras_if = &adev->gfx.ras->ras_block.ras_comm;
2202+
2203+ /* If not define special ras_late_init function, use gfx default ras_late_init */
2204+ if (!adev->gfx.ras->ras_block.ras_late_init)
2205+ adev->gfx.ras->ras_block.ras_late_init = amdgpu_gfx_ras_late_init;
2206+
2207+ /* If not define special ras_fini function, use gfx default ras_fini */
2208+ if (!adev->gfx.ras->ras_block.ras_fini)
2209+ adev->gfx.ras->ras_block.ras_fini = amdgpu_gfx_ras_fini;
2210+
2211+ /* If not defined special ras_cb function, use default ras_cb */
2212+ if (!adev->gfx.ras->ras_block.ras_cb)
2213+ adev->gfx.ras->ras_block.ras_cb = amdgpu_gfx_process_ras_data_cb;
2214+ }
2215+
23012216 adev->gfx.config.gb_addr_config = gb_addr_config;
23022217
23032218 adev->gfx.config.gb_addr_config_fields.num_pipes = 1 <<
@@ -2434,10 +2349,14 @@ static int gfx_v9_0_sw_init(void *handle) · 130 unmodified lines
24342349 return r;
24352350 }
24362351
2437− r = adev->gfx.rlc.funcs->init(adev);
2438− if (r) {
2439− DRM_ERROR("Failed to init rlc BOs!\n");
2440− return r;
2352+ if (adev->gfx.rlc.funcs) {
2353+ if (adev->gfx.rlc.funcs->init) {
2354+ r = adev->gfx.rlc.funcs->init(adev);
2355+ if (r) {
2356+ dev_err(adev->dev, "Failed to init rlc BOs!\n");
2357+ return r;
2358+ }
2359+ }
24412360 }
24422361
24432362 r = gfx_v9_0_mec_init(adev);
@@ -2513,9 +2432,8 @@ static int gfx_v9_0_sw_fini(void *handle) · 69 unmodified lines
25132432 int i;
25142433 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
25152434
2516− if (adev->gfx.ras_funcs &&
2517− adev->gfx.ras_funcs->ras_fini)
2518− adev->gfx.ras_funcs->ras_fini(adev);
2435+ if (adev->gfx.ras && adev->gfx.ras->ras_block.ras_fini)
2436+ adev->gfx.ras->ras_block.ras_fini(adev);
25192437
25202438 for (i = 0; i < adev->gfx.num_gfx_rings; i++)
25212439 amdgpu_ring_fini(&adev->gfx.gfx_ring[i]);
@@ -4840,6 +4758,9 @@ static int gfx_v9_0_early_init(void *handle) · 2318 unmodified lines
48404758 gfx_v9_0_set_gds_init(adev);
48414759 gfx_v9_0_set_rlc_funcs(adev);
48424760
4761+ /* init rlcg reg access ctrl */
4762+ gfx_v9_0_init_rlcg_reg_access_ctrl(adev);
4763+
48434764 return 0;
48444765 }
48454766
@@ -4870,16 +4791,9 @@ static int gfx_v9_0_ecc_late_init(void *handle) · 24 unmodified lines
48704791 if (r)
48714792 return r;
48724793
4873− if (adev->gfx.ras_funcs &&
4874− adev->gfx.ras_funcs->ras_late_init) {
4875− r = adev->gfx.ras_funcs->ras_late_init(adev);
4876− if (r)
4877− return r;
4878− }
4879−
4880− if (adev->gfx.ras_funcs &&
4881− adev->gfx.ras_funcs->enable_watchdog_timer)
4882− adev->gfx.ras_funcs->enable_watchdog_timer(adev);
4794+ if (adev->gfx.ras &&
4795+ adev->gfx.ras->enable_watchdog_timer)
4796+ adev->gfx.ras->enable_watchdog_timer(adev);
48834797
48844798 return 0;
48854799 }
@@ -5250,8 +5164,6 @@ static const struct amdgpu_rlc_funcs gfx_v9_0_rlc_funcs = { · 364 unmodified lines
52505164 .reset = gfx_v9_0_rlc_reset,
52515165 .start = gfx_v9_0_rlc_start,
52525166 .update_spm_vmid = gfx_v9_0_update_spm_vmid,
5253− .sriov_wreg = gfx_v9_0_sriov_wreg,
5254− .sriov_rreg = gfx_v9_0_sriov_rreg,
52555167 .is_rlcg_access_range = gfx_v9_0_is_rlcg_access_range,
52565168 };
52575169
@@ -6819,7 +6731,7 @@ static void gfx_v9_0_reset_ras_error_count(struct amdgpu_device *adev) · 1561 unmodified lines
68196731 WREG32_SOC15(GC, 0, mmATC_L2_CACHE_4K_EDC_INDEX, 255);
68206732 }
68216733
6822−static int gfx_v9_0_query_ras_error_count(struct amdgpu_device *adev,
6734+static void gfx_v9_0_query_ras_error_count(struct amdgpu_device *adev,
68236735 void *ras_error_status)
68246736 {
68256737 struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
@@ -6828,7 +6740,7 @@ static int gfx_v9_0_query_ras_error_count(struct amdgpu_device *adev, · 2 unmodified lines
68286740 uint32_t reg_value;
68296741
68306742 if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX))
6831− return -EINVAL;
6743+ return;
68326744
68336745 err_data->ue_count = 0;
68346746 err_data->ce_count = 0;
@@ -6857,8 +6769,6 @@ static int gfx_v9_0_query_ras_error_count(struct amdgpu_device *adev, · 22 unmodified lines
68576769 mutex_unlock(&adev->grbm_idx_mutex);
68586770
68596771 gfx_v9_0_query_utc_edc_status(adev, err_data);
6860−
6861− return 0;
68626772 }
68636773
68646774 static void gfx_v9_0_emit_mem_sync(struct amdgpu_ring *ring)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4.c+14−10
@@ -863,7 +863,7 @@ static int gfx_v9_4_ras_error_count(struct amdgpu_device *adev, · 862 unmodified lines
863863 return 0;
864864 }
865865
866−static int gfx_v9_4_query_ras_error_count(struct amdgpu_device *adev,
866+static void gfx_v9_4_query_ras_error_count(struct amdgpu_device *adev,
867867 void *ras_error_status)
868868 {
869869 struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
@@ -872,7 +872,7 @@ static int gfx_v9_4_query_ras_error_count(struct amdgpu_device *adev, · 2 unmodified lines
872872 uint32_t reg_value;
873873
874874 if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX))
875− return -EINVAL;
875+ return;
876876
877877 err_data->ue_count = 0;
878878 err_data->ce_count = 0;
@@ -903,7 +903,6 @@ static int gfx_v9_4_query_ras_error_count(struct amdgpu_device *adev, · 24 unmodified lines
903903
904904 gfx_v9_4_query_utc_edc_status(adev, err_data);
905905
906− return 0;
907906 }
908907
909908 static void gfx_v9_4_reset_ras_error_count(struct amdgpu_device *adev)
@@ -1029,11 +1028,16 @@ static void gfx_v9_4_query_ras_error_status(struct amdgpu_device *adev) · 119 unmodified lines
10291028 mutex_unlock(&adev->grbm_idx_mutex);
10301029 }
10311030
1032−const struct amdgpu_gfx_ras_funcs gfx_v9_4_ras_funcs = {
1033− .ras_late_init = amdgpu_gfx_ras_late_init,
1034− .ras_fini = amdgpu_gfx_ras_fini,
1035− .ras_error_inject = &gfx_v9_4_ras_error_inject,
1036− .query_ras_error_count = &gfx_v9_4_query_ras_error_count,
1037− .reset_ras_error_count = &gfx_v9_4_reset_ras_error_count,
1038− .query_ras_error_status = &gfx_v9_4_query_ras_error_status,
1031+
1032+const struct amdgpu_ras_block_hw_ops gfx_v9_4_ras_ops = {
1033+ .ras_error_inject = &gfx_v9_4_ras_error_inject,
1034+ .query_ras_error_count = &gfx_v9_4_query_ras_error_count,
1035+ .reset_ras_error_count = &gfx_v9_4_reset_ras_error_count,
1036+ .query_ras_error_status = &gfx_v9_4_query_ras_error_status,
1037+};
1038+
1039+struct amdgpu_gfx_ras gfx_v9_4_ras = {
1040+ .ras_block = {
1041+ .hw_ops = &gfx_v9_4_ras_ops,
1042+ },
10391043 };
drivers/gpu/drm/amd/amdgpu/gfx_v9_4.h+1−1
@@ -24,6 +24,6 @@ · 23 unmodified lines
2424 #ifndef __GFX_V9_4_H__
2525 #define __GFX_V9_4_H__
2626
27−extern const struct amdgpu_gfx_ras_funcs gfx_v9_4_ras_funcs;
27+extern struct amdgpu_gfx_ras gfx_v9_4_ras;
2828
2929 #endif /* __GFX_V9_4_H__ */
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c+14−11
@@ -1641,14 +1641,14 @@ static int gfx_v9_4_2_query_utc_edc_count(struct amdgpu_device *adev, · 1640 unmodified lines
16411641 return 0;
16421642 }
16431643
1644−static int gfx_v9_4_2_query_ras_error_count(struct amdgpu_device *adev,
1644+static void gfx_v9_4_2_query_ras_error_count(struct amdgpu_device *adev,
16451645 void *ras_error_status)
16461646 {
16471647 struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
16481648 uint32_t sec_count = 0, ded_count = 0;
16491649
16501650 if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX))
1651− return -EINVAL;
1651+ return;
16521652
16531653 err_data->ue_count = 0;
16541654 err_data->ce_count = 0;
@@ -1661,7 +1661,6 @@ static int gfx_v9_4_2_query_ras_error_count(struct amdgpu_device *adev, · 6 unmodified lines
16611661 err_data->ce_count += sec_count;
16621662 err_data->ue_count += ded_count;
16631663
1664− return 0;
16651664 }
16661665
16671666 static void gfx_v9_4_2_reset_utc_err_status(struct amdgpu_device *adev)
@@ -1931,13 +1930,17 @@ static void gfx_v9_4_2_reset_sq_timeout_status(struct amdgpu_device *adev) · 263 unmodified lines
19311930 mutex_unlock(&adev->grbm_idx_mutex);
19321931 }
19331932
1934−const struct amdgpu_gfx_ras_funcs gfx_v9_4_2_ras_funcs = {
1935− .ras_late_init = amdgpu_gfx_ras_late_init,
1936− .ras_fini = amdgpu_gfx_ras_fini,
1937− .ras_error_inject = &gfx_v9_4_2_ras_error_inject,
1938− .query_ras_error_count = &gfx_v9_4_2_query_ras_error_count,
1939− .reset_ras_error_count = &gfx_v9_4_2_reset_ras_error_count,
1940− .query_ras_error_status = &gfx_v9_4_2_query_ras_error_status,
1941− .reset_ras_error_status = &gfx_v9_4_2_reset_ras_error_status,
1933+struct amdgpu_ras_block_hw_ops gfx_v9_4_2_ras_ops = {
1934+ .ras_error_inject = &gfx_v9_4_2_ras_error_inject,
1935+ .query_ras_error_count = &gfx_v9_4_2_query_ras_error_count,
1936+ .reset_ras_error_count = &gfx_v9_4_2_reset_ras_error_count,
1937+ .query_ras_error_status = &gfx_v9_4_2_query_ras_error_status,
1938+ .reset_ras_error_status = &gfx_v9_4_2_reset_ras_error_status,
1939+};
1940+
1941+struct amdgpu_gfx_ras gfx_v9_4_2_ras = {
1942+ .ras_block = {
1943+ .hw_ops = &gfx_v9_4_2_ras_ops,
1944+ },
19421945 .enable_watchdog_timer = &gfx_v9_4_2_enable_watchdog_timer,
19431946 };
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h+1−1
@@ -31,6 +31,6 @@ void gfx_v9_4_2_init_golden_registers(struct amdgpu_device *adev, · 30 unmodified lines
3131 void gfx_v9_4_2_set_power_brake_sequence(struct amdgpu_device *adev);
3232 int gfx_v9_4_2_do_edc_gpr_workarounds(struct amdgpu_device *adev);
3333
34−extern const struct amdgpu_gfx_ras_funcs gfx_v9_4_2_ras_funcs;
34+extern struct amdgpu_gfx_ras gfx_v9_4_2_ras;
3535
3636 #endif /* __GFX_V9_4_2_H__ */
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c+6−1
@@ -543,7 +543,9 @@ static void gfxhub_v2_1_utcl2_harvest(struct amdgpu_device *adev) · 542 unmodified lines
543543 adev->gfx.config.max_sh_per_se *
544544 adev->gfx.config.max_shader_engines);
545545
546− if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 3)) {
546+ switch (adev->ip_versions[GC_HWIP][0]) {
547+ case IP_VERSION(10, 3, 1):
548+ case IP_VERSION(10, 3, 3):
547549 /* Get SA disabled bitmap from eFuse setting */
548550 efuse_setting = RREG32_SOC15(GC, 0, mmCC_GC_SA_UNIT_DISABLE);
549551 efuse_setting &= CC_GC_SA_UNIT_DISABLE__SA_DISABLE_MASK;
@@ -566,6 +568,9 @@ static void gfxhub_v2_1_utcl2_harvest(struct amdgpu_device *adev) · 16 unmodified lines
566568 disabled_sa = tmp;
567569
568570 WREG32_SOC15(GC, 0, mmGCUTCL2_HARVEST_BYPASS_GROUPS_YELLOW_CARP, disabled_sa);
571+ break;
572+ default:
573+ break;
569574 }
570575 }
571576
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c+47−13
@@ -48,6 +48,8 @@ · 47 unmodified lines
4848 #include "athub_v2_0.h"
4949 #include "athub_v2_1.h"
5050
51+#include "amdgpu_reset.h"
52+
5153 #if 0
5254 static const struct soc15_reg_golden golden_settings_navi10_hdp[] =
5355 {
@@ -328,7 +330,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · 274 unmodified lines
328330 */
329331 if (adev->gfx.kiq.ring.sched.ready &&
330332 (amdgpu_sriov_runtime(adev) || !amdgpu_sriov_vf(adev)) &&
331− down_read_trylock(&adev->reset_sem)) {
333+ down_read_trylock(&adev->reset_domain->sem)) {
332334 struct amdgpu_vmhub *hub = &adev->vmhub[vmhub];
333335 const unsigned eng = 17;
334336 u32 inv_req = hub->vmhub_funcs->get_invalidate_req(vmid, flush_type);
@@ -338,7 +340,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · 3 unmodified lines
338340 amdgpu_virt_kiq_reg_write_reg_wait(adev, req, ack, inv_req,
339341 1 << vmid);
340342
341− up_read(&adev->reset_sem);
343+ up_read(&adev->reset_domain->sem);
342344 return;
343345 }
344346
@@ -664,11 +666,31 @@ static void gmc_v10_0_set_umc_funcs(struct amdgpu_device *adev) · 319 unmodified lines
664666 adev->umc.umc_inst_num = UMC_V8_7_UMC_INSTANCE_NUM;
665667 adev->umc.channel_offs = UMC_V8_7_PER_CHANNEL_OFFSET_SIENNA;
666668 adev->umc.channel_idx_tbl = &umc_v8_7_channel_idx_tbl[0][0];
667− adev->umc.ras_funcs = &umc_v8_7_ras_funcs;
669+ adev->umc.ras = &umc_v8_7_ras;
668670 break;
669671 default:
670672 break;
671673 }
674+ if (adev->umc.ras) {
675+ amdgpu_ras_register_ras_block(adev, &adev->umc.ras->ras_block);
676+
677+ strcpy(adev->umc.ras->ras_block.ras_comm.name, "umc");
678+ adev->umc.ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__UMC;
679+ adev->umc.ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
680+ adev->umc.ras_if = &adev->umc.ras->ras_block.ras_comm;
681+
682+ /* If don't define special ras_late_init function, use default ras_late_init */
683+ if (!adev->umc.ras->ras_block.ras_late_init)
684+ adev->umc.ras->ras_block.ras_late_init = amdgpu_umc_ras_late_init;
685+
686+ /* If don't define special ras_fini function, use default ras_fini */
687+ if (!adev->umc.ras->ras_block.ras_fini)
688+ adev->umc.ras->ras_block.ras_fini = amdgpu_umc_ras_fini;
689+
690+ /* If not defined special ras_cb function, use default ras_cb */
691+ if (!adev->umc.ras->ras_block.ras_cb)
692+ adev->umc.ras->ras_block.ras_cb = amdgpu_umc_process_ras_data_cb;
693+ }
672694 }
673695
674696
@@ -677,6 +699,7 @@ static void gmc_v10_0_set_mmhub_funcs(struct amdgpu_device *adev) · 2 unmodified lines
677699 switch (adev->ip_versions[MMHUB_HWIP][0]) {
678700 case IP_VERSION(2, 3, 0):
679701 case IP_VERSION(2, 4, 0):
702+ case IP_VERSION(2, 4, 1):
680703 adev->mmhub.funcs = &mmhub_v2_3_funcs;
681704 break;
682705 default:
@@ -693,7 +716,9 @@ static void gmc_v10_0_set_gfxhub_funcs(struct amdgpu_device *adev) · 10 unmodified lines
693716 case IP_VERSION(10, 3, 1):
694717 case IP_VERSION(10, 3, 4):
695718 case IP_VERSION(10, 3, 5):
719+ case IP_VERSION(10, 3, 6):
696720 case IP_VERSION(10, 3, 3):
721+ case IP_VERSION(10, 3, 7):
697722 adev->gfxhub.funcs = &gfxhub_v2_1_funcs;
698723 break;
699724 default:
@@ -705,6 +730,7 @@ static void gmc_v10_0_set_gfxhub_funcs(struct amdgpu_device *adev) · 5 unmodified lines
705730
706731 static int gmc_v10_0_early_init(void *handle)
707732 {
733+ int r;
708734 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
709735
710736 gmc_v10_0_set_mmhub_funcs(adev);
@@ -720,6 +746,10 @@ static int gmc_v10_0_early_init(void *handle) · 9 unmodified lines
720746 adev->gmc.private_aperture_end =
721747 adev->gmc.private_aperture_start + (4ULL << 30) - 1;
722748
749+ r = amdgpu_gmc_ras_early_init(adev);
750+ if (r)
751+ return r;
752+
723753 return 0;
724754 }
725755
@@ -862,12 +892,15 @@ static int gmc_v10_0_sw_init(void *handle) · 136 unmodified lines
862892 case IP_VERSION(10, 1, 1):
863893 case IP_VERSION(10, 1, 2):
864894 case IP_VERSION(10, 1, 3):
895+ case IP_VERSION(10, 1, 4):
865896 case IP_VERSION(10, 3, 0):
866897 case IP_VERSION(10, 3, 2):
867898 case IP_VERSION(10, 3, 1):
868899 case IP_VERSION(10, 3, 4):
869900 case IP_VERSION(10, 3, 5):
901+ case IP_VERSION(10, 3, 6):
870902 case IP_VERSION(10, 3, 3):
903+ case IP_VERSION(10, 3, 7):
871904 adev->num_vmhubs = 2;
872905 /*
873906 * To fulfill 4-level page support,
@@ -986,14 +1019,7 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev) · 112 unmodified lines
9861019 return -EINVAL;
9871020 }
9881021
989− if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev))
990− goto skip_pin_bo;
991−
992− r = amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
993− if (r)
994− return r;
995−
996−skip_pin_bo:
1022+ amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
9971023 r = adev->gfxhub.funcs->gart_enable(adev);
9981024 if (r)
9991025 return r;
@@ -1019,8 +1045,6 @@ skip_pin_bo: · 19 unmodified lines
10191045 (unsigned)(adev->gmc.gart_size >> 20),
10201046 (unsigned long long)amdgpu_bo_gpu_offset(adev->gart.bo));
10211047
1022− adev->gart.ready = true;
1023−
10241048 return 0;
10251049 }
10261050
@@ -1043,6 +1067,12 @@ static int gmc_v10_0_hw_init(void *handle) · 16 unmodified lines
10431067 if (r)
10441068 return r;
10451069
1070+ if (amdgpu_emu_mode == 1) {
1071+ r = amdgpu_gmc_vram_checking(adev);
1072+ if (r)
1073+ return r;
1074+ }
1075+
10461076 if (adev->umc.funcs && adev->umc.funcs->init_registers)
10471077 adev->umc.funcs->init_registers(adev);
10481078
@@ -1140,6 +1170,10 @@ static void gmc_v10_0_get_clockgating_state(void *handle, u32 *flags) · 91 unmodified lines
11401170 {
11411171 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
11421172
1173+ if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 3) ||
1174+ adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 4))
1175+ return;
1176+
11431177 adev->mmhub.funcs->get_clockgating(adev, flags);
11441178
11451179 if (adev->ip_versions[ATHUB_HWIP][0] >= IP_VERSION(2, 1, 0))
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c+6−6
@@ -469,16 +469,14 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable) · 468 unmodified lines
469469 static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
470470 {
471471 uint64_t table_addr;
472− int r, i;
473472 u32 field;
473+ int i;
474474
475475 if (adev->gart.bo == NULL) {
476476 dev_err(adev->dev, "No VRAM object for PCIE GART.\n");
477477 return -EINVAL;
478478 }
479− r = amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
480− if (r)
481− return r;
479+ amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
482480
483481 table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
484482
@@ -558,7 +556,6 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev) · 73 unmodified lines
558556 dev_info(adev->dev, "PCIE GART of %uM enabled (table at 0x%016llX).\n",
559557 (unsigned)(adev->gmc.gart_size >> 20),
560558 (unsigned long long)table_addr);
561− adev->gart.ready = true;
562559 return 0;
563560 }
564561
@@ -922,7 +919,10 @@ static int gmc_v6_0_hw_init(void *handle) · 357 unmodified lines
922919 if (r)
923920 return r;
924921
925− return r;
922+ if (amdgpu_emu_mode == 1)
923+ return amdgpu_gmc_vram_checking(adev);
924+ else
925+ return r;
926926 }
927927
928928 static int gmc_v6_0_hw_fini(void *handle)
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c+6−7
@@ -613,17 +613,14 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable) · 612 unmodified lines
613613 static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
614614 {
615615 uint64_t table_addr;
616− int r, i;
617616 u32 tmp, field;
617+ int i;
618618
619619 if (adev->gart.bo == NULL) {
620620 dev_err(adev->dev, "No VRAM object for PCIE GART.\n");
621621 return -EINVAL;
622622 }
623− r = amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
624− if (r)
625− return r;
626−
623+ amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
627624 table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
628625
629626 /* Setup TLB control */
@@ -712,7 +709,6 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) · 82 unmodified lines
712709 DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
713710 (unsigned)(adev->gmc.gart_size >> 20),
714711 (unsigned long long)table_addr);
715− adev->gart.ready = true;
716712 return 0;
717713 }
718714
@@ -1111,7 +1107,10 @@ static int gmc_v7_0_hw_init(void *handle) · 392 unmodified lines
11111107 if (r)
11121108 return r;
11131109
1114− return r;
1110+ if (amdgpu_emu_mode == 1)
1111+ return amdgpu_gmc_vram_checking(adev);
1112+ else
1113+ return r;
11151114 }
11161115
11171116 static int gmc_v7_0_hw_fini(void *handle)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c+6−7
@@ -837,17 +837,14 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable) · 836 unmodified lines
837837 static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
838838 {
839839 uint64_t table_addr;
840− int r, i;
841840 u32 tmp, field;
841+ int i;
842842
843843 if (adev->gart.bo == NULL) {
844844 dev_err(adev->dev, "No VRAM object for PCIE GART.\n");
845845 return -EINVAL;
846846 }
847− r = amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
848− if (r)
849− return r;
850−
847+ amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
851848 table_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
852849
853850 /* Setup TLB control */
@@ -953,7 +950,6 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) · 99 unmodified lines
953950 DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
954951 (unsigned)(adev->gmc.gart_size >> 20),
955952 (unsigned long long)table_addr);
956− adev->gart.ready = true;
957953 return 0;
958954 }
959955
@@ -1242,7 +1238,10 @@ static int gmc_v8_0_hw_init(void *handle) · 282 unmodified lines
12421238 if (r)
12431239 return r;
12441240
1245− return r;
1241+ if (amdgpu_emu_mode == 1)
1242+ return amdgpu_gmc_vram_checking(adev);
1243+ else
1244+ return r;
12461245 }
12471246
12481247 static int gmc_v8_0_hw_fini(void *handle)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c+74−31
@@ -62,6 +62,8 @@ · 61 unmodified lines
6262 #include "amdgpu_ras.h"
6363 #include "amdgpu_xgmi.h"
6464
65+#include "amdgpu_reset.h"
66+
6567 /* add these here since we already include dce12 headers and these are for DCN */
6668 #define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION 0x055d
6769 #define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_BASE_IDX 2
@@ -787,13 +789,13 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · 719 unmodified lines
787789 */
788790 if (adev->gfx.kiq.ring.sched.ready &&
789791 (amdgpu_sriov_runtime(adev) || !amdgpu_sriov_vf(adev)) &&
790− down_read_trylock(&adev->reset_sem)) {
792+ down_read_trylock(&adev->reset_domain->sem)) {
791793 uint32_t req = hub->vm_inv_eng0_req + hub->eng_distance * eng;
792794 uint32_t ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;
793795
794796 amdgpu_virt_kiq_reg_write_reg_wait(adev, req, ack, inv_req,
795797 1 << vmid);
796− up_read(&adev->reset_sem);
798+ up_read(&adev->reset_domain->sem);
797799 return;
798800 }
799801
@@ -900,7 +902,7 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev, · 100 unmodified lines
900902 if (amdgpu_in_reset(adev))
901903 return -EIO;
902904
903− if (ring->sched.ready && down_read_trylock(&adev->reset_sem)) {
905+ if (ring->sched.ready && down_read_trylock(&adev->reset_domain->sem)) {
904906 /* Vega20+XGMI caches PTEs in TC and TLB. Add a
905907 * heavy-weight TLB flush (type 2), which flushes
906908 * both. Due to a race condition with concurrent
@@ -927,7 +929,7 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev, · 20 unmodified lines
927929 if (r) {
928930 amdgpu_ring_undo(ring);
929931 spin_unlock(&adev->gfx.kiq.ring_lock);
930− up_read(&adev->reset_sem);
932+ up_read(&adev->reset_domain->sem);
931933 return -ETIME;
932934 }
933935
@@ -936,10 +938,10 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev, · 2 unmodified lines
936938 r = amdgpu_fence_wait_polling(ring, seq, adev->usec_timeout);
937939 if (r < 1) {
938940 dev_err(adev->dev, "wait for kiq fence error: %ld.\n", r);
939− up_read(&adev->reset_sem);
941+ up_read(&adev->reset_domain->sem);
940942 return -ETIME;
941943 }
942− up_read(&adev->reset_sem);
944+ up_read(&adev->reset_domain->sem);
943945 return 0;
944946 }
945947
@@ -1202,7 +1204,7 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev) · 256 unmodified lines
12021204 adev->umc.umc_inst_num = UMC_V6_1_UMC_INSTANCE_NUM;
12031205 adev->umc.channel_offs = UMC_V6_1_PER_CHANNEL_OFFSET_VG20;
12041206 adev->umc.channel_idx_tbl = &umc_v6_1_channel_idx_tbl[0][0];
1205− adev->umc.ras_funcs = &umc_v6_1_ras_funcs;
1207+ adev->umc.ras = &umc_v6_1_ras;
12061208 break;
12071209 case IP_VERSION(6, 1, 2):
12081210 adev->umc.max_ras_err_cnt_per_query = UMC_V6_1_TOTAL_CHANNEL_NUM;
@@ -1210,15 +1212,16 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev) · 1 unmodified line
12101212 adev->umc.umc_inst_num = UMC_V6_1_UMC_INSTANCE_NUM;
12111213 adev->umc.channel_offs = UMC_V6_1_PER_CHANNEL_OFFSET_ARCT;
12121214 adev->umc.channel_idx_tbl = &umc_v6_1_channel_idx_tbl[0][0];
1213− adev->umc.ras_funcs = &umc_v6_1_ras_funcs;
1215+ adev->umc.ras = &umc_v6_1_ras;
12141216 break;
12151217 case IP_VERSION(6, 7, 0):
1216− adev->umc.max_ras_err_cnt_per_query = UMC_V6_7_TOTAL_CHANNEL_NUM;
1218+ adev->umc.max_ras_err_cnt_per_query =
1219+ UMC_V6_7_TOTAL_CHANNEL_NUM * UMC_V6_7_BAD_PAGE_NUM_PER_CHANNEL;
12171220 adev->umc.channel_inst_num = UMC_V6_7_CHANNEL_INSTANCE_NUM;
12181221 adev->umc.umc_inst_num = UMC_V6_7_UMC_INSTANCE_NUM;
12191222 adev->umc.channel_offs = UMC_V6_7_PER_CHANNEL_OFFSET;
12201223 if (!adev->gmc.xgmi.connected_to_cpu)
1221− adev->umc.ras_funcs = &umc_v6_7_ras_funcs;
1224+ adev->umc.ras = &umc_v6_7_ras;
12221225 if (1 & adev->smuio.funcs->get_die_id(adev))
12231226 adev->umc.channel_idx_tbl = &umc_v6_7_channel_idx_tbl_first[0][0];
12241227 else
@@ -1227,6 +1230,27 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev) · 2 unmodified lines
12271230 default:
12281231 break;
12291232 }
1233+
1234+ if (adev->umc.ras) {
1235+ amdgpu_ras_register_ras_block(adev, &adev->umc.ras->ras_block);
1236+
1237+ strcpy(adev->umc.ras->ras_block.ras_comm.name, "umc");
1238+ adev->umc.ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__UMC;
1239+ adev->umc.ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
1240+ adev->umc.ras_if = &adev->umc.ras->ras_block.ras_comm;
1241+
1242+ /* If don't define special ras_late_init function, use default ras_late_init */
1243+ if (!adev->umc.ras->ras_block.ras_late_init)
1244+ adev->umc.ras->ras_block.ras_late_init = amdgpu_umc_ras_late_init;
1245+
1246+ /* If don't define special ras_fini function, use default ras_fini */
1247+ if (!adev->umc.ras->ras_block.ras_fini)
1248+ adev->umc.ras->ras_block.ras_fini = amdgpu_umc_ras_fini;
1249+
1250+ /* If not defined special ras_cb function, use default ras_cb */
1251+ if (!adev->umc.ras->ras_block.ras_cb)
1252+ adev->umc.ras->ras_block.ras_cb = amdgpu_umc_process_ras_data_cb;
1253+ }
12301254 }
12311255
12321256 static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev)
@@ -1248,18 +1272,31 @@ static void gmc_v9_0_set_mmhub_ras_funcs(struct amdgpu_device *adev) · 15 unmodified lines
12481272 {
12491273 switch (adev->ip_versions[MMHUB_HWIP][0]) {
12501274 case IP_VERSION(9, 4, 0):
1251− adev->mmhub.ras_funcs = &mmhub_v1_0_ras_funcs;
1275+ adev->mmhub.ras = &mmhub_v1_0_ras;
12521276 break;
12531277 case IP_VERSION(9, 4, 1):
1254− adev->mmhub.ras_funcs = &mmhub_v9_4_ras_funcs;
1278+ adev->mmhub.ras = &mmhub_v9_4_ras;
12551279 break;
12561280 case IP_VERSION(9, 4, 2):
1257− adev->mmhub.ras_funcs = &mmhub_v1_7_ras_funcs;
1281+ adev->mmhub.ras = &mmhub_v1_7_ras;
12581282 break;
12591283 default:
12601284 /* mmhub ras is not available */
12611285 break;
12621286 }
1287+
1288+ if (adev->mmhub.ras) {
1289+ amdgpu_ras_register_ras_block(adev, &adev->mmhub.ras->ras_block);
1290+
1291+ strcpy(adev->mmhub.ras->ras_block.ras_comm.name, "mmhub");
1292+ adev->mmhub.ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__MMHUB;
1293+ adev->mmhub.ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
1294+ adev->mmhub.ras_if = &adev->mmhub.ras->ras_block.ras_comm;
1295+
1296+ /* If don't define special ras_fini function, use default ras_fini */
1297+ if (!adev->mmhub.ras->ras_block.ras_fini)
1298+ adev->mmhub.ras->ras_block.ras_fini = amdgpu_mmhub_ras_fini;
1299+ }
12631300 }
12641301
12651302 static void gmc_v9_0_set_gfxhub_funcs(struct amdgpu_device *adev)
@@ -1269,7 +1306,9 @@ static void gmc_v9_0_set_gfxhub_funcs(struct amdgpu_device *adev) · 3 unmodified lines
12691306
12701307 static void gmc_v9_0_set_hdp_ras_funcs(struct amdgpu_device *adev)
12711308 {
1272− adev->hdp.ras_funcs = &hdp_v4_0_ras_funcs;
1309+ adev->hdp.ras = &hdp_v4_0_ras;
1310+ amdgpu_ras_register_ras_block(adev, &adev->hdp.ras->ras_block);
1311+ adev->hdp.ras_if = &adev->hdp.ras->ras_block.ras_comm;
12731312 }
12741313
12751314 static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)
@@ -1287,6 +1326,7 @@ static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev) · 11 unmodified lines
12871326
12881327 static int gmc_v9_0_early_init(void *handle)
12891328 {
1329+ int r;
12901330 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
12911331
12921332 /* ARCT and VEGA20 don't have XGMI defined in their IP discovery tables */
@@ -1316,6 +1356,10 @@ static int gmc_v9_0_early_init(void *handle) · 23 unmodified lines
13161356 adev->gmc.private_aperture_end =
13171357 adev->gmc.private_aperture_start + (4ULL << 30) - 1;
13181358
1359+ r = amdgpu_gmc_ras_early_init(adev);
1360+ if (r)
1361+ return r;
1362+
13191363 return 0;
13201364 }
13211365
@@ -1342,13 +1386,13 @@ static int gmc_v9_0_late_init(void *handle) · 20 unmodified lines
13421386 }
13431387
13441388 if (!amdgpu_persistent_edc_harvesting_supported(adev)) {
1345− if (adev->mmhub.ras_funcs &&
1346− adev->mmhub.ras_funcs->reset_ras_error_count)
1347− adev->mmhub.ras_funcs->reset_ras_error_count(adev);
1389+ if (adev->mmhub.ras && adev->mmhub.ras->ras_block.hw_ops &&
1390+ adev->mmhub.ras->ras_block.hw_ops->reset_ras_error_count)
1391+ adev->mmhub.ras->ras_block.hw_ops->reset_ras_error_count(adev);
13481392
1349− if (adev->hdp.ras_funcs &&
1350− adev->hdp.ras_funcs->reset_ras_error_count)
1351− adev->hdp.ras_funcs->reset_ras_error_count(adev);
1393+ if (adev->hdp.ras && adev->hdp.ras->ras_block.hw_ops &&
1394+ adev->hdp.ras->ras_block.hw_ops->reset_ras_error_count)
1395+ adev->hdp.ras->ras_block.hw_ops->reset_ras_error_count(adev);
13521396 }
13531397
13541398 r = amdgpu_gmc_ras_late_init(adev);
@@ -1752,14 +1796,7 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) · 397 unmodified lines
17521796 return -EINVAL;
17531797 }
17541798
1755− if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev))
1756− goto skip_pin_bo;
1757−
1758− r = amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
1759− if (r)
1760− return r;
1761−
1762−skip_pin_bo:
1799+ amdgpu_gtt_mgr_recover(&adev->mman.gtt_mgr);
17631800 r = adev->gfxhub.funcs->gart_enable(adev);
17641801 if (r)
17651802 return r;
@@ -1776,7 +1813,6 @@ skip_pin_bo: · 10 unmodified lines
17761813 DRM_INFO("PTB located at 0x%016llX\n",
17771814 (unsigned long long)amdgpu_bo_gpu_offset(adev->gart.bo));
17781815
1779− adev->gart.ready = true;
17801816 return 0;
17811817 }
17821818
@@ -1784,7 +1820,7 @@ static int gmc_v9_0_hw_init(void *handle) · 1 unmodified line
17841820 {
17851821 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
17861822 bool value;
1787− int i;
1823+ int i, r;
17881824
17891825 /* The sequence of these two function calls matters.*/
17901826 gmc_v9_0_init_golden_registers(adev);
@@ -1819,7 +1855,14 @@ static int gmc_v9_0_hw_init(void *handle) · 28 unmodified lines
18191855 if (adev->umc.funcs && adev->umc.funcs->init_registers)
18201856 adev->umc.funcs->init_registers(adev);
18211857
1822− return gmc_v9_0_gart_enable(adev);
1858+ r = gmc_v9_0_gart_enable(adev);
1859+ if (r)
1860+ return r;
1861+
1862+ if (amdgpu_emu_mode == 1)
1863+ return amdgpu_gmc_vram_checking(adev);
1864+ else
1865+ return r;
18231866 }
18241867
18251868 /**
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c+16−3
@@ -146,17 +146,30 @@ static void hdp_v4_0_init_registers(struct amdgpu_device *adev) · 145 unmodified lines
146146
147147 WREG32_FIELD15(HDP, 0, HDP_MISC_CNTL, FLUSH_INVALIDATE_CACHE, 1);
148148
149+ if (adev->ip_versions[HDP_HWIP][0] == IP_VERSION(4, 4, 0))
150+ WREG32_FIELD15(HDP, 0, HDP_MISC_CNTL, READ_BUFFER_WATERMARK, 2);
151+
149152 WREG32_SOC15(HDP, 0, mmHDP_NONSURFACE_BASE, (adev->gmc.vram_start >> 8));
150153 WREG32_SOC15(HDP, 0, mmHDP_NONSURFACE_BASE_HI, (adev->gmc.vram_start >> 40));
151154 }
152155
153−const struct amdgpu_hdp_ras_funcs hdp_v4_0_ras_funcs = {
154− .ras_late_init = amdgpu_hdp_ras_late_init,
155− .ras_fini = amdgpu_hdp_ras_fini,
156+struct amdgpu_ras_block_hw_ops hdp_v4_0_ras_hw_ops = {
156157 .query_ras_error_count = hdp_v4_0_query_ras_error_count,
157158 .reset_ras_error_count = hdp_v4_0_reset_ras_error_count,
158159 };
159160
161+struct amdgpu_hdp_ras hdp_v4_0_ras = {
162+ .ras_block = {
163+ .ras_comm = {
164+ .name = "hdp",
165+ .block = AMDGPU_RAS_BLOCK__HDP,
166+ .type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE,
167+ },
168+ .hw_ops = &hdp_v4_0_ras_hw_ops,
169+ .ras_fini = amdgpu_hdp_ras_fini,
170+ },
171+};
172+
160173 const struct amdgpu_hdp_funcs hdp_v4_0_funcs = {
161174 .flush_hdp = hdp_v4_0_flush_hdp,
162175 .invalidate_hdp = hdp_v4_0_invalidate_hdp,
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h+1−1
@@ -27,6 +27,6 @@ · 26 unmodified lines
2727 #include "soc15_common.h"
2828
2929 extern const struct amdgpu_hdp_funcs hdp_v4_0_funcs;
30−extern const struct amdgpu_hdp_ras_funcs hdp_v4_0_ras_funcs;
30+extern struct amdgpu_hdp_ras hdp_v4_0_ras;
3131
3232 #endif
drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c+7−2
@@ -50,11 +50,16 @@ static int jpeg_v3_0_early_init(void *handle) · 49 unmodified lines
5050 {
5151 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
5252
53− if (adev->asic_type != CHIP_YELLOW_CARP) {
54− u32 harvest = RREG32_SOC15(JPEG, 0, mmCC_UVD_HARVESTING);
53+ u32 harvest;
5554
55+ switch (adev->ip_versions[UVD_HWIP][0]) {
56+ case IP_VERSION(3, 1, 1):
57+ break;
58+ default:
59+ harvest = RREG32_SOC15(JPEG, 0, mmCC_UVD_HARVESTING);
5660 if (harvest & CC_UVD_HARVESTING__UVD_DISABLE_MASK)
5761 return -ENOENT;
62+ break;
5863 }
5964
6065 adev->jpeg.num_jpeg_inst = 1;
drivers/gpu/drm/amd/amdgpu/mca_v3_0.c+67−35
@@ -37,24 +37,42 @@ static void mca_v3_0_mp0_query_ras_error_count(struct amdgpu_device *adev, · 36 unmodified lines
3737 ras_error_status);
3838 }
3939
40−static int mca_v3_0_mp0_ras_late_init(struct amdgpu_device *adev)
40+static void mca_v3_0_mp0_ras_fini(struct amdgpu_device *adev)
4141 {
42− return amdgpu_mca_ras_late_init(adev, &adev->mca.mp0);
42+ amdgpu_mca_ras_fini(adev, &adev->mca.mp0);
4343 }
4444
45−static void mca_v3_0_mp0_ras_fini(struct amdgpu_device *adev)
45+static int mca_v3_0_ras_block_match(struct amdgpu_ras_block_object *block_obj,
46+ enum amdgpu_ras_block block, uint32_t sub_block_index)
4647 {
47− amdgpu_mca_ras_fini(adev, &adev->mca.mp0);
48+ if (!block_obj)
49+ return -EINVAL;
50+
51+ if ((block_obj->ras_comm.block == block) &&
52+ (block_obj->ras_comm.sub_block_index == sub_block_index)) {
53+ return 0;
54+ }
55+
56+ return -EINVAL;
4857 }
4958
50−const struct amdgpu_mca_ras_funcs mca_v3_0_mp0_ras_funcs = {
51− .ras_late_init = mca_v3_0_mp0_ras_late_init,
52− .ras_fini = mca_v3_0_mp0_ras_fini,
59+const struct amdgpu_ras_block_hw_ops mca_v3_0_mp0_hw_ops = {
5360 .query_ras_error_count = mca_v3_0_mp0_query_ras_error_count,
5461 .query_ras_error_address = NULL,
55− .ras_block = AMDGPU_RAS_BLOCK__MCA,
56− .ras_sub_block = AMDGPU_RAS_MCA_BLOCK__MP0,
57− .sysfs_name = "mp0_err_count",
62+};
63+
64+struct amdgpu_mca_ras_block mca_v3_0_mp0_ras = {
65+ .ras_block = {
66+ .ras_comm = {
67+ .block = AMDGPU_RAS_BLOCK__MCA,
68+ .sub_block_index = AMDGPU_RAS_MCA_BLOCK__MP0,
69+ .type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE,
70+ .name = "mp0",
71+ },
72+ .hw_ops = &mca_v3_0_mp0_hw_ops,
73+ .ras_block_match = mca_v3_0_ras_block_match,
74+ .ras_fini = mca_v3_0_mp0_ras_fini,
75+ },
5876 };
5977
6078 static void mca_v3_0_mp1_query_ras_error_count(struct amdgpu_device *adev,
@@ -65,24 +83,28 @@ static void mca_v3_0_mp1_query_ras_error_count(struct amdgpu_device *adev, · 4 unmodified lines
6583 ras_error_status);
6684 }
6785
68−static int mca_v3_0_mp1_ras_late_init(struct amdgpu_device *adev)
69−{
70− return amdgpu_mca_ras_late_init(adev, &adev->mca.mp1);
71−}
72−
7386 static void mca_v3_0_mp1_ras_fini(struct amdgpu_device *adev)
7487 {
7588 amdgpu_mca_ras_fini(adev, &adev->mca.mp1);
7689 }
7790
78−const struct amdgpu_mca_ras_funcs mca_v3_0_mp1_ras_funcs = {
79− .ras_late_init = mca_v3_0_mp1_ras_late_init,
80− .ras_fini = mca_v3_0_mp1_ras_fini,
91+const struct amdgpu_ras_block_hw_ops mca_v3_0_mp1_hw_ops = {
8192 .query_ras_error_count = mca_v3_0_mp1_query_ras_error_count,
8293 .query_ras_error_address = NULL,
83− .ras_block = AMDGPU_RAS_BLOCK__MCA,
84− .ras_sub_block = AMDGPU_RAS_MCA_BLOCK__MP1,
85− .sysfs_name = "mp1_err_count",
94+};
95+
96+struct amdgpu_mca_ras_block mca_v3_0_mp1_ras = {
97+ .ras_block = {
98+ .ras_comm = {
99+ .block = AMDGPU_RAS_BLOCK__MCA,
100+ .sub_block_index = AMDGPU_RAS_MCA_BLOCK__MP1,
101+ .type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE,
102+ .name = "mp1",
103+ },
104+ .hw_ops = &mca_v3_0_mp1_hw_ops,
105+ .ras_block_match = mca_v3_0_ras_block_match,
106+ .ras_fini = mca_v3_0_mp1_ras_fini,
107+ },
86108 };
87109
88110 static void mca_v3_0_mpio_query_ras_error_count(struct amdgpu_device *adev,
@@ -93,24 +115,28 @@ static void mca_v3_0_mpio_query_ras_error_count(struct amdgpu_device *adev, · 4 unmodified lines
93115 ras_error_status);
94116 }
95117
96−static int mca_v3_0_mpio_ras_late_init(struct amdgpu_device *adev)
97−{
98− return amdgpu_mca_ras_late_init(adev, &adev->mca.mpio);
99−}
100−
101118 static void mca_v3_0_mpio_ras_fini(struct amdgpu_device *adev)
102119 {
103120 amdgpu_mca_ras_fini(adev, &adev->mca.mpio);
104121 }
105122
106−const struct amdgpu_mca_ras_funcs mca_v3_0_mpio_ras_funcs = {
107− .ras_late_init = mca_v3_0_mpio_ras_late_init,
108− .ras_fini = mca_v3_0_mpio_ras_fini,
123+const struct amdgpu_ras_block_hw_ops mca_v3_0_mpio_hw_ops = {
109124 .query_ras_error_count = mca_v3_0_mpio_query_ras_error_count,
110125 .query_ras_error_address = NULL,
111− .ras_block = AMDGPU_RAS_BLOCK__MCA,
112− .ras_sub_block = AMDGPU_RAS_MCA_BLOCK__MPIO,
113− .sysfs_name = "mpio_err_count",
126+};
127+
128+struct amdgpu_mca_ras_block mca_v3_0_mpio_ras = {
129+ .ras_block = {
130+ .ras_comm = {
131+ .block = AMDGPU_RAS_BLOCK__MCA,
132+ .sub_block_index = AMDGPU_RAS_MCA_BLOCK__MPIO,
133+ .type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE,
134+ .name = "mpio",
135+ },
136+ .hw_ops = &mca_v3_0_mpio_hw_ops,
137+ .ras_block_match = mca_v3_0_ras_block_match,
138+ .ras_fini = mca_v3_0_mpio_ras_fini,
139+ },
114140 };
115141
116142
@@ -118,9 +144,15 @@ static void mca_v3_0_init(struct amdgpu_device *adev) · 1 unmodified line
118144 {
119145 struct amdgpu_mca *mca = &adev->mca;
120146
121− mca->mp0.ras_funcs = &mca_v3_0_mp0_ras_funcs;
122− mca->mp1.ras_funcs = &mca_v3_0_mp1_ras_funcs;
123− mca->mpio.ras_funcs = &mca_v3_0_mpio_ras_funcs;
147+ mca->mp0.ras = &mca_v3_0_mp0_ras;
148+ mca->mp1.ras = &mca_v3_0_mp1_ras;
149+ mca->mpio.ras = &mca_v3_0_mpio_ras;
150+ amdgpu_ras_register_ras_block(adev, &mca->mp0.ras->ras_block);
151+ amdgpu_ras_register_ras_block(adev, &mca->mp1.ras->ras_block);
152+ amdgpu_ras_register_ras_block(adev, &mca->mpio.ras->ras_block);
153+ mca->mp0.ras_if = &mca->mp0.ras->ras_block.ras_comm;
154+ mca->mp1.ras_if = &mca->mp1.ras->ras_block.ras_comm;
155+ mca->mpio.ras_if = &mca->mpio.ras->ras_block.ras_comm;
124156 }
125157
126158 const struct amdgpu_mca_funcs mca_v3_0_funcs = {
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c+7−3
@@ -774,13 +774,17 @@ static void mmhub_v1_0_reset_ras_error_count(struct amdgpu_device *adev) · 773 unmodified lines
774774 }
775775 }
776776
777−const struct amdgpu_mmhub_ras_funcs mmhub_v1_0_ras_funcs = {
778− .ras_late_init = amdgpu_mmhub_ras_late_init,
779− .ras_fini = amdgpu_mmhub_ras_fini,
777+struct amdgpu_ras_block_hw_ops mmhub_v1_0_ras_hw_ops = {
780778 .query_ras_error_count = mmhub_v1_0_query_ras_error_count,
781779 .reset_ras_error_count = mmhub_v1_0_reset_ras_error_count,
782780 };
783781
782+struct amdgpu_mmhub_ras mmhub_v1_0_ras = {
783+ .ras_block = {
784+ .hw_ops = &mmhub_v1_0_ras_hw_ops,
785+ },
786+};
787+
784788 const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs = {
785789 .get_fb_location = mmhub_v1_0_get_fb_location,
786790 .init = mmhub_v1_0_init,
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.h+1−1
@@ -24,6 +24,6 @@ · 23 unmodified lines
2424 #define __MMHUB_V1_0_H__
2525
2626 extern const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs;
27−extern const struct amdgpu_mmhub_ras_funcs mmhub_v1_0_ras_funcs;
27+extern struct amdgpu_mmhub_ras mmhub_v1_0_ras;
2828
2929 #endif
drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c+7−3
@@ -1321,15 +1321,19 @@ static void mmhub_v1_7_reset_ras_error_status(struct amdgpu_device *adev) · 1320 unmodified lines
13211321 }
13221322 }
13231323
1324−const struct amdgpu_mmhub_ras_funcs mmhub_v1_7_ras_funcs = {
1325− .ras_late_init = amdgpu_mmhub_ras_late_init,
1326− .ras_fini = amdgpu_mmhub_ras_fini,
1324+struct amdgpu_ras_block_hw_ops mmhub_v1_7_ras_hw_ops = {
13271325 .query_ras_error_count = mmhub_v1_7_query_ras_error_count,
13281326 .reset_ras_error_count = mmhub_v1_7_reset_ras_error_count,
13291327 .query_ras_error_status = mmhub_v1_7_query_ras_error_status,
13301328 .reset_ras_error_status = mmhub_v1_7_reset_ras_error_status,
13311329 };
13321330
1331+struct amdgpu_mmhub_ras mmhub_v1_7_ras = {
1332+ .ras_block = {
1333+ .hw_ops = &mmhub_v1_7_ras_hw_ops,
1334+ },
1335+};
1336+
13331337 const struct amdgpu_mmhub_funcs mmhub_v1_7_funcs = {
13341338 .get_fb_location = mmhub_v1_7_get_fb_location,
13351339 .init = mmhub_v1_7_init,
drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.h+1−1
@@ -24,6 +24,6 @@ · 23 unmodified lines
2424 #define __MMHUB_V1_7_H__
2525
2626 extern const struct amdgpu_mmhub_funcs mmhub_v1_7_funcs;
27−extern const struct amdgpu_mmhub_ras_funcs mmhub_v1_7_ras_funcs;
27+extern struct amdgpu_mmhub_ras mmhub_v1_7_ras;
2828
2929 #endif
drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c+1−0
@@ -93,6 +93,7 @@ mmhub_v2_3_print_l2_protection_fault_status(struct amdgpu_device *adev, · 92 unmodified lines
9393 switch (adev->ip_versions[MMHUB_HWIP][0]) {
9494 case IP_VERSION(2, 3, 0):
9595 case IP_VERSION(2, 4, 0):
96+ case IP_VERSION(2, 4, 1):
9697 mmhub_cid = mmhub_client_ids_vangogh[cid][rw];
9798 break;
9899 default:
drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.c+7−3
@@ -1655,14 +1655,18 @@ static void mmhub_v9_4_query_ras_error_status(struct amdgpu_device *adev) · 1654 unmodified lines
16551655 }
16561656 }
16571657
1658−const struct amdgpu_mmhub_ras_funcs mmhub_v9_4_ras_funcs = {
1659− .ras_late_init = amdgpu_mmhub_ras_late_init,
1660− .ras_fini = amdgpu_mmhub_ras_fini,
1658+const struct amdgpu_ras_block_hw_ops mmhub_v9_4_ras_hw_ops = {
16611659 .query_ras_error_count = mmhub_v9_4_query_ras_error_count,
16621660 .reset_ras_error_count = mmhub_v9_4_reset_ras_error_count,
16631661 .query_ras_error_status = mmhub_v9_4_query_ras_error_status,
16641662 };
16651663
1664+struct amdgpu_mmhub_ras mmhub_v9_4_ras = {
1665+ .ras_block = {
1666+ .hw_ops = &mmhub_v9_4_ras_hw_ops,
1667+ },
1668+};
1669+
16661670 const struct amdgpu_mmhub_funcs mmhub_v9_4_funcs = {
16671671 .get_fb_location = mmhub_v9_4_get_fb_location,
16681672 .init = mmhub_v9_4_init,
drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.h+1−1
@@ -24,6 +24,6 @@ · 23 unmodified lines
2424 #define __MMHUB_V9_4_H__
2525
2626 extern const struct amdgpu_mmhub_funcs mmhub_v9_4_funcs;
27−extern const struct amdgpu_mmhub_ras_funcs mmhub_v9_4_ras_funcs;
27+extern struct amdgpu_mmhub_ras mmhub_v9_4_ras;
2828
2929 #endif
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c+12−7
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 #include "soc15_common.h"
3333 #include "mxgpu_ai.h"
3434
35+#include "amdgpu_reset.h"
36+
3537 static void xgpu_ai_mailbox_send_ack(struct amdgpu_device *adev)
3638 {
3739 WREG8(AI_MAIBOX_CONTROL_RCV_OFFSET_BYTE, 2);
@@ -257,10 +259,10 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work) · 219 unmodified lines
257259 * otherwise the mailbox msg will be ruined/reseted by
258260 * the VF FLR.
259261 */
260− if (atomic_cmpxchg(&adev->in_gpu_reset, 0, 1) != 0)
262+ if (atomic_cmpxchg(&adev->reset_domain->in_gpu_reset, 0, 1) != 0)
261263 return;
262264
263− down_write(&adev->reset_sem);
265+ down_write(&adev->reset_domain->sem);
264266
265267 amdgpu_virt_fini_data_exchange(adev);
266268
@@ -275,14 +277,14 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work) · 8 unmodified lines
275277 } while (timeout > 1);
276278
277279 flr_done:
278− atomic_set(&adev->in_gpu_reset, 0);
279− up_write(&adev->reset_sem);
280+ atomic_set(&adev->reset_domain->in_gpu_reset, 0);
281+ up_write(&adev->reset_domain->sem);
280282
281283 /* Trigger recovery for world switch failure if no TDR */
282284 if (amdgpu_device_should_recover_gpu(adev)
283285 && (!amdgpu_device_has_job_running(adev) ||
284286 adev->sdma_timeout == MAX_SCHEDULE_TIMEOUT))
285− amdgpu_device_gpu_recover(adev, NULL);
287+ amdgpu_device_gpu_recover_imp(adev, NULL);
286288 }
287289
288290 static int xgpu_ai_set_mailbox_rcv_irq(struct amdgpu_device *adev,
@@ -307,8 +309,11 @@ static int xgpu_ai_mailbox_rcv_irq(struct amdgpu_device *adev, · 18 unmodified lines
307309
308310 switch (event) {
309311 case IDH_FLR_NOTIFICATION:
310− if (amdgpu_sriov_runtime(adev))
311− schedule_work(&adev->virt.flr_work);
312+ if (amdgpu_sriov_runtime(adev) && !amdgpu_in_reset(adev))
313+ WARN_ONCE(!amdgpu_reset_domain_schedule(adev->reset_domain,
314+ &adev->virt.flr_work),
315+ "Failed to queue work! at %s",
316+ __func__);
312317 break;
313318 case IDH_QUERY_ALIVE:
314319 xgpu_ai_mailbox_send_ack(adev);
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c+12−7
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #include "soc15_common.h"
3232 #include "mxgpu_nv.h"
3333
34+#include "amdgpu_reset.h"
35+
3436 static void xgpu_nv_mailbox_send_ack(struct amdgpu_device *adev)
3537 {
3638 WREG8(NV_MAIBOX_CONTROL_RCV_OFFSET_BYTE, 2);
@@ -281,10 +283,10 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work) · 244 unmodified lines
281283 * otherwise the mailbox msg will be ruined/reseted by
282284 * the VF FLR.
283285 */
284− if (atomic_cmpxchg(&adev->in_gpu_reset, 0, 1) != 0)
286+ if (atomic_cmpxchg(&adev->reset_domain->in_gpu_reset, 0, 1) != 0)
285287 return;
286288
287− down_write(&adev->reset_sem);
289+ down_write(&adev->reset_domain->sem);
288290
289291 amdgpu_virt_fini_data_exchange(adev);
290292
@@ -299,8 +301,8 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work) · 8 unmodified lines
299301 } while (timeout > 1);
300302
301303 flr_done:
302− atomic_set(&adev->in_gpu_reset, 0);
303− up_write(&adev->reset_sem);
304+ atomic_set(&adev->reset_domain->in_gpu_reset, 0);
305+ up_write(&adev->reset_domain->sem);
304306
305307 /* Trigger recovery for world switch failure if no TDR */
306308 if (amdgpu_device_should_recover_gpu(adev)
@@ -309,7 +311,7 @@ flr_done: · 2 unmodified lines
309311 adev->gfx_timeout == MAX_SCHEDULE_TIMEOUT ||
310312 adev->compute_timeout == MAX_SCHEDULE_TIMEOUT ||
311313 adev->video_timeout == MAX_SCHEDULE_TIMEOUT))
312− amdgpu_device_gpu_recover(adev, NULL);
314+ amdgpu_device_gpu_recover_imp(adev, NULL);
313315 }
314316
315317 static int xgpu_nv_set_mailbox_rcv_irq(struct amdgpu_device *adev,
@@ -337,8 +339,11 @@ static int xgpu_nv_mailbox_rcv_irq(struct amdgpu_device *adev, · 21 unmodified lines
337339
338340 switch (event) {
339341 case IDH_FLR_NOTIFICATION:
340− if (amdgpu_sriov_runtime(adev))
341− schedule_work(&adev->virt.flr_work);
342+ if (amdgpu_sriov_runtime(adev) && !amdgpu_in_reset(adev))
343+ WARN_ONCE(!amdgpu_reset_domain_schedule(adev->reset_domain,
344+ &adev->virt.flr_work),
345+ "Failed to queue work! at %s",
346+ __func__);
342347 break;
343348 /* READY_TO_ACCESS_GPU is fetched by kernel polling, IRQ can ignore
344349 * it byfar since that polling thread will handle it,
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c+9−4
@@ -42,6 +42,8 @@ · 41 unmodified lines
4242 #include "smu/smu_7_1_3_d.h"
4343 #include "mxgpu_vi.h"
4444
45+#include "amdgpu_reset.h"
46+
4547 /* VI golden setting */
4648 static const u32 xgpu_fiji_mgcg_cgcg_init[] = {
4749 mmRLC_CGTT_MGCG_OVERRIDE, 0xffffffff, 0xffffffff,
@@ -521,7 +523,7 @@ static void xgpu_vi_mailbox_flr_work(struct work_struct *work) · 473 unmodified lines
521523
522524 /* Trigger recovery due to world switch failure */
523525 if (amdgpu_device_should_recover_gpu(adev))
524− amdgpu_device_gpu_recover(adev, NULL);
526+ amdgpu_device_gpu_recover_imp(adev, NULL);
525527 }
526528
527529 static int xgpu_vi_set_mailbox_rcv_irq(struct amdgpu_device *adev,
@@ -544,14 +546,17 @@ static int xgpu_vi_mailbox_rcv_irq(struct amdgpu_device *adev, · 16 unmodified lines
544546 {
545547 int r;
546548
547− /* trigger gpu-reset by hypervisor only if TDR disbaled */
549+ /* trigger gpu-reset by hypervisor only if TDR disabled */
548550 if (!amdgpu_gpu_recovery) {
549551 /* see what event we get */
550552 r = xgpu_vi_mailbox_rcv_msg(adev, IDH_FLR_NOTIFICATION);
551553
552554 /* only handle FLR_NOTIFY now */
553− if (!r)
554− schedule_work(&adev->virt.flr_work);
555+ if (!r && !amdgpu_in_reset(adev))
556+ WARN_ONCE(!amdgpu_reset_domain_schedule(adev->reset_domain,
557+ &adev->virt.flr_work),
558+ "Failed to queue work! at %s",
559+ __func__);
555560 }
556561
557562 return 0;
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c+35−13
@@ -59,10 +59,16 @@ static u32 nbio_v7_2_get_rev_id(struct amdgpu_device *adev) · 58 unmodified lines
5959 {
6060 u32 tmp;
6161
62− if (adev->asic_type == CHIP_YELLOW_CARP)
62+ switch (adev->ip_versions[NBIO_HWIP][0]) {
63+ case IP_VERSION(7, 2, 1):
64+ case IP_VERSION(7, 3, 0):
65+ case IP_VERSION(7, 5, 0):
6366 tmp = RREG32_SOC15(NBIO, 0, regRCC_STRAP0_RCC_DEV0_EPF0_STRAP0_YC);
64− else
67+ break;
68+ default:
6569 tmp = RREG32_SOC15(NBIO, 0, regRCC_STRAP0_RCC_DEV0_EPF0_STRAP0);
70+ break;
71+ }
6672
6773 tmp &= RCC_STRAP0_RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0_MASK;
6874 tmp >>= RCC_STRAP0_RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0__SHIFT;
@@ -72,20 +78,26 @@ static u32 nbio_v7_2_get_rev_id(struct amdgpu_device *adev) · 3 unmodified lines
7278
7379 static void nbio_v7_2_mc_access_enable(struct amdgpu_device *adev, bool enable)
7480 {
75− if (enable)
76− if (adev->asic_type == CHIP_YELLOW_CARP)
81+ switch (adev->ip_versions[NBIO_HWIP][0]) {
82+ case IP_VERSION(7, 2, 1):
83+ case IP_VERSION(7, 3, 0):
84+ case IP_VERSION(7, 5, 0):
85+ if (enable)
7786 WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_FB_EN_YC,
7887 BIF_BX0_BIF_FB_EN__FB_READ_EN_MASK |
7988 BIF_BX0_BIF_FB_EN__FB_WRITE_EN_MASK);
8089 else
90+ WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_FB_EN_YC, 0);
91+ break;
92+ default:
93+ if (enable)
8194 WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_FB_EN,
8295 BIF_BX0_BIF_FB_EN__FB_READ_EN_MASK |
8396 BIF_BX0_BIF_FB_EN__FB_WRITE_EN_MASK);
84− else
85− if (adev->asic_type == CHIP_YELLOW_CARP)
86− WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_FB_EN_YC, 0);
8797 else
8898 WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_FB_EN, 0);
99+ break;
100+ }
89101 }
90102
91103 static u32 nbio_v7_2_get_memsize(struct amdgpu_device *adev)
@@ -250,7 +262,10 @@ static void nbio_v7_2_update_medium_grain_light_sleep(struct amdgpu_device *adev · 158 unmodified lines
250262 {
251263 uint32_t def, data;
252264
253− if (adev->asic_type == CHIP_YELLOW_CARP) {
265+ switch (adev->ip_versions[NBIO_HWIP][0]) {
266+ case IP_VERSION(7, 2, 1):
267+ case IP_VERSION(7, 3, 0):
268+ case IP_VERSION(7, 5, 0):
254269 def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CNTL2));
255270 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_BIF_LS))
256271 data |= PCIE_CNTL2__SLV_MEM_LS_EN_MASK;
@@ -260,8 +275,8 @@ static void nbio_v7_2_update_medium_grain_light_sleep(struct amdgpu_device *adev · 3 unmodified lines
260275 if (def != data)
261276 WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CNTL2), data);
262277
263− data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regBIF1_PCIE_TX_POWER_CTRL_1));
264− def = data;
278+ def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0,
279+ regBIF1_PCIE_TX_POWER_CTRL_1));
265280 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_BIF_LS))
266281 data |= (BIF1_PCIE_TX_POWER_CTRL_1__MST_MEM_LS_EN_MASK |
267282 BIF1_PCIE_TX_POWER_CTRL_1__REPLAY_MEM_LS_EN_MASK);
@@ -272,7 +287,8 @@ static void nbio_v7_2_update_medium_grain_light_sleep(struct amdgpu_device *adev · 4 unmodified lines
272287 if (def != data)
273288 WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regBIF1_PCIE_TX_POWER_CTRL_1),
274289 data);
275− } else {
290+ break;
291+ default:
276292 def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CNTL2));
277293 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_BIF_LS))
278294 data |= (PCIE_CNTL2__SLV_MEM_LS_EN_MASK |
@@ -285,6 +301,7 @@ static void nbio_v7_2_update_medium_grain_light_sleep(struct amdgpu_device *adev · 6 unmodified lines
285301
286302 if (def != data)
287303 WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CNTL2), data);
304+ break;
288305 }
289306 }
290307
@@ -352,7 +369,10 @@ const struct nbio_hdp_flush_reg nbio_v7_2_hdp_flush_reg = { · 61 unmodified lines
352369 static void nbio_v7_2_init_registers(struct amdgpu_device *adev)
353370 {
354371 uint32_t def, data;
355− if (adev->asic_type == CHIP_YELLOW_CARP) {
372+ switch (adev->ip_versions[NBIO_HWIP][0]) {
373+ case IP_VERSION(7, 2, 1):
374+ case IP_VERSION(7, 3, 0):
375+ case IP_VERSION(7, 5, 0):
356376 def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regBIF1_PCIE_MST_CTRL_3));
357377 data = REG_SET_FIELD(data, BIF1_PCIE_MST_CTRL_3,
358378 CI_SWUS_MAX_READ_REQUEST_SIZE_MODE, 1);
@@ -361,7 +381,8 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev) · 2 unmodified lines
361381
362382 if (def != data)
363383 WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regBIF1_PCIE_MST_CTRL_3), data);
364− } else {
384+ break;
385+ default:
365386 def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CONFIG_CNTL));
366387 data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL,
367388 CI_SWUS_MAX_READ_REQUEST_SIZE_MODE, 1);
@@ -370,6 +391,7 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev) · 2 unmodified lines
370391
371392 if (def != data)
372393 WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CONFIG_CNTL), data);
394+ break;
373395 }
374396
375397 if (amdgpu_sriov_vf(adev))
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c+16−4
@@ -658,16 +658,28 @@ static void nbio_v7_4_enable_doorbell_interrupt(struct amdgpu_device *adev, · 657 unmodified lines
658658 DOORBELL_INTERRUPT_DISABLE, enable ? 0 : 1);
659659 }
660660
661−const struct amdgpu_nbio_ras_funcs nbio_v7_4_ras_funcs = {
661+const struct amdgpu_ras_block_hw_ops nbio_v7_4_ras_hw_ops = {
662+ .query_ras_error_count = nbio_v7_4_query_ras_error_count,
663+};
664+
665+struct amdgpu_nbio_ras nbio_v7_4_ras = {
666+ .ras_block = {
667+ .ras_comm = {
668+ .name = "pcie_bif",
669+ .block = AMDGPU_RAS_BLOCK__PCIE_BIF,
670+ .type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE,
671+ },
672+ .hw_ops = &nbio_v7_4_ras_hw_ops,
673+ .ras_late_init = amdgpu_nbio_ras_late_init,
674+ .ras_fini = amdgpu_nbio_ras_fini,
675+ },
662676 .handle_ras_controller_intr_no_bifring = nbio_v7_4_handle_ras_controller_intr_no_bifring,
663677 .handle_ras_err_event_athub_intr_no_bifring = nbio_v7_4_handle_ras_err_event_athub_intr_no_bifring,
664678 .init_ras_controller_interrupt = nbio_v7_4_init_ras_controller_interrupt,
665679 .init_ras_err_event_athub_interrupt = nbio_v7_4_init_ras_err_event_athub_interrupt,
666− .query_ras_error_count = nbio_v7_4_query_ras_error_count,
667− .ras_late_init = amdgpu_nbio_ras_late_init,
668− .ras_fini = amdgpu_nbio_ras_fini,
669680 };
670681
682+
671683 static void nbio_v7_4_program_ltr(struct amdgpu_device *adev)
672684 {
673685 uint32_t def, data;
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.h+1−1
@@ -29,6 +29,6 @@ · 28 unmodified lines
2929 extern const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg;
3030 extern const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg_ald;
3131 extern const struct amdgpu_nbio_funcs nbio_v7_4_funcs;
32−extern const struct amdgpu_nbio_ras_funcs nbio_v7_4_ras_funcs;
32+extern struct amdgpu_nbio_ras nbio_v7_4_ras;
3333
3434 #endif
drivers/gpu/drm/amd/amdgpu/nv.c+51−67
@@ -204,6 +204,7 @@ static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode, · 203 unmodified lines
204204 *codecs = &sc_video_codecs_decode;
205205 return 0;
206206 case IP_VERSION(3, 1, 1):
207+ case IP_VERSION(3, 1, 2):
207208 if (encode)
208209 *codecs = &nv_video_codecs_encode;
209210 else
@@ -258,21 +259,6 @@ static u64 nv_pcie_rreg64(struct amdgpu_device *adev, u32 reg) · 48 unmodified lines
258259 return amdgpu_device_indirect_rreg64(adev, address, data, reg);
259260 }
260261
261−static u32 nv_pcie_port_rreg(struct amdgpu_device *adev, u32 reg)
262−{
263− unsigned long flags, address, data;
264− u32 r;
265− address = adev->nbio.funcs->get_pcie_port_index_offset(adev);
266− data = adev->nbio.funcs->get_pcie_port_data_offset(adev);
267−
268− spin_lock_irqsave(&adev->pcie_idx_lock, flags);
269− WREG32(address, reg * 4);
270− (void)RREG32(address);
271− r = RREG32(data);
272− spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
273− return r;
274−}
275−
276262 static void nv_pcie_wreg64(struct amdgpu_device *adev, u32 reg, u64 v)
277263 {
278264 unsigned long address, data;
@@ -283,21 +269,6 @@ static void nv_pcie_wreg64(struct amdgpu_device *adev, u32 reg, u64 v) · 4 unmodified lines
283269 amdgpu_device_indirect_wreg64(adev, address, data, reg, v);
284270 }
285271
286−static void nv_pcie_port_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
287−{
288− unsigned long flags, address, data;
289−
290− address = adev->nbio.funcs->get_pcie_port_index_offset(adev);
291− data = adev->nbio.funcs->get_pcie_port_data_offset(adev);
292−
293− spin_lock_irqsave(&adev->pcie_idx_lock, flags);
294− WREG32(address, reg * 4);
295− (void)RREG32(address);
296− WREG32(data, v);
297− (void)RREG32(data);
298− spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
299−}
300−
301272 static u32 nv_didt_rreg(struct amdgpu_device *adev, u32 reg)
302273 {
303274 unsigned long flags, address, data;
@@ -360,38 +331,6 @@ static bool nv_read_disabled_bios(struct amdgpu_device *adev) · 56 unmodified lines
360331 return false;
361332 }
362333
363−static bool nv_read_bios_from_rom(struct amdgpu_device *adev,
364− u8 *bios, u32 length_bytes)
365−{
366− u32 *dw_ptr;
367− u32 i, length_dw;
368− u32 rom_index_offset, rom_data_offset;
369−
370− if (bios == NULL)
371− return false;
372− if (length_bytes == 0)
373− return false;
374− /* APU vbios image is part of sbios image */
375− if (adev->flags & AMD_IS_APU)
376− return false;
377−
378− dw_ptr = (u32 *)bios;
379− length_dw = ALIGN(length_bytes, 4) / 4;
380−
381− rom_index_offset =
382− adev->smuio.funcs->get_rom_index_offset(adev);
383− rom_data_offset =
384− adev->smuio.funcs->get_rom_data_offset(adev);
385−
386− /* set rom index to 0 */
387− WREG32(rom_index_offset, 0);
388− /* read out the rom data */
389− for (i = 0; i < length_dw; i++)
390− dw_ptr[i] = RREG32(rom_data_offset);
391−
392− return true;
393−}
394−
395334 static struct soc15_allowed_register_entry nv_allowed_read_registers[] = {
396335 { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS)},
397336 { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2)},
@@ -515,6 +454,8 @@ nv_asic_reset_method(struct amdgpu_device *adev) · 117 unmodified lines
515454 case IP_VERSION(11, 5, 0):
516455 case IP_VERSION(13, 0, 1):
517456 case IP_VERSION(13, 0, 3):
457+ case IP_VERSION(13, 0, 5):
458+ case IP_VERSION(13, 0, 8):
518459 return AMD_RESET_METHOD_MODE2;
519460 case IP_VERSION(11, 0, 7):
520461 case IP_VERSION(11, 0, 11):
@@ -584,7 +525,7 @@ static void nv_pcie_gen3_enable(struct amdgpu_device *adev) · 63 unmodified lines
584525
585526 static void nv_program_aspm(struct amdgpu_device *adev)
586527 {
587− if (!amdgpu_aspm)
528+ if (!amdgpu_device_should_use_aspm(adev))
588529 return;
589530
590531 if (!(adev->flags & AMD_IS_APU) &&
@@ -699,7 +640,8 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev, · 108 unmodified lines
699640 adev->gfx.funcs->update_perfmon_mgcg(adev, !enter);
700641
701642 if (!(adev->flags & AMD_IS_APU) &&
702− (adev->nbio.funcs->enable_aspm))
643+ (adev->nbio.funcs->enable_aspm) &&
644+ amdgpu_device_should_use_aspm(adev))
703645 adev->nbio.funcs->enable_aspm(adev, !enter);
704646
705647 return 0;
@@ -708,7 +650,7 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev, · 2 unmodified lines
708650 static const struct amdgpu_asic_funcs nv_asic_funcs =
709651 {
710652 .read_disabled_bios = &nv_read_disabled_bios,
711− .read_bios_from_rom = &nv_read_bios_from_rom,
653+ .read_bios_from_rom = &amdgpu_soc15_read_bios_from_rom,
712654 .read_register = &nv_read_register,
713655 .reset = &nv_asic_reset,
714656 .reset_method = &nv_asic_reset_method,
@@ -742,8 +684,8 @@ static int nv_common_early_init(void *handle) · 27 unmodified lines
742684 adev->pcie_wreg = &nv_pcie_wreg;
743685 adev->pcie_rreg64 = &nv_pcie_rreg64;
744686 adev->pcie_wreg64 = &nv_pcie_wreg64;
745− adev->pciep_rreg = &nv_pcie_port_rreg;
746− adev->pciep_wreg = &nv_pcie_port_wreg;
687+ adev->pciep_rreg = amdgpu_device_pcie_port_rreg;
688+ adev->pciep_wreg = amdgpu_device_pcie_port_wreg;
747689
748690 /* TODO: will add them during VCN v2 implementation */
749691 adev->uvd_ctx_rreg = NULL;
@@ -964,10 +906,52 @@ static int nv_common_early_init(void *handle) · 214 unmodified lines
964906 adev->external_rev_id = adev->rev_id + 0x01;
965907 break;
966908 case IP_VERSION(10, 1, 3):
909+ case IP_VERSION(10, 1, 4):
967910 adev->cg_flags = 0;
968911 adev->pg_flags = 0;
969912 adev->external_rev_id = adev->rev_id + 0x82;
970913 break;
914+ case IP_VERSION(10, 3, 6):
915+ adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
916+ AMD_CG_SUPPORT_GFX_MGLS |
917+ AMD_CG_SUPPORT_GFX_CGCG |
918+ AMD_CG_SUPPORT_GFX_CGLS |
919+ AMD_CG_SUPPORT_GFX_3D_CGCG |
920+ AMD_CG_SUPPORT_GFX_3D_CGLS |
921+ AMD_CG_SUPPORT_GFX_RLC_LS |
922+ AMD_CG_SUPPORT_GFX_CP_LS |
923+ AMD_CG_SUPPORT_GFX_FGCG |
924+ AMD_CG_SUPPORT_MC_MGCG |
925+ AMD_CG_SUPPORT_MC_LS |
926+ AMD_CG_SUPPORT_SDMA_LS |
927+ AMD_CG_SUPPORT_HDP_MGCG |
928+ AMD_CG_SUPPORT_HDP_LS |
929+ AMD_CG_SUPPORT_ATHUB_MGCG |
930+ AMD_CG_SUPPORT_ATHUB_LS |
931+ AMD_CG_SUPPORT_IH_CG |
932+ AMD_CG_SUPPORT_VCN_MGCG |
933+ AMD_CG_SUPPORT_JPEG_MGCG;
934+ adev->pg_flags = AMD_PG_SUPPORT_GFX_PG |
935+ AMD_PG_SUPPORT_VCN |
936+ AMD_PG_SUPPORT_VCN_DPG |
937+ AMD_PG_SUPPORT_JPEG;
938+ adev->external_rev_id = adev->rev_id + 0x01;
939+ break;
940+ case IP_VERSION(10, 3, 7):
941+ adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
942+ AMD_CG_SUPPORT_GFX_MGLS |
943+ AMD_CG_SUPPORT_GFX_CGCG |
944+ AMD_CG_SUPPORT_GFX_CGLS |
945+ AMD_CG_SUPPORT_GFX_3D_CGCG |
946+ AMD_CG_SUPPORT_GFX_3D_CGLS |
947+ AMD_CG_SUPPORT_GFX_RLC_LS |
948+ AMD_CG_SUPPORT_GFX_CP_LS |
949+ AMD_CG_SUPPORT_GFX_FGCG;
950+ adev->pg_flags = AMD_PG_SUPPORT_VCN |
951+ AMD_PG_SUPPORT_VCN_DPG |
952+ AMD_PG_SUPPORT_JPEG;
953+ adev->external_rev_id = adev->rev_id + 0x01;
954+ break;
971955 default:
972956 /* FIXME: not supported yet */
973957 return -EINVAL;
drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h+1−0
@@ -258,6 +258,7 @@ enum psp_gfx_fw_type { · 257 unmodified lines
258258 GFX_FW_TYPE_SDMA6 = 56, /* SDMA6 MI */
259259 GFX_FW_TYPE_SDMA7 = 57, /* SDMA7 MI */
260260 GFX_FW_TYPE_VCN1 = 58, /* VCN1 MI */
261+ GFX_FW_TYPE_CAP = 62, /* CAP_FW */
261262 GFX_FW_TYPE_REG_LIST = 67, /* REG_LIST MI */
262263 GFX_FW_TYPE_MAX
263264 };
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c+2−2
@@ -53,11 +53,13 @@ MODULE_FIRMWARE("amdgpu/navi14_ta.bin"); · 52 unmodified lines
5353 MODULE_FIRMWARE("amdgpu/navi12_sos.bin");
5454 MODULE_FIRMWARE("amdgpu/navi12_asd.bin");
5555 MODULE_FIRMWARE("amdgpu/navi12_ta.bin");
56+MODULE_FIRMWARE("amdgpu/navi12_cap.bin");
5657 MODULE_FIRMWARE("amdgpu/arcturus_sos.bin");
5758 MODULE_FIRMWARE("amdgpu/arcturus_asd.bin");
5859 MODULE_FIRMWARE("amdgpu/arcturus_ta.bin");
5960 MODULE_FIRMWARE("amdgpu/sienna_cichlid_sos.bin");
6061 MODULE_FIRMWARE("amdgpu/sienna_cichlid_ta.bin");
62+MODULE_FIRMWARE("amdgpu/sienna_cichlid_cap.bin");
6163 MODULE_FIRMWARE("amdgpu/navy_flounder_sos.bin");
6264 MODULE_FIRMWARE("amdgpu/navy_flounder_ta.bin");
6365 MODULE_FIRMWARE("amdgpu/vangogh_asd.bin");
@@ -177,8 +179,6 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) · 113 unmodified lines
177179 err = psp_init_asd_microcode(psp, chip_name);
178180 if (err)
179181 return err;
180− if (amdgpu_sriov_vf(adev))
181− break;
182182 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
183183 err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
184184 if (err) {
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c+14−0
@@ -34,6 +34,12 @@ MODULE_FIRMWARE("amdgpu/aldebaran_ta.bin"); · 33 unmodified lines
3434 MODULE_FIRMWARE("amdgpu/yellow_carp_asd.bin");
3535 MODULE_FIRMWARE("amdgpu/yellow_carp_toc.bin");
3636 MODULE_FIRMWARE("amdgpu/yellow_carp_ta.bin");
37+MODULE_FIRMWARE("amdgpu/psp_13_0_5_asd.bin");
38+MODULE_FIRMWARE("amdgpu/psp_13_0_5_toc.bin");
39+MODULE_FIRMWARE("amdgpu/psp_13_0_5_ta.bin");
40+MODULE_FIRMWARE("amdgpu/psp_13_0_8_asd.bin");
41+MODULE_FIRMWARE("amdgpu/psp_13_0_8_toc.bin");
42+MODULE_FIRMWARE("amdgpu/psp_13_0_8_ta.bin");
3743
3844 /* For large FW files the time to complete can be very long */
3945 #define USBC_PD_POLLING_LIMIT_S 240
@@ -55,6 +61,12 @@ static int psp_v13_0_init_microcode(struct psp_context *psp) · 15 unmodified lines
5561 case IP_VERSION(13, 0, 3):
5662 chip_name = "yellow_carp";
5763 break;
64+ case IP_VERSION(13, 0, 5):
65+ chip_name = "psp_13_0_5";
66+ break;
67+ case IP_VERSION(13, 0, 8):
68+ chip_name = "psp_13_0_8";
69+ break;
5870 default:
5971 BUG();
6072 }
@@ -69,6 +81,8 @@ static int psp_v13_0_init_microcode(struct psp_context *psp) · 8 unmodified lines
6981 break;
7082 case IP_VERSION(13, 0, 1):
7183 case IP_VERSION(13, 0, 3):
84+ case IP_VERSION(13, 0, 5):
85+ case IP_VERSION(13, 0, 8):
7286 err = psp_init_asd_microcode(psp, chip_name);
7387 if (err)
7488 return err;
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c+1−0
@@ -44,6 +44,7 @@ · 43 unmodified lines
4444
4545 MODULE_FIRMWARE("amdgpu/vega10_sos.bin");
4646 MODULE_FIRMWARE("amdgpu/vega10_asd.bin");
47+MODULE_FIRMWARE("amdgpu/vega10_cap.bin");
4748 MODULE_FIRMWARE("amdgpu/vega12_sos.bin");
4849 MODULE_FIRMWARE("amdgpu/vega12_asd.bin");
4950
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c+59−18
@@ -1885,22 +1885,16 @@ static int sdma_v4_0_process_ras_data_cb(struct amdgpu_device *adev, · 1884 unmodified lines
18851885 static int sdma_v4_0_late_init(void *handle)
18861886 {
18871887 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1888− struct ras_ih_if ih_info = {
1889− .cb = sdma_v4_0_process_ras_data_cb,
1890− };
18911888
18921889 sdma_v4_0_setup_ulv(adev);
18931890
18941891 if (!amdgpu_persistent_edc_harvesting_supported(adev)) {
1895− if (adev->sdma.funcs &&
1896− adev->sdma.funcs->reset_ras_error_count)
1897− adev->sdma.funcs->reset_ras_error_count(adev);
1892+ if (adev->sdma.ras && adev->sdma.ras->ras_block.hw_ops &&
1893+ adev->sdma.ras->ras_block.hw_ops->reset_ras_error_count)
1894+ adev->sdma.ras->ras_block.hw_ops->reset_ras_error_count(adev);
18981895 }
18991896
1900− if (adev->sdma.funcs && adev->sdma.funcs->ras_late_init)
1901− return adev->sdma.funcs->ras_late_init(adev, &ih_info);
1902− else
1903− return 0;
1897+ return 0;
19041898 }
19051899
19061900 static int sdma_v4_0_sw_init(void *handle)
@@ -2001,8 +1995,9 @@ static int sdma_v4_0_sw_fini(void *handle) · 94 unmodified lines
20011995 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
20021996 int i;
20031997
2004− if (adev->sdma.funcs && adev->sdma.funcs->ras_fini)
2005− adev->sdma.funcs->ras_fini(adev);
1998+ if (adev->sdma.ras && adev->sdma.ras->ras_block.hw_ops &&
1999+ adev->sdma.ras->ras_block.ras_fini)
2000+ adev->sdma.ras->ras_block.ras_fini(adev);
20062001
20072002 for (i = 0; i < adev->sdma.num_instances; i++) {
20082003 amdgpu_ring_fini(&adev->sdma.instance[i].ring);
@@ -2057,6 +2052,10 @@ static int sdma_v4_0_suspend(void *handle) · 48 unmodified lines
20572052 {
20582053 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
20592054
2055+ /* SMU saves SDMA state for us */
2056+ if (adev->in_s0ix)
2057+ return 0;
2058+
20602059 return sdma_v4_0_hw_fini(adev);
20612060 }
20622061
@@ -2064,6 +2063,10 @@ static int sdma_v4_0_resume(void *handle) · 1 unmodified line
20642063 {
20652064 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
20662065
2066+ /* SMU restores SDMA state for us */
2067+ if (adev->in_s0ix)
2068+ return 0;
2069+
20672070 return sdma_v4_0_hw_init(adev);
20682071 }
20692072
@@ -2740,7 +2743,7 @@ static void sdma_v4_0_get_ras_error_count(uint32_t value, · 670 unmodified lines
27402743 }
27412744 }
27422745
2743−static int sdma_v4_0_query_ras_error_count(struct amdgpu_device *adev,
2746+static int sdma_v4_0_query_ras_error_count_by_instance(struct amdgpu_device *adev,
27442747 uint32_t instance, void *ras_error_status)
27452748 {
27462749 struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
@@ -2762,6 +2765,18 @@ static int sdma_v4_0_query_ras_error_count(struct amdgpu_device *adev, · 15 unmodified lines
27622765 return 0;
27632766 };
27642767
2768+static void sdma_v4_0_query_ras_error_count(struct amdgpu_device *adev, void *ras_error_status)
2769+{
2770+ int i = 0;
2771+
2772+ for (i = 0; i < adev->sdma.num_instances; i++) {
2773+ if (sdma_v4_0_query_ras_error_count_by_instance(adev, i, ras_error_status)) {
2774+ dev_err(adev->dev, "Query ras error count failed in SDMA%d\n", i);
2775+ return;
2776+ }
2777+ }
2778+}
2779+
27652780 static void sdma_v4_0_reset_ras_error_count(struct amdgpu_device *adev)
27662781 {
27672782 int i;
@@ -2773,26 +2788,52 @@ static void sdma_v4_0_reset_ras_error_count(struct amdgpu_device *adev) · 5 unmodified lines
27732788 }
27742789 }
27752790
2776−static const struct amdgpu_sdma_ras_funcs sdma_v4_0_ras_funcs = {
2777− .ras_late_init = amdgpu_sdma_ras_late_init,
2778− .ras_fini = amdgpu_sdma_ras_fini,
2791+const struct amdgpu_ras_block_hw_ops sdma_v4_0_ras_hw_ops = {
27792792 .query_ras_error_count = sdma_v4_0_query_ras_error_count,
27802793 .reset_ras_error_count = sdma_v4_0_reset_ras_error_count,
27812794 };
27822795
2796+static struct amdgpu_sdma_ras sdma_v4_0_ras = {
2797+ .ras_block = {
2798+ .hw_ops = &sdma_v4_0_ras_hw_ops,
2799+ .ras_cb = sdma_v4_0_process_ras_data_cb,
2800+ },
2801+};
2802+
27832803 static void sdma_v4_0_set_ras_funcs(struct amdgpu_device *adev)
27842804 {
27852805 switch (adev->ip_versions[SDMA0_HWIP][0]) {
27862806 case IP_VERSION(4, 2, 0):
27872807 case IP_VERSION(4, 2, 2):
2788− adev->sdma.funcs = &sdma_v4_0_ras_funcs;
2808+ adev->sdma.ras = &sdma_v4_0_ras;
27892809 break;
27902810 case IP_VERSION(4, 4, 0):
2791− adev->sdma.funcs = &sdma_v4_4_ras_funcs;
2811+ adev->sdma.ras = &sdma_v4_4_ras;
27922812 break;
27932813 default:
27942814 break;
27952815 }

24 more lines aren’t shown here.

drivers/gpu/drm/amd/amdgpu/sdma_v4_4.c+21−4

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

drivers/gpu/drm/amd/amdgpu/sdma_v4_4.h+1−1

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

drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c+21−7

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

drivers/gpu/drm/amd/amdgpu/si.c+1−1

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

drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c+54−27

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

drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.h+3−3

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

drivers/gpu/drm/amd/amdgpu/soc15.c+16−52

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

drivers/gpu/drm/amd/amdgpu/soc15_common.h+4−4

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

drivers/gpu/drm/amd/amdgpu/ta_ras_if.h+2−1

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

drivers/gpu/drm/amd/amdgpu/umc_v6_1.c+11−19

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

drivers/gpu/drm/amd/amdgpu/umc_v6_1.h+1−1

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

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c+142−83

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

drivers/gpu/drm/amd/amdgpu/umc_v6_7.h+24−1

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

drivers/gpu/drm/amd/amdgpu/umc_v8_7.c+142−24

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

drivers/gpu/drm/amd/amdgpu/umc_v8_7.h+1−1

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

drivers/gpu/drm/amd/amdgpu/vi.c+1−1

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

drivers/gpu/drm/amd/amdkfd/Makefile+0−2

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

drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c+1−1

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

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c+1189−433

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

drivers/gpu/drm/amd/amdkfd/kfd_crat.c+5−3

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

drivers/gpu/drm/amd/amdkfd/kfd_crat.h+3−2

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

drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c+0−845

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

drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.h+0−230

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

drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c+0−158

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

drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.h+0−293

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

drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c+3−2

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

drivers/gpu/drm/amd/amdkfd/kfd_device.c+34−33

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

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c+221−48

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

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h+55−7

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

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c+2−10

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

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_vi.c+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_events.c+281−35

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

drivers/gpu/drm/amd/amdkfd/kfd_events.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c+3−2

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

drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c+6−5

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

drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c+6−5

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

drivers/gpu/drm/amd/amdkfd/kfd_iommu.c+2−13

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

drivers/gpu/drm/amd/amdkfd/kfd_iommu.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_migrate.c+11−13

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

drivers/gpu/drm/amd/amdkfd/kfd_module.c+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c+66−1

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

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h+43−1

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

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c+74−52

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

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c+86−69

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

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c+100−75

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

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c+92−59

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

drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c+5−6

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

drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c+16−36

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

drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c+5−24

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

drivers/gpu/drm/amd/amdkfd/kfd_pasid.c+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_ai.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_aldebaran.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_diq.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_vi.h+4−3

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

drivers/gpu/drm/amd/amdkfd/kfd_pm4_opcodes.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_priv.h+171−25

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

drivers/gpu/drm/amd/amdkfd/kfd_process.c+67−28

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

drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c+371−4

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

drivers/gpu/drm/amd/amdkfd/kfd_queue.c+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c+3−2

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

drivers/gpu/drm/amd/amdkfd/kfd_smi_events.h+2−1

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

drivers/gpu/drm/amd/amdkfd/kfd_svm.c+380−57

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

drivers/gpu/drm/amd/amdkfd/kfd_svm.h+39−0

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

drivers/gpu/drm/amd/amdkfd/kfd_topology.c+5−4

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

drivers/gpu/drm/amd/amdkfd/kfd_topology.h+2−1

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+100−61

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h+13−0

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c+94−32

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c+3−1

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c+188−15

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c+280−9

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h+14−0

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c+88−160

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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c+7−57

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

drivers/gpu/drm/amd/display/dc/Makefile+5−3

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

drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c+0−2

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

drivers/gpu/drm/amd/display/dc/bios/command_table2.c+0−4

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

drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c+2−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile+19−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c+36−1

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c+2−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c+2−1

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c+5−2

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c+8−8

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c+15−13

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c+20−7

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.h+1−1

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c+617−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.h+49−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c+314−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.h+126−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c+715−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.h+49−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c+312−0

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

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h+137−0

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

drivers/gpu/drm/amd/display/dc/core/dc.c+71−13

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

drivers/gpu/drm/amd/display/dc/core/dc_link.c+393−505

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

drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c+3−0

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

drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+1017−543

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

drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c+23−1

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

drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c+0−917

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

drivers/gpu/drm/amd/display/dc/core/dc_resource.c+83−27

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

drivers/gpu/drm/amd/display/dc/core/dc_stream.c+22−1

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

drivers/gpu/drm/amd/display/dc/dc.h+24−22

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

drivers/gpu/drm/amd/display/dc/dc_dp_types.h+46−42

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

drivers/gpu/drm/amd/display/dc/dc_helper.c+60−0

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

drivers/gpu/drm/amd/display/dc/dc_hw_types.h+1−0

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

drivers/gpu/drm/amd/display/dc/dc_link.h+14−7

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

drivers/gpu/drm/amd/display/dc/dc_stream.h+0−6

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

drivers/gpu/drm/amd/display/dc/dc_types.h+0−6

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

drivers/gpu/drm/amd/display/dc/dce/dce_aux.c+1−1

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

drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c+9−8

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

drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h+2−1

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

drivers/gpu/drm/amd/display/dc/dce/dmub_outbox.c+14−11

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

drivers/gpu/drm/amd/display/dc/dce/dmub_outbox.h+2−2

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

drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c+4−0

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

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+39−97

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

drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c+1−1

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+2−10

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c+9−9

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.h+2−1

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c+0−15

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h+0−3

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dccg.h+13−2

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+19−34

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c+9−12

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c+0−2

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

drivers/gpu/drm/amd/display/dc/dcn201/dcn201_init.c+1−0

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

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dio_stream_encoder.c+0−2

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

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c+3−4

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

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c+2−2

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

drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c+2−2

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

drivers/gpu/drm/amd/display/dc/dcn302/Makefile+0−12

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

drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c+12−308

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

drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.h+3−0

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

drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c+2−2

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c+81−25

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.h+6−0

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c+11−0

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.h+6−3

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.c+32−29

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c+21−7

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_optc.c+1−1

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_optc.h+2−0

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c+3−1

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

drivers/gpu/drm/amd/display/dc/dcn315/Makefilerenamed from drivers/gpu/drm/amd/display/dc/calcs/Makefile+12−24

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

drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c+2304−0

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

drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.h+42−0

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

drivers/gpu/drm/amd/display/dc/dcn316/Makefile+56−0

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

drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.c+2306−0

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

drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.h+42−0

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

drivers/gpu/drm/amd/display/dc/dm_helpers.h+3−3

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

drivers/gpu/drm/amd/display/dc/dml/Makefile+11−1

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

drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.crenamed from drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c+0−0

File renamed without changes.

drivers/gpu/drm/amd/display/dc/dml/calcs/calcs_logger.hrenamed from drivers/gpu/drm/amd/display/dc/calcs/calcs_logger.h+0−0

File renamed without changes.

drivers/gpu/drm/amd/display/dc/dml/calcs/custom_float.crenamed from drivers/gpu/drm/amd/display/dc/calcs/custom_float.c+0−0

File renamed without changes.

drivers/gpu/drm/amd/display/dc/dml/calcs/dce_calcs.crenamed from drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c+23−25

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

drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_auto.crenamed from drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c+0−0

File renamed without changes.

drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_auto.hrenamed from drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.h+0−0

File renamed without changes.

drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.crenamed from drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c+0−0

File renamed without changes.

drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.crenamed from drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c+0−0

File renamed without changes.

drivers/gpu/drm/amd/display/dc/dml/dcn302/dcn302_fpu.c+357−0

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

drivers/gpu/drm/amd/display/dc/dml/dcn302/dcn302_fpu.h+32−0

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

drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c+26−3

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

drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h+1−0

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

drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c+24−0

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

drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h+3−0

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

drivers/gpu/drm/amd/display/dc/dml/dsc/rc_calc_fpu.c+1−1

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

drivers/gpu/drm/amd/display/dc/gpio/Makefile+8−0

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

drivers/gpu/drm/amd/display/dc/gpio/dcn30/hw_factory_dcn30.c+2−2

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

drivers/gpu/drm/amd/display/dc/gpio/dcn30/hw_translate_dcn30.c+2−2

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

drivers/gpu/drm/amd/display/dc/gpio/dcn315/hw_factory_dcn315.c+260−0

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

drivers/gpu/drm/amd/display/dc/gpio/dcn315/hw_factory_dcn315.h+31−0

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

drivers/gpu/drm/amd/display/dc/gpio/dcn315/hw_translate_dcn315.c+374−0

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

drivers/gpu/drm/amd/display/dc/gpio/dcn315/hw_translate_dcn315.h+33−0

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

drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c+5−0

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

drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c+5−0

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

drivers/gpu/drm/amd/display/dc/inc/core_types.h+1−12

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

drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h+44−12

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

drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h+2−2

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

drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h+0−2

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

drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h+2−3

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

drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h+4−6

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

drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h+0−2

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

drivers/gpu/drm/amd/display/dc/inc/hw_sequencer_private.h+0−2

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

drivers/gpu/drm/amd/display/dc/inc/link_dpcd.h+1−1

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

drivers/gpu/drm/amd/display/dc/inc/link_enc_cfg.h+3−0

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

drivers/gpu/drm/amd/display/dc/inc/link_hwss.h+44−42

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

drivers/gpu/drm/amd/display/dc/inc/reg_helper.h+34−0

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

drivers/gpu/drm/amd/display/dc/inc/resource.h+6−10

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

drivers/gpu/drm/amd/display/dc/irq/Makefile+8−0

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

drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c+1−1

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

drivers/gpu/drm/amd/display/dc/irq/dcn201/irq_service_dcn201.c+0−5

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

drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c+0−14

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

drivers/gpu/drm/amd/display/dc/irq/dcn30/irq_service_dcn30.c+3−3

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

drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c+438−0

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

drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.h+34−0

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

drivers/gpu/drm/amd/display/dc/link/Makefile+30−0

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

drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.c+137−0

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

drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.h+53−0

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

drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.c+51−0

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

drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.h+34−0

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

drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.c+254−0

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

drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.h+35−0

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

drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.c+43−0

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

drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.h+34−0

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

drivers/gpu/drm/amd/display/dc/virtual/Makefile+1−1

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

drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c+2−1

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

drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.c+43−0

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

drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h+34−0

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

drivers/gpu/drm/amd/display/dmub/dmub_srv.h+2−0

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

drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h+52−5

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

drivers/gpu/drm/amd/display/dmub/src/Makefile+1−1

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

drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c+1−1

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

drivers/gpu/drm/amd/display/dmub/src/dmub_dcn315.c+62−0

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

drivers/gpu/drm/amd/display/dmub/src/dmub_dcn315.h+68−0

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

drivers/gpu/drm/amd/display/dmub/src/dmub_dcn316.c+62−0

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

drivers/gpu/drm/amd/display/dmub/src/dmub_dcn316.h+33−0

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

drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c+10−1

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

drivers/gpu/drm/amd/display/include/bios_parser_types.h+0−2

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

drivers/gpu/drm/amd/display/include/dal_asic_id.h+12−1

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

drivers/gpu/drm/amd/display/include/dal_types.h+2−0

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

drivers/gpu/drm/amd/display/include/ddc_service_types.h+6−0

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

drivers/gpu/drm/amd/display/include/dpcd_defs.h+0−4

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

drivers/gpu/drm/amd/display/include/grph_object_defs.h+0−2

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

drivers/gpu/drm/amd/display/include/grph_object_id.h+0−2

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

drivers/gpu/drm/amd/display/include/link_service_types.h+0−12

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

drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h+2−1

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

drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c+13−12

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

drivers/gpu/drm/amd/include/amd_shared.h+1−2

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

drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_5_offset.h+15191−0

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

This diff is larger than a page shows: the files after these aren’t listed. Clone the repository to see all of it.

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