History

Merge tag 'drm-next-2021-08-31-1' of git://anongit.freedesktop.org/drm/drm

Pull drm updates from Dave Airlie: "Highlights: - i915 has seen a lot of refactoring and uAPI cleanups due to a change in the upstream direction going forward This has all been audited with known userspace, but there may be some pitfalls that were missed. - i915 now uses common TTM to enable discrete memory on DG1/2 GPUs - i915 enables Jasper and Elkhart Lake by default and has preliminary XeHP/DG2 support - amdgpu adds support for Cyan Skillfish - lots of implicit fencing rules documented and fixed up in drivers - msm now uses the core scheduler - the irq midlayer has been removed for non-legacy drivers - the sysfb code now works on more than x86. Otherwise the usual smattering of stuff everywhere, panels, bridges, refactorings. Detailed summary: core: - extract i915 eDP backlight into core - DP aux bus support - drm_device.irq_enabled removed - port drivers to native irq interfaces - export gem shadow plane handling for vgem - print proper driver name in framebuffer registration - driver fixes for implicit fencing rules - ARM fixed rate compression modifier added - updated fb damage handling - rmfb ioctl logging/docs - drop drm_gem_object_put_locked - define DRM_FORMAT_MAX_PLANES - add gem fb vmap/vunmap helpers - add lockdep_assert(once) helpers - mark drm irq midlayer as legacy - use offset adjusted bo mapping conversion vgaarb: - cleanups fbdev: - extend efifb handling to all arches - div by 0 fixes for multiple drivers udmabuf: - add hugepage mapping support dma-buf: - non-dynamic exporter fixups - document implicit fencing rules amdgpu: - Initial Cyan Skillfish support - switch virtual DCE over to vkms based atomic - VCN/JPEG power down fixes - NAVI PCIE link handling fixes - AMD HDMI freesync fixes - Yellow Carp + Beige Goby fixes - Clockgating/S0ix/SMU/EEPROM fixes - embed hw fence in job - rework dma-resv handling - ensure eviction to system ram amdkfd: - uapi: SVM address range query added - sysfs leak fix - GPUVM TLB optimizations - vmfault/migration counters i915: - Enable JSL and EHL by default - preliminary XeHP/DG2 support - remove all CNL support (never shipped) - move to TTM for discrete memory support - allow mixed object mmap handling - GEM uAPI spring cleaning - add I915_MMAP_OBJECT_FIXED - reinstate ADL-P mmap ioctls - drop a bunch of unused by userspace features - disable and remove GPU relocations - revert some i915 misfeatures - major refactoring of GuC for Gen11+ - execbuffer object locking separate step - reject caching/set-domain on discrete - Enable pipe DMC loading on XE-LPD and ADL-P - add PSF GV point support - Refactor and fix DDI buffer translations - Clean up FBC CFB allocation code - Finish INTEL_GEN() and friends macro conversions nouveau: - add eDP backlight support - implicit fence fix msm: - a680/7c3 support - drm/scheduler conversion panfrost: - rework GPU reset virtio: - fix fencing for planes ast: - add detect support bochs: - move to tiny GPU driver vc4: - use hotplug irqs - HDMI codec support vmwgfx: - use internal vmware device headers ingenic: - demidlayering irq rcar-du: - shutdown fixes - convert to bridge connector helpers zynqmp-dsub: - misc fixes mgag200: - convert PLL handling to atomic mediatek: - MT8133 AAL support - gem mmap object support - MT8167 support etnaviv: - NXP Layerscape LS1028A SoC support - GEM mmap cleanups tegra: - new user API exynos: - missing unlock fix - build warning fix - use refcount_t" * tag 'drm-next-2021-08-31-1' of git://anongit.freedesktop.org/drm/drm: (1318 commits) drm/amd/display: Move AllowDRAMSelfRefreshOrDRAMClockChangeInVblank to bounding box drm/amd/display: Remove duplicate dml init drm/amd/display: Update bounding box states (v2) drm/amd/display: Update number of DCN3 clock states drm/amdgpu: disable GFX CGCG in aldebaran drm/amdgpu: Clear RAS interrupt status on aldebaran drm/amdgpu: Add support for RAS XGMI err query drm/amdkfd: Account for SH/SE count when setting up cu masks. drm/amdgpu: rename amdgpu_bo_get_preferred_pin_domain drm/amdgpu: drop redundant cancel_delayed_work_sync call drm/amdgpu: add missing cleanups for more ASICs on UVD/VCE suspend drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend drm/amdkfd: map SVM range with correct access permission drm/amdkfd: check access permisson to restore retry fault drm/amdgpu: Update RAS XGMI Error Query drm/amdgpu: Add driver infrastructure for MCA RAS drm/amd/display: Add Logging for HDMI color depth information drm/amd/amdgpu: consolidate PSP TA init shared buf functions drm/amd/amdgpu: add name field back to ras_common_if drm/amdgpu: Fix build with missing pm_suspend_target_state module export ...

Linus Torvalds committed 5 years ago

Commit 477f70c2 parents 835d31d 8f0284f1124 files · +62925 −35691Browse files

Unified · Split

1124 files
  1. Documentation/ABI/testing/sysfs-kernel-dmabuf-buffers +24 −0
  2. Documentation/devicetree/bindings/display/bridge/simple-bridge.yaml +3 −0
  3. Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml +19 −2
  4. Documentation/devicetree/bindings/display/dp-aux-bus.yaml +37 −0
  5. Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt +1 −1
  6. Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml +17 −0
  7. Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +72 −0
  8. Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml +78 −0
  9. Documentation/devicetree/bindings/display/panel/innolux,ej030na.yaml +62 −0
  10. Documentation/devicetree/bindings/display/panel/panel-simple.yaml +24 −0
  11. Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml +99 −0
  12. Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml +16 −2
  13. Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt +1 −0
  14. Documentation/devicetree/bindings/display/solomon,ssd1307fb.yaml +208 −0
  15. Documentation/devicetree/bindings/display/ssd1307fb.txt +0 −60
  16. Documentation/devicetree/bindings/vendor-prefixes.yaml +4 −0
  17. Documentation/driver-api/dma-buf.rst +13 −0
  18. Documentation/driver-api/thermal/nouveau_thermal.rst +1 −1
  19. Documentation/gpu/drm-kms.rst +33 −2
  20. Documentation/gpu/drm-uapi.rst +22 −0
  21. Documentation/gpu/i915.rst +15 −0
  22. Documentation/gpu/rfc/i915_parallel_execbuf.h +122 −0
  23. Documentation/gpu/rfc/i915_scheduler.rst +148 −0
  24. Documentation/gpu/rfc/index.rst +4 −0
  25. Documentation/gpu/vkms.rst +26 −12
  26. MAINTAINERS +19 −6
  27. arch/arm/include/asm/efi.h +1 −4
  28. arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +15 −15
  29. arch/arm64/include/asm/efi.h +1 −4
  30. arch/riscv/include/asm/efi.h +1 −4
  31. arch/x86/Kconfig +0 −26
  32. arch/x86/kernel/Makefile +0 −3
  33. drivers/dma-buf/Kconfig +11 −0
  34. drivers/dma-buf/Makefile +1 −0
  35. drivers/dma-buf/dma-buf-sysfs-stats.c +205 −0
  36. drivers/dma-buf/dma-buf-sysfs-stats.h +35 −0
  37. drivers/dma-buf/dma-buf.c +25 −1
  38. drivers/dma-buf/dma-fence-chain.c +1 −1
  39. drivers/dma-buf/dma-resv.c +12 −21
  40. drivers/dma-buf/st-dma-fence-chain.c +4 −12
  41. drivers/dma-buf/udmabuf.c +50 −9
  42. drivers/firmware/Kconfig +32 −0
  43. drivers/firmware/Makefile +2 −0
  44. drivers/firmware/efi/Makefile +2 −0
  45. drivers/firmware/efi/efi-init.c +0 −90
  46. drivers/firmware/efi/sysfb_efi.c +77 −3
  47. drivers/firmware/sysfb.c +25 −12
  48. drivers/firmware/sysfb_simplefb.c +23 −10
  49. drivers/gpu/drm/Kconfig +5 −3
  50. drivers/gpu/drm/Makefile +2 −1
  51. drivers/gpu/drm/amd/amdgpu/Makefile +9 −3
  52. drivers/gpu/drm/amd/amdgpu/amdgpu.h +15 −3
  53. drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +26 −28
  54. drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +4 −4
  55. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +83 −1
  56. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +5 −3
  57. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c +1 −0
  58. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c +2 −1
  59. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c +31 −0
  60. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c +31 −0
  61. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +32 −1
  62. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h +2 −0
  63. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +29 −9
  64. drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h +1 −0
  65. drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +56 −16
  66. drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 −1
  67. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +119 −48
  68. drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +0 −65
  69. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +11 −10
  70. drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c +239 −0
  71. drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h +37 −0
  72. drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +1 −4
  73. drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +80 −64
  74. drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +10 −22
  75. drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +3 −3
  76. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 −3
  77. drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 −1
  78. drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +21 −0
  79. drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +12 −14
  80. drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c +0 −1
  81. drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c +1 −1
  82. drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 −1
  83. drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +18 −11
  84. drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +1 −1
  85. drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +28 −11
  86. drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +5 −1
  87. drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +0 −2
  88. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +20 −14
  89. drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c +117 −0
  90. drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h +72 −0
  91. drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c +0 −1
  92. drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c +0 −1
  93. drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +1 −0
  94. drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +7 −7
  95. drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1 −2
  96. drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c +13 −7
  97. drivers/gpu/drm/amd/amdgpu/amdgpu_pll.h +2 −1
  98. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +655 −460
  99. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +68 −97
  100. drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c +2 −2
  101. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +63 −57
  102. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +8 −4
  103. drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +871 −408
  104. drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h +53 −17
  105. drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 −6
  106. drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h +2 −2
  107. drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +0 −1
  108. drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +2 −2
  109. drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +68 −50
  110. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +56 −46
  111. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1 −1
  112. drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +88 −4
  113. drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +47 −34
  114. drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +1 −2
  115. drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 −1
  116. drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +0 −1
  117. drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 −2
  118. drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +4 −4
  119. drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +643 −0
  120. drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h +26 −0
  121. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +69 −98
  122. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +8 −6
  123. drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +136 −4
  124. drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +2 −0
  125. drivers/gpu/drm/amd/amdgpu/atombios_crtc.c +1 −1
  126. drivers/gpu/drm/amd/amdgpu/cik.c +5 −5
  127. drivers/gpu/drm/amd/amdgpu/cyan_skillfish_reg_init.c +51 −0
  128. drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0 −780
  129. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +143 −18
  130. drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 −0
  131. drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 −0
  132. drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 −0
  133. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 −2
  134. drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +3 −3
  135. drivers/gpu/drm/amd/amdgpu/gfxhub_v1_1.c +2 −3
  136. drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +5 −1
  137. drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +31 −1
  138. drivers/gpu/drm/amd/amdgpu/mca_v3_0.c +125 −0
  139. drivers/gpu/drm/amd/amdgpu/mca_v3_0.h +26 −0
  140. drivers/gpu/drm/amd/amdgpu/mmsch_v1_0.h +1 −3
  141. drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +14 −4
  142. drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h +2 −1
  143. drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +21 −0
  144. drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +31 −7
  145. drivers/gpu/drm/amd/amdgpu/nv.c +36 −11
  146. drivers/gpu/drm/amd/amdgpu/nv.h +1 −0
  147. drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +20 −20
  148. drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +31 −46
  149. drivers/gpu/drm/amd/amdgpu/psp_v11_0_8.c +208 −0
  150. drivers/gpu/drm/amd/amdgpu/psp_v11_0_8.h +5 −5
  151. drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +14 −14
  152. drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +93 −33
  153. drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +2 −2
  154. drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +49 −1
  155. drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +0 −17
  156. drivers/gpu/drm/amd/amdgpu/si.c +4 −4
  157. drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c +186 −138
  158. drivers/gpu/drm/amd/amdgpu/soc15.c +7 −9
  159. drivers/gpu/drm/amd/amdgpu/soc15_common.h +4 −4
  160. drivers/gpu/drm/amd/amdgpu/ta_xgmi_if.h +15 −2
  161. drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +15 −0
  162. drivers/gpu/drm/amd/amdgpu/umc_v6_7.h +15 −0
  163. drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c +24 −0
  164. drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +24 −0
  165. drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +24 −1
  166. drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +24 −0
  167. drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +24 −0
  168. drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +25 −0
  169. drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +23 −0
  170. drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +23 −0
  171. drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1 −1
  172. drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 −1
  173. drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1 −1
  174. drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +21 −14
  175. drivers/gpu/drm/amd/amdgpu/vi.c +15 −8
  176. drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +35 −12
  177. drivers/gpu/drm/amd/amdkfd/kfd_crat.c +17 −0
  178. drivers/gpu/drm/amd/amdkfd/kfd_device.c +51 −8
  179. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +42 −18
  180. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +1 −1
  181. drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c +1 −0
  182. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +63 −21
  183. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h +1 −0
  184. drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +5 −0
  185. drivers/gpu/drm/amd/amdkfd/kfd_priv.h +2 −1
  186. drivers/gpu/drm/amd/amdkfd/kfd_process.c +2 −1
  187. drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +5 −5
  188. drivers/gpu/drm/amd/amdkfd/kfd_smi_events.h +1 −1
  189. drivers/gpu/drm/amd/amdkfd/kfd_svm.c +146 −71
  190. drivers/gpu/drm/amd/amdkfd/kfd_svm.h +3 −2
  191. drivers/gpu/drm/amd/amdkfd/kfd_topology.c +5 −1
  192. drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1 −0
  193. drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +4 −0
  194. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +245 −127
  195. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +15 −12
  196. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +9 −9
  197. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +7 −9
  198. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq_params.h +1 −0
  199. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +23 −0
  200. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +24 −0
  201. drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c +144 −0
  202. drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h +34 −0
  203. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c +6 −6
  204. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c +2 −2
  205. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c +6 −6
  206. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c +8 −8
  207. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c +15 −10
  208. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c +5 −5
  209. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c +1 −1
  210. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c +5 −5
  211. drivers/gpu/drm/amd/display/dc/core/dc.c +41 −21
  212. drivers/gpu/drm/amd/display/dc/core/dc_link.c +63 −55
  213. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +64 −63
  214. drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c +25 −0
  215. drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c +1 −1
  216. drivers/gpu/drm/amd/display/dc/core/dc_resource.c +6 −1
  217. drivers/gpu/drm/amd/display/dc/core/dc_stat.c +24 −0
  218. drivers/gpu/drm/amd/display/dc/core/dc_stream.c +68 −41
  219. drivers/gpu/drm/amd/display/dc/dc.h +60 −60
  220. drivers/gpu/drm/amd/display/dc/dc_dp_types.h +1 −0
  221. drivers/gpu/drm/amd/display/dc/dc_stat.h +1 −0
  222. drivers/gpu/drm/amd/display/dc/dc_trace.h +3 −0
  223. drivers/gpu/drm/amd/display/dc/dc_types.h +41 −42
  224. drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +191 −9
  225. drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +16 −5
  226. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h +18 −1
  227. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +29 −0
  228. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h +4 −0
  229. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +31 −22
  230. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +6 −0
  231. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.h +2 −0
  232. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +11 −0
  233. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.c +21 −0
  234. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.h +21 −12
  235. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c +17 −0
  236. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +8 −6
  237. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +9 −42
  238. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h +0 −2
  239. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c +1 −0
  240. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.h +13 −1
  241. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c +1 −1
  242. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +4 −1
  243. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c +64 −26
  244. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubbub.c +1 −0
  245. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubbub.h +13 −1
  246. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +22 −15
  247. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c +3 −5
  248. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c +33 −16
  249. drivers/gpu/drm/amd/display/dc/dcn301/dcn301_hubbub.c +1 −0
  250. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.c +30 −3
  251. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.h +14 −1
  252. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +4 −18
  253. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c +1 −1
  254. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +0 −1
  255. drivers/gpu/drm/amd/display/dc/dml/Makefile +4 −0
  256. drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c +1 −1
  257. drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c +1 −1
  258. drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c +6 −5
  259. drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +1 −1
  260. drivers/gpu/drm/amd/display/dc/dml/dcn2x/dcn2x.c +102 −0
  261. drivers/gpu/drm/amd/display/dc/dml/dcn2x/dcn2x.h +34 −0
  262. drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +15 −10
  263. drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c +1 −1
  264. drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +8 −7
  265. drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c +1 −1
  266. drivers/gpu/drm/amd/display/dc/dml/display_mode_enums.h +3 −1
  267. drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h +2 −0
  268. drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c +9 −7
  269. drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h +2 −2
  270. drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c +2 −2
  271. drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +228 −165
  272. drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +0 −1
  273. drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h +5 −0
  274. drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +11 −0
  275. drivers/gpu/drm/amd/display/dc/inc/hw_sequencer_private.h +0 −1
  276. drivers/gpu/drm/amd/display/dc/inc/link_dpcd.h +25 −0
  277. drivers/gpu/drm/amd/display/dc/irq_types.h +1 −1
  278. drivers/gpu/drm/amd/display/dc/os_types.h +3 −32
  279. drivers/gpu/drm/amd/display/dmub/dmub_srv.h +18 −0
  280. drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +36 −23
  281. drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c +28 −10
  282. drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h +8 −2
  283. drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +17 −0
  284. drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c +64 −11
  285. drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h +8 −2
  286. drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c +0 −6
  287. drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_transition.c +4 −4
  288. drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c +0 −3
  289. drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_transition.c +2 −2
  290. drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c +74 −0
  291. drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.h +0 −72
  292. drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c +49 −60
  293. drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h +10 −3
  294. drivers/gpu/drm/amd/include/amd_shared.h +1 −0
  295. drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_2_sh_mask.h +4 −0
  296. drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_2_offset.h +4 −0
  297. drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_2_sh_mask.h +54 −0
  298. drivers/gpu/drm/amd/include/asic_reg/mp/mp_11_0_8_offset.h +352 −0
  299. drivers/gpu/drm/amd/include/asic_reg/thm/thm_11_0_2_offset.h +6 −0
  300. drivers/gpu/drm/amd/include/asic_reg/thm/thm_11_0_2_sh_mask.h +3 −0
  301. drivers/gpu/drm/amd/include/asic_reg/umc/umc_8_7_0_sh_mask.h +100 −79
  302. drivers/gpu/drm/amd/include/cyan_skillfish_ip_offset.h +714 −0
  303. drivers/gpu/drm/amd/include/kgd_kfd_interface.h +3 −0
  304. drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 −2
  305. drivers/gpu/drm/amd/pm/amdgpu_pm.c +26 −22
  306. drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +5 −4
  307. drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +27 −6
  308. drivers/gpu/drm/amd/pm/inc/hwmgr.h +3 −3
  309. drivers/gpu/drm/amd/pm/inc/smu11_driver_if_cyan_skillfish.h +95 −0
  310. drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h +63 −2
  311. drivers/gpu/drm/amd/pm/inc/smu_types.h +1 −1
  312. drivers/gpu/drm/amd/pm/inc/smu_v11_0.h +14 −2
  313. drivers/gpu/drm/amd/pm/inc/smu_v11_8_pmfw.h +152 −0
  314. drivers/gpu/drm/amd/pm/inc/smu_v11_8_ppsmc.h +70 −0
  315. drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +8 −8
  316. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +12 −12
  317. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +23 −23
  318. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c +8 −13
  319. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.h +2 −2
  320. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +4 −3
  321. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +22 −22
  322. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c +8 −10
  323. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.h +2 −2
  324. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c +7 −7
  325. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +40 −40
  326. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_thermal.c +16 −14
  327. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_thermal.h +2 −2
  328. drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +8 −11
  329. drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +62 −37
  330. drivers/gpu/drm/amd/pm/swsmu/smu11/Makefile +1 −0
  331. drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +237 −209
  332. drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.c +76 −0
  333. drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.h +8 −11
  334. drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +203 −59
  335. drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +269 −292
  336. drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +127 −8
  337. drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +23 −23
  338. drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +10 −10
  339. drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +95 −194
  340. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +70 −32
  341. drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +7 −7
  342. drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +243 −49
  343. drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +2 −1
  344. drivers/gpu/drm/arm/display/komeda/komeda_kms.c +0 −5
  345. drivers/gpu/drm/arm/hdlcd_drv.c +96 −78
  346. drivers/gpu/drm/arm/hdlcd_drv.h +1 −0
  347. drivers/gpu/drm/arm/malidp_drv.c +0 −4
  348. drivers/gpu/drm/armada/armada_drv.c +1 −3
  349. drivers/gpu/drm/armada/armada_overlay.c +0 −2
  350. drivers/gpu/drm/armada/armada_plane.c +0 −29
  351. drivers/gpu/drm/armada/armada_plane.h +0 −2
  352. drivers/gpu/drm/aspeed/aspeed_gfx_crtc.c +0 −1
  353. drivers/gpu/drm/ast/ast_drv.c +1 −1
  354. drivers/gpu/drm/ast/ast_drv.h +6 −0
  355. drivers/gpu/drm/ast/ast_main.c +5 −0
  356. drivers/gpu/drm/ast/ast_mode.c +39 −15
  357. drivers/gpu/drm/ast/ast_post.c +65 −26
  358. drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +47 −33
  359. drivers/gpu/drm/bochs/Kconfig +0 −11
  360. drivers/gpu/drm/bochs/Makefile +0 −4
  361. drivers/gpu/drm/bochs/bochs.h +0 −98
  362. drivers/gpu/drm/bochs/bochs_drv.c +0 −205
  363. drivers/gpu/drm/bochs/bochs_hw.c +0 −323
  364. drivers/gpu/drm/bochs/bochs_kms.c +0 −178
  365. drivers/gpu/drm/bochs/bochs_mm.c +0 −24
  366. drivers/gpu/drm/bridge/Kconfig +1 −0
  367. drivers/gpu/drm/bridge/adv7511/adv7533.c +1 −1
  368. drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +1 −8
  369. drivers/gpu/drm/bridge/analogix/anx7625.c +26 −10
  370. drivers/gpu/drm/bridge/analogix/anx7625.h +3 −1
  371. drivers/gpu/drm/bridge/cdns-dsi.c +2 −2
  372. drivers/gpu/drm/bridge/ite-it66121.c +2 −0
  373. drivers/gpu/drm/bridge/lontium-lt8912b.c +1 −1
  374. drivers/gpu/drm/bridge/nwl-dsi.c +1 −7
  375. drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +53 −2
  376. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +44 −24
  377. drivers/gpu/drm/bridge/tc358768.c +2 −2
  378. drivers/gpu/drm/bridge/ti-sn65dsi83.c +113 −87
  379. drivers/gpu/drm/bridge/ti-sn65dsi86.c +414 −346
  380. drivers/gpu/drm/drm_aperture.c +13 −8
  381. drivers/gpu/drm/drm_atomic.c +2 −2
  382. drivers/gpu/drm/drm_atomic_helper.c +15 −5
  383. drivers/gpu/drm/drm_atomic_uapi.c +3 −3
  384. drivers/gpu/drm/drm_auth.c +70 −26
  385. drivers/gpu/drm/drm_bridge.c +11 −1
  386. drivers/gpu/drm/drm_bufs.c +1 −1
  387. drivers/gpu/drm/drm_cache.c +1 −1
  388. drivers/gpu/drm/drm_connector.c +4 −1
  389. drivers/gpu/drm/drm_crtc_internal.h +2 −0
  390. drivers/gpu/drm/drm_damage_helper.c +2 −56
  391. drivers/gpu/drm/drm_debugfs.c +2 −1
  392. drivers/gpu/drm/drm_debugfs_crc.c +4 −4
  393. drivers/gpu/drm/drm_dp_aux_bus.c +323 −0
  394. drivers/gpu/drm/drm_dp_helper.c +467 −3
  395. drivers/gpu/drm/drm_dp_mst_topology.c +6 −4
  396. drivers/gpu/drm/drm_drv.c +2 −2
  397. drivers/gpu/drm/drm_dsc.c +1 −1
  398. drivers/gpu/drm/drm_edid.c +2 −2
  399. drivers/gpu/drm/drm_fb_helper.c +1 −1
  400. drivers/gpu/drm/drm_file.c +4 −3
  401. drivers/gpu/drm/drm_format_helper.c +1 −1
  402. drivers/gpu/drm/drm_framebuffer.c +22 −2
  403. drivers/gpu/drm/drm_gem.c +5 −33
  404. drivers/gpu/drm/drm_gem_atomic_helper.c +59 −38
  405. drivers/gpu/drm/drm_gem_framebuffer_helper.c +191 −8
  406. drivers/gpu/drm/drm_gem_shmem_helper.c +3 −3
  407. drivers/gpu/drm/drm_gem_vram_helper.c +4 −7
  408. drivers/gpu/drm/drm_hdcp.c +1 −1
  409. drivers/gpu/drm/drm_ioctl.c +2 −2
  410. drivers/gpu/drm/drm_irq.c +9 −95
  411. drivers/gpu/drm/drm_lease.c +120 −143
  412. drivers/gpu/drm/drm_legacy_misc.c +1 −2
  413. drivers/gpu/drm/drm_mipi_dbi.c +61 −14
  414. drivers/gpu/drm/drm_mm.c +1 −1
  415. drivers/gpu/drm/drm_mode_object.c +1 −1
  416. drivers/gpu/drm/drm_modes.c +2 −2
  417. drivers/gpu/drm/drm_of.c +4 −2
  418. drivers/gpu/drm/drm_plane.c +105 −1
  419. drivers/gpu/drm/drm_plane_helper.c +1 −1
  420. drivers/gpu/drm/drm_prime.c +2 −2
  421. drivers/gpu/drm/drm_probe_helper.c +1 −1
  422. drivers/gpu/drm/drm_property.c +1 −1
  423. drivers/gpu/drm/drm_scdc_helper.c +1 −1
  424. drivers/gpu/drm/drm_simple_kms_helper.c +46 −5
  425. drivers/gpu/drm/drm_syncobj.c +4 −4
  426. drivers/gpu/drm/drm_vblank.c +18 −9
  427. drivers/gpu/drm/drm_vma_manager.c +1 −1
  428. drivers/gpu/drm/etnaviv/etnaviv_drv.c +2 −12
  429. drivers/gpu/drm/etnaviv/etnaviv_drv.h +0 −3
  430. drivers/gpu/drm/etnaviv/etnaviv_gem.c +5 −13
  431. drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c +0 −13
  432. drivers/gpu/drm/etnaviv/etnaviv_gpu.c +6 −0
  433. drivers/gpu/drm/etnaviv/etnaviv_hwdb.c +31 −0
  434. drivers/gpu/drm/etnaviv/etnaviv_sched.c +2 −1
  435. drivers/gpu/drm/exynos/exynos_dp.c +1 −4
  436. drivers/gpu/drm/exynos/exynos_drm_dma.c +2 −0
  437. drivers/gpu/drm/exynos/exynos_drm_drv.c +0 −10
  438. drivers/gpu/drm/exynos/exynos_drm_dsi.c +4 −4
  439. drivers/gpu/drm/exynos/exynos_drm_g2d.c +8 −6
  440. drivers/gpu/drm/exynos/exynos_hdmi.c +1 −4
  441. drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +46 −32
  442. drivers/gpu/drm/gma500/oaktrail_lvds.c +3 −3
  443. drivers/gpu/drm/gma500/power.c +1 −0
  444. drivers/gpu/drm/gma500/psb_drv.c +2 −6
  445. drivers/gpu/drm/gma500/psb_drv.h +0 −5
  446. drivers/gpu/drm/gma500/psb_irq.c +24 −2
  447. drivers/gpu/drm/gma500/psb_irq.h +2 −2
  448. drivers/gpu/drm/gud/gud_drv.c +41 −20
  449. drivers/gpu/drm/gud/gud_internal.h +2 −0
  450. drivers/gpu/drm/gud/gud_pipe.c +67 −19
  451. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c +1 −2
  452. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +8 −7
  453. drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c +1 −8
  454. drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +0 −2
  455. drivers/gpu/drm/hyperv/hyperv_drm_drv.c +2 −2
  456. drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +2 −2
  457. drivers/gpu/drm/i810/i810_dma.c +1 −2
  458. drivers/gpu/drm/i915/Kconfig.debug +6 −0
  459. drivers/gpu/drm/i915/Makefile +11 −4
  460. drivers/gpu/drm/i915/display/i9xx_plane.c +1 −1
  461. drivers/gpu/drm/i915/display/icl_dsi.c +44 −2
  462. drivers/gpu/drm/i915/display/intel_acpi.c +19 −0
  463. drivers/gpu/drm/i915/display/intel_acpi.h +3 −0
  464. drivers/gpu/drm/i915/display/intel_atomic_plane.c +6 −1
  465. drivers/gpu/drm/i915/display/intel_atomic_plane.h +1 −2
  466. drivers/gpu/drm/i915/display/intel_audio.c +2 −2
  467. drivers/gpu/drm/i915/display/intel_bios.c +4 −4
  468. drivers/gpu/drm/i915/display/intel_bw.c +172 −6
  469. drivers/gpu/drm/i915/display/intel_cdclk.c +40 −67
  470. drivers/gpu/drm/i915/display/intel_color.c +2 −3
  471. drivers/gpu/drm/i915/display/intel_combo_phy.c +20 −86
  472. drivers/gpu/drm/i915/display/intel_crt.c +3 −0
  473. drivers/gpu/drm/i915/display/intel_crtc.c +5 −5
  474. drivers/gpu/drm/i915/display/intel_cursor.c +8 −4
  475. drivers/gpu/drm/i915/display/intel_ddi.c +275 −355
  476. drivers/gpu/drm/i915/display/intel_ddi.h +2 −2
  477. drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c +1331 −1144
  478. drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h +18 −52
  479. drivers/gpu/drm/i915/display/intel_display.c +267 −118
  480. drivers/gpu/drm/i915/display/intel_display.h +1 −0
  481. drivers/gpu/drm/i915/display/intel_display_debugfs.c +101 −17
  482. drivers/gpu/drm/i915/display/intel_display_power.c +255 −313
  483. drivers/gpu/drm/i915/display/intel_display_power.h +12 −3
  484. drivers/gpu/drm/i915/display/intel_display_types.h +31 −3
  485. drivers/gpu/drm/i915/display/intel_dmc.c +108 −124
  486. drivers/gpu/drm/i915/display/intel_dmc.h +18 −5
  487. drivers/gpu/drm/i915/display/intel_dp.c +29 −36
  488. drivers/gpu/drm/i915/display/intel_dp_aux.c +0 −1
  489. drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +40 −289
  490. drivers/gpu/drm/i915/display/intel_dp_mst.c +24 −19
  491. drivers/gpu/drm/i915/display/intel_dpll.c +7 −5
  492. drivers/gpu/drm/i915/display/intel_dpll_mgr.c +134 −497
  493. drivers/gpu/drm/i915/display/intel_dpll_mgr.h +1 −2
  494. drivers/gpu/drm/i915/display/intel_fbc.c +107 −112
  495. drivers/gpu/drm/i915/display/intel_fbdev.c +57 −39
  496. drivers/gpu/drm/i915/display/intel_fdi.c +12 −13
  497. drivers/gpu/drm/i915/display/intel_gmbus.c +2 −2
  498. drivers/gpu/drm/i915/display/intel_hdmi.c +31 −22
  499. drivers/gpu/drm/i915/display/intel_lvds.c +2 −2
  500. drivers/gpu/drm/i915/display/intel_opregion.c +3 −0
  501. drivers/gpu/drm/i915/display/intel_psr.c +214 −51
  502. drivers/gpu/drm/i915/display/intel_quirks.c +34 −0
  503. drivers/gpu/drm/i915/display/intel_sdvo.c +2 −2
  504. drivers/gpu/drm/i915/display/intel_snps_phy.c +862 −0
  505. drivers/gpu/drm/i915/display/intel_snps_phy.h +35 −0
  506. drivers/gpu/drm/i915/display/intel_sprite.c +1 −1
  507. drivers/gpu/drm/i915/display/intel_tc.c +27 −7
  508. drivers/gpu/drm/i915/display/intel_tc.h +2 −0
  509. drivers/gpu/drm/i915/display/intel_tv.c +6 −7
  510. drivers/gpu/drm/i915/display/intel_vbt_defs.h +1 −1
  511. drivers/gpu/drm/i915/display/intel_vdsc.c +4 −1
  512. drivers/gpu/drm/i915/display/intel_vga.c +8 −4
  513. drivers/gpu/drm/i915/display/skl_scaler.c +24 −25
  514. drivers/gpu/drm/i915/display/skl_universal_plane.c +14 −14
  515. drivers/gpu/drm/i915/display/vlv_dsi.c +6 −7
  516. drivers/gpu/drm/i915/gem/i915_gem_clflush.c +1 −3
  517. drivers/gpu/drm/i915/gem/i915_gem_client_blt.c +0 −355
  518. drivers/gpu/drm/i915/gem/i915_gem_client_blt.h +0 −21
  519. drivers/gpu/drm/i915/gem/i915_gem_context.c +1302 −1618
  520. drivers/gpu/drm/i915/gem/i915_gem_context.h +6 −0
  521. drivers/gpu/drm/i915/gem/i915_gem_context_types.h +183 −13
  522. drivers/gpu/drm/i915/gem/i915_gem_create.c +93 −95
  523. drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +46 −12
  524. drivers/gpu/drm/i915/gem/i915_gem_domain.c +10 −1
  525. drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +68 −418
  526. drivers/gpu/drm/i915/gem/i915_gem_internal.c +2 −2
  527. drivers/gpu/drm/i915/gem/i915_gem_lmem.c +74 −86
  528. drivers/gpu/drm/i915/gem/i915_gem_lmem.h +7 −5
  529. drivers/gpu/drm/i915/gem/i915_gem_mman.c +78 −29
  530. drivers/gpu/drm/i915/gem/i915_gem_object.c +289 −61
  531. drivers/gpu/drm/i915/gem/i915_gem_object.h +49 −20
  532. drivers/gpu/drm/i915/gem/i915_gem_object_blt.c +0 −461
  533. drivers/gpu/drm/i915/gem/i915_gem_object_blt.h +0 −39
  534. drivers/gpu/drm/i915/gem/i915_gem_object_types.h +241 −14
  535. drivers/gpu/drm/i915/gem/i915_gem_pages.c +34 −20
  536. drivers/gpu/drm/i915/gem/i915_gem_phys.c +1 −1
  537. drivers/gpu/drm/i915/gem/i915_gem_region.c +12 −11
  538. drivers/gpu/drm/i915/gem/i915_gem_region.h +1 −0
  539. drivers/gpu/drm/i915/gem/i915_gem_shmem.c +25 −5
  540. drivers/gpu/drm/i915/gem/i915_gem_stolen.c +2 −2
  541. drivers/gpu/drm/i915/gem/i915_gem_ttm.c +965 −0
  542. drivers/gpu/drm/i915/gem/i915_gem_ttm.h +49 −0
  543. drivers/gpu/drm/i915/gem/i915_gem_userptr.c +64 −53
  544. drivers/gpu/drm/i915/gem/i915_gem_wait.c +21 −2
  545. drivers/gpu/drm/i915/gem/selftests/huge_gem_object.c +2 −2
  546. drivers/gpu/drm/i915/gem/selftests/huge_pages.c +4 −4
  547. drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c +1 −113
  548. drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c +2 −125
  549. drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c +188 −2
  550. drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c +243 −0
  551. drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +87 −77
  552. drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c +0 −597
  553. drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c +2 −1
  554. drivers/gpu/drm/i915/gem/selftests/mock_context.c +43 −24
  555. drivers/gpu/drm/i915/gem/selftests/mock_context.h +3 −1
  556. drivers/gpu/drm/i915/gt/debugfs_gt_pm.c +5 −5
  557. drivers/gpu/drm/i915/gt/gen8_engine_cs.c +9 −8
  558. drivers/gpu/drm/i915/gt/gen8_ppgtt.c +68 −0
  559. drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +20 −24
  560. drivers/gpu/drm/i915/gt/intel_breadcrumbs.h +14 −2
  561. drivers/gpu/drm/i915/gt/intel_breadcrumbs_types.h +7 −0
  562. drivers/gpu/drm/i915/gt/intel_context.c +61 −27
  563. drivers/gpu/drm/i915/gt/intel_context.h +51 −5
  564. drivers/gpu/drm/i915/gt/intel_context_param.c +0 −63
  565. drivers/gpu/drm/i915/gt/intel_context_param.h +1 −5
  566. drivers/gpu/drm/i915/gt/intel_context_types.h +63 −1
  567. drivers/gpu/drm/i915/gt/intel_engine.h +68 −19
  568. drivers/gpu/drm/i915/gt/intel_engine_cs.c +261 −159
  569. drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c +59 −15
  570. drivers/gpu/drm/i915/gt/intel_engine_heartbeat.h +4 −0
  571. drivers/gpu/drm/i915/gt/intel_engine_pm.c +1 −3
  572. drivers/gpu/drm/i915/gt/intel_engine_types.h +26 −67
  573. drivers/gpu/drm/i915/gt/intel_engine_user.c +5 −1
  574. drivers/gpu/drm/i915/gt/intel_execlists_submission.c +345 −259
  575. drivers/gpu/drm/i915/gt/intel_execlists_submission.h +2 −10
  576. drivers/gpu/drm/i915/gt/intel_ggtt.c +3 −3
  577. drivers/gpu/drm/i915/gt/intel_gpu_commands.h +2 −0
  578. drivers/gpu/drm/i915/gt/intel_gt.c +194 −3
  579. drivers/gpu/drm/i915/gt/intel_gt.h +10 −0
  580. drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c +5 −5
  581. drivers/gpu/drm/i915/gt/intel_gt_irq.c +12 −1
  582. drivers/gpu/drm/i915/gt/intel_gt_pm.c +4 −7
  583. drivers/gpu/drm/i915/gt/intel_gt_requests.c +5 −16
  584. drivers/gpu/drm/i915/gt/intel_gt_requests.h +5 −4
  585. drivers/gpu/drm/i915/gt/intel_gt_types.h +37 −0
  586. drivers/gpu/drm/i915/gt/intel_gtt.c +16 −4
  587. drivers/gpu/drm/i915/gt/intel_gtt.h +7 −11
  588. drivers/gpu/drm/i915/gt/intel_lrc.c +69 −48
  589. drivers/gpu/drm/i915/gt/intel_lrc_reg.h +2 −1
  590. drivers/gpu/drm/i915/gt/intel_migrate.c +688 −0
  591. drivers/gpu/drm/i915/gt/intel_migrate.h +65 −0
  592. drivers/gpu/drm/i915/gt/intel_migrate_types.h +15 −0
  593. drivers/gpu/drm/i915/gt/intel_mocs.c +1 −1
  594. drivers/gpu/drm/i915/gt/intel_rc6.c +33 −16
  595. drivers/gpu/drm/i915/gt/intel_region_lmem.c +4 −3
  596. drivers/gpu/drm/i915/gt/intel_renderstate.h +1 −0
  597. drivers/gpu/drm/i915/gt/intel_reset.c +26 −30
  598. drivers/gpu/drm/i915/gt/intel_ring.h +1 −0
  599. drivers/gpu/drm/i915/gt/intel_ring_submission.c +64 −6
  600. drivers/gpu/drm/i915/gt/intel_rps.c +207 −2
  601. drivers/gpu/drm/i915/gt/intel_rps.h +10 −0
  602. drivers/gpu/drm/i915/gt/intel_sseu.c +42 −84
  603. drivers/gpu/drm/i915/gt/intel_sseu.h +8 −2
  604. drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c +4 −4
  605. drivers/gpu/drm/i915/gt/intel_workarounds.c +250 −248
  606. drivers/gpu/drm/i915/gt/intel_workarounds_types.h +1 −0
  607. drivers/gpu/drm/i915/gt/mock_engine.c +44 −7
  608. drivers/gpu/drm/i915/gt/selftest_context.c +10 −0
  609. drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c +22 −0
  610. drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.h +2 −0
  611. drivers/gpu/drm/i915/gt/selftest_engine_pm.c +2 −2
  612. drivers/gpu/drm/i915/gt/selftest_execlists.c +42 −265
  613. drivers/gpu/drm/i915/gt/selftest_hangcheck.c +253 −77
  614. drivers/gpu/drm/i915/gt/selftest_lrc.c +3 −3
  615. drivers/gpu/drm/i915/gt/selftest_migrate.c +669 −0
  616. drivers/gpu/drm/i915/gt/selftest_mocs.c +37 −15
  617. drivers/gpu/drm/i915/gt/selftest_reset.c +1 −1
  618. drivers/gpu/drm/i915/gt/selftest_slpc.c +311 −0
  619. drivers/gpu/drm/i915/gt/selftest_timeline.c +1 −1
  620. drivers/gpu/drm/i915/gt/selftest_workarounds.c +118 −44
  621. drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +128 −1
  622. drivers/gpu/drm/i915/gt/uc/abi/guc_actions_slpc_abi.h +235 −0
  623. drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +105 −22
  624. drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h +31 −34
  625. drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +213 −0
  626. drivers/gpu/drm/i915/gt/uc/intel_guc.c +120 −86
  627. drivers/gpu/drm/i915/gt/uc/intel_guc.h +113 −6
  628. drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +425 −62
  629. drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h +4 −0
  630. drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +475 −228
  631. drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +32 −4
  632. drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +46 −1
  633. drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +51 −116
  634. drivers/gpu/drm/i915/gt/uc/intel_guc_log.c +10 −19
  635. drivers/gpu/drm/i915/gt/uc/intel_guc_log.h +2 −4
  636. drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c +80 −0
  637. drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h +31 −0
  638. drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +626 −0
  639. drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +42 −0
  640. drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_types.h +29 −0
  641. drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2604 −291
  642. drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +16 −2
  643. drivers/gpu/drm/i915/gt/uc/intel_uc.c +94 −32
  644. drivers/gpu/drm/i915/gt/uc/intel_uc.h +15 −0
  645. drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +14 −13
  646. drivers/gpu/drm/i915/gvt/gtt.c +1 −1
  647. drivers/gpu/drm/i915/gvt/scheduler.c +2 −5
  648. drivers/gpu/drm/i915/i915_active.c +11 −26
  649. drivers/gpu/drm/i915/i915_active.h +3 −0
  650. drivers/gpu/drm/i915/i915_buddy.c +421 −0
  651. drivers/gpu/drm/i915/i915_buddy.h +135 −0
  652. drivers/gpu/drm/i915/i915_cmd_parser.c +34 −33
  653. drivers/gpu/drm/i915/i915_debugfs.c +4 −4
  654. drivers/gpu/drm/i915/i915_debugfs_params.c +32 −0
  655. drivers/gpu/drm/i915/i915_drv.c +13 −6
  656. drivers/gpu/drm/i915/i915_drv.h +145 −125
  657. drivers/gpu/drm/i915/i915_gem.c +4 −59
  658. drivers/gpu/drm/i915/i915_gem.h +0 −12
  659. drivers/gpu/drm/i915/i915_gem_evict.c +1 −0
  660. drivers/gpu/drm/i915/i915_gem_ww.c +63 −0
  661. drivers/gpu/drm/i915/i915_gem_ww.h +50 −0
  662. drivers/gpu/drm/i915/i915_getparam.c +5 −2
  663. drivers/gpu/drm/i915/i915_globals.c +0 −160
  664. drivers/gpu/drm/i915/i915_globals.h +0 −37
  665. drivers/gpu/drm/i915/i915_gpu_error.c +22 −5
  666. drivers/gpu/drm/i915/i915_irq.c +111 −67
  667. drivers/gpu/drm/i915/i915_module.c +124 −0
  668. drivers/gpu/drm/i915/i915_pci.c +115 −94
  669. drivers/gpu/drm/i915/i915_pci.h +8 −0
  670. drivers/gpu/drm/i915/i915_perf.c +31 −27
  671. drivers/gpu/drm/i915/i915_perf.h +1 −1
  672. drivers/gpu/drm/i915/i915_pmu.c +4 −2
  673. drivers/gpu/drm/i915/i915_pmu.h +2 −2
  674. drivers/gpu/drm/i915/i915_reg.h +246 −204
  675. drivers/gpu/drm/i915/i915_request.c +129 −170
  676. drivers/gpu/drm/i915/i915_request.h +34 −4
  677. drivers/gpu/drm/i915/i915_scatterlist.c +80 −0
  678. drivers/gpu/drm/i915/i915_scatterlist.h +5 −0
  679. drivers/gpu/drm/i915/i915_scheduler.c +102 −118
  680. drivers/gpu/drm/i915/i915_scheduler.h +53 −1
  681. drivers/gpu/drm/i915/i915_scheduler_types.h +111 −0
  682. drivers/gpu/drm/i915/i915_sw_fence_work.c +1 −4
  683. drivers/gpu/drm/i915/i915_sw_fence_work.h +1 −1
  684. drivers/gpu/drm/i915/i915_sysfs.c +17 −66
  685. drivers/gpu/drm/i915/i915_trace.h +197 −4
  686. drivers/gpu/drm/i915/i915_ttm_buddy_manager.c +258 −0
  687. drivers/gpu/drm/i915/i915_ttm_buddy_manager.h +56 −0
  688. drivers/gpu/drm/i915/i915_vma.c +9 −25
  689. drivers/gpu/drm/i915/i915_vma.h +3 −0
  690. drivers/gpu/drm/i915/intel_device_info.c +21 −13
  691. drivers/gpu/drm/i915/intel_device_info.h +13 −7
  692. drivers/gpu/drm/i915/intel_dram.c +21 −21
  693. drivers/gpu/drm/i915/intel_memory_region.c +10 −53
  694. drivers/gpu/drm/i915/intel_memory_region.h +10 −20
  695. drivers/gpu/drm/i915/intel_pch.c +4 −4
  696. drivers/gpu/drm/i915/intel_pch.h +2 −0
  697. drivers/gpu/drm/i915/intel_pm.c +191 −113
  698. drivers/gpu/drm/i915/intel_region_ttm.c +58 −92
  699. drivers/gpu/drm/i915/intel_region_ttm.h +15 −8
  700. drivers/gpu/drm/i915/intel_sideband.c +9 −4
  701. drivers/gpu/drm/i915/intel_sideband.h +1 −1
  702. drivers/gpu/drm/i915/intel_step.c +130 −19
  703. drivers/gpu/drm/i915/intel_step.h +23 −10
  704. drivers/gpu/drm/i915/intel_uncore.c +370 −54
  705. drivers/gpu/drm/i915/intel_uncore.h +19 −1
  706. drivers/gpu/drm/i915/intel_wopcm.c +5 −5
  707. drivers/gpu/drm/i915/selftests/i915_buddy.c +787 −0
  708. drivers/gpu/drm/i915/selftests/i915_live_selftests.h +3 −2
  709. drivers/gpu/drm/i915/selftests/i915_mock_selftests.h +1 −1
  710. drivers/gpu/drm/i915/selftests/i915_perf_selftests.h +1 −1
  711. drivers/gpu/drm/i915/selftests/i915_request.c +2 −2
  712. drivers/gpu/drm/i915/selftests/i915_selftest.c +2 −2
  713. drivers/gpu/drm/i915/selftests/igt_flush_test.c +1 −1
  714. drivers/gpu/drm/i915/selftests/igt_live_test.c +1 −1
  715. drivers/gpu/drm/i915/selftests/igt_mmap.c +19 −6
  716. drivers/gpu/drm/i915/selftests/igt_mmap.h +7 −5
  717. drivers/gpu/drm/i915/selftests/intel_memory_region.c +195 −62
  718. drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c +88 −0
  719. drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h +33 −0
  720. drivers/gpu/drm/i915/selftests/intel_uncore.c +2 −0
  721. drivers/gpu/drm/i915/selftests/mock_gem_device.c +2 −1
  722. drivers/gpu/drm/i915/selftests/mock_gtt.c +0 −1
  723. drivers/gpu/drm/i915/selftests/mock_region.c +18 −11
  724. drivers/gpu/drm/imx/dcss/dcss-kms.c +1 −7
  725. drivers/gpu/drm/imx/dcss/dcss-plane.c +0 −1
  726. drivers/gpu/drm/imx/imx-drm-core.c +0 −11
  727. drivers/gpu/drm/imx/imx-ldb.c +1 −3
  728. drivers/gpu/drm/imx/ipuv3-plane.c +0 −1
  729. drivers/gpu/drm/imx/parallel-display.c +1 −4
  730. drivers/gpu/drm/ingenic/ingenic-drm-drv.c +6 −35
  731. drivers/gpu/drm/ingenic/ingenic-ipu.c +0 −1
  732. drivers/gpu/drm/kmb/kmb_drv.c +20 −6
  733. drivers/gpu/drm/kmb/kmb_dsi.c +0 −1
  734. drivers/gpu/drm/lima/lima_sched.c +2 −1
  735. drivers/gpu/drm/mcde/mcde_display.c +0 −1
  736. drivers/gpu/drm/mcde/mcde_dsi.c +2 −9
  737. drivers/gpu/drm/mediatek/Makefile +2 −1
  738. drivers/gpu/drm/mediatek/mtk_disp_aal.c +169 −0
  739. drivers/gpu/drm/mediatek/mtk_disp_drv.h +9 −0
  740. drivers/gpu/drm/mediatek/mtk_disp_rdma.c +3 −3
  741. drivers/gpu/drm/mediatek/mtk_dpi.c +1 −3
  742. drivers/gpu/drm/mediatek/mtk_drm_crtc.c +141 −32
  743. drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4 −40
  744. drivers/gpu/drm/mediatek/mtk_drm_drv.c +46 −19
  745. drivers/gpu/drm/mediatek/mtk_drm_drv.h +1 −0
  746. drivers/gpu/drm/mediatek/mtk_drm_gem.c +12 −32
  747. drivers/gpu/drm/mediatek/mtk_drm_gem.h +0 −3
  748. drivers/gpu/drm/mediatek/mtk_drm_plane.c +0 −1
  749. drivers/gpu/drm/mediatek/mtk_dsi.c +2 −2
  750. drivers/gpu/drm/mediatek/mtk_hdmi.c +1 −4
  751. drivers/gpu/drm/meson/meson_drv.c +4 −8
  752. drivers/gpu/drm/meson/meson_overlay.c +0 −1
  753. drivers/gpu/drm/meson/meson_plane.c +0 −1
  754. drivers/gpu/drm/mga/mga_dma.c +1 −1
  755. drivers/gpu/drm/mga/mga_drv.h +0 −1
  756. drivers/gpu/drm/mgag200/Makefile +1 −1
  757. drivers/gpu/drm/mgag200/mgag200_drv.c +31 −33
  758. drivers/gpu/drm/mgag200/mgag200_drv.h +62 −15
  759. drivers/gpu/drm/mgag200/mgag200_mode.c +78 −719
  760. drivers/gpu/drm/mgag200/mgag200_pll.c +992 −0
  761. drivers/gpu/drm/mgag200/mgag200_reg.h +4 −5
  762. drivers/gpu/drm/msm/Kconfig +4 −3
  763. drivers/gpu/drm/msm/Makefile +1 −0
  764. drivers/gpu/drm/msm/adreno/a5xx_debugfs.c +2 −2
  765. drivers/gpu/drm/msm/adreno/a5xx_gpu.c +27 −8
  766. drivers/gpu/drm/msm/adreno/a5xx_power.c +1 −1
  767. drivers/gpu/drm/msm/adreno/a5xx_preempt.c +3 −4
  768. drivers/gpu/drm/msm/adreno/a6xx_gmu.c +14 −10
  769. drivers/gpu/drm/msm/adreno/a6xx_gmu.h +1 −0
  770. drivers/gpu/drm/msm/adreno/a6xx_gpu.c +86 −51
  771. drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +2 −2
  772. drivers/gpu/drm/msm/adreno/a6xx_hfi.c +33 −1
  773. drivers/gpu/drm/msm/adreno/adreno_device.c +34 −6
  774. drivers/gpu/drm/msm/adreno/adreno_gpu.c +3 −3
  775. drivers/gpu/drm/msm/adreno/adreno_gpu.h +19 −3
  776. drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +30 −13
  777. drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +5 −7
  778. drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +5 −0
  779. drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +6 −4
  780. drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +57 −45
  781. drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +7 −3
  782. drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +41 −44
  783. drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c +1 −1
  784. drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +3 −8
  785. drivers/gpu/drm/msm/disp/msm_disp_snapshot.h +0 −1
  786. drivers/gpu/drm/msm/dp/dp_aux.c +3 −0
  787. drivers/gpu/drm/msm/dp/dp_catalog.c +6 −2
  788. drivers/gpu/drm/msm/dp/dp_ctrl.c +89 −50
  789. drivers/gpu/drm/msm/dp/dp_display.c +44 −32
  790. drivers/gpu/drm/msm/dp/dp_link.c +18 −32
  791. drivers/gpu/drm/msm/dp/dp_panel.c +7 −2
  792. drivers/gpu/drm/msm/dp/dp_power.c +3 −0
  793. drivers/gpu/drm/msm/dsi/dsi.c +10 −5
  794. drivers/gpu/drm/msm/dsi/dsi.h +10 −8
  795. drivers/gpu/drm/msm/dsi/dsi.xml.h +74 −0
  796. drivers/gpu/drm/msm/dsi/dsi_cfg.c +24 −9
  797. drivers/gpu/drm/msm/dsi/dsi_cfg.h +2 −1
  798. drivers/gpu/drm/msm/dsi/dsi_host.c +122 −47
  799. drivers/gpu/drm/msm/dsi/dsi_manager.c +74 −72
  800. drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +69 −14
  801. drivers/gpu/drm/msm/dsi/phy/dsi_phy.h +5 −0
  802. drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +1 −1
  803. drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c +4 −4
  804. drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +146 −44
  805. drivers/gpu/drm/msm/msm_drv.c +99 −59
  806. drivers/gpu/drm/msm/msm_drv.h +15 −3
  807. drivers/gpu/drm/msm/msm_fbdev.c +3 −11
  808. drivers/gpu/drm/msm/msm_fence.c +9 −44
  809. drivers/gpu/drm/msm/msm_fence.h +37 −7
  810. drivers/gpu/drm/msm/msm_gem.c +22 −112
  811. drivers/gpu/drm/msm/msm_gem.h +28 −22
  812. drivers/gpu/drm/msm/msm_gem_prime.c +0 −11
  813. drivers/gpu/drm/msm/msm_gem_submit.c +210 −140
  814. drivers/gpu/drm/msm/msm_gpu.c +50 −170
  815. drivers/gpu/drm/msm/msm_gpu.h +132 −7
  816. drivers/gpu/drm/msm/msm_gpu_devfreq.c +203 −0
  817. drivers/gpu/drm/msm/msm_kms.h +1 −4
  818. drivers/gpu/drm/msm/msm_rd.c +5 −1
  819. drivers/gpu/drm/msm/msm_ringbuffer.c +66 −3
  820. drivers/gpu/drm/msm/msm_ringbuffer.h +12 −0
  821. drivers/gpu/drm/msm/msm_submitqueue.c +40 −13
  822. drivers/gpu/drm/mxsfb/mxsfb_drv.c +53 −31
  823. drivers/gpu/drm/mxsfb/mxsfb_drv.h +3 −0
  824. drivers/gpu/drm/mxsfb/mxsfb_kms.c +64 −10
  825. drivers/gpu/drm/mxsfb/mxsfb_regs.h +9 −0
  826. drivers/gpu/drm/nouveau/dispnv50/disp.c +33 −1
  827. drivers/gpu/drm/nouveau/nouveau_backlight.c +149 −17
  828. drivers/gpu/drm/nouveau/nouveau_connector.h +8 −1
  829. drivers/gpu/drm/nouveau/nouveau_drm.c +1 −4
  830. drivers/gpu/drm/nouveau/nouveau_encoder.h +1 −0
  831. drivers/gpu/drm/nouveau/nouveau_fence.c +1 −1
  832. drivers/gpu/drm/nouveau/nouveau_vga.c +4 −4
  833. drivers/gpu/drm/omapdrm/omap_drv.c +1 −5
  834. drivers/gpu/drm/omapdrm/omap_drv.h +2 −0
  835. drivers/gpu/drm/omapdrm/omap_irq.c +3 −10
  836. drivers/gpu/drm/omapdrm/omap_plane.c +3 −0
  837. drivers/gpu/drm/panel/Kconfig +54 −0
  838. drivers/gpu/drm/panel/Makefile +5 −0
  839. drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c +1 −1
  840. drivers/gpu/drm/panel/panel-dsi-cm.c +1 −1
  841. drivers/gpu/drm/panel/panel-elida-kd35t133.c +1 −1
  842. drivers/gpu/drm/panel/panel-ilitek-ili9341.c +792 −0
  843. drivers/gpu/drm/panel/panel-innolux-ej030na.c +289 −0
  844. drivers/gpu/drm/panel/panel-khadas-ts050.c +1 −1
  845. drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +1 −1
  846. drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c +1 −1
  847. drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c +1 −1
  848. drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +366 −0
  849. drivers/gpu/drm/panel/panel-samsung-db7430.c +347 −0
  850. drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c +1 −1
  851. drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c +6 −4
  852. drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +31 −52
  853. drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +9 −32
  854. drivers/gpu/drm/panel/panel-samsung-s6e63m0.h +30 −3
  855. drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c +2 −2
  856. drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +1 −1
  857. drivers/gpu/drm/panel/panel-simple.c +343 −14
  858. drivers/gpu/drm/panel/panel-sony-acx424akp.c +26 −56
  859. drivers/gpu/drm/panel/panel-widechips-ws2401.c +441 −0
  860. drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c +1 −1
  861. drivers/gpu/drm/panfrost/panfrost_devfreq.c +2 −1
  862. drivers/gpu/drm/panfrost/panfrost_device.c +94 −48
  863. drivers/gpu/drm/panfrost/panfrost_device.h +94 −5
  864. drivers/gpu/drm/panfrost/panfrost_drv.c +27 −64
  865. drivers/gpu/drm/panfrost/panfrost_gem.c +9 −11
  866. drivers/gpu/drm/panfrost/panfrost_gpu.c +1 −1
  867. drivers/gpu/drm/panfrost/panfrost_job.c +472 −223
  868. drivers/gpu/drm/panfrost/panfrost_job.h +3 −5
  869. drivers/gpu/drm/panfrost/panfrost_mmu.c +145 −58
  870. drivers/gpu/drm/panfrost/panfrost_mmu.h +3 −2
  871. drivers/gpu/drm/panfrost/panfrost_regs.h +0 −3
  872. drivers/gpu/drm/pl111/pl111_display.c +0 −2
  873. drivers/gpu/drm/pl111/pl111_drv.c +0 −1
  874. drivers/gpu/drm/qxl/qxl_drv.c +1 −3
  875. drivers/gpu/drm/qxl/qxl_drv.h +0 −3
  876. drivers/gpu/drm/qxl/qxl_irq.c +5 −4
  877. drivers/gpu/drm/qxl/qxl_prime.c +0 −6
  878. drivers/gpu/drm/r128/r128_cce.c +1 −2
  879. drivers/gpu/drm/radeon/atombios.h +2 −2
  880. drivers/gpu/drm/radeon/evergreen.c +7 −1
  881. drivers/gpu/drm/radeon/r100.c +9 −0
  882. drivers/gpu/drm/radeon/r300_reg.h +1 −1
  883. drivers/gpu/drm/radeon/radeon_device.c +10 −9
  884. drivers/gpu/drm/radeon/radeon_drv.c +1 −5
  885. drivers/gpu/drm/radeon/radeon_fb.c +3 −5
  886. drivers/gpu/drm/radeon/radeon_fence.c +2 −2
  887. drivers/gpu/drm/radeon/radeon_irq_kms.c +45 −15
  888. drivers/gpu/drm/radeon/radeon_kms.h +0 −4
  889. drivers/gpu/drm/radeon/radeon_vm.c +1 −1
  890. drivers/gpu/drm/radeon/rs600.c +7 −1
  891. drivers/gpu/drm/radeon/rv770.c +7 −1
  892. drivers/gpu/drm/rcar-du/rcar_du_drv.c +9 −4
  893. drivers/gpu/drm/rcar-du/rcar_du_encoder.c +21 −5
  894. drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c +1 −0
  895. drivers/gpu/drm/rcar-du/rcar_lvds.c +14 −112
  896. drivers/gpu/drm/rockchip/Kconfig +2 −0
  897. drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +349 −0
  898. drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 −7
  899. drivers/gpu/drm/rockchip/rockchip_drm_vop.c +0 −1
  900. drivers/gpu/drm/rockchip/rockchip_lvds.c +1 −4
  901. drivers/gpu/drm/rockchip/rockchip_rgb.c +1 −4
  902. drivers/gpu/drm/scheduler/sched_main.c +13 −8
  903. drivers/gpu/drm/selftests/test-drm_damage_helper.c +71 −216
  904. drivers/gpu/drm/shmobile/shmob_drm_drv.c +9 −5
  905. drivers/gpu/drm/shmobile/shmob_drm_drv.h +1 −0
  906. drivers/gpu/drm/sti/sti_compositor.c +0 −2
  907. drivers/gpu/drm/sti/sti_dvo.c +1 −3
  908. drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +13 −4
  909. drivers/gpu/drm/stm/ltdc.c +5 −7
  910. drivers/gpu/drm/sun4i/sun4i_drv.c +1 −3
  911. drivers/gpu/drm/sun4i/sun4i_layer.c +0 −1
  912. drivers/gpu/drm/sun4i/sun4i_lvds.c +1 −3
  913. drivers/gpu/drm/sun4i/sun4i_rgb.c +1 −3
  914. drivers/gpu/drm/sun4i/sun8i_ui_layer.c +0 −1
  915. drivers/gpu/drm/sun4i/sun8i_vi_layer.c +0 −1
  916. drivers/gpu/drm/tegra/Kconfig +1 −0
  917. drivers/gpu/drm/tegra/Makefile +3 −0
  918. drivers/gpu/drm/tegra/dc.c +356 −2
  919. drivers/gpu/drm/tegra/dc.h +17 −0
  920. drivers/gpu/drm/tegra/drm.c +63 −44
  921. drivers/gpu/drm/tegra/drm.h +12 −0
  922. drivers/gpu/drm/tegra/firewall.c +254 −0
  923. drivers/gpu/drm/tegra/gem.c +13 −0
  924. drivers/gpu/drm/tegra/gem.h +2 −0
  925. drivers/gpu/drm/tegra/plane.c +117 −0
  926. drivers/gpu/drm/tegra/plane.h +16 −0
  927. drivers/gpu/drm/tegra/rgb.c +1 −4
  928. drivers/gpu/drm/tegra/submit.c +625 −0
  929. drivers/gpu/drm/tegra/submit.h +21 −0
  930. drivers/gpu/drm/tegra/uapi.c +338 −0
  931. drivers/gpu/drm/tegra/uapi.h +58 −0
  932. drivers/gpu/drm/tegra/vic.c +51 −61
  933. drivers/gpu/drm/tidss/tidss_drv.c +5 −10
  934. drivers/gpu/drm/tidss/tidss_drv.h +2 −0
  935. drivers/gpu/drm/tidss/tidss_irq.c +24 −6
  936. drivers/gpu/drm/tidss/tidss_irq.h +1 −3
  937. drivers/gpu/drm/tidss/tidss_kms.c +1 −3
  938. drivers/gpu/drm/tidss/tidss_plane.c +0 −1
  939. drivers/gpu/drm/tilcdc/tilcdc_drv.c +40 −11
  940. drivers/gpu/drm/tilcdc/tilcdc_drv.h +3 −0
  941. drivers/gpu/drm/tilcdc/tilcdc_external.c +1 −3
  942. drivers/gpu/drm/tiny/Kconfig +15 −2
  943. drivers/gpu/drm/tiny/Makefile +1 −0
  944. drivers/gpu/drm/tiny/bochs.c +733 −0
  945. drivers/gpu/drm/tiny/cirrus.c +3 −3
  946. drivers/gpu/drm/tiny/gm12u320.c +7 −16
  947. drivers/gpu/drm/tiny/hx8357d.c +0 −1
  948. drivers/gpu/drm/tiny/ili9225.c +0 −1
  949. drivers/gpu/drm/tiny/ili9341.c +0 −1
  950. drivers/gpu/drm/tiny/ili9486.c +0 −1
  951. drivers/gpu/drm/tiny/mi0283qt.c +0 −1
  952. drivers/gpu/drm/tiny/repaper.c +4 −15
  953. drivers/gpu/drm/tiny/simpledrm.c +2 −2
  954. drivers/gpu/drm/tiny/st7586.c +6 −13
  955. drivers/gpu/drm/tiny/st7735r.c +0 −1
  956. drivers/gpu/drm/ttm/ttm_bo.c +37 −29
  957. drivers/gpu/drm/tve200/tve200_display.c +0 −1
  958. drivers/gpu/drm/udl/udl_modeset.c +10 −23
  959. drivers/gpu/drm/v3d/Makefile +1 −0
  960. drivers/gpu/drm/v3d/v3d_drv.c +8 −0
  961. drivers/gpu/drm/v3d/v3d_drv.h +63 −0
  962. drivers/gpu/drm/v3d/v3d_gem.c +31 −0
  963. drivers/gpu/drm/v3d/v3d_perfmon.c +213 −0
  964. drivers/gpu/drm/v3d/v3d_regs.h +2 −0
  965. drivers/gpu/drm/v3d/v3d_sched.c +21 −5
  966. drivers/gpu/drm/vboxvideo/vbox_drv.c +1 −2
  967. drivers/gpu/drm/vboxvideo/vbox_drv.h +0 −1
  968. drivers/gpu/drm/vboxvideo/vbox_irq.c +11 −5
  969. drivers/gpu/drm/vboxvideo/vbox_mode.c +2 −3
  970. drivers/gpu/drm/vc4/Kconfig +1 −0
  971. drivers/gpu/drm/vc4/vc4_drv.c +1 −5
  972. drivers/gpu/drm/vc4/vc4_drv.h +5 −3
  973. drivers/gpu/drm/vc4/vc4_dsi.c +1 −3
  974. drivers/gpu/drm/vc4/vc4_hdmi.c +232 −218
  975. drivers/gpu/drm/vc4/vc4_hdmi.h +1 −4
  976. drivers/gpu/drm/vc4/vc4_irq.c +38 −10
  977. drivers/gpu/drm/vc4/vc4_kms.c +0 −1
  978. drivers/gpu/drm/vc4/vc4_regs.h +30 −0
  979. drivers/gpu/drm/vc4/vc4_v3d.c +10 −7
  980. drivers/gpu/drm/via/via_mm.c +1 −2
  981. drivers/gpu/drm/virtio/virtgpu_drv.c +1 −1
  982. drivers/gpu/drm/virtio/virtgpu_drv.h +3 −1
  983. drivers/gpu/drm/virtio/virtgpu_plane.c +51 −13
  984. drivers/gpu/drm/virtio/virtgpu_prime.c +2 −0
  985. drivers/gpu/drm/virtio/virtgpu_vq.c +5 −2
  986. drivers/gpu/drm/vkms/vkms_composer.c +13 −15
  987. drivers/gpu/drm/vkms/vkms_drv.c +29 −3
  988. drivers/gpu/drm/vkms/vkms_drv.h +10 −3
  989. drivers/gpu/drm/vkms/vkms_plane.c +12 −45
  990. drivers/gpu/drm/vkms/vkms_writeback.c +16 −12
  991. drivers/gpu/drm/vmwgfx/Kconfig +8 −0
  992. drivers/gpu/drm/vmwgfx/Makefile +1 −1
  993. drivers/gpu/drm/vmwgfx/device_include/includeCheck.h +0 −3
  994. drivers/gpu/drm/vmwgfx/device_include/svga3d_caps.h +0 −111
  995. drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h +1459 −2221
  996. drivers/gpu/drm/vmwgfx/device_include/svga3d_devcaps.h +327 −466
  997. drivers/gpu/drm/vmwgfx/device_include/svga3d_dx.h +1580 −1923
  998. drivers/gpu/drm/vmwgfx/device_include/svga3d_limits.h +28 −73
  999. drivers/gpu/drm/vmwgfx/device_include/svga3d_reg.h +5 −10
  1000. drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h +1513 −1619
  1001. drivers/gpu/drm/vmwgfx/device_include/svga3d_types.h +1288 −1732
  1002. drivers/gpu/drm/vmwgfx/device_include/svga_escape.h +17 −51
  1003. drivers/gpu/drm/vmwgfx/device_include/svga_overlay.h +60 −143
  1004. drivers/gpu/drm/vmwgfx/device_include/svga_reg.h +720 −2127
  1005. drivers/gpu/drm/vmwgfx/device_include/svga_types.h +0 −51
  1006. drivers/gpu/drm/vmwgfx/device_include/vm_basic_types.h +127 −3
  1007. drivers/gpu/drm/vmwgfx/device_include/vmware_pack_begin.h +0 −2
  1008. drivers/gpu/drm/vmwgfx/device_include/vmware_pack_end.h +0 −2
  1009. drivers/gpu/drm/vmwgfx/ttm_memory.c +2 −0
  1010. drivers/gpu/drm/vmwgfx/vmw_surface_cache.h +539 −0
  1011. drivers/gpu/drm/vmwgfx/vmwgfx_binding.c +10 −14
  1012. drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +2 −3
  1013. drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c +4 −5
  1014. drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +5 −5
  1015. drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c +4 −3
  1016. drivers/gpu/drm/vmwgfx/vmwgfx_context.c +2 −2
  1017. drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +1 −2
  1018. drivers/gpu/drm/vmwgfx/vmwgfx_devcaps.c +142 −0
  1019. drivers/gpu/drm/vmwgfx/vmwgfx_devcaps.h +50 −0
  1020. drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +256 −201
  1021. drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +37 −13
  1022. drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +14 −3
  1023. drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +34 −2
  1024. drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +12 −99
  1025. drivers/gpu/drm/vmwgfx/vmwgfx_irq.c +5 −19
  1026. drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +14 −4
  1027. drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +1 −4
  1028. drivers/gpu/drm/vmwgfx/vmwgfx_mksstat.h +144 −0
  1029. drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +23 −22
  1030. drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +577 −2
  1031. drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +7 −4
  1032. drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +0 −4
  1033. drivers/gpu/drm/vmwgfx/vmwgfx_shader.c +1 −2
  1034. drivers/gpu/drm/vmwgfx/vmwgfx_so.c +2 −1
  1035. drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +3 −4
  1036. drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +42 −42
  1037. drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0 −35
  1038. drivers/gpu/drm/vmwgfx/vmwgfx_validation.c +2 −2
  1039. drivers/gpu/drm/xen/xen_drm_front_kms.c +0 −1
  1040. drivers/gpu/drm/xlnx/Kconfig +2 −0
  1041. drivers/gpu/drm/xlnx/zynqmp_disp.c +159 −161
  1042. drivers/gpu/drm/xlnx/zynqmp_dp.c +12 −10
  1043. drivers/gpu/drm/xlnx/zynqmp_dpsub.c +0 −2
  1044. drivers/gpu/drm/zte/zx_drm_drv.c +0 −6
  1045. drivers/gpu/host1x/Makefile +1 −0
  1046. drivers/gpu/host1x/cdma.c +52 −6
  1047. drivers/gpu/host1x/fence.c +168 −0
  1048. drivers/gpu/host1x/fence.h +13 −0
  1049. drivers/gpu/host1x/hw/channel_hw.c +66 −21
  1050. drivers/gpu/host1x/hw/debug_hw.c +17 −15
  1051. drivers/gpu/host1x/hw/debug_hw_1x01.c +6 −2
  1052. drivers/gpu/host1x/hw/debug_hw_1x06.c +15 −1
  1053. drivers/gpu/host1x/hw/hw_host1x02_uclass.h +12 −0
  1054. drivers/gpu/host1x/hw/hw_host1x04_uclass.h +12 −0
  1055. drivers/gpu/host1x/hw/hw_host1x05_uclass.h +12 −0
  1056. drivers/gpu/host1x/hw/hw_host1x06_uclass.h +12 −0
  1057. drivers/gpu/host1x/hw/hw_host1x07_uclass.h +12 −0
  1058. drivers/gpu/host1x/intr.c +9 −0
  1059. drivers/gpu/host1x/intr.h +2 −0
  1060. drivers/gpu/host1x/job.c +71 −27
  1061. drivers/gpu/host1x/job.h +16 −0
  1062. drivers/gpu/host1x/syncpt.c +2 −0
  1063. drivers/gpu/host1x/syncpt.h +12 −0
  1064. drivers/gpu/vga/vgaarb.c +23 −44
  1065. drivers/vfio/pci/vfio_pci.c +5 −6
  1066. drivers/video/fbdev/arcfb.c +1 −1
  1067. drivers/video/fbdev/asiliantfb.c +3 −0
  1068. drivers/video/fbdev/core/fbmem.c +3 −3
  1069. drivers/video/fbdev/ep93xx-fb.c +2 −2
  1070. drivers/video/fbdev/kyro/fbdev.c +8 −0
  1071. drivers/video/fbdev/neofb.c +1 −1
  1072. drivers/video/fbdev/omap2/omapfb/dss/apply.c +1 −3
  1073. drivers/video/fbdev/riva/fbdev.c +3 −0
  1074. drivers/video/fbdev/ssd1307fb.c +104 −47
  1075. include/drm/amd_asic_type.h +9 −8
  1076. include/drm/bridge/dw_hdmi.h +2 −0
  1077. include/drm/drm_aperture.h +9 −5
  1078. include/drm/drm_auth.h +57 −11
  1079. include/drm/drm_bridge.h +23 −3
  1080. include/drm/drm_connector.h +10 −0
  1081. include/drm/drm_damage_helper.h +0 −18
  1082. include/drm/drm_device.h +4 −14
  1083. include/drm/drm_dp_aux_bus.h +57 −0
  1084. include/drm/drm_dp_helper.h +142 −33
  1085. include/drm/drm_drv.h +4 −40
  1086. include/drm/drm_edid.h +1 −1
  1087. include/drm/drm_file.h +19 −3
  1088. include/drm/drm_fourcc.h +9 −4
  1089. include/drm/drm_framebuffer.h +4 −4
  1090. include/drm/drm_gem.h +0 −2
  1091. include/drm/drm_gem_atomic_helper.h +16 −1
  1092. include/drm/drm_gem_framebuffer_helper.h +13 −0
  1093. include/drm/drm_gem_vram_helper.h +12 −4
  1094. include/drm/drm_legacy.h +3 −0
  1095. include/drm/drm_mipi_dbi.h +6 −1
  1096. include/drm/drm_mipi_dsi.h +9 −4
  1097. include/drm/drm_modeset_helper_vtables.h +5 −2
  1098. include/drm/drm_panel.h +4 −4
  1099. include/drm/drm_plane.h +8 −31
  1100. include/drm/drm_print.h +1 −1
  1101. include/drm/drm_property.h +8 −1
  1102. include/drm/drm_rect.h +3 −0
  1103. include/drm/drm_simple_kms_helper.h +32 −2
  1104. include/drm/drm_vma_manager.h +1 −1
  1105. include/drm/gpu_scheduler.h +36 −1
  1106. include/drm/ttm/ttm_placement.h +5 −2
  1107. include/dt-bindings/phy/phy.h +2 −0
  1108. include/linux/dma-buf.h +143 −27
  1109. include/linux/dma-fence-chain.h +46 −6
  1110. include/linux/fb.h +2 −1
  1111. include/linux/host1x.h +24 −3
  1112. include/linux/lockdep.h +21 −20
  1113. include/linux/sysfb.h +16 −16
  1114. include/linux/vgaarb.h +42 −76
  1115. include/uapi/drm/drm.h +12 −2
  1116. include/uapi/drm/drm_fourcc.h +106 −3
  1117. include/uapi/drm/drm_mode.h +88 −4
  1118. include/uapi/drm/i915_drm.h +417 −81
  1119. include/uapi/drm/msm_drm.h +13 −1
  1120. include/uapi/drm/tegra_drm.h +402 −23
  1121. include/uapi/drm/v3d_drm.h +136 −0
  1122. include/uapi/drm/vmwgfx_drm.h +41 −0
  1123. include/uapi/linux/dma-buf.h +49 −1
  1124. include/uapi/linux/kfd_ioctl.h +9 −7
Documentation/ABI/testing/sysfs-kernel-dmabuf-buffers+24−0
@@ -0,0 +1,24 @@
1+What: /sys/kernel/dmabuf/buffers
2+Date: May 2021
3+KernelVersion: v5.13
4+Contact: Hridya Valsaraju <hridya@google.com>
5+Description: The /sys/kernel/dmabuf/buffers directory contains a
6+ snapshot of the internal state of every DMA-BUF.
7+ /sys/kernel/dmabuf/buffers/<inode_number> will contain the
8+ statistics for the DMA-BUF with the unique inode number
9+ <inode_number>
10+Users: kernel memory tuning/debugging tools
11+
12+What: /sys/kernel/dmabuf/buffers/<inode_number>/exporter_name
13+Date: May 2021
14+KernelVersion: v5.13
15+Contact: Hridya Valsaraju <hridya@google.com>
16+Description: This file is read-only and contains the name of the exporter of
17+ the DMA-BUF.
18+
19+What: /sys/kernel/dmabuf/buffers/<inode_number>/size
20+Date: May 2021
21+KernelVersion: v5.13
22+Contact: Hridya Valsaraju <hridya@google.com>
23+Description: This file is read-only and specifies the size of the DMA-BUF in
24+ bytes.
Documentation/devicetree/bindings/display/bridge/simple-bridge.yaml+3−0
@@ -22,6 +22,9 @@ properties: · 21 unmodified lines
2222 - ti,ths8134a
2323 - ti,ths8134b
2424 - const: ti,ths8134
25+ - items:
26+ - const: corpro,gm7123
27+ - const: adi,adv7123
2528 - enum:
2629 - adi,adv7123
2730 - dumb-vga-dac
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml+19−2
@@ -70,6 +70,9 @@ properties: · 69 unmodified lines
7070 const: 1
7171 description: See ../../pwm/pwm.yaml for description of the cell formats.
7272
73+ aux-bus:
74+ $ref: /schemas/display/dp-aux-bus.yaml#
75+
7376 ports:
7477 $ref: /schemas/graph.yaml#/properties/ports
7578
@@ -150,7 +153,6 @@ properties: · 74 unmodified lines
150153 required:
151154 - compatible
152155 - reg
153− - enable-gpios
154156 - vccio-supply
155157 - vpll-supply
156158 - vcca-supply
@@ -201,11 +203,26 @@ examples: · 44 unmodified lines
201203
202204 port@1 {
203205 reg = <1>;
204− endpoint {
206+ sn65dsi86_out: endpoint {
205207 remote-endpoint = <&panel_in_edp>;
206208 };
207209 };
208210 };
211+
212+ aux-bus {
213+ panel {
214+ compatible = "boe,nv133fhm-n62";
215+ power-supply = <&pp3300_dx_edp>;
216+ backlight = <&backlight>;
217+ hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>;
218+
219+ port {
220+ panel_in_edp: endpoint {
221+ remote-endpoint = <&sn65dsi86_out>;
222+ };
223+ };
224+ };
225+ };
209226 };
210227 };
211228 - |
Documentation/devicetree/bindings/display/dp-aux-bus.yaml+37−0
@@ -0,0 +1,37 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/dp-aux-bus.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: DisplayPort AUX bus
8+
9+maintainers:
10+ - Douglas Anderson <dianders@chromium.org>
11+
12+description:
13+ DisplayPort controllers provide a control channel to the sinks that
14+ are hooked up to them. This is the DP AUX bus. Over the DP AUX bus
15+ we can query properties about a sink and also configure it. In
16+ particular, DP sinks support DDC over DP AUX which allows tunneling
17+ a standard I2C DDC connection over the AUX channel.
18+
19+ To model this relationship, DP sinks should be placed as children
20+ of the DP controller under the "aux-bus" node.
21+
22+ At the moment, this binding only handles the eDP case. It is
23+ possible it will be extended in the future to handle the DP case.
24+ For DP, presumably a connector would be listed under the DP AUX
25+ bus instead of a panel.
26+
27+properties:
28+ $nodename:
29+ const: "aux-bus"
30+
31+ panel:
32+ $ref: panel/panel-common.yaml#
33+
34+additionalProperties: false
35+
36+required:
37+ - panel
Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt+1−1
@@ -7,7 +7,7 @@ channel output. · 6 unmodified lines
77
88 Required properties:
99 - compatible: "mediatek,<chip>-dsi"
10−- the supported chips are mt2701, mt7623, mt8173 and mt8183.
10+- the supported chips are mt2701, mt7623, mt8167, mt8173 and mt8183.
1111 - reg: Physical base address and length of the controller's registers
1212 - interrupts: The interrupt signal from the function block.
1313 - clocks: device clocks
Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml+17−0
@@ -64,6 +64,18 @@ properties: · 63 unmodified lines
6464 Indicates if the DSI controller is driving a panel which needs
6565 2 DSI links.
6666
67+ assigned-clocks:
68+ minItems: 2
69+ maxItems: 2
70+ description: |
71+ Parents of "byte" and "pixel" for the given platform.
72+
73+ assigned-clock-parents:
74+ minItems: 2
75+ maxItems: 2
76+ description: |
77+ The Byte clock and Pixel clock PLL outputs provided by a DSI PHY block.
78+
6779 power-domains:
6880 maxItems: 1
6981
@@ -119,6 +131,8 @@ required: · 49 unmodified lines
119131 - clock-names
120132 - phys
121133 - phy-names
134+ - assigned-clocks
135+ - assigned-clock-parents
122136 - power-domains
123137 - operating-points-v2
124138 - ports
@@ -159,6 +173,9 @@ examples: · 34 unmodified lines
159173 phys = <&dsi0_phy>;
160174 phy-names = "dsi";
161175
176+ assigned-clocks = <&dispcc DISP_CC_MDSS_BYTE0_CLK_SRC>, <&dispcc DISP_CC_MDSS_PCLK0_CLK_SRC>;
177+ assigned-clock-parents = <&dsi_phy 0>, <&dsi_phy 1>;
178+
162179 power-domains = <&rpmhpd SC7180_CX>;
163180 operating-points-v2 = <&dsi_opp_table>;
164181
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml+72−0
@@ -0,0 +1,72 @@
1+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/msm/dsi-phy-7nm.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Qualcomm Display DSI 7nm PHY
8+
9+maintainers:
10+ - Jonathan Marek <jonathan@marek.ca>
11+
12+allOf:
13+ - $ref: dsi-phy-common.yaml#
14+
15+properties:
16+ compatible:
17+ oneOf:
18+ - const: qcom,dsi-phy-7nm
19+ - const: qcom,dsi-phy-7nm-8150
20+ - const: qcom,sc7280-dsi-phy-7nm
21+
22+ reg:
23+ items:
24+ - description: dsi phy register set
25+ - description: dsi phy lane register set
26+ - description: dsi pll register set
27+
28+ reg-names:
29+ items:
30+ - const: dsi_phy
31+ - const: dsi_phy_lane
32+ - const: dsi_pll
33+
34+ vdds-supply:
35+ description: |
36+ Connected to VDD_A_DSI_PLL_0P9 pin (or VDDA_DSI{0,1}_PLL_0P9 for sm8150)
37+
38+ phy-type:
39+ description: D-PHY (default) or C-PHY mode
40+ enum: [ 10, 11 ]
41+ default: 10
42+
43+required:
44+ - compatible
45+ - reg
46+ - reg-names
47+ - vdds-supply
48+
49+unevaluatedProperties: false
50+
51+examples:
52+ - |
53+ #include <dt-bindings/clock/qcom,dispcc-sm8250.h>
54+ #include <dt-bindings/clock/qcom,rpmh.h>
55+
56+ dsi-phy@ae94400 {
57+ compatible = "qcom,dsi-phy-7nm";
58+ reg = <0x0ae94400 0x200>,
59+ <0x0ae94600 0x280>,
60+ <0x0ae94900 0x260>;
61+ reg-names = "dsi_phy",
62+ "dsi_phy_lane",
63+ "dsi_pll";
64+
65+ #clock-cells = <1>;
66+ #phy-cells = <0>;
67+
68+ vdds-supply = <&vreg_l5a_0p88>;
69+ clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>,
70+ <&rpmhcc RPMH_CXO_CLK>;
71+ clock-names = "iface", "ref";
72+ };
Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml+78−0
@@ -0,0 +1,78 @@
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/ilitek,ili9341.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Ilitek-9341 Display Panel
8+
9+maintainers:
10+ - Dillon Min <dillon.minfei@gmail.com>
11+
12+description: |
13+ Ilitek ILI9341 TFT panel driver with SPI control bus
14+ This is a driver for 320x240 TFT panels, accepting a rgb input
15+ streams with 16 bits or 18 bits.
16+
17+allOf:
18+ - $ref: panel-common.yaml#
19+
20+properties:
21+ compatible:
22+ items:
23+ - enum:
24+ # ili9341 240*320 Color on stm32f429-disco board
25+ - st,sf-tc240t-9370-t
26+ - const: ilitek,ili9341
27+
28+ reg: true
29+
30+ dc-gpios:
31+ maxItems: 1
32+ description: Display data/command selection (D/CX) of this DBI panel
33+
34+ spi-3wire: true
35+
36+ spi-max-frequency:
37+ const: 10000000
38+
39+ port: true
40+
41+ vci-supply:
42+ description: Analog voltage supply (2.5 .. 3.3V)
43+
44+ vddi-supply:
45+ description: Voltage supply for interface logic (1.65 .. 3.3 V)
46+
47+ vddi-led-supply:
48+ description: Voltage supply for the LED driver (1.65 .. 3.3 V)
49+
50+additionalProperties: false
51+
52+required:
53+ - compatible
54+ - reg
55+ - dc-gpios
56+ - port
57+
58+examples:
59+ - |+
60+ spi {
61+ #address-cells = <1>;
62+ #size-cells = <0>;
63+ panel: display@0 {
64+ compatible = "st,sf-tc240t-9370-t",
65+ "ilitek,ili9341";
66+ reg = <0>;
67+ spi-3wire;
68+ spi-max-frequency = <10000000>;
69+ dc-gpios = <&gpiod 13 0>;
70+ port {
71+ panel_in: endpoint {
72+ remote-endpoint = <&display_out>;
73+ };
74+ };
75+ };
76+ };
77+...
78+
Documentation/devicetree/bindings/display/panel/innolux,ej030na.yaml+62−0
@@ -0,0 +1,62 @@
1+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/panel/innolux,ej030na.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Innolux EJ030NA 3.0" (320x480 pixels) 24-bit TFT LCD panel
8+
9+description: |
10+ The panel must obey the rules for a SPI slave device as specified in
11+ spi/spi-controller.yaml
12+
13+maintainers:
14+ - Paul Cercueil <paul@crapouillou.net>
15+
16+allOf:
17+ - $ref: panel-common.yaml#
18+
19+properties:
20+ compatible:
21+ const: innolux,ej030na
22+
23+ backlight: true
24+ port: true
25+ power-supply: true
26+ reg: true
27+ reset-gpios: true
28+
29+required:
30+ - compatible
31+ - reg
32+ - power-supply
33+ - reset-gpios
34+
35+unevaluatedProperties: false
36+
37+examples:
38+ - |
39+ #include <dt-bindings/gpio/gpio.h>
40+
41+ spi {
42+ #address-cells = <1>;
43+ #size-cells = <0>;
44+
45+ panel@0 {
46+ compatible = "innolux,ej030na";
47+ reg = <0>;
48+
49+ spi-max-frequency = <10000000>;
50+
51+ reset-gpios = <&gpe 4 GPIO_ACTIVE_LOW>;
52+ power-supply = <&lcd_power>;
53+
54+ backlight = <&backlight>;
55+
56+ port {
57+ panel_input: endpoint {
58+ remote-endpoint = <&panel_output>;
59+ };
60+ };
61+ };
62+ };
Documentation/devicetree/bindings/display/panel/panel-simple.yaml+24−0
@@ -46,9 +46,13 @@ properties: · 45 unmodified lines
4646 # AU Optronics Corporation 11.6" HD (1366x768) color TFT-LCD panel
4747 - auo,b116xw03
4848 # AU Optronics Corporation 13.3" FHD (1920x1080) color TFT-LCD panel
49+ - auo,b133han05
50+ # AU Optronics Corporation 13.3" FHD (1920x1080) color TFT-LCD panel
4951 - auo,b133htn01
5052 # AU Optronics Corporation 13.3" WXGA (1366x768) TFT LCD panel
5153 - auo,b133xtn01
54+ # AU Optronics Corporation 14.0" FHD (1920x1080) color TFT-LCD panel
55+ - auo,b140han06
5256 # AU Optronics Corporation 7.0" FHD (800 x 480) TFT LCD panel
5357 - auo,g070vvn01
5458 # AU Optronics Corporation 10.1" (1280x800) color TFT LCD panel
@@ -110,6 +114,9 @@ properties: · 55 unmodified lines
110114 # Emerging Display Technology Corp. 5.7" VGA TFT LCD panel
111115 - edt,et057090dhu
112116 - edt,et070080dh6
117+ # Emerging Display Technology Corp. 3.5" WVGA TFT LCD panel with
118+ # capacitive multitouch
119+ - edt,etm0350g0dh6
113120 # Emerging Display Technology Corp. 480x272 TFT Display with capacitive touch
114121 - edt,etm043080dh6gp
115122 # Emerging Display Technology Corp. 480x272 TFT Display
@@ -128,6 +135,11 @@ properties: · 12 unmodified lines
128135 # Emerging Display Technology Corp. WVGA TFT Display with capacitive touch
129136 - edt,etm0700g0dh6
130137 - edt,etm0700g0edh6
138+ # Emerging Display Technology Corp. 5.7" VGA TFT LCD panel with
139+ # capacitive touch
140+ - edt,etmv570g2dhu
141+ # E Ink VB3300-KCA
142+ - eink,vb3300-kca
131143 # Evervision Electronics Co. Ltd. VGG804821 5.0" WVGA TFT LCD Panel
132144 - evervision,vgg804821
133145 # Foxlink Group 5" WVGA TFT LCD panel
@@ -202,8 +214,14 @@ properties: · 68 unmodified lines
202214 - logictechno,lt161010-2nhr
203215 # Logic Technologies LT170410-2WHC 10.1" 1280x800 IPS TFT Cap Touch Mod.
204216 - logictechno,lt170410-2whc
217+ # Logic Technologies LTTD800x480 L2RT 7" 800x480 TFT Resistive Touch Module
218+ - logictechno,lttd800480070-l2rt
219+ # Logic Technologies LTTD800480070-L6WH-RT 7” 800x480 TFT Resistive Touch Module
220+ - logictechno,lttd800480070-l6wh-rt
205221 # Mitsubishi "AA070MC01 7.0" WVGA TFT LCD panel
206222 - mitsubishi,aa070mc01-ca1
223+ # Multi-Inno Technology Co.,Ltd MI1010AIT-1CP 10.1" 1280x800 LVDS IPS Cap Touch Mod.
224+ - multi-inno,mi1010ait-1cp
207225 # NEC LCD Technologies, Ltd. 12.1" WXGA (1280x800) LVDS TFT LCD panel
208226 - nec,nl12880bc20-05
209227 # NEC LCD Technologies,Ltd. WQVGA TFT LCD panel
@@ -238,10 +256,14 @@ properties: · 28 unmodified lines
238256 - powertip,ph800480t013-idf02
239257 # QiaoDian XianShi Corporation 4"3 TFT LCD panel
240258 - qiaodian,qd43003c0-40
259+ # Shenzhen QiShenglong Industrialist Co., Ltd. Gopher 2b 4.3" 480(RGB)x272 TFT LCD panel
260+ - qishenglong,gopher2b-lcd
241261 # Rocktech Displays Ltd. RK101II01D-CT 10.1" TFT 1280x800
242262 - rocktech,rk101ii01d-ct
243263 # Rocktech Display Ltd. RK070ER9427 800(RGB)x480 TFT LCD panel
244264 - rocktech,rk070er9427
265+ # Samsung 13.3" FHD (1920x1080 pixels) eDP AMOLED panel
266+ - samsung,atna33xc20
245267 # Samsung 12.2" (2560x1600 pixels) TFT LCD panel
246268 - samsung,lsn122dl01-c01
247269 # Samsung Electronics 10.1" WSVGA TFT LCD panel
@@ -298,6 +320,8 @@ properties: · 50 unmodified lines
298320 enable-gpios: true
299321 port: true
300322 power-supply: true
323+ no-hpd: true
324+ hpd-gpios: true
301325
302326 additionalProperties: false
303327
Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml+99−0
@@ -0,0 +1,99 @@
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/samsung,lms380kf01.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Samsung LMS380KF01 display panel
8+
9+description: The LMS380KF01 is a 480x800 DPI display panel from Samsung Mobile
10+ Displays (SMD) utilizing the WideChips WS2401 display controller. It can be
11+ used with internal or external backlight control.
12+ The panel must obey the rules for a SPI slave device as specified in
13+ spi/spi-controller.yaml
14+
15+maintainers:
16+ - Linus Walleij <linus.walleij@linaro.org>
17+
18+allOf:
19+ - $ref: panel-common.yaml#
20+
21+properties:
22+ compatible:
23+ const: samsung,lms380kf01
24+
25+ reg: true
26+
27+ interrupts:
28+ description: provides an optional ESD (electrostatic discharge)
29+ interrupt that signals abnormalities in the display hardware.
30+ This can also be raised for other reasons like erroneous
31+ configuration.
32+ maxItems: 1
33+
34+ reset-gpios: true
35+
36+ vci-supply:
37+ description: regulator that supplies the VCI analog voltage
38+ usually around 3.0 V
39+
40+ vccio-supply:
41+ description: regulator that supplies the VCCIO voltage usually
42+ around 1.8 V
43+
44+ backlight: true
45+
46+ spi-cpha: true
47+
48+ spi-cpol: true
49+
50+ spi-max-frequency:
51+ maximum: 1200000
52+
53+ port: true
54+
55+required:
56+ - compatible
57+ - reg
58+ - spi-cpha
59+ - spi-cpol
60+ - port
61+
62+additionalProperties: false
63+
64+examples:
65+ - |
66+ #include <dt-bindings/gpio/gpio.h>
67+ #include <dt-bindings/interrupt-controller/irq.h>
68+
69+ spi {
70+ compatible = "spi-gpio";
71+ sck-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
72+ miso-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
73+ mosi-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
74+ cs-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
75+ num-chipselects = <1>;
76+ #address-cells = <1>;
77+ #size-cells = <0>;
78+
79+ panel@0 {
80+ compatible = "samsung,lms380kf01";
81+ spi-max-frequency = <1200000>;
82+ spi-cpha;
83+ spi-cpol;
84+ reg = <0>;
85+ vci-supply = <&lcd_3v0_reg>;
86+ vccio-supply = <&lcd_1v8_reg>;
87+ reset-gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
88+ interrupt-parent = <&gpio>;
89+ interrupts = <5 IRQ_TYPE_EDGE_RISING>;
90+
91+ port {
92+ panel_in: endpoint {
93+ remote-endpoint = <&display_out>;
94+ };
95+ };
96+ };
97+ };
98+
99+...
Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml+16−2
@@ -33,8 +33,11 @@ properties: · 32 unmodified lines
3333
3434 backlight: true
3535
36+ spi-cpha: true
37+
38+ spi-cpol: true
39+
3640 spi-max-frequency:
37− $ref: /schemas/types.yaml#/definitions/uint32
3841 description: inherited as a SPI client node, the datasheet specifies
3942 maximum 300 ns minimum cycle which gives around 3 MHz max frequency
4043 maximum: 3000000
@@ -44,6 +47,9 @@ properties: · 3 unmodified lines
4447 required:
4548 - compatible
4649 - reg
50+ - spi-cpha
51+ - spi-cpol
52+ - port
4753
4854 additionalProperties: false
4955
@@ -52,15 +58,23 @@ examples: · 2 unmodified lines
5258 #include <dt-bindings/gpio/gpio.h>
5359
5460 spi {
61+ compatible = "spi-gpio";
62+ sck-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
63+ miso-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
64+ mosi-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
65+ cs-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
66+ num-chipselects = <1>;
5567 #address-cells = <1>;
5668 #size-cells = <0>;
5769 panel@0 {
5870 compatible = "samsung,lms397kf04";
5971 spi-max-frequency = <3000000>;
72+ spi-cpha;
73+ spi-cpol;
6074 reg = <0>;
6175 vci-supply = <&lcd_3v0_reg>;
6276 vccio-supply = <&lcd_1v8_reg>;
63− reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
77+ reset-gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
6478 backlight = <&ktd259>;
6579
6680 port {
Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt+1−0
@@ -23,6 +23,7 @@ Required properties: · 22 unmodified lines
2323 Optional properties:
2424 - phys: from general PHY binding: the phandle for the PHY device.
2525 - phy-names: Should be "dphy" if phys references an external phy.
26+- #phy-cells: Defined when used as ISP phy, should be 0.
2627 - power-domains: a phandle to mipi dsi power domain node.
2728 - resets: list of phandle + reset specifier pairs, as described in [3].
2829 - reset-names: string reset name, must be "apb".
Documentation/devicetree/bindings/display/solomon,ssd1307fb.yaml+208−0
@@ -0,0 +1,208 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/solomon,ssd1307fb.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Solomon SSD1307 OLED Controller Framebuffer
8+
9+maintainers:
10+ - Maxime Ripard <mripard@kernel.org>
11+
12+properties:
13+ compatible:
14+ enum:
15+ - solomon,ssd1305fb-i2c
16+ - solomon,ssd1306fb-i2c
17+ - solomon,ssd1307fb-i2c
18+ - solomon,ssd1309fb-i2c
19+
20+ reg:
21+ maxItems: 1
22+
23+ pwms:
24+ maxItems: 1
25+
26+ reset-gpios:
27+ maxItems: 1
28+
29+ vbat-supply:
30+ description: The supply for VBAT
31+
32+ solomon,height:
33+ $ref: /schemas/types.yaml#/definitions/uint32
34+ default: 16
35+ description:
36+ Height in pixel of the screen driven by the controller
37+
38+ solomon,width:
39+ $ref: /schemas/types.yaml#/definitions/uint32
40+ default: 96
41+ description:
42+ Width in pixel of the screen driven by the controller
43+
44+ solomon,page-offset:
45+ $ref: /schemas/types.yaml#/definitions/uint32
46+ default: 1
47+ description:
48+ Offset of pages (band of 8 pixels) that the screen is mapped to
49+
50+ solomon,segment-no-remap:
51+ type: boolean
52+ description:
53+ Display needs normal (non-inverted) data column to segment mapping
54+
55+ solomon,col-offset:
56+ $ref: /schemas/types.yaml#/definitions/uint32
57+ default: 0
58+ description:
59+ Offset of columns (COL/SEG) that the screen is mapped to
60+
61+ solomon,com-seq:
62+ type: boolean
63+ description:
64+ Display uses sequential COM pin configuration
65+
66+ solomon,com-lrremap:
67+ type: boolean
68+ description:
69+ Display uses left-right COM pin remap
70+
71+ solomon,com-invdir:
72+ type: boolean
73+ description:
74+ Display uses inverted COM pin scan direction
75+
76+ solomon,com-offset:
77+ $ref: /schemas/types.yaml#/definitions/uint32
78+ default: 0
79+ description:
80+ Number of the COM pin wired to the first display line
81+
82+ solomon,prechargep1:
83+ $ref: /schemas/types.yaml#/definitions/uint32
84+ default: 2
85+ description:
86+ Length of deselect period (phase 1) in clock cycles
87+
88+ solomon,prechargep2:
89+ $ref: /schemas/types.yaml#/definitions/uint32
90+ default: 2
91+ description:
92+ Length of precharge period (phase 2) in clock cycles. This needs to be
93+ the higher, the higher the capacitance of the OLED's pixels is.
94+
95+ solomon,dclk-div:
96+ $ref: /schemas/types.yaml#/definitions/uint32
97+ minimum: 1
98+ maximum: 16
99+ description:
100+ Clock divisor. The default value is controller-dependent.
101+
102+ solomon,dclk-frq:
103+ $ref: /schemas/types.yaml#/definitions/uint32
104+ minimum: 0
105+ maximum: 15
106+ description:
107+ Clock frequency, higher value means higher frequency.
108+ The default value is controller-dependent.
109+
110+ solomon,lookup-table:
111+ $ref: /schemas/types.yaml#/definitions/uint8-array
112+ maxItems: 4
113+ description:
114+ 8 bit value array of current drive pulse widths for BANK0, and colors A,
115+ B, and C. Each value in range of 31 to 63 for pulse widths of 32 to 64.
116+ Color D is always width 64.
117+
118+ solomon,area-color-enable:
119+ type: boolean
120+ description:
121+ Display uses color mode
122+
123+ solomon,low-power:
124+ type: boolean
125+ description:
126+ Display runs in low power mode
127+
128+required:
129+ - compatible
130+ - reg
131+
132+allOf:
133+ - if:
134+ properties:
135+ compatible:
136+ contains:
137+ const: solomon,ssd1305fb-i2c
138+ then:
139+ properties:
140+ solomon,dclk-div:
141+ default: 1
142+ solomon,dclk-frq:
143+ default: 7
144+
145+ - if:
146+ properties:
147+ compatible:
148+ contains:
149+ const: solomon,ssd1306fb-i2c
150+ then:
151+ properties:
152+ solomon,dclk-div:
153+ default: 1
154+ solomon,dclk-frq:
155+ default: 8
156+
157+ - if:
158+ properties:
159+ compatible:
160+ contains:
161+ const: solomon,ssd1307fb-i2c
162+ then:
163+ properties:
164+ solomon,dclk-div:
165+ default: 2
166+ solomon,dclk-frq:
167+ default: 12
168+ required:
169+ - pwms
170+
171+ - if:
172+ properties:
173+ compatible:
174+ contains:
175+ const: solomon,ssd1309fb-i2c
176+ then:
177+ properties:
178+ solomon,dclk-div:
179+ default: 1
180+ solomon,dclk-frq:
181+ default: 10
182+
183+additionalProperties: false
184+
185+examples:
186+ - |
187+ i2c1 {
188+ #address-cells = <1>;
189+ #size-cells = <0>;
190+
191+ ssd1307: oled@3c {
192+ compatible = "solomon,ssd1307fb-i2c";
193+ reg = <0x3c>;
194+ pwms = <&pwm 4 3000>;
195+ reset-gpios = <&gpio2 7>;
196+ };
197+
198+ ssd1306: oled@3d {
199+ compatible = "solomon,ssd1306fb-i2c";
200+ reg = <0x3c>;
201+ pwms = <&pwm 4 3000>;
202+ reset-gpios = <&gpio2 7>;
203+ solomon,com-lrremap;
204+ solomon,com-invdir;
205+ solomon,com-offset = <32>;
206+ solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>;
207+ };
208+ };
Documentation/devicetree/bindings/display/ssd1307fb.txt+0−60
@@ -1,60 +0,0 @@
1−* Solomon SSD1307 Framebuffer Driver
2−
3−Required properties:
4− - compatible: Should be "solomon,<chip>fb-<bus>". The only supported bus for
5− now is i2c, and the supported chips are ssd1305, ssd1306, ssd1307 and
6− ssd1309.
7− - reg: Should contain address of the controller on the I2C bus. Most likely
8− 0x3c or 0x3d
9− - pwm: Should contain the pwm to use according to the OF device tree PWM
10− specification [0]. Only required for the ssd1307.
11− - solomon,height: Height in pixel of the screen driven by the controller
12− - solomon,width: Width in pixel of the screen driven by the controller
13− - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is
14− mapped to.
15−
16−Optional properties:
17− - reset-gpios: The GPIO used to reset the OLED display, if available. See
18− Documentation/devicetree/bindings/gpio/gpio.txt for details.
19− - vbat-supply: The supply for VBAT
20− - solomon,segment-no-remap: Display needs normal (non-inverted) data column
21− to segment mapping
22− - solomon,col-offset: Offset of columns (COL/SEG) that the screen is mapped to.
23− - solomon,com-seq: Display uses sequential COM pin configuration
24− - solomon,com-lrremap: Display uses left-right COM pin remap
25− - solomon,com-invdir: Display uses inverted COM pin scan direction
26− - solomon,com-offset: Number of the COM pin wired to the first display line
27− - solomon,prechargep1: Length of deselect period (phase 1) in clock cycles.
28− - solomon,prechargep2: Length of precharge period (phase 2) in clock cycles.
29− This needs to be the higher, the higher the capacitance
30− of the OLED's pixels is
31− - solomon,dclk-div: Clock divisor 1 to 16
32− - solomon,dclk-frq: Clock frequency 0 to 15, higher value means higher
33− frequency
34− - solomon,lookup-table: 8 bit value array of current drive pulse widths for
35− BANK0, and colors A, B, and C. Each value in range
36− of 31 to 63 for pulse widths of 32 to 64. Color D
37− is always width 64.
38− - solomon,area-color-enable: Display uses color mode
39− - solomon,low-power. Display runs in low power mode
40−
41−[0]: Documentation/devicetree/bindings/pwm/pwm.txt
42−
43−Examples:
44−ssd1307: oled@3c {
45− compatible = "solomon,ssd1307fb-i2c";
46− reg = <0x3c>;
47− pwms = <&pwm 4 3000>;
48− reset-gpios = <&gpio2 7>;
49−};
50−
51−ssd1306: oled@3c {
52− compatible = "solomon,ssd1306fb-i2c";
53− reg = <0x3c>;
54− pwms = <&pwm 4 3000>;
55− reset-gpios = <&gpio2 7>;
56− solomon,com-lrremap;
57− solomon,com-invdir;
58− solomon,com-offset = <32>;
59− solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>;
60−};
Documentation/devicetree/bindings/vendor-prefixes.yaml+4−0
@@ -341,6 +341,8 @@ patternProperties: · 340 unmodified lines
341341 description: eGalax_eMPIA Technology Inc
342342 "^einfochips,.*":
343343 description: Einfochips
344+ "^eink,.*":
345+ description: E Ink Corporation
344346 "^elan,.*":
345347 description: Elan Microelectronic Corp.
346348 "^element14,.*":
@@ -938,6 +940,8 @@ patternProperties: · 591 unmodified lines
938940 description: Chengdu Kaixuan Information Technology Co., Ltd.
939941 "^qiaodian,.*":
940942 description: QiaoDian XianShi Corporation
943+ "^qishenglong,.*":
944+ description: Shenzhen QiShenglong Industrialist Co., Ltd.
941945 "^qnap,.*":
942946 description: QNAP Systems, Inc.
943947 "^radxa,.*":
Documentation/driver-api/dma-buf.rst+13−0
@@ -88,6 +88,9 @@ consider though: · 87 unmodified lines
8888 - The DMA buffer FD is also pollable, see `Implicit Fence Poll Support`_ below for
8989 details.
9090
91+- The DMA buffer FD also supports a few dma-buf-specific ioctls, see
92+ `DMA Buffer ioctls`_ below for details.
93+
9194 Basic Operation and Device DMA Access
9295 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9396
@@ -106,6 +109,16 @@ Implicit Fence Poll Support · 12 unmodified lines
106109 .. kernel-doc:: drivers/dma-buf/dma-buf.c
107110 :doc: implicit fence polling
108111
112+DMA-BUF statistics
113+~~~~~~~~~~~~~~~~~~
114+.. kernel-doc:: drivers/dma-buf/dma-buf-sysfs-stats.c
115+ :doc: overview
116+
117+DMA Buffer ioctls
118+~~~~~~~~~~~~~~~~~
119+
120+.. kernel-doc:: include/uapi/linux/dma-buf.h
121+
109122 Kernel Functions and Structures Reference
110123 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111124
Documentation/driver-api/thermal/nouveau_thermal.rst+1−1
@@ -90,7 +90,7 @@ Bug reports · 89 unmodified lines
9090 -----------
9191
9292 Thermal management on Nouveau is new and may not work on all cards. If you have
93−inquiries, please ping mupuf on IRC (#nouveau, freenode).
93+inquiries, please ping mupuf on IRC (#nouveau, OFTC).
9494
9595 Bug reports should be filled on Freedesktop's bug tracker. Please follow
9696 https://nouveau.freedesktop.org/wiki/Bugs
Documentation/gpu/drm-kms.rst+33−2
@@ -159,6 +159,8 @@ KMS Core Structures and Functions · 158 unmodified lines
159159 .. kernel-doc:: drivers/gpu/drm/drm_mode_config.c
160160 :export:
161161
162+.. _kms_base_object_abstraction:
163+
162164 Modeset Base Object Abstraction
163165 ===============================
164166
@@ -463,6 +465,35 @@ KMS Properties · 298 unmodified lines
463465 This section of the documentation is primarily aimed at user-space developers.
464466 For the driver APIs, see the other sections.
465467
468+Requirements
469+------------
470+
471+KMS drivers might need to add extra properties to support new features. Each
472+new property introduced in a driver needs to meet a few requirements, in
473+addition to the one mentioned above:
474+
475+* It must be standardized, documenting:
476+
477+ * The full, exact, name string;
478+ * If the property is an enum, all the valid value name strings;
479+ * What values are accepted, and what these values mean;
480+ * What the property does and how it can be used;
481+ * How the property might interact with other, existing properties.
482+
483+* It must provide a generic helper in the core code to register that
484+ property on the object it attaches to.
485+
486+* Its content must be decoded by the core and provided in the object's
487+ associated state structure. That includes anything drivers might want
488+ to precompute, like struct drm_clip_rect for planes.
489+
490+* Its initial state must match the behavior prior to the property
491+ introduction. This might be a fixed value matching what the hardware
492+ does, or it may be inherited from the state the firmware left the
493+ system in during boot.
494+
495+* An IGT test must be submitted where reasonable.
496+
466497 Property Types and Blob Property Support
467498 ----------------------------------------
468499
@@ -508,8 +539,8 @@ Plane Composition Properties · 39 unmodified lines
508539 Damage Tracking Properties
509540 --------------------------
510541
511−.. kernel-doc:: drivers/gpu/drm/drm_damage_helper.c
512− :doc: overview
542+.. kernel-doc:: drivers/gpu/drm/drm_plane.c
543+ :doc: damage tracking
513544
514545 Color Management Properties
515546 ---------------------------
Documentation/gpu/drm-uapi.rst+22−0
@@ -37,6 +37,15 @@ Primary Nodes, DRM Master and Authentication · 36 unmodified lines
3737 .. kernel-doc:: include/drm/drm_auth.h
3838 :internal:
3939
40+
41+.. _drm_leasing:
42+
43+DRM Display Resource Leasing
44+============================
45+
46+.. kernel-doc:: drivers/gpu/drm/drm_lease.c
47+ :doc: drm leasing
48+
4049 Open-Source Userspace Requirements
4150 ==================================
4251
@@ -457,6 +466,19 @@ Userspace API Structures · 414 unmodified lines
457466 .. kernel-doc:: include/uapi/drm/drm_mode.h
458467 :doc: overview
459468
469+.. _crtc_index:
470+
471+CRTC index
472+----------
473+
474+CRTC's have both an object ID and an index, and they are not the same thing.
475+The index is used in cases where a densely packed identifier for a CRTC is
476+needed, for instance a bitmask of CRTC's. The member possible_crtcs of struct
477+drm_mode_get_plane is an example.
478+
479+DRM_IOCTL_MODE_GETRESOURCES populates a structure with an array of CRTC ID's,
480+and the CRTC index is its position in this array.
481+
460482 .. kernel-doc:: include/uapi/drm/drm.h
461483 :internal:
462484
Documentation/gpu/i915.rst+15−0
@@ -422,9 +422,16 @@ Batchbuffer Parsing · 421 unmodified lines
422422 User Batchbuffer Execution
423423 --------------------------
424424
425+.. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_context_types.h
426+
425427 .. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
426428 :doc: User command execution
427429
430+Scheduling
431+----------
432+.. kernel-doc:: drivers/gpu/drm/i915/i915_scheduler_types.h
433+ :functions: i915_sched_engine
434+
428435 Logical Rings, Logical Ring Contexts and Execlists
429436 --------------------------------------------------
430437
@@ -518,6 +525,14 @@ GuC-based command submission · 87 unmodified lines
518525 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
519526 :doc: GuC-based command submission
520527
528+GuC ABI
529+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
530+
531+.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
532+.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h
533+.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
534+.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
535+
521536 HuC
522537 ---
523538 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_huc.c
Documentation/gpu/rfc/i915_parallel_execbuf.h+122−0
@@ -0,0 +1,122 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#define I915_CONTEXT_ENGINES_EXT_PARALLEL_SUBMIT 2 /* see i915_context_engines_parallel_submit */
7+
8+/**
9+ * struct drm_i915_context_engines_parallel_submit - Configure engine for
10+ * parallel submission.
11+ *
12+ * Setup a slot in the context engine map to allow multiple BBs to be submitted
13+ * in a single execbuf IOCTL. Those BBs will then be scheduled to run on the GPU
14+ * in parallel. Multiple hardware contexts are created internally in the i915
15+ * run these BBs. Once a slot is configured for N BBs only N BBs can be
16+ * submitted in each execbuf IOCTL and this is implicit behavior e.g. The user
17+ * doesn't tell the execbuf IOCTL there are N BBs, the execbuf IOCTL knows how
18+ * many BBs there are based on the slot's configuration. The N BBs are the last
19+ * N buffer objects or first N if I915_EXEC_BATCH_FIRST is set.
20+ *
21+ * The default placement behavior is to create implicit bonds between each
22+ * context if each context maps to more than 1 physical engine (e.g. context is
23+ * a virtual engine). Also we only allow contexts of same engine class and these
24+ * contexts must be in logically contiguous order. Examples of the placement
25+ * behavior described below. Lastly, the default is to not allow BBs to
26+ * preempted mid BB rather insert coordinated preemption on all hardware
27+ * contexts between each set of BBs. Flags may be added in the future to change
28+ * both of these default behaviors.
29+ *
30+ * Returns -EINVAL if hardware context placement configuration is invalid or if
31+ * the placement configuration isn't supported on the platform / submission
32+ * interface.
33+ * Returns -ENODEV if extension isn't supported on the platform / submission
34+ * interface.
35+ *
36+ * .. code-block:: none
37+ *
38+ * Example 1 pseudo code:
39+ * CS[X] = generic engine of same class, logical instance X
40+ * INVALID = I915_ENGINE_CLASS_INVALID, I915_ENGINE_CLASS_INVALID_NONE
41+ * set_engines(INVALID)
42+ * set_parallel(engine_index=0, width=2, num_siblings=1,
43+ * engines=CS[0],CS[1])
44+ *
45+ * Results in the following valid placement:
46+ * CS[0], CS[1]
47+ *
48+ * Example 2 pseudo code:
49+ * CS[X] = generic engine of same class, logical instance X
50+ * INVALID = I915_ENGINE_CLASS_INVALID, I915_ENGINE_CLASS_INVALID_NONE
51+ * set_engines(INVALID)
52+ * set_parallel(engine_index=0, width=2, num_siblings=2,
53+ * engines=CS[0],CS[2],CS[1],CS[3])
54+ *
55+ * Results in the following valid placements:
56+ * CS[0], CS[1]
57+ * CS[2], CS[3]
58+ *
59+ * This can also be thought of as 2 virtual engines described by 2-D array
60+ * in the engines the field with bonds placed between each index of the
61+ * virtual engines. e.g. CS[0] is bonded to CS[1], CS[2] is bonded to
62+ * CS[3].
63+ * VE[0] = CS[0], CS[2]
64+ * VE[1] = CS[1], CS[3]
65+ *
66+ * Example 3 pseudo code:
67+ * CS[X] = generic engine of same class, logical instance X
68+ * INVALID = I915_ENGINE_CLASS_INVALID, I915_ENGINE_CLASS_INVALID_NONE
69+ * set_engines(INVALID)
70+ * set_parallel(engine_index=0, width=2, num_siblings=2,
71+ * engines=CS[0],CS[1],CS[1],CS[3])
72+ *
73+ * Results in the following valid and invalid placements:
74+ * CS[0], CS[1]
75+ * CS[1], CS[3] - Not logical contiguous, return -EINVAL
76+ */
77+struct drm_i915_context_engines_parallel_submit {
78+ /**
79+ * @base: base user extension.
80+ */
81+ struct i915_user_extension base;
82+
83+ /**
84+ * @engine_index: slot for parallel engine
85+ */
86+ __u16 engine_index;
87+
88+ /**
89+ * @width: number of contexts per parallel engine
90+ */
91+ __u16 width;
92+
93+ /**
94+ * @num_siblings: number of siblings per context
95+ */
96+ __u16 num_siblings;
97+
98+ /**
99+ * @mbz16: reserved for future use; must be zero
100+ */
101+ __u16 mbz16;
102+
103+ /**
104+ * @flags: all undefined flags must be zero, currently not defined flags
105+ */
106+ __u64 flags;
107+
108+ /**
109+ * @mbz64: reserved for future use; must be zero
110+ */
111+ __u64 mbz64[3];
112+
113+ /**
114+ * @engines: 2-d array of engine instances to configure parallel engine
115+ *
116+ * length = width (i) * num_siblings (j)
117+ * index = j + i * num_siblings
118+ */
119+ struct i915_engine_class_instance engines[0];
120+
121+} __packed;
122+
Documentation/gpu/rfc/i915_scheduler.rst+148−0
@@ -0,0 +1,148 @@
1+=========================================
2+I915 GuC Submission/DRM Scheduler Section
3+=========================================
4+
5+Upstream plan
6+=============
7+For upstream the overall plan for landing GuC submission and integrating the
8+i915 with the DRM scheduler is:
9+
10+* Merge basic GuC submission
11+ * Basic submission support for all gen11+ platforms
12+ * Not enabled by default on any current platforms but can be enabled via
13+ modparam enable_guc
14+ * Lots of rework will need to be done to integrate with DRM scheduler so
15+ no need to nit pick everything in the code, it just should be
16+ functional, no major coding style / layering errors, and not regress
17+ execlists
18+ * Update IGTs / selftests as needed to work with GuC submission
19+ * Enable CI on supported platforms for a baseline
20+ * Rework / get CI heathly for GuC submission in place as needed
21+* Merge new parallel submission uAPI
22+ * Bonding uAPI completely incompatible with GuC submission, plus it has
23+ severe design issues in general, which is why we want to retire it no
24+ matter what
25+ * New uAPI adds I915_CONTEXT_ENGINES_EXT_PARALLEL context setup step
26+ which configures a slot with N contexts
27+ * After I915_CONTEXT_ENGINES_EXT_PARALLEL a user can submit N batches to
28+ a slot in a single execbuf IOCTL and the batches run on the GPU in
29+ paralllel
30+ * Initially only for GuC submission but execlists can be supported if
31+ needed
32+* Convert the i915 to use the DRM scheduler
33+ * GuC submission backend fully integrated with DRM scheduler
34+ * All request queues removed from backend (e.g. all backpressure
35+ handled in DRM scheduler)
36+ * Resets / cancels hook in DRM scheduler
37+ * Watchdog hooks into DRM scheduler
38+ * Lots of complexity of the GuC backend can be pulled out once
39+ integrated with DRM scheduler (e.g. state machine gets
40+ simplier, locking gets simplier, etc...)
41+ * Execlists backend will minimum required to hook in the DRM scheduler
42+ * Legacy interface
43+ * Features like timeslicing / preemption / virtual engines would
44+ be difficult to integrate with the DRM scheduler and these
45+ features are not required for GuC submission as the GuC does
46+ these things for us
47+ * ROI low on fully integrating into DRM scheduler
48+ * Fully integrating would add lots of complexity to DRM
49+ scheduler
50+ * Port i915 priority inheritance / boosting feature in DRM scheduler
51+ * Used for i915 page flip, may be useful to other DRM drivers as
52+ well
53+ * Will be an optional feature in the DRM scheduler
54+ * Remove in-order completion assumptions from DRM scheduler
55+ * Even when using the DRM scheduler the backends will handle
56+ preemption, timeslicing, etc... so it is possible for jobs to
57+ finish out of order
58+ * Pull out i915 priority levels and use DRM priority levels
59+ * Optimize DRM scheduler as needed
60+
61+TODOs for GuC submission upstream
62+=================================
63+
64+* Need an update to GuC firmware / i915 to enable error state capture
65+* Open source tool to decode GuC logs
66+* Public GuC spec
67+
68+New uAPI for basic GuC submission
69+=================================
70+No major changes are required to the uAPI for basic GuC submission. The only
71+change is a new scheduler attribute: I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP.
72+This attribute indicates the 2k i915 user priority levels are statically mapped
73+into 3 levels as follows:
74+
75+* -1k to -1 Low priority
76+* 0 Medium priority
77+* 1 to 1k High priority
78+
79+This is needed because the GuC only has 4 priority bands. The highest priority
80+band is reserved with the kernel. This aligns with the DRM scheduler priority
81+levels too.
82+
83+Spec references:
84+----------------
85+* https://www.khronos.org/registry/EGL/extensions/IMG/EGL_IMG_context_priority.txt
86+* https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap5.html#devsandqueues-priority
87+* https://spec.oneapi.com/level-zero/latest/core/api.html#ze-command-queue-priority-t
88+
89+New parallel submission uAPI
90+============================
91+The existing bonding uAPI is completely broken with GuC submission because
92+whether a submission is a single context submit or parallel submit isn't known
93+until execbuf time activated via the I915_SUBMIT_FENCE. To submit multiple
94+contexts in parallel with the GuC the context must be explicitly registered with
95+N contexts and all N contexts must be submitted in a single command to the GuC.
96+The GuC interfaces do not support dynamically changing between N contexts as the
97+bonding uAPI does. Hence the need for a new parallel submission interface. Also
98+the legacy bonding uAPI is quite confusing and not intuitive at all. Furthermore
99+I915_SUBMIT_FENCE is by design a future fence, so not really something we should
100+continue to support.
101+
102+The new parallel submission uAPI consists of 3 parts:
103+
104+* Export engines logical mapping
105+* A 'set_parallel' extension to configure contexts for parallel
106+ submission
107+* Extend execbuf2 IOCTL to support submitting N BBs in a single IOCTL
108+
109+Export engines logical mapping
110+------------------------------
111+Certain use cases require BBs to be placed on engine instances in logical order
112+(e.g. split-frame on gen11+). The logical mapping of engine instances can change
113+based on fusing. Rather than making UMDs be aware of fusing, simply expose the
114+logical mapping with the existing query engine info IOCTL. Also the GuC
115+submission interface currently only supports submitting multiple contexts to
116+engines in logical order which is a new requirement compared to execlists.
117+Lastly, all current platforms have at most 2 engine instances and the logical
118+order is the same as uAPI order. This will change on platforms with more than 2
119+engine instances.
120+
121+A single bit will be added to drm_i915_engine_info.flags indicating that the
122+logical instance has been returned and a new field,
123+drm_i915_engine_info.logical_instance, returns the logical instance.
124+
125+A 'set_parallel' extension to configure contexts for parallel submission
126+------------------------------------------------------------------------
127+The 'set_parallel' extension configures a slot for parallel submission of N BBs.
128+It is a setup step that must be called before using any of the contexts. See
129+I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE or I915_CONTEXT_ENGINES_EXT_BOND for
130+similar existing examples. Once a slot is configured for parallel submission the
131+execbuf2 IOCTL can be called submitting N BBs in a single IOCTL. Initially only
132+supports GuC submission. Execlists supports can be added later if needed.
133+
134+Add I915_CONTEXT_ENGINES_EXT_PARALLEL_SUBMIT and
135+drm_i915_context_engines_parallel_submit to the uAPI to implement this
136+extension.
137+
138+.. kernel-doc:: Documentation/gpu/rfc/i915_parallel_execbuf.h
139+ :functions: drm_i915_context_engines_parallel_submit
140+
141+Extend execbuf2 IOCTL to support submitting N BBs in a single IOCTL
142+-------------------------------------------------------------------
143+Contexts that have been configured with the 'set_parallel' extension can only
144+submit N BBs in a single execbuf2 IOCTL. The BBs are either the last N objects
145+in the drm_i915_gem_exec_object2 list or the first N if I915_EXEC_BATCH_FIRST is
146+set. The number of BBs is implicit based on the slot submitted and how it has
147+been configured by 'set_parallel' or other extensions. No uAPI changes are
148+required to the execbuf2 IOCTL.
Documentation/gpu/rfc/index.rst+4−0
@@ -19,3 +19,7 @@ host such documentation: · 18 unmodified lines
1919 .. toctree::
2020
2121 i915_gem_lmem.rst
22+
23+.. toctree::
24+
25+ i915_scheduler.rst
Documentation/gpu/vkms.rst+26−12
@@ -98,9 +98,17 @@ with VKMS maintainers. · 97 unmodified lines
9898 IGT better support
9999 ------------------
100100
101−- Investigate: (1) test cases on kms_plane that are failing due to timeout on
102− capturing CRC; (2) when running kms_flip test cases in sequence, some
103− successful individual test cases are failing randomly.
101+Debugging:
102+
103+- kms_plane: some test cases are failing due to timeout on capturing CRC;
104+
105+- kms_flip: when running test cases in sequence, some successful individual
106+ test cases are failing randomly; when individually, some successful test
107+ cases display in the log the following error::
108+
109+ [drm:vkms_prepare_fb [vkms]] ERROR vmap failed: -4
110+
111+Virtual hardware (vblank-less) mode:
104112
105113 - VKMS already has support for vblanks simulated via hrtimers, which can be
106114 tested with kms_flip test; in some way, we can say that VKMS already mimics
@@ -116,7 +124,17 @@ Add Plane Features · 9 unmodified lines
116124
117125 There's lots of plane features we could add support for:
118126
119−- Real overlay planes, not just cursor.
127+- Multiple overlay planes. [Good to get started]
128+
129+- Clearing primary plane: clear primary plane before plane composition (at the
130+ start) for correctness of pixel blend ops. It also guarantees alpha channel
131+ is cleared in the target buffer for stable crc. [Good to get started]
132+
133+- ARGB format on primary plane: blend the primary plane into background with
134+ translucent alpha.
135+
136+- Support when the primary plane isn't exactly matching the output size: blend
137+ the primary plane into the black background.
120138
121139 - Full alpha blending on all planes.
122140
@@ -129,13 +147,8 @@ There's lots of plane features we could add support for: · 6 unmodified lines
129147 cursor api).
130148
131149 For all of these, we also want to review the igt test coverage and make sure
132−all relevant igt testcases work on vkms.
133−
134−Prime Buffer Sharing
135−--------------------
136−
137−- Syzbot report - WARNING in vkms_gem_free_object:
138− https://syzkaller.appspot.com/bug?extid=e7ad70d406e74d8fc9d0
150+all relevant igt testcases work on vkms. They are good options for internship
151+project.
139152
140153 Runtime Configuration
141154 ---------------------
@@ -153,7 +166,7 @@ module. Use/Test-cases: · 11 unmodified lines
153166 the refresh rate.
154167
155168 The currently proposed solution is to expose vkms configuration through
156−configfs. All existing module options should be supported through configfs
169+configfs. All existing module options should be supported through configfs
157170 too.
158171
159172 Writeback support
@@ -162,6 +175,7 @@ Writeback support · 2 unmodified lines
162175 - The writeback and CRC capture operations share the use of composer_enabled
163176 boolean to ensure vblanks. Probably, when these operations work together,
164177 composer_enabled needs to refcounting the composer state to proper work.
178+ [Good to get started]
165179
166180 - Add support for cloned writeback outputs and related test cases using a
167181 cloned output in the IGT kms_writeback.
MAINTAINERS+19−6
@@ -1703,7 +1703,7 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) · 1702 unmodified lines
17031703 S: Maintained
17041704 W: https://asahilinux.org
17051705 B: https://github.com/AsahiLinux/linux/issues
1706−C: irc://chat.freenode.net/asahi-dev
1706+C: irc://irc.oftc.net/asahi-dev
17071707 T: git https://github.com/AsahiLinux/linux.git
17081708 F: Documentation/devicetree/bindings/arm/apple.yaml
17091709 F: Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
@@ -5799,7 +5799,7 @@ M: Gerd Hoffmann <kraxel@redhat.com> · 4089 unmodified lines
57995799 L: virtualization@lists.linux-foundation.org
58005800 S: Maintained
58015801 T: git git://anongit.freedesktop.org/drm/drm-misc
5802−F: drivers/gpu/drm/bochs/
5802+F: drivers/gpu/drm/tiny/bochs.c
58035803
58045804 DRM DRIVER FOR BOE HIMAX8279D PANELS
58055805 M: Jerry Han <hanxu5@huaqin.corp-partner.google.com>
@@ -5984,6 +5984,13 @@ S: Maintained · 178 unmodified lines
59845984 F: Documentation/devicetree/bindings/display/panel/raydium,rm67191.yaml
59855985 F: drivers/gpu/drm/panel/panel-raydium-rm67191.c
59865986
5987+DRM DRIVER FOR SAMSUNG DB7430 PANELS
5988+M: Linus Walleij <linus.walleij@linaro.org>
5989+S: Maintained
5990+T: git git://anongit.freedesktop.org/drm/drm-misc
5991+F: Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml
5992+F: drivers/gpu/drm/panel/panel-samsung-db7430.c
5993+
59875994 DRM DRIVER FOR SITRONIX ST7703 PANELS
59885995 M: Guido Günther <agx@sigxcpu.org>
59895996 R: Purism Kernel Team <kernel@puri.sm>
@@ -6082,21 +6089,27 @@ F: drivers/gpu/drm/vboxvideo/ · 92 unmodified lines
60826089
60836090 DRM DRIVER FOR VMWARE VIRTUAL GPU
60846091 M: "VMware Graphics" <linux-graphics-maintainer@vmware.com>
6085−M: Roland Scheidegger <sroland@vmware.com>
60866092 M: Zack Rusin <zackr@vmware.com>
60876093 L: dri-devel@lists.freedesktop.org
60886094 S: Supported
6089−T: git git://people.freedesktop.org/~sroland/linux
6095+T: git git://anongit.freedesktop.org/drm/drm-misc
60906096 F: drivers/gpu/drm/vmwgfx/
60916097 F: include/uapi/drm/vmwgfx_drm.h
60926098
6099+DRM DRIVER FOR WIDECHIPS WS2401 PANELS
6100+M: Linus Walleij <linus.walleij@linaro.org>
6101+S: Maintained
6102+T: git git://anongit.freedesktop.org/drm/drm-misc
6103+F: Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
6104+F: drivers/gpu/drm/panel/panel-widechips-ws2401.c
6105+
60936106 DRM DRIVERS
60946107 M: David Airlie <airlied@linux.ie>
60956108 M: Daniel Vetter <daniel@ffwll.ch>
60966109 L: dri-devel@lists.freedesktop.org
60976110 S: Maintained
60986111 B: https://gitlab.freedesktop.org/drm
6099−C: irc://chat.freenode.net/dri-devel
6112+C: irc://irc.oftc.net/dri-devel
61006113 T: git git://anongit.freedesktop.org/drm/drm
61016114 F: Documentation/devicetree/bindings/display/
61026115 F: Documentation/devicetree/bindings/gpu/
@@ -9288,7 +9301,7 @@ S: Supported · 3185 unmodified lines
92889301 W: https://01.org/linuxgraphics/
92899302 Q: http://patchwork.freedesktop.org/project/intel-gfx/
92909303 B: https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs
9291−C: irc://chat.freenode.net/intel-gfx
9304+C: irc://irc.oftc.net/intel-gfx
92929305 T: git git://anongit.freedesktop.org/drm-intel
92939306 F: Documentation/gpu/i915.rst
92949307 F: drivers/gpu/drm/i915/
arch/arm/include/asm/efi.h+1−4
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717
1818 #ifdef CONFIG_EFI
1919 void efi_init(void);
20+extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
2021
2122 int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
2223 int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
@@ -52,10 +53,6 @@ void efi_virtmap_unload(void); · 29 unmodified lines
5253 struct screen_info *alloc_screen_info(void);
5354 void free_screen_info(struct screen_info *si);
5455
55−static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
56−{
57−}
58−
5956 /*
6057 * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
6158 * so we will reserve that amount of memory. We have no easy way to tell what
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi+15−15
@@ -255,21 +255,6 @@ · 254 unmodified lines
255255 #sound-dai-cells = <0>;
256256 };
257257
258− panel: panel {
259− /* Compatible will be filled in per-board */
260− power-supply = <&pp3300_dx_edp>;
261− backlight = <&backlight>;
262− hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>;
263−
264− ports {
265− port {
266− panel_in_edp: endpoint {
267− remote-endpoint = <&sn65dsi86_out>;
268− };
269− };
270− };
271− };
272−
273258 pwmleds {
274259 compatible = "pwm-leds";
275260 keyboard_backlight: keyboard-backlight {
@@ -666,6 +651,21 @@ edp_brij_i2c: &i2c2 { · 390 unmodified lines
666651 };
667652 };
668653 };
654+
655+ aux-bus {
656+ panel: panel {
657+ /* Compatible will be filled in per-board */
658+ power-supply = <&pp3300_dx_edp>;
659+ backlight = <&backlight>;
660+ hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>;
661+
662+ port {
663+ panel_in_edp: endpoint {
664+ remote-endpoint = <&sn65dsi86_out>;
665+ };
666+ };
667+ };
668+ };
669669 };
670670 };
671671
arch/arm64/include/asm/efi.h+1−4
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414
1515 #ifdef CONFIG_EFI
1616 extern void efi_init(void);
17+extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
1718 #else
1819 #define efi_init()
1920 #endif
@@ -85,10 +86,6 @@ static inline void free_screen_info(struct screen_info *si) · 65 unmodified lines
8586 {
8687 }
8788
88−static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
89−{
90−}
91−
9289 #define EFI_ALLOC_ALIGN SZ_64K
9390
9491 /*
arch/riscv/include/asm/efi.h+1−4
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313
1414 #ifdef CONFIG_EFI
1515 extern void efi_init(void);
16+extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
1617 #else
1718 #define efi_init()
1819 #endif
@@ -39,10 +40,6 @@ static inline void free_screen_info(struct screen_info *si) · 20 unmodified lines
3940 {
4041 }
4142
42−static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
43−{
44−}
45−
4643 void efi_virtmap_load(void);
4744 void efi_virtmap_unload(void);
4845
arch/x86/Kconfig+0−26
@@ -2767,32 +2767,6 @@ config AMD_NB · 2766 unmodified lines
27672767 def_bool y
27682768 depends on CPU_SUP_AMD && PCI
27692769
2770−config X86_SYSFB
2771− bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
2772− help
2773− Firmwares often provide initial graphics framebuffers so the BIOS,
2774− bootloader or kernel can show basic video-output during boot for
2775− user-guidance and debugging. Historically, x86 used the VESA BIOS
2776− Extensions and EFI-framebuffers for this, which are mostly limited
2777− to x86.
2778− This option, if enabled, marks VGA/VBE/EFI framebuffers as generic
2779− framebuffers so the new generic system-framebuffer drivers can be
2780− used on x86. If the framebuffer is not compatible with the generic
2781− modes, it is advertised as fallback platform framebuffer so legacy
2782− drivers like efifb, vesafb and uvesafb can pick it up.
2783− If this option is not selected, all system framebuffers are always
2784− marked as fallback platform framebuffers as usual.
2785−
2786− Note: Legacy fbdev drivers, including vesafb, efifb, uvesafb, will
2787− not be able to pick up generic system framebuffers if this option
2788− is selected. You are highly encouraged to enable simplefb as
2789− replacement if you select this option. simplefb can correctly deal
2790− with generic system framebuffers. But you should still keep vesafb
2791− and others enabled as fallback if a system framebuffer is
2792− incompatible with simplefb.
2793−
2794− If unsure, say Y.
2795−
27962770 endmenu
27972771
27982772
arch/x86/kernel/Makefile+0−3
@@ -136,9 +136,6 @@ obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o · 135 unmodified lines
136136 obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
137137 obj-$(CONFIG_OF) += devicetree.o
138138 obj-$(CONFIG_UPROBES) += uprobes.o
139−obj-y += sysfb.o
140−obj-$(CONFIG_X86_SYSFB) += sysfb_simplefb.o
141−obj-$(CONFIG_EFI) += sysfb_efi.o
142139
143140 obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
144141 obj-$(CONFIG_TRACING) += tracepoint.o
drivers/dma-buf/Kconfig+11−0
@@ -72,6 +72,17 @@ menuconfig DMABUF_HEAPS · 71 unmodified lines
7272 allows userspace to allocate dma-bufs that can be shared
7373 between drivers.
7474
75+menuconfig DMABUF_SYSFS_STATS
76+ bool "DMA-BUF sysfs statistics"
77+ select DMA_SHARED_BUFFER
78+ help
79+ Choose this option to enable DMA-BUF sysfs statistics
80+ in location /sys/kernel/dmabuf/buffers.
81+
82+ /sys/kernel/dmabuf/buffers/<inode_number> will contain
83+ statistics for the DMA-BUF with the unique inode number
84+ <inode_number>.
85+
7586 source "drivers/dma-buf/heaps/Kconfig"
7687
7788 endmenu
drivers/dma-buf/Makefile+1−0
@@ -6,6 +6,7 @@ obj-$(CONFIG_DMABUF_HEAPS) += heaps/ · 5 unmodified lines
66 obj-$(CONFIG_SYNC_FILE) += sync_file.o
77 obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o
88 obj-$(CONFIG_UDMABUF) += udmabuf.o
9+obj-$(CONFIG_DMABUF_SYSFS_STATS) += dma-buf-sysfs-stats.o
910
1011 dmabuf_selftests-y := \
1112 selftest.o \
drivers/dma-buf/dma-buf-sysfs-stats.c+205−0
@@ -0,0 +1,205 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * DMA-BUF sysfs statistics.
4+ *
5+ * Copyright (C) 2021 Google LLC.
6+ */
7+
8+#include <linux/dma-buf.h>
9+#include <linux/dma-resv.h>
10+#include <linux/kobject.h>
11+#include <linux/printk.h>
12+#include <linux/slab.h>
13+#include <linux/sysfs.h>
14+
15+#include "dma-buf-sysfs-stats.h"
16+
17+#define to_dma_buf_entry_from_kobj(x) container_of(x, struct dma_buf_sysfs_entry, kobj)
18+
19+/**
20+ * DOC: overview
21+ *
22+ * ``/sys/kernel/debug/dma_buf/bufinfo`` provides an overview of every DMA-BUF
23+ * in the system. However, since debugfs is not safe to be mounted in
24+ * production, procfs and sysfs can be used to gather DMA-BUF statistics on
25+ * production systems.
26+ *
27+ * The ``/proc/<pid>/fdinfo/<fd>`` files in procfs can be used to gather
28+ * information about DMA-BUF fds. Detailed documentation about the interface
29+ * is present in Documentation/filesystems/proc.rst.
30+ *
31+ * Unfortunately, the existing procfs interfaces can only provide information
32+ * about the DMA-BUFs for which processes hold fds or have the buffers mmapped
33+ * into their address space. This necessitated the creation of the DMA-BUF sysfs
34+ * statistics interface to provide per-buffer information on production systems.
35+ *
36+ * The interface at ``/sys/kernel/dma-buf/buffers`` exposes information about
37+ * every DMA-BUF when ``CONFIG_DMABUF_SYSFS_STATS`` is enabled.
38+ *
39+ * The following stats are exposed by the interface:
40+ *
41+ * * ``/sys/kernel/dmabuf/buffers/<inode_number>/exporter_name``
42+ * * ``/sys/kernel/dmabuf/buffers/<inode_number>/size``
43+ *
44+ * The information in the interface can also be used to derive per-exporter
45+ * statistics. The data from the interface can be gathered on error conditions
46+ * or other important events to provide a snapshot of DMA-BUF usage.
47+ * It can also be collected periodically by telemetry to monitor various metrics.
48+ *
49+ * Detailed documentation about the interface is present in
50+ * Documentation/ABI/testing/sysfs-kernel-dmabuf-buffers.
51+ */
52+
53+struct dma_buf_stats_attribute {
54+ struct attribute attr;
55+ ssize_t (*show)(struct dma_buf *dmabuf,
56+ struct dma_buf_stats_attribute *attr, char *buf);
57+};
58+#define to_dma_buf_stats_attr(x) container_of(x, struct dma_buf_stats_attribute, attr)
59+
60+static ssize_t dma_buf_stats_attribute_show(struct kobject *kobj,
61+ struct attribute *attr,
62+ char *buf)
63+{
64+ struct dma_buf_stats_attribute *attribute;
65+ struct dma_buf_sysfs_entry *sysfs_entry;
66+ struct dma_buf *dmabuf;
67+
68+ attribute = to_dma_buf_stats_attr(attr);
69+ sysfs_entry = to_dma_buf_entry_from_kobj(kobj);
70+ dmabuf = sysfs_entry->dmabuf;
71+
72+ if (!dmabuf || !attribute->show)
73+ return -EIO;
74+
75+ return attribute->show(dmabuf, attribute, buf);
76+}
77+
78+static const struct sysfs_ops dma_buf_stats_sysfs_ops = {
79+ .show = dma_buf_stats_attribute_show,
80+};
81+
82+static ssize_t exporter_name_show(struct dma_buf *dmabuf,
83+ struct dma_buf_stats_attribute *attr,
84+ char *buf)
85+{
86+ return sysfs_emit(buf, "%s\n", dmabuf->exp_name);
87+}
88+
89+static ssize_t size_show(struct dma_buf *dmabuf,
90+ struct dma_buf_stats_attribute *attr,
91+ char *buf)
92+{
93+ return sysfs_emit(buf, "%zu\n", dmabuf->size);
94+}
95+
96+static struct dma_buf_stats_attribute exporter_name_attribute =
97+ __ATTR_RO(exporter_name);
98+static struct dma_buf_stats_attribute size_attribute = __ATTR_RO(size);
99+
100+static struct attribute *dma_buf_stats_default_attrs[] = {
101+ &exporter_name_attribute.attr,
102+ &size_attribute.attr,
103+ NULL,
104+};
105+ATTRIBUTE_GROUPS(dma_buf_stats_default);
106+
107+static void dma_buf_sysfs_release(struct kobject *kobj)
108+{
109+ struct dma_buf_sysfs_entry *sysfs_entry;
110+
111+ sysfs_entry = to_dma_buf_entry_from_kobj(kobj);
112+ kfree(sysfs_entry);
113+}
114+
115+static struct kobj_type dma_buf_ktype = {
116+ .sysfs_ops = &dma_buf_stats_sysfs_ops,
117+ .release = dma_buf_sysfs_release,
118+ .default_groups = dma_buf_stats_default_groups,
119+};
120+
121+void dma_buf_stats_teardown(struct dma_buf *dmabuf)
122+{
123+ struct dma_buf_sysfs_entry *sysfs_entry;
124+
125+ sysfs_entry = dmabuf->sysfs_entry;
126+ if (!sysfs_entry)
127+ return;
128+
129+ kobject_del(&sysfs_entry->kobj);
130+ kobject_put(&sysfs_entry->kobj);
131+}
132+
133+
134+/* Statistics files do not need to send uevents. */
135+static int dmabuf_sysfs_uevent_filter(struct kset *kset, struct kobject *kobj)
136+{
137+ return 0;
138+}
139+
140+static const struct kset_uevent_ops dmabuf_sysfs_no_uevent_ops = {
141+ .filter = dmabuf_sysfs_uevent_filter,
142+};
143+
144+static struct kset *dma_buf_stats_kset;
145+static struct kset *dma_buf_per_buffer_stats_kset;
146+int dma_buf_init_sysfs_statistics(void)
147+{
148+ dma_buf_stats_kset = kset_create_and_add("dmabuf",
149+ &dmabuf_sysfs_no_uevent_ops,
150+ kernel_kobj);
151+ if (!dma_buf_stats_kset)
152+ return -ENOMEM;
153+
154+ dma_buf_per_buffer_stats_kset = kset_create_and_add("buffers",
155+ &dmabuf_sysfs_no_uevent_ops,
156+ &dma_buf_stats_kset->kobj);
157+ if (!dma_buf_per_buffer_stats_kset) {
158+ kset_unregister(dma_buf_stats_kset);
159+ return -ENOMEM;
160+ }
161+
162+ return 0;
163+}
164+
165+void dma_buf_uninit_sysfs_statistics(void)
166+{
167+ kset_unregister(dma_buf_per_buffer_stats_kset);
168+ kset_unregister(dma_buf_stats_kset);
169+}
170+
171+int dma_buf_stats_setup(struct dma_buf *dmabuf)
172+{
173+ struct dma_buf_sysfs_entry *sysfs_entry;
174+ int ret;
175+
176+ if (!dmabuf || !dmabuf->file)
177+ return -EINVAL;
178+
179+ if (!dmabuf->exp_name) {
180+ pr_err("exporter name must not be empty if stats needed\n");
181+ return -EINVAL;
182+ }
183+
184+ sysfs_entry = kzalloc(sizeof(struct dma_buf_sysfs_entry), GFP_KERNEL);
185+ if (!sysfs_entry)
186+ return -ENOMEM;
187+
188+ sysfs_entry->kobj.kset = dma_buf_per_buffer_stats_kset;
189+ sysfs_entry->dmabuf = dmabuf;
190+
191+ dmabuf->sysfs_entry = sysfs_entry;
192+
193+ /* create the directory for buffer stats */
194+ ret = kobject_init_and_add(&sysfs_entry->kobj, &dma_buf_ktype, NULL,
195+ "%lu", file_inode(dmabuf->file)->i_ino);
196+ if (ret)
197+ goto err_sysfs_dmabuf;
198+
199+ return 0;
200+
201+err_sysfs_dmabuf:
202+ kobject_put(&sysfs_entry->kobj);
203+ dmabuf->sysfs_entry = NULL;
204+ return ret;
205+}
drivers/dma-buf/dma-buf-sysfs-stats.h+35−0
@@ -0,0 +1,35 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+/*
3+ * DMA-BUF sysfs statistics.
4+ *
5+ * Copyright (C) 2021 Google LLC.
6+ */
7+
8+#ifndef _DMA_BUF_SYSFS_STATS_H
9+#define _DMA_BUF_SYSFS_STATS_H
10+
11+#ifdef CONFIG_DMABUF_SYSFS_STATS
12+
13+int dma_buf_init_sysfs_statistics(void);
14+void dma_buf_uninit_sysfs_statistics(void);
15+
16+int dma_buf_stats_setup(struct dma_buf *dmabuf);
17+
18+void dma_buf_stats_teardown(struct dma_buf *dmabuf);
19+#else
20+
21+static inline int dma_buf_init_sysfs_statistics(void)
22+{
23+ return 0;
24+}
25+
26+static inline void dma_buf_uninit_sysfs_statistics(void) {}
27+
28+static inline int dma_buf_stats_setup(struct dma_buf *dmabuf)
29+{
30+ return 0;
31+}
32+
33+static inline void dma_buf_stats_teardown(struct dma_buf *dmabuf) {}
34+#endif
35+#endif // _DMA_BUF_SYSFS_STATS_H
drivers/dma-buf/dma-buf.c+25−1
@@ -29,6 +29,8 @@ · 28 unmodified lines
2929 #include <uapi/linux/dma-buf.h>
3030 #include <uapi/linux/magic.h>
3131
32+#include "dma-buf-sysfs-stats.h"
33+
3234 static inline int is_dma_buf_file(struct file *);
3335
3436 struct dma_buf_list {
@@ -74,6 +76,7 @@ static void dma_buf_release(struct dentry *dentry) · 39 unmodified lines
7476 */
7577 BUG_ON(dmabuf->cb_shared.active || dmabuf->cb_excl.active);
7678
79+ dma_buf_stats_teardown(dmabuf);
7780 dmabuf->ops->release(dmabuf);
7881
7982 if (dmabuf->resv == (struct dma_resv *)&dmabuf[1])
@@ -580,6 +583,10 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) · 500 unmodified lines
580583 file->f_mode |= FMODE_LSEEK;
581584 dmabuf->file = file;
582585
586+ ret = dma_buf_stats_setup(dmabuf);
587+ if (ret)
588+ goto err_sysfs;
589+
583590 mutex_init(&dmabuf->lock);
584591 INIT_LIST_HEAD(&dmabuf->attachments);
585592
@@ -589,6 +596,14 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) · 3 unmodified lines
589596
590597 return dmabuf;
591598
599+err_sysfs:
600+ /*
601+ * Set file->f_path.dentry->d_fsdata to NULL so that when
602+ * dma_buf_release() gets invoked by dentry_ops, it exits
603+ * early before calling the release() dma_buf op.
604+ */
605+ file->f_path.dentry->d_fsdata = NULL;
606+ fput(file);
592607 err_dmabuf:
593608 kfree(dmabuf);
594609 err_module:
@@ -926,6 +941,9 @@ EXPORT_SYMBOL_GPL(dma_buf_unpin); · 331 unmodified lines
926941 * the underlying backing storage is pinned for as long as a mapping exists,
927942 * therefore users/importers should not hold onto a mapping for undue amounts of
928943 * time.
944+ *
945+ * Important: Dynamic importers must wait for the exclusive fence of the struct
946+ * dma_resv attached to the DMA-BUF first.
929947 */
930948 struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
931949 enum dma_data_direction direction)
@@ -992,7 +1010,6 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, · 60 unmodified lines
9921010 }
9931011 }
9941012 #endif /* CONFIG_DMA_API_DEBUG */
995−
9961013 return sg_table;
9971014 }
9981015 EXPORT_SYMBOL_GPL(dma_buf_map_attachment);
@@ -1469,6 +1486,12 @@ static inline void dma_buf_uninit_debugfs(void) · 470 unmodified lines
14691486
14701487 static int __init dma_buf_init(void)
14711488 {
1489+ int ret;
1490+
1491+ ret = dma_buf_init_sysfs_statistics();
1492+ if (ret)
1493+ return ret;
1494+
14721495 dma_buf_mnt = kern_mount(&dma_buf_fs_type);
14731496 if (IS_ERR(dma_buf_mnt))
14741497 return PTR_ERR(dma_buf_mnt);
@@ -1484,5 +1507,6 @@ static void __exit dma_buf_deinit(void) · 9 unmodified lines
14841507 {
14851508 dma_buf_uninit_debugfs();
14861509 kern_unmount(dma_buf_mnt);
1510+ dma_buf_uninit_sysfs_statistics();
14871511 }
14881512 __exitcall(dma_buf_deinit);
drivers/dma-buf/dma-fence-chain.c+1−1
@@ -137,6 +137,7 @@ static void dma_fence_chain_cb(struct dma_fence *f, struct dma_fence_cb *cb) · 136 unmodified lines
137137 struct dma_fence_chain *chain;
138138
139139 chain = container_of(cb, typeof(*chain), cb);
140+ init_irq_work(&chain->work, dma_fence_chain_irq_work);
140141 irq_work_queue(&chain->work);
141142 dma_fence_put(f);
142143 }
@@ -239,7 +240,6 @@ void dma_fence_chain_init(struct dma_fence_chain *chain, · 96 unmodified lines
239240 rcu_assign_pointer(chain->prev, prev);
240241 chain->fence = fence;
241242 chain->prev_seqno = 0;
242− init_irq_work(&chain->work, dma_fence_chain_irq_work);
243243
244244 /* Try to reuse the context of the previous chain node. */
245245 if (prev_chain && __dma_fence_is_later(seqno, prev->seqno, prev->ops)) {
drivers/dma-buf/dma-resv.c+12−21
@@ -615,25 +615,21 @@ static inline int dma_resv_test_signaled_single(struct dma_fence *passed_fence) · 614 unmodified lines
615615 */
616616 bool dma_resv_test_signaled(struct dma_resv *obj, bool test_all)
617617 {
618− unsigned int seq, shared_count;
618+ struct dma_fence *fence;
619+ unsigned int seq;
619620 int ret;
620621
621622 rcu_read_lock();
622623 retry:
623624 ret = true;
624− shared_count = 0;
625625 seq = read_seqcount_begin(&obj->seq);
626626
627627 if (test_all) {
628628 struct dma_resv_list *fobj = dma_resv_shared_list(obj);
629− unsigned int i;
630−
631− if (fobj)
632− shared_count = fobj->shared_count;
629+ unsigned int i, shared_count;
633630
631+ shared_count = fobj ? fobj->shared_count : 0;
634632 for (i = 0; i < shared_count; ++i) {
635− struct dma_fence *fence;
636−
637633 fence = rcu_dereference(fobj->shared[i]);
638634 ret = dma_resv_test_signaled_single(fence);
639635 if (ret < 0)
@@ -641,24 +637,19 @@ retry: · 1 unmodified line
641637 else if (!ret)
642638 break;
643639 }
644−
645− if (read_seqcount_retry(&obj->seq, seq))
646− goto retry;
647640 }
648641
649− if (!shared_count) {
650− struct dma_fence *fence_excl = dma_resv_excl_fence(obj);
651−
652− if (fence_excl) {
653− ret = dma_resv_test_signaled_single(fence_excl);
654− if (ret < 0)
655− goto retry;
642+ fence = dma_resv_excl_fence(obj);
643+ if (ret && fence) {
644+ ret = dma_resv_test_signaled_single(fence);
645+ if (ret < 0)
646+ goto retry;
656647
657− if (read_seqcount_retry(&obj->seq, seq))
658− goto retry;
659− }
660648 }
661649
650+ if (read_seqcount_retry(&obj->seq, seq))
651+ goto retry;
652+
662653 rcu_read_unlock();
663654 return ret;
664655 }
drivers/dma-buf/st-dma-fence-chain.c+4−12
@@ -58,28 +58,20 @@ static struct dma_fence *mock_fence(void) · 57 unmodified lines
5858 return &f->base;
5959 }
6060
61−static inline struct mock_chain {
62− struct dma_fence_chain base;
63−} *to_mock_chain(struct dma_fence *f) {
64− return container_of(f, struct mock_chain, base.base);
65−}
66−
6761 static struct dma_fence *mock_chain(struct dma_fence *prev,
6862 struct dma_fence *fence,
6963 u64 seqno)
7064 {
71− struct mock_chain *f;
65+ struct dma_fence_chain *f;
7266
73− f = kmalloc(sizeof(*f), GFP_KERNEL);
67+ f = dma_fence_chain_alloc();
7468 if (!f)
7569 return NULL;
7670
77− dma_fence_chain_init(&f->base,
78− dma_fence_get(prev),
79− dma_fence_get(fence),
71+ dma_fence_chain_init(f, dma_fence_get(prev), dma_fence_get(fence),
8072 seqno);
8173
82− return &f->base.base;
74+ return &f->base;
8375 }
8476
8577 static int sanitycheck(void *arg)
drivers/dma-buf/udmabuf.c+50−9
@@ -11,9 +11,15 @@ · 10 unmodified lines
1111 #include <linux/shmem_fs.h>
1212 #include <linux/slab.h>
1313 #include <linux/udmabuf.h>
14+#include <linux/hugetlb.h>
1415
15−static const u32 list_limit = 1024; /* udmabuf_create_list->count limit */
16−static const size_t size_limit_mb = 64; /* total dmabuf size, in megabytes */
16+static int list_limit = 1024;
17+module_param(list_limit, int, 0644);
18+MODULE_PARM_DESC(list_limit, "udmabuf_create_list->count limit. Default is 1024.");
19+
20+static int size_limit_mb = 64;
21+module_param(size_limit_mb, int, 0644);
22+MODULE_PARM_DESC(size_limit_mb, "Max size of a dmabuf, in megabytes. Default is 64.");
1723
1824 struct udmabuf {
1925 pgoff_t pagecount;
@@ -160,10 +166,13 @@ static long udmabuf_create(struct miscdevice *device, · 140 unmodified lines
160166 {
161167 DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
162168 struct file *memfd = NULL;
169+ struct address_space *mapping = NULL;
163170 struct udmabuf *ubuf;
164171 struct dma_buf *buf;
165172 pgoff_t pgoff, pgcnt, pgidx, pgbuf = 0, pglimit;
166− struct page *page;
173+ struct page *page, *hpage = NULL;
174+ pgoff_t subpgoff, maxsubpgs;
175+ struct hstate *hpstate;
167176 int seals, ret = -EINVAL;
168177 u32 i, flags;
169178
@@ -194,7 +203,8 @@ static long udmabuf_create(struct miscdevice *device, · 24 unmodified lines
194203 memfd = fget(list[i].memfd);
195204 if (!memfd)
196205 goto err;
197− if (!shmem_mapping(file_inode(memfd)->i_mapping))
206+ mapping = file_inode(memfd)->i_mapping;
207+ if (!shmem_mapping(mapping) && !is_file_hugepages(memfd))
198208 goto err;
199209 seals = memfd_fcntl(memfd, F_GET_SEALS, 0);
200210 if (seals == -EINVAL)
@@ -205,17 +215,48 @@ static long udmabuf_create(struct miscdevice *device, · 4 unmodified lines
205215 goto err;
206216 pgoff = list[i].offset >> PAGE_SHIFT;
207217 pgcnt = list[i].size >> PAGE_SHIFT;
218+ if (is_file_hugepages(memfd)) {
219+ hpstate = hstate_file(memfd);
220+ pgoff = list[i].offset >> huge_page_shift(hpstate);
221+ subpgoff = (list[i].offset &
222+ ~huge_page_mask(hpstate)) >> PAGE_SHIFT;
223+ maxsubpgs = huge_page_size(hpstate) >> PAGE_SHIFT;
224+ }
208225 for (pgidx = 0; pgidx < pgcnt; pgidx++) {
209− page = shmem_read_mapping_page(
210− file_inode(memfd)->i_mapping, pgoff + pgidx);
211− if (IS_ERR(page)) {
212− ret = PTR_ERR(page);
213− goto err;
226+ if (is_file_hugepages(memfd)) {
227+ if (!hpage) {
228+ hpage = find_get_page_flags(mapping, pgoff,
229+ FGP_ACCESSED);
230+ if (!hpage) {
231+ ret = -EINVAL;
232+ goto err;
233+ }
234+ }
235+ page = hpage + subpgoff;
236+ get_page(page);
237+ subpgoff++;
238+ if (subpgoff == maxsubpgs) {
239+ put_page(hpage);
240+ hpage = NULL;
241+ subpgoff = 0;
242+ pgoff++;
243+ }
244+ } else {
245+ page = shmem_read_mapping_page(mapping,
246+ pgoff + pgidx);
247+ if (IS_ERR(page)) {
248+ ret = PTR_ERR(page);
249+ goto err;
250+ }
214251 }
215252 ubuf->pages[pgbuf++] = page;
216253 }
217254 fput(memfd);
218255 memfd = NULL;
256+ if (hpage) {
257+ put_page(hpage);
258+ hpage = NULL;
259+ }
219260 }
220261
221262 exp_info.ops = &udmabuf_ops;
drivers/firmware/Kconfig+32−0
@@ -251,6 +251,38 @@ config QCOM_SCM_DOWNLOAD_MODE_DEFAULT · 250 unmodified lines
251251
252252 Say Y here to enable "download mode" by default.
253253
254+config SYSFB
255+ bool
256+ default y
257+ depends on X86 || EFI
258+
259+config SYSFB_SIMPLEFB
260+ bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
261+ depends on SYSFB
262+ help
263+ Firmwares often provide initial graphics framebuffers so the BIOS,
264+ bootloader or kernel can show basic video-output during boot for
265+ user-guidance and debugging. Historically, x86 used the VESA BIOS
266+ Extensions and EFI-framebuffers for this, which are mostly limited
267+ to x86 BIOS or EFI systems.
268+ This option, if enabled, marks VGA/VBE/EFI framebuffers as generic
269+ framebuffers so the new generic system-framebuffer drivers can be
270+ used instead. If the framebuffer is not compatible with the generic
271+ modes, it is advertised as fallback platform framebuffer so legacy
272+ drivers like efifb, vesafb and uvesafb can pick it up.
273+ If this option is not selected, all system framebuffers are always
274+ marked as fallback platform framebuffers as usual.
275+
276+ Note: Legacy fbdev drivers, including vesafb, efifb, uvesafb, will
277+ not be able to pick up generic system framebuffers if this option
278+ is selected. You are highly encouraged to enable simplefb as
279+ replacement if you select this option. simplefb can correctly deal
280+ with generic system framebuffers. But you should still keep vesafb
281+ and others enabled as fallback if a system framebuffer is
282+ incompatible with simplefb.
283+
284+ If unsure, say Y.
285+
254286 config TI_SCI_PROTOCOL
255287 tristate "TI System Control Interface (TISCI) Message Protocol"
256288 depends on TI_MESSAGE_MANAGER
drivers/firmware/Makefile+2−0
@@ -18,6 +18,8 @@ obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o · 17 unmodified lines
1818 obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o
1919 obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o
2020 obj-$(CONFIG_QCOM_SCM) += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
21+obj-$(CONFIG_SYSFB) += sysfb.o
22+obj-$(CONFIG_SYSFB_SIMPLEFB) += sysfb_simplefb.o
2123 obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o
2224 obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o
2325 obj-$(CONFIG_TURRIS_MOX_RWTM) += turris-mox-rwtm.o
drivers/firmware/efi/Makefile+2−0
@@ -36,6 +36,8 @@ obj-$(CONFIG_LOAD_UEFI_KEYS) += mokvar-table.o · 35 unmodified lines
3636 fake_map-y += fake_mem.o
3737 fake_map-$(CONFIG_X86) += x86_fake_mem.o
3838
39+obj-$(CONFIG_SYSFB) += sysfb_efi.o
40+
3941 arm-obj-$(CONFIG_EFI) := efi-init.o arm-runtime.o
4042 obj-$(CONFIG_ARM) += $(arm-obj-y)
4143 obj-$(CONFIG_ARM64) += $(arm-obj-y)
drivers/firmware/efi/efi-init.c+0−90
@@ -275,93 +275,3 @@ void __init efi_init(void) · 274 unmodified lines
275275 }
276276 #endif
277277 }
278−
279−static bool efifb_overlaps_pci_range(const struct of_pci_range *range)
280−{
281− u64 fb_base = screen_info.lfb_base;
282−
283− if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
284− fb_base |= (u64)(unsigned long)screen_info.ext_lfb_base << 32;
285−
286− return fb_base >= range->cpu_addr &&
287− fb_base < (range->cpu_addr + range->size);
288−}
289−
290−static struct device_node *find_pci_overlap_node(void)
291−{
292− struct device_node *np;
293−
294− for_each_node_by_type(np, "pci") {
295− struct of_pci_range_parser parser;
296− struct of_pci_range range;
297− int err;
298−
299− err = of_pci_range_parser_init(&parser, np);
300− if (err) {
301− pr_warn("of_pci_range_parser_init() failed: %d\n", err);
302− continue;
303− }
304−
305− for_each_of_pci_range(&parser, &range)
306− if (efifb_overlaps_pci_range(&range))
307− return np;
308− }
309− return NULL;
310−}
311−
312−/*
313− * If the efifb framebuffer is backed by a PCI graphics controller, we have
314− * to ensure that this relation is expressed using a device link when
315− * running in DT mode, or the probe order may be reversed, resulting in a
316− * resource reservation conflict on the memory window that the efifb
317− * framebuffer steals from the PCIe host bridge.
318− */
319−static int efifb_add_links(struct fwnode_handle *fwnode)
320−{
321− struct device_node *sup_np;
322−
323− sup_np = find_pci_overlap_node();
324−
325− /*
326− * If there's no PCI graphics controller backing the efifb, we are
327− * done here.
328− */
329− if (!sup_np)
330− return 0;
331−
332− fwnode_link_add(fwnode, of_fwnode_handle(sup_np));
333− of_node_put(sup_np);
334−
335− return 0;
336−}
337−
338−static const struct fwnode_operations efifb_fwnode_ops = {
339− .add_links = efifb_add_links,
340−};
341−
342−static struct fwnode_handle efifb_fwnode;
343−
344−static int __init register_gop_device(void)
345−{
346− struct platform_device *pd;
347− int err;
348−
349− if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
350− return 0;
351−
352− pd = platform_device_alloc("efi-framebuffer", 0);
353− if (!pd)
354− return -ENOMEM;
355−
356− if (IS_ENABLED(CONFIG_PCI)) {
357− fwnode_init(&efifb_fwnode, &efifb_fwnode_ops);
358− pd->dev.fwnode = &efifb_fwnode;
359− }
360−
361− err = platform_device_add_data(pd, &screen_info, sizeof(screen_info));
362− if (err)
363− return err;
364−
365− return platform_device_add(pd);
366−}
367−subsys_initcall(register_gop_device);
drivers/firmware/efi/sysfb_efi.crenamed from arch/x86/kernel/sysfb_efi.c+77−3
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /*
3− * Generic System Framebuffers on x86
3+ * Generic System Framebuffers
44 * Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
55 *
66 * EFI Quirks Copyright (c) 2006 Edgar Hucek <gimli@dark-green.com>
@@ -19,12 +19,14 @@ · 12 unmodified lines
1919 #include <linux/init.h>
2020 #include <linux/kernel.h>
2121 #include <linux/mm.h>
22+#include <linux/of_address.h>
2223 #include <linux/pci.h>
24+#include <linux/platform_device.h>
2325 #include <linux/screen_info.h>
26+#include <linux/sysfb.h>
2427 #include <video/vga.h>
2528
2629 #include <asm/efi.h>
27−#include <asm/sysfb.h>
2830
2931 enum {
3032 OVERRIDE_NONE = 0x0,
@@ -267,7 +269,73 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = { · 236 unmodified lines
267269 {},
268270 };
269271
270−__init void sysfb_apply_efi_quirks(void)
272+static bool efifb_overlaps_pci_range(const struct of_pci_range *range)
273+{
274+ u64 fb_base = screen_info.lfb_base;
275+
276+ if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
277+ fb_base |= (u64)(unsigned long)screen_info.ext_lfb_base << 32;
278+
279+ return fb_base >= range->cpu_addr &&
280+ fb_base < (range->cpu_addr + range->size);
281+}
282+
283+static struct device_node *find_pci_overlap_node(void)
284+{
285+ struct device_node *np;
286+
287+ for_each_node_by_type(np, "pci") {
288+ struct of_pci_range_parser parser;
289+ struct of_pci_range range;
290+ int err;
291+
292+ err = of_pci_range_parser_init(&parser, np);
293+ if (err) {
294+ pr_warn("of_pci_range_parser_init() failed: %d\n", err);
295+ continue;
296+ }
297+
298+ for_each_of_pci_range(&parser, &range)
299+ if (efifb_overlaps_pci_range(&range))
300+ return np;
301+ }
302+ return NULL;
303+}
304+
305+/*
306+ * If the efifb framebuffer is backed by a PCI graphics controller, we have
307+ * to ensure that this relation is expressed using a device link when
308+ * running in DT mode, or the probe order may be reversed, resulting in a
309+ * resource reservation conflict on the memory window that the efifb
310+ * framebuffer steals from the PCIe host bridge.
311+ */
312+static int efifb_add_links(struct fwnode_handle *fwnode)
313+{
314+ struct device_node *sup_np;
315+
316+ sup_np = find_pci_overlap_node();
317+
318+ /*
319+ * If there's no PCI graphics controller backing the efifb, we are
320+ * done here.
321+ */
322+ if (!sup_np)
323+ return 0;
324+
325+ fwnode_link_add(fwnode, of_fwnode_handle(sup_np));
326+ of_node_put(sup_np);
327+
328+ return 0;
329+}
330+
331+static const struct fwnode_operations efifb_fwnode_ops = {
332+ .add_links = efifb_add_links,
333+};
334+
335+#ifdef CONFIG_EFI
336+static struct fwnode_handle efifb_fwnode;
337+
338+__init void sysfb_apply_efi_quirks(struct platform_device *pd)
271339 {
272340 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI ||
273341 !(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
@@ -281,4 +349,10 @@ __init void sysfb_apply_efi_quirks(void) · 7 unmodified lines
281349 screen_info.lfb_height = temp;
282350 screen_info.lfb_linelength = 4 * screen_info.lfb_width;
283351 }
352+
353+ if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI && IS_ENABLED(CONFIG_PCI)) {
354+ fwnode_init(&efifb_fwnode, &efifb_fwnode_ops);
355+ pd->dev.fwnode = &efifb_fwnode;
356+ }
284357 }
358+#endif
drivers/firmware/sysfb.crenamed from arch/x86/kernel/sysfb.c+25−12
@@ -1,11 +1,11 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /*
3− * Generic System Framebuffers on x86
3+ * Generic System Framebuffers
44 * Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
55 */
66
77 /*
8− * Simple-Framebuffer support for x86 systems
8+ * Simple-Framebuffer support
99 * Create a platform-device for any available boot framebuffer. The
1010 * simple-framebuffer platform device is already available on DT systems, so
1111 * this module parses the global "screen_info" object and creates a suitable
@@ -16,12 +16,12 @@ · 4 unmodified lines
1616 * to pick these devices up without messing with simple-framebuffer drivers.
1717 * The global "screen_info" is still valid at all times.
1818 *
19− * If CONFIG_X86_SYSFB is not selected, we never register "simple-framebuffer"
19+ * If CONFIG_SYSFB_SIMPLEFB is not selected, never register "simple-framebuffer"
2020 * platform devices, but only use legacy framebuffer devices for
2121 * backwards compatibility.
2222 *
2323 * TODO: We set the dev_id field of all platform-devices to 0. This allows
24− * other x86 OF/DT parsers to create such devices, too. However, they must
24+ * other OF/DT parsers to create such devices, too. However, they must
2525 * start at offset 1 for this to work.
2626 */
2727
@@ -32,7 +32,7 @@ · 4 unmodified lines
3232 #include <linux/platform_data/simplefb.h>
3333 #include <linux/platform_device.h>
3434 #include <linux/screen_info.h>
35−#include <asm/sysfb.h>
35+#include <linux/sysfb.h>
3636
3737 static __init int sysfb_init(void)
3838 {
@@ -43,12 +43,10 @@ static __init int sysfb_init(void) · 4 unmodified lines
4343 bool compatible;
4444 int ret;
4545
46− sysfb_apply_efi_quirks();
47−
4846 /* try to create a simple-framebuffer device */
49− compatible = parse_mode(si, &mode);
47+ compatible = sysfb_parse_mode(si, &mode);
5048 if (compatible) {
51− ret = create_simplefb(si, &mode);
49+ ret = sysfb_create_simplefb(si, &mode);
5250 if (!ret)
5351 return 0;
5452 }
@@ -61,9 +59,24 @@ static __init int sysfb_init(void) · 6 unmodified lines
6159 else
6260 name = "platform-framebuffer";
6361
64− pd = platform_device_register_resndata(NULL, name, 0,
65− NULL, 0, si, sizeof(*si));
66− return PTR_ERR_OR_ZERO(pd);
62+ pd = platform_device_alloc(name, 0);
63+ if (!pd)
64+ return -ENOMEM;
65+
66+ sysfb_apply_efi_quirks(pd);
67+
68+ ret = platform_device_add_data(pd, si, sizeof(*si));
69+ if (ret)
70+ goto err;
71+
72+ ret = platform_device_add(pd);
73+ if (ret)
74+ goto err;
75+
76+ return 0;
77+err:
78+ platform_device_put(pd);
79+ return ret;
6780 }
6881
6982 /* must execute after PCI subsystem for EFI quirks */
drivers/firmware/sysfb_simplefb.crenamed from arch/x86/kernel/sysfb_simplefb.c+23−10
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /*
3− * Generic System Framebuffers on x86
3+ * Generic System Framebuffers
44 * Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
55 */
66
@@ -18,14 +18,14 @@ · 11 unmodified lines
1818 #include <linux/platform_data/simplefb.h>
1919 #include <linux/platform_device.h>
2020 #include <linux/screen_info.h>
21−#include <asm/sysfb.h>
21+#include <linux/sysfb.h>
2222
2323 static const char simplefb_resname[] = "BOOTFB";
2424 static const struct simplefb_format formats[] = SIMPLEFB_FORMATS;
2525
26−/* try parsing x86 screen_info into a simple-framebuffer mode struct */
27−__init bool parse_mode(const struct screen_info *si,
28− struct simplefb_platform_data *mode)
26+/* try parsing screen_info into a simple-framebuffer mode struct */
27+__init bool sysfb_parse_mode(const struct screen_info *si,
28+ struct simplefb_platform_data *mode)
2929 {
3030 const struct simplefb_format *f;
3131 __u8 type;
@@ -57,13 +57,14 @@ __init bool parse_mode(const struct screen_info *si, · 25 unmodified lines
5757 return false;
5858 }
5959
60−__init int create_simplefb(const struct screen_info *si,
61− const struct simplefb_platform_data *mode)
60+__init int sysfb_create_simplefb(const struct screen_info *si,
61+ const struct simplefb_platform_data *mode)
6262 {
6363 struct platform_device *pd;
6464 struct resource res;
6565 u64 base, size;
6666 u32 length;
67+ int ret;
6768
6869 /*
6970 * If the 64BIT_BASE capability is set, ext_lfb_base will contain the
@@ -105,7 +106,19 @@ __init int create_simplefb(const struct screen_info *si, · 35 unmodified lines
105106 if (res.end <= res.start)
106107 return -EINVAL;
107108
108− pd = platform_device_register_resndata(NULL, "simple-framebuffer", 0,
109− &res, 1, mode, sizeof(*mode));
110− return PTR_ERR_OR_ZERO(pd);
109+ pd = platform_device_alloc("simple-framebuffer", 0);
110+ if (!pd)
111+ return -ENOMEM;
112+
113+ sysfb_apply_efi_quirks(pd);
114+
115+ ret = platform_device_add_resources(pd, &res, 1);
116+ if (ret)
117+ return ret;
118+
119+ ret = platform_device_add_data(pd, mode, sizeof(*mode));
120+ if (ret)
121+ return ret;
122+
123+ return platform_device_add(pd);
111124 }
drivers/gpu/drm/Kconfig+5−3
@@ -35,6 +35,11 @@ config DRM_MIPI_DSI · 34 unmodified lines
3535 bool
3636 depends on DRM
3737
38+config DRM_DP_AUX_BUS
39+ tristate
40+ depends on DRM
41+ depends on OF
42+
3843 config DRM_DP_AUX_CHARDEV
3944 bool "DRM DP AUX Interface"
4045 depends on DRM
@@ -251,7 +256,6 @@ config DRM_AMDGPU · 210 unmodified lines
251256 select HWMON
252257 select BACKLIGHT_CLASS_DEVICE
253258 select INTERVAL_TREE
254− select CHASH
255259 help
256260 Choose this option if you have a recent AMD Radeon graphics card.
257261
@@ -317,8 +321,6 @@ source "drivers/gpu/drm/tilcdc/Kconfig" · 59 unmodified lines
317321
318322 source "drivers/gpu/drm/qxl/Kconfig"
319323
320−source "drivers/gpu/drm/bochs/Kconfig"
321−
322324 source "drivers/gpu/drm/virtio/Kconfig"
323325
324326 source "drivers/gpu/drm/msm/Kconfig"
drivers/gpu/drm/Makefile+2−1
@@ -33,6 +33,8 @@ drm-$(CONFIG_PCI) += drm_pci.o · 32 unmodified lines
3333 drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o
3434 drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
3535
36+obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o
37+
3638 drm_vram_helper-y := drm_gem_vram_helper.o
3739 obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
3840
@@ -96,7 +98,6 @@ obj-y += omapdrm/ · 57 unmodified lines
9698 obj-$(CONFIG_DRM_SUN4I) += sun4i/
9799 obj-y += tilcdc/
98100 obj-$(CONFIG_DRM_QXL) += qxl/
99−obj-$(CONFIG_DRM_BOCHS) += bochs/
100101 obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/
101102 obj-$(CONFIG_DRM_MSM) += msm/
102103 obj-$(CONFIG_DRM_TEGRA) += tegra/
drivers/gpu/drm/amd/amdgpu/Makefile+9−3
@@ -57,7 +57,8 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ · 56 unmodified lines
5757 amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \
5858 amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \
5959 amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o \
60− amdgpu_fw_attestation.o amdgpu_securedisplay.o amdgpu_hdp.o
60+ amdgpu_fw_attestation.o amdgpu_securedisplay.o amdgpu_hdp.o \
61+ amdgpu_eeprom.o amdgpu_mca.o
6162
6263 amdgpu-$(CONFIG_PROC_FS) += amdgpu_fdinfo.o
6364
@@ -75,7 +76,7 @@ amdgpu-y += \ · 11 unmodified lines
7576 vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o navi14_reg_init.o \
7677 arct_reg_init.o navi12_reg_init.o mxgpu_nv.o sienna_cichlid_reg_init.o vangogh_reg_init.o \
7778 nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o hdp_v5_0.o aldebaran_reg_init.o aldebaran.o \
78− beige_goby_reg_init.o yellow_carp_reg_init.o
79+ beige_goby_reg_init.o yellow_carp_reg_init.o cyan_skillfish_reg_init.o
7980
8081 # add DF block
8182 amdgpu-y += \
@@ -111,6 +112,7 @@ amdgpu-y += \ · 29 unmodified lines
111112 psp_v3_1.o \
112113 psp_v10_0.o \
113114 psp_v11_0.o \
115+ psp_v11_0_8.o \
114116 psp_v12_0.o \
115117 psp_v13_0.o
116118
@@ -118,7 +120,7 @@ amdgpu-y += \ · 1 unmodified line
118120 amdgpu-y += \
119121 dce_v10_0.o \
120122 dce_v11_0.o \
121− dce_virtual.o
123+ amdgpu_vkms.o
122124
123125 # add GFX block
124126 amdgpu-y += \
@@ -187,6 +189,10 @@ amdgpu-y += \ · 62 unmodified lines
187189 amdgpu-y += \
188190 amdgpu_reset.o
189191
192+# add MCA block
193+amdgpu-y += \
194+ mca_v3_0.o
195+
190196 # add amdkfd interfaces
191197 amdgpu-y += amdgpu_amdkfd.o
192198
drivers/gpu/drm/amd/amdgpu/amdgpu.h+15−3
@@ -108,6 +108,7 @@ · 107 unmodified lines
108108 #include "amdgpu_df.h"
109109 #include "amdgpu_smuio.h"
110110 #include "amdgpu_fdinfo.h"
111+#include "amdgpu_mca.h"
111112
112113 #define MAX_GPU_INSTANCE 16
113114
@@ -916,6 +917,7 @@ struct amdgpu_device { · 802 unmodified lines
916917
917918 /* display */
918919 bool enable_virtual_display;
920+ struct amdgpu_vkms_output *amdgpu_vkms_output;
919921 struct amdgpu_mode_info mode_info;
920922 /* For pre-DCE11. DCE11 and later are in "struct amdgpu_device->dm" */
921923 struct work_struct hotplug_work;
@@ -1008,6 +1010,9 @@ struct amdgpu_device { · 86 unmodified lines
10081010 /* df */
10091011 struct amdgpu_df df;
10101012
1013+ /* MCA */
1014+ struct amdgpu_mca mca;
1015+
10111016 struct amdgpu_ip_block ip_blocks[AMDGPU_MAX_IP_NUM];
10121017 uint32_t harvest_ip_mask;
10131018 int num_ip_blocks;
@@ -1108,8 +1113,13 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev); · 94 unmodified lines
11081113
11091114 int amdgpu_gpu_wait_for_idle(struct amdgpu_device *adev);
11101115
1116+void amdgpu_device_mm_access(struct amdgpu_device *adev, loff_t pos,
1117+ void *buf, size_t size, bool write);
1118+size_t amdgpu_device_aper_access(struct amdgpu_device *adev, loff_t pos,
1119+ void *buf, size_t size, bool write);
1120+
11111121 void amdgpu_device_vram_access(struct amdgpu_device *adev, loff_t pos,
1112− uint32_t *buf, size_t size, bool write);
1122+ void *buf, size_t size, bool write);
11131123 uint32_t amdgpu_device_rreg(struct amdgpu_device *adev,
11141124 uint32_t reg, uint32_t acc_flags);
11151125 void amdgpu_device_wreg(struct amdgpu_device *adev,
@@ -1265,6 +1275,8 @@ int emu_soc_asic_init(struct amdgpu_device *adev); · 149 unmodified lines
12651275
12661276 #define amdgpu_inc_vram_lost(adev) atomic_inc(&((adev)->vram_lost_counter));
12671277
1278+#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
1279+
12681280 /* Common functions */
12691281 bool amdgpu_device_has_job_running(struct amdgpu_device *adev);
12701282 bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev);
@@ -1385,12 +1397,12 @@ int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_sta · 114 unmodified lines
13851397 int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
13861398
13871399 void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);
1388−bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev);
1400+bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
13891401 void amdgpu_acpi_detect(void);
13901402 #else
13911403 static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
13921404 static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
1393−static inline bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev) { return false; }
1405+static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
13941406 static inline void amdgpu_acpi_detect(void) { }
13951407 static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
13961408 static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c+26−28
@@ -160,17 +160,28 @@ static int acp_poweron(struct generic_pm_domain *genpd) · 159 unmodified lines
160160 return 0;
161161 }
162162
163−static struct device *get_mfd_cell_dev(const char *device_name, int r)
163+static int acp_genpd_add_device(struct device *dev, void *data)
164164 {
165− char auto_dev_name[25];
166− struct device *dev;
165+ struct generic_pm_domain *gpd = data;
166+ int ret;
167167
168− snprintf(auto_dev_name, sizeof(auto_dev_name),
169− "%s.%d.auto", device_name, r);
170− dev = bus_find_device_by_name(&platform_bus_type, NULL, auto_dev_name);
171− dev_info(dev, "device %s added to pm domain\n", auto_dev_name);
168+ ret = pm_genpd_add_device(gpd, dev);
169+ if (ret)
170+ dev_err(dev, "Failed to add dev to genpd %d\n", ret);
172171
173− return dev;
172+ return ret;
173+}
174+
175+static int acp_genpd_remove_device(struct device *dev, void *data)
176+{
177+ int ret;
178+
179+ ret = pm_genpd_remove_device(dev);
180+ if (ret)
181+ dev_err(dev, "Failed to remove dev from genpd %d\n", ret);
182+
183+ /* Continue to remove */
184+ return 0;
174185 }
175186
176187 /**
@@ -181,11 +192,10 @@ static struct device *get_mfd_cell_dev(const char *device_name, int r) · 4 unmodified lines
181192 */
182193 static int acp_hw_init(void *handle)
183194 {
184− int r, i;
195+ int r;
185196 uint64_t acp_base;
186197 u32 val = 0;
187198 u32 count = 0;
188− struct device *dev;
189199 struct i2s_platform_data *i2s_pdata = NULL;
190200
191201 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -341,15 +351,10 @@ static int acp_hw_init(void *handle) · 149 unmodified lines
341351 if (r)
342352 goto failure;
343353
344− for (i = 0; i < ACP_DEVS ; i++) {
345− dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
346− r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev);
347− if (r) {
348− dev_err(dev, "Failed to add dev to genpd\n");
349− goto failure;
350− }
351− }
352−
354+ r = device_for_each_child(adev->acp.parent, &adev->acp.acp_genpd->gpd,
355+ acp_genpd_add_device);
356+ if (r)
357+ goto failure;
353358
354359 /* Assert Soft reset of ACP */
355360 val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET);
@@ -410,10 +415,8 @@ failure: · 54 unmodified lines
410415 */
411416 static int acp_hw_fini(void *handle)
412417 {
413− int i, ret;
414418 u32 val = 0;
415419 u32 count = 0;
416− struct device *dev;
417420 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
418421
419422 /* return early if no ACP */
@@ -458,13 +461,8 @@ static int acp_hw_fini(void *handle) · 38 unmodified lines
458461 udelay(100);
459462 }
460463
461− for (i = 0; i < ACP_DEVS ; i++) {
462− dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
463− ret = pm_genpd_remove_device(dev);
464− /* If removal fails, dont giveup and try rest */
465− if (ret)
466− dev_err(dev, "remove dev from genpd failed\n");
467− }
464+ device_for_each_child(adev->acp.parent, NULL,
465+ acp_genpd_remove_device);
468466
469467 mfd_remove_devices(adev->acp.parent);
470468 kfree(adev->acp.acp_res);
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c+4−4
@@ -854,8 +854,8 @@ int amdgpu_acpi_init(struct amdgpu_device *adev) · 853 unmodified lines
854854 if (amdgpu_device_has_dc_support(adev)) {
855855 #if defined(CONFIG_DRM_AMD_DC)
856856 struct amdgpu_display_manager *dm = &adev->dm;
857− if (dm->backlight_dev)
858− atif->bd = dm->backlight_dev;
857+ if (dm->backlight_dev[0])
858+ atif->bd = dm->backlight_dev[0];
859859 #endif
860860 } else {
861861 struct drm_encoder *tmp;
@@ -1032,13 +1032,13 @@ void amdgpu_acpi_detect(void) · 170 unmodified lines
10321032 }
10331033
10341034 /**
1035− * amdgpu_acpi_is_s0ix_supported
1035+ * amdgpu_acpi_is_s0ix_active
10361036 *
10371037 * @adev: amdgpu_device_pointer
10381038 *
10391039 * returns true if supported, false if not.
10401040 */
1041−bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)
1041+bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
10421042 {
10431043 #if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)
10441044 if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c+83−1
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 */
2222
2323 #include "amdgpu_amdkfd.h"
24+#include "amd_pcie.h"
2425 #include "amd_shared.h"
2526
2627 #include "amdgpu.h"
@@ -553,6 +554,88 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s · 526 unmodified lines
553554 return (uint8_t)ret;
554555 }
555556
557+int amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(struct kgd_dev *dst, struct kgd_dev *src, bool is_min)
558+{
559+ struct amdgpu_device *adev = (struct amdgpu_device *)dst, *peer_adev;
560+ int num_links;
561+
562+ if (adev->asic_type != CHIP_ALDEBARAN)
563+ return 0;
564+
565+ if (src)
566+ peer_adev = (struct amdgpu_device *)src;
567+
568+ /* num links returns 0 for indirect peers since indirect route is unknown. */
569+ num_links = is_min ? 1 : amdgpu_xgmi_get_num_links(adev, peer_adev);
570+ if (num_links < 0) {
571+ DRM_ERROR("amdgpu: failed to get xgmi num links between node %d and %d. ret = %d\n",
572+ adev->gmc.xgmi.physical_node_id,
573+ peer_adev->gmc.xgmi.physical_node_id, num_links);
574+ num_links = 0;
575+ }
576+
577+ /* Aldebaran xGMI DPM is defeatured so assume x16 x 25Gbps for bandwidth. */
578+ return (num_links * 16 * 25000)/BITS_PER_BYTE;
579+}
580+
581+int amdgpu_amdkfd_get_pcie_bandwidth_mbytes(struct kgd_dev *dev, bool is_min)
582+{
583+ struct amdgpu_device *adev = (struct amdgpu_device *)dev;
584+ int num_lanes_shift = (is_min ? ffs(adev->pm.pcie_mlw_mask) :
585+ fls(adev->pm.pcie_mlw_mask)) - 1;
586+ int gen_speed_shift = (is_min ? ffs(adev->pm.pcie_gen_mask &
587+ CAIL_PCIE_LINK_SPEED_SUPPORT_MASK) :
588+ fls(adev->pm.pcie_gen_mask &
589+ CAIL_PCIE_LINK_SPEED_SUPPORT_MASK)) - 1;
590+ uint32_t num_lanes_mask = 1 << num_lanes_shift;
591+ uint32_t gen_speed_mask = 1 << gen_speed_shift;
592+ int num_lanes_factor = 0, gen_speed_mbits_factor = 0;
593+
594+ switch (num_lanes_mask) {
595+ case CAIL_PCIE_LINK_WIDTH_SUPPORT_X1:
596+ num_lanes_factor = 1;
597+ break;
598+ case CAIL_PCIE_LINK_WIDTH_SUPPORT_X2:
599+ num_lanes_factor = 2;
600+ break;
601+ case CAIL_PCIE_LINK_WIDTH_SUPPORT_X4:
602+ num_lanes_factor = 4;
603+ break;
604+ case CAIL_PCIE_LINK_WIDTH_SUPPORT_X8:
605+ num_lanes_factor = 8;
606+ break;
607+ case CAIL_PCIE_LINK_WIDTH_SUPPORT_X12:
608+ num_lanes_factor = 12;
609+ break;
610+ case CAIL_PCIE_LINK_WIDTH_SUPPORT_X16:
611+ num_lanes_factor = 16;
612+ break;
613+ case CAIL_PCIE_LINK_WIDTH_SUPPORT_X32:
614+ num_lanes_factor = 32;
615+ break;
616+ }
617+
618+ switch (gen_speed_mask) {
619+ case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1:
620+ gen_speed_mbits_factor = 2500;
621+ break;
622+ case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2:
623+ gen_speed_mbits_factor = 5000;
624+ break;
625+ case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3:
626+ gen_speed_mbits_factor = 8000;
627+ break;
628+ case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4:
629+ gen_speed_mbits_factor = 16000;
630+ break;
631+ case CAIL_PCIE_LINK_SPEED_SUPPORT_GEN5:
632+ gen_speed_mbits_factor = 32000;
633+ break;
634+ }
635+
636+ return (num_lanes_factor * gen_speed_mbits_factor)/BITS_PER_BYTE;
637+}
638+
556639 uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr(struct kgd_dev *kgd)
557640 {
558641 struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
@@ -631,7 +714,6 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine, · 72 unmodified lines
631714 ret = dma_fence_wait(f, false);
632715
633716 err_ib_sched:
634− dma_fence_put(f);
635717 amdgpu_job_free(job);
636718 err:
637719 return ret;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h+5−3
@@ -226,6 +226,8 @@ uint32_t amdgpu_amdkfd_get_num_gws(struct kgd_dev *kgd); · 225 unmodified lines
226226 uint32_t amdgpu_amdkfd_get_asic_rev_id(struct kgd_dev *kgd);
227227 int amdgpu_amdkfd_get_noretry(struct kgd_dev *kgd);
228228 uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *src);
229+int amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(struct kgd_dev *dst, struct kgd_dev *src, bool is_min);
230+int amdgpu_amdkfd_get_pcie_bandwidth_mbytes(struct kgd_dev *dev, bool is_min);
229231
230232 /* Read user wptr from a specified user address space with page fault
231233 * disabled. The memory must be pinned and mapped to the hardware when
@@ -269,7 +271,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( · 37 unmodified lines
269271 struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv,
270272 uint64_t *size);
271273 int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
272− struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv);
274+ struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv, bool *table_freed);
273275 int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
274276 struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv);
275277 int amdgpu_amdkfd_gpuvm_sync_memory(
@@ -330,7 +332,7 @@ int kgd2kfd_pre_reset(struct kfd_dev *kfd); · 54 unmodified lines
330332 int kgd2kfd_post_reset(struct kfd_dev *kfd);
331333 void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry);
332334 void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd);
333−void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint32_t throttle_bitmask);
335+void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask);
334336 #else
335337 static inline int kgd2kfd_init(void)
336338 {
@@ -389,7 +391,7 @@ void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd) · 52 unmodified lines
389391 }
390392
391393 static inline
392−void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint32_t throttle_bitmask)
394+void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask)
393395 {
394396 }
395397 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c+1−0
@@ -44,4 +44,5 @@ const struct kfd2kgd_calls aldebaran_kfd2kgd = { · 43 unmodified lines
4444 .get_atc_vmid_pasid_mapping_info =
4545 kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
4646 .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,
47+ .program_trap_handler_settings = kgd_gfx_v9_program_trap_handler_settings
4748 };
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c+2−1
@@ -305,5 +305,6 @@ const struct kfd2kgd_calls arcturus_kfd2kgd = { · 304 unmodified lines
305305 kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
306306 .set_vm_context_page_table_base =
307307 kgd_gfx_v9_set_vm_context_page_table_base,
308− .get_cu_occupancy = kgd_gfx_v9_get_cu_occupancy
308+ .get_cu_occupancy = kgd_gfx_v9_get_cu_occupancy,
309+ .program_trap_handler_settings = kgd_gfx_v9_program_trap_handler_settings
309310 };
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c+31−0
@@ -560,6 +560,9 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd, · 559 unmodified lines
560560 case KFD_PREEMPT_TYPE_WAVEFRONT_RESET:
561561 type = RESET_WAVES;
562562 break;
563+ case KFD_PREEMPT_TYPE_WAVEFRONT_SAVE:
564+ type = SAVE_WAVES;
565+ break;
563566 default:
564567 type = DRAIN_PIPE;
565568 break;
@@ -754,6 +757,33 @@ static void set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t vmid, · 188 unmodified lines
754757 adev->gfxhub.funcs->setup_vm_pt_regs(adev, vmid, page_table_base);
755758 }
756759
760+static void program_trap_handler_settings(struct kgd_dev *kgd,
761+ uint32_t vmid, uint64_t tba_addr, uint64_t tma_addr)
762+{
763+ struct amdgpu_device *adev = get_amdgpu_device(kgd);
764+
765+ lock_srbm(kgd, 0, 0, 0, vmid);
766+
767+ /*
768+ * Program TBA registers
769+ */
770+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TBA_LO),
771+ lower_32_bits(tba_addr >> 8));
772+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TBA_HI),
773+ upper_32_bits(tba_addr >> 8) |
774+ (1 << SQ_SHADER_TBA_HI__TRAP_EN__SHIFT));
775+
776+ /*
777+ * Program TMA registers
778+ */
779+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TMA_LO),
780+ lower_32_bits(tma_addr >> 8));
781+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TMA_HI),
782+ upper_32_bits(tma_addr >> 8));
783+
784+ unlock_srbm(kgd);
785+}
786+
757787 const struct kfd2kgd_calls gfx_v10_kfd2kgd = {
758788 .program_sh_mem_settings = kgd_program_sh_mem_settings,
759789 .set_pasid_vmid_mapping = kgd_set_pasid_vmid_mapping,
@@ -774,4 +804,5 @@ const struct kfd2kgd_calls gfx_v10_kfd2kgd = { · 14 unmodified lines
774804 .get_atc_vmid_pasid_mapping_info =
775805 get_atc_vmid_pasid_mapping_info,
776806 .set_vm_context_page_table_base = set_vm_context_page_table_base,
807+ .program_trap_handler_settings = program_trap_handler_settings,
777808 };
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c+31−0
@@ -537,6 +537,9 @@ static int hqd_destroy_v10_3(struct kgd_dev *kgd, void *mqd, · 536 unmodified lines
537537 case KFD_PREEMPT_TYPE_WAVEFRONT_RESET:
538538 type = RESET_WAVES;
539539 break;
540+ case KFD_PREEMPT_TYPE_WAVEFRONT_SAVE:
541+ type = SAVE_WAVES;
542+ break;
540543 default:
541544 type = DRAIN_PIPE;
542545 break;
@@ -658,6 +661,33 @@ static void set_vm_context_page_table_base_v10_3(struct kgd_dev *kgd, uint32_t v · 115 unmodified lines
658661 adev->gfxhub.funcs->setup_vm_pt_regs(adev, vmid, page_table_base);
659662 }
660663
664+static void program_trap_handler_settings_v10_3(struct kgd_dev *kgd,
665+ uint32_t vmid, uint64_t tba_addr, uint64_t tma_addr)
666+{
667+ struct amdgpu_device *adev = get_amdgpu_device(kgd);
668+
669+ lock_srbm(kgd, 0, 0, 0, vmid);
670+
671+ /*
672+ * Program TBA registers
673+ */
674+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TBA_LO),
675+ lower_32_bits(tba_addr >> 8));
676+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TBA_HI),
677+ upper_32_bits(tba_addr >> 8) |
678+ (1 << SQ_SHADER_TBA_HI__TRAP_EN__SHIFT));
679+
680+ /*
681+ * Program TMA registers
682+ */
683+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TMA_LO),
684+ lower_32_bits(tma_addr >> 8));
685+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TMA_HI),
686+ upper_32_bits(tma_addr >> 8));
687+
688+ unlock_srbm(kgd);
689+}
690+
661691 #if 0
662692 uint32_t enable_debug_trap_v10_3(struct kgd_dev *kgd,
663693 uint32_t trap_debug_wave_launch_mode,
@@ -820,6 +850,7 @@ const struct kfd2kgd_calls gfx_v10_3_kfd2kgd = { · 156 unmodified lines
820850 .address_watch_get_offset = address_watch_get_offset_v10_3,
821851 .get_atc_vmid_pasid_mapping_info = NULL,
822852 .set_vm_context_page_table_base = set_vm_context_page_table_base_v10_3,
853+ .program_trap_handler_settings = program_trap_handler_settings_v10_3,
823854 #if 0
824855 .enable_debug_trap = enable_debug_trap_v10_3,
825856 .disable_debug_trap = disable_debug_trap_v10_3,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c+32−1
@@ -42,7 +42,8 @@ · 41 unmodified lines
4242 enum hqd_dequeue_request_type {
4343 NO_ACTION = 0,
4444 DRAIN_PIPE,
45− RESET_WAVES
45+ RESET_WAVES,
46+ SAVE_WAVES
4647 };
4748
4849 static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)
@@ -566,6 +567,9 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd, · 517 unmodified lines
566567 case KFD_PREEMPT_TYPE_WAVEFRONT_RESET:
567568 type = RESET_WAVES;
568569 break;
570+ case KFD_PREEMPT_TYPE_WAVEFRONT_SAVE:
571+ type = SAVE_WAVES;
572+ break;
569573 default:
570574 type = DRAIN_PIPE;
571575 break;
@@ -878,6 +882,32 @@ void kgd_gfx_v9_get_cu_occupancy(struct kgd_dev *kgd, int pasid, · 306 unmodified lines
878882 adev->gfx.cu_info.max_waves_per_simd;
879883 }
880884
885+void kgd_gfx_v9_program_trap_handler_settings(struct kgd_dev *kgd,
886+ uint32_t vmid, uint64_t tba_addr, uint64_t tma_addr)
887+{
888+ struct amdgpu_device *adev = get_amdgpu_device(kgd);
889+
890+ lock_srbm(kgd, 0, 0, 0, vmid);
891+
892+ /*
893+ * Program TBA registers
894+ */
895+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TBA_LO),
896+ lower_32_bits(tba_addr >> 8));
897+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TBA_HI),
898+ upper_32_bits(tba_addr >> 8));
899+
900+ /*
901+ * Program TMA registers
902+ */
903+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TMA_LO),
904+ lower_32_bits(tma_addr >> 8));
905+ WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TMA_HI),
906+ upper_32_bits(tma_addr >> 8));
907+
908+ unlock_srbm(kgd);
909+}
910+
881911 const struct kfd2kgd_calls gfx_v9_kfd2kgd = {
882912 .program_sh_mem_settings = kgd_gfx_v9_program_sh_mem_settings,
883913 .set_pasid_vmid_mapping = kgd_gfx_v9_set_pasid_vmid_mapping,
@@ -899,4 +929,5 @@ const struct kfd2kgd_calls gfx_v9_kfd2kgd = { · 15 unmodified lines
899929 kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
900930 .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,
901931 .get_cu_occupancy = kgd_gfx_v9_get_cu_occupancy,
932+ .program_trap_handler_settings = kgd_gfx_v9_program_trap_handler_settings,
902933 };
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h+2−0
@@ -65,3 +65,5 @@ void kgd_gfx_v9_set_vm_context_page_table_base(struct kgd_dev *kgd, · 64 unmodified lines
6565 uint32_t vmid, uint64_t page_table_base);
6666 void kgd_gfx_v9_get_cu_occupancy(struct kgd_dev *kgd, int pasid,
6767 int *pasid_wave_cnt, int *max_waves_per_cu);
68+void kgd_gfx_v9_program_trap_handler_settings(struct kgd_dev *kgd,
69+ uint32_t vmid, uint64_t tba_addr, uint64_t tma_addr);
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c+29−9
@@ -1057,7 +1057,8 @@ static void unmap_bo_from_gpuvm(struct kgd_mem *mem, · 1056 unmodified lines
10571057
10581058 static int update_gpuvm_pte(struct kgd_mem *mem,
10591059 struct kfd_mem_attachment *entry,
1060− struct amdgpu_sync *sync)
1060+ struct amdgpu_sync *sync,
1061+ bool *table_freed)
10611062 {
10621063 struct amdgpu_bo_va *bo_va = entry->bo_va;
10631064 struct amdgpu_device *adev = entry->adev;
@@ -1068,7 +1069,7 @@ static int update_gpuvm_pte(struct kgd_mem *mem, · 4 unmodified lines
10681069 return ret;
10691070
10701071 /* Update the page tables */
1071− ret = amdgpu_vm_bo_update(adev, bo_va, false);
1072+ ret = amdgpu_vm_bo_update(adev, bo_va, false, table_freed);
10721073 if (ret) {
10731074 pr_err("amdgpu_vm_bo_update failed\n");
10741075 return ret;
@@ -1080,7 +1081,8 @@ static int update_gpuvm_pte(struct kgd_mem *mem, · 5 unmodified lines
10801081 static int map_bo_to_gpuvm(struct kgd_mem *mem,
10811082 struct kfd_mem_attachment *entry,
10821083 struct amdgpu_sync *sync,
1083− bool no_update_pte)
1084+ bool no_update_pte,
1085+ bool *table_freed)
10841086 {
10851087 int ret;
10861088
@@ -1097,7 +1099,7 @@ static int map_bo_to_gpuvm(struct kgd_mem *mem, · 10 unmodified lines
10971099 if (no_update_pte)
10981100 return 0;
10991101
1100− ret = update_gpuvm_pte(mem, entry, sync);
1102+ ret = update_gpuvm_pte(mem, entry, sync, table_freed);
11011103 if (ret) {
11021104 pr_err("update_gpuvm_pte() failed\n");
11031105 goto update_gpuvm_pte_failed;
@@ -1285,11 +1287,22 @@ int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd, · 181 unmodified lines
12851287 if (avm->process_info)
12861288 return -EINVAL;
12871289
1290+ /* Free the original amdgpu allocated pasid,
1291+ * will be replaced with kfd allocated pasid.
1292+ */
1293+ if (avm->pasid) {
1294+ amdgpu_pasid_free(avm->pasid);
1295+ amdgpu_vm_set_pasid(adev, avm, 0);
1296+ }
1297+
12881298 /* Convert VM into a compute VM */
1289− ret = amdgpu_vm_make_compute(adev, avm, pasid);
1299+ ret = amdgpu_vm_make_compute(adev, avm);
12901300 if (ret)
12911301 return ret;
12921302
1303+ ret = amdgpu_vm_set_pasid(adev, avm, pasid);
1304+ if (ret)
1305+ return ret;
12931306 /* Initialize KFD part of the VM and process info */
12941307 ret = init_kfd_vm(avm, process_info, ef);
12951308 if (ret)
@@ -1594,7 +1607,8 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( · 298 unmodified lines
15941607 }
15951608
15961609 int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
1597− struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv)
1610+ struct kgd_dev *kgd, struct kgd_mem *mem,
1611+ void *drm_priv, bool *table_freed)
15981612 {
15991613 struct amdgpu_device *adev = get_amdgpu_device(kgd);
16001614 struct amdgpu_vm *avm = drm_priv_to_vm(drm_priv);
@@ -1682,7 +1696,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu( · 81 unmodified lines
16821696 entry->va, entry->va + bo_size, entry);
16831697
16841698 ret = map_bo_to_gpuvm(mem, entry, ctx.sync,
1685− is_invalid_userptr);
1699+ is_invalid_userptr, table_freed);
16861700 if (ret) {
16871701 pr_err("Failed to map bo to gpuvm\n");
16881702 goto out_unreserve;
@@ -1706,6 +1720,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu( · 17 unmodified lines
17061720 true);
17071721 ret = unreserve_bo_and_vms(&ctx, false, false);
17081722
1723+ /* Only apply no TLB flush on Aldebaran to
1724+ * workaround regressions on other Asics.
1725+ */
1726+ if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
1727+ *table_freed = true;
1728+
17091729 goto out;
17101730
17111731 out_unreserve:
@@ -2132,7 +2152,7 @@ static int validate_invalid_user_pages(struct amdkfd_process_info *process_info) · 420 unmodified lines
21322152 continue;
21332153
21342154 kfd_mem_dmaunmap_attachment(mem, attachment);
2135− ret = update_gpuvm_pte(mem, attachment, &sync);
2155+ ret = update_gpuvm_pte(mem, attachment, &sync, NULL);
21362156 if (ret) {
21372157 pr_err("%s: update PTE failed\n", __func__);
21382158 /* make sure this gets validated again */
@@ -2338,7 +2358,7 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef) · 199 unmodified lines
23382358 continue;
23392359
23402360 kfd_mem_dmaunmap_attachment(mem, attachment);
2341− ret = update_gpuvm_pte(mem, attachment, &sync_obj);
2361+ ret = update_gpuvm_pte(mem, attachment, &sync_obj, NULL);
23422362 if (ret) {
23432363 pr_debug("Memory eviction: update PTE failed. Try again\n");
23442364 goto validate_map_fail;
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h+1−0
@@ -34,6 +34,7 @@ struct amdgpu_fpriv; · 33 unmodified lines
3434 struct amdgpu_bo_list_entry {
3535 struct ttm_validate_buffer tv;
3636 struct amdgpu_bo_va *bo_va;
37+ struct dma_fence_chain *chain;
3738 uint32_t priority;
3839 struct page **user_pages;
3940 bool user_invalidated;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c+56−16
@@ -572,6 +572,20 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 571 unmodified lines
572572 goto out;
573573 }
574574
575+ amdgpu_bo_list_for_each_entry(e, p->bo_list) {
576+ struct amdgpu_bo *bo = ttm_to_amdgpu_bo(e->tv.bo);
577+
578+ e->bo_va = amdgpu_vm_bo_find(vm, bo);
579+
580+ if (bo->tbo.base.dma_buf && !amdgpu_bo_explicit_sync(bo)) {
581+ e->chain = dma_fence_chain_alloc();
582+ if (!e->chain) {
583+ r = -ENOMEM;
584+ goto error_validate;
585+ }
586+ }
587+ }
588+
575589 amdgpu_cs_get_threshold_for_moves(p->adev, &p->bytes_moved_threshold,
576590 &p->bytes_moved_vis_threshold);
577591 p->bytes_moved = 0;
@@ -599,15 +613,6 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 21 unmodified lines
599613 gws = p->bo_list->gws_obj;
600614 oa = p->bo_list->oa_obj;
601615
602− amdgpu_bo_list_for_each_entry(e, p->bo_list) {
603− struct amdgpu_bo *bo = ttm_to_amdgpu_bo(e->tv.bo);
604−
605− /* Make sure we use the exclusive slot for shared BOs */
606− if (bo->prime_shared_count)
607− e->tv.num_shared = 0;
608− e->bo_va = amdgpu_vm_bo_find(vm, bo);
609− }
610−
611616 if (gds) {
612617 p->job->gds_base = amdgpu_bo_gpu_offset(gds) >> PAGE_SHIFT;
613618 p->job->gds_size = amdgpu_bo_size(gds) >> PAGE_SHIFT;
@@ -629,8 +634,13 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 15 unmodified lines
629634 }
630635
631636 error_validate:
632− if (r)
637+ if (r) {
638+ amdgpu_bo_list_for_each_entry(e, p->bo_list) {
639+ dma_fence_chain_free(e->chain);
640+ e->chain = NULL;
641+ }
633642 ttm_eu_backoff_reservation(&p->ticket, &p->validated);
643+ }
634644 out:
635645 return r;
636646 }
@@ -670,9 +680,17 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, · 33 unmodified lines
670680 {
671681 unsigned i;
672682
673− if (error && backoff)
683+ if (error && backoff) {
684+ struct amdgpu_bo_list_entry *e;
685+
686+ amdgpu_bo_list_for_each_entry(e, parser->bo_list) {
687+ dma_fence_chain_free(e->chain);
688+ e->chain = NULL;
689+ }
690+
674691 ttm_eu_backoff_reservation(&parser->ticket,
675692 &parser->validated);
693+ }
676694
677695 for (i = 0; i < parser->num_post_deps; i++) {
678696 drm_syncobj_put(parser->post_deps[i].syncobj);
@@ -781,7 +799,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) · 102 unmodified lines
781799 if (r)
782800 return r;
783801
784− r = amdgpu_vm_bo_update(adev, fpriv->prt_va, false);
802+ r = amdgpu_vm_bo_update(adev, fpriv->prt_va, false, NULL);
785803 if (r)
786804 return r;
787805
@@ -792,7 +810,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) · 4 unmodified lines
792810 if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
793811 bo_va = fpriv->csa_va;
794812 BUG_ON(!bo_va);
795− r = amdgpu_vm_bo_update(adev, bo_va, false);
813+ r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
796814 if (r)
797815 return r;
798816
@@ -811,7 +829,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) · 12 unmodified lines
811829 if (bo_va == NULL)
812830 continue;
813831
814− r = amdgpu_vm_bo_update(adev, bo_va, false);
832+ r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
815833 if (r)
816834 return r;
817835
@@ -1109,7 +1127,7 @@ static int amdgpu_cs_process_syncobj_timeline_out_dep(struct amdgpu_cs_parser *p · 291 unmodified lines
11091127
11101128 dep->chain = NULL;
11111129 if (syncobj_deps[i].point) {
1112− dep->chain = kmalloc(sizeof(*dep->chain), GFP_KERNEL);
1130+ dep->chain = dma_fence_chain_alloc();
11131131 if (!dep->chain)
11141132 return -ENOMEM;
11151133 }
@@ -1117,7 +1135,7 @@ static int amdgpu_cs_process_syncobj_timeline_out_dep(struct amdgpu_cs_parser *p · 1 unmodified line
11171135 dep->syncobj = drm_syncobj_find(p->filp,
11181136 syncobj_deps[i].handle);
11191137 if (!dep->syncobj) {
1120− kfree(dep->chain);
1138+ dma_fence_chain_free(dep->chain);
11211139 return -EINVAL;
11221140 }
11231141 dep->point = syncobj_deps[i].point;
@@ -1245,6 +1263,28 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, · 121 unmodified lines
12451263
12461264 amdgpu_vm_move_to_lru_tail(p->adev, &fpriv->vm);
12471265
1266+ amdgpu_bo_list_for_each_entry(e, p->bo_list) {
1267+ struct dma_resv *resv = e->tv.bo->base.resv;
1268+ struct dma_fence_chain *chain = e->chain;
1269+
1270+ if (!chain)
1271+ continue;
1272+
1273+ /*
1274+ * Work around dma_resv shortcommings by wrapping up the
1275+ * submission in a dma_fence_chain and add it as exclusive
1276+ * fence, but first add the submission as shared fence to make
1277+ * sure that shared fences never signal before the exclusive
1278+ * one.
1279+ */
1280+ dma_fence_chain_init(chain, dma_resv_excl_fence(resv),
1281+ dma_fence_get(p->fence), 1);
1282+
1283+ dma_resv_add_shared_fence(resv, p->fence);
1284+ rcu_assign_pointer(resv->fence_excl, &chain->base);
1285+ e->chain = NULL;
1286+ }
1287+
12481288 ttm_eu_fence_buffer_objects(&p->ticket, &p->validated, p->fence);
12491289 mutex_unlock(&p->adev->notifier_lock);
12501290
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c+1−1
@@ -1414,7 +1414,7 @@ no_preempt: · 1413 unmodified lines
14141414 continue;
14151415 }
14161416 job = to_amdgpu_job(s_job);
1417− if (preempted && job->fence == fence)
1417+ if (preempted && (&job->hw_fence) == fence)
14181418 /* mark the job as preempted */
14191419 job->preemption_status |= AMDGPU_IB_PREEMPTED;
14201420 }
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+119−48
@@ -116,6 +116,7 @@ const char *amdgpu_asic_name[] = { · 115 unmodified lines
116116 "RENOIR",
117117 "ALDEBARAN",
118118 "NAVI10",
119+ "CYAN_SKILLFISH",
119120 "NAVI14",
120121 "NAVI12",
121122 "SIENNA_CICHLID",
@@ -287,7 +288,7 @@ bool amdgpu_device_supports_smart_shift(struct drm_device *dev) · 165 unmodified lines
287288 */
288289
289290 /**
290− * amdgpu_device_vram_access - read/write a buffer in vram
291+ * amdgpu_device_mm_access - access vram by MM_INDEX/MM_DATA
291292 *
292293 * @adev: amdgpu_device pointer
293294 * @pos: offset of the buffer in vram
@@ -295,22 +296,65 @@ bool amdgpu_device_supports_smart_shift(struct drm_device *dev) · 1 unmodified line
295296 * @size: read/write size, sizeof(@buf) must > @size
296297 * @write: true - write to vram, otherwise - read from vram
297298 */
298−void amdgpu_device_vram_access(struct amdgpu_device *adev, loff_t pos,
299− uint32_t *buf, size_t size, bool write)
299+void amdgpu_device_mm_access(struct amdgpu_device *adev, loff_t pos,
300+ void *buf, size_t size, bool write)
300301 {
301302 unsigned long flags;
302− uint32_t hi = ~0;
303+ uint32_t hi = ~0, tmp = 0;
304+ uint32_t *data = buf;
303305 uint64_t last;
304306 int idx;
305307
306308 if (!drm_dev_enter(&adev->ddev, &idx))
307309 return;
308310
311+ BUG_ON(!IS_ALIGNED(pos, 4) || !IS_ALIGNED(size, 4));
312+
313+ spin_lock_irqsave(&adev->mmio_idx_lock, flags);
314+ for (last = pos + size; pos < last; pos += 4) {
315+ tmp = pos >> 31;
316+
317+ WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t)pos) | 0x80000000);
318+ if (tmp != hi) {
319+ WREG32_NO_KIQ(mmMM_INDEX_HI, tmp);
320+ hi = tmp;
321+ }
322+ if (write)
323+ WREG32_NO_KIQ(mmMM_DATA, *data++);
324+ else
325+ *data++ = RREG32_NO_KIQ(mmMM_DATA);
326+ }
327+
328+ spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
329+ drm_dev_exit(idx);
330+}
331+
332+/**
333+ * amdgpu_device_vram_access - access vram by vram aperature
334+ *
335+ * @adev: amdgpu_device pointer
336+ * @pos: offset of the buffer in vram
337+ * @buf: virtual address of the buffer in system memory
338+ * @size: read/write size, sizeof(@buf) must > @size
339+ * @write: true - write to vram, otherwise - read from vram
340+ *
341+ * The return value means how many bytes have been transferred.
342+ */
343+size_t amdgpu_device_aper_access(struct amdgpu_device *adev, loff_t pos,
344+ void *buf, size_t size, bool write)
345+{
309346 #ifdef CONFIG_64BIT
347+ void __iomem *addr;
348+ size_t count = 0;
349+ uint64_t last;
350+
351+ if (!adev->mman.aper_base_kaddr)
352+ return 0;
353+
310354 last = min(pos + size, adev->gmc.visible_vram_size);
311355 if (last > pos) {
312− void __iomem *addr = adev->mman.aper_base_kaddr + pos;
313− size_t count = last - pos;
356+ addr = adev->mman.aper_base_kaddr + pos;
357+ count = last - pos;
314358
315359 if (write) {
316360 memcpy_toio(addr, buf, count);
@@ -322,35 +366,37 @@ void amdgpu_device_vram_access(struct amdgpu_device *adev, loff_t pos, · 5 unmodified lines
322366 memcpy_fromio(buf, addr, count);
323367 }
324368
325− if (count == size)
326− goto exit;
327−
328− pos += count;
329− buf += count / 4;
330− size -= count;
331369 }
370+
371+ return count;
372+#else
373+ return 0;
332374 #endif
375+}
333376
334− spin_lock_irqsave(&adev->mmio_idx_lock, flags);
335− for (last = pos + size; pos < last; pos += 4) {
336− uint32_t tmp = pos >> 31;
377+/**
378+ * amdgpu_device_vram_access - read/write a buffer in vram
379+ *
380+ * @adev: amdgpu_device pointer
381+ * @pos: offset of the buffer in vram
382+ * @buf: virtual address of the buffer in system memory
383+ * @size: read/write size, sizeof(@buf) must > @size
384+ * @write: true - write to vram, otherwise - read from vram
385+ */
386+void amdgpu_device_vram_access(struct amdgpu_device *adev, loff_t pos,
387+ void *buf, size_t size, bool write)
388+{
389+ size_t count;
337390
338− WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t)pos) | 0x80000000);
339− if (tmp != hi) {
340− WREG32_NO_KIQ(mmMM_INDEX_HI, tmp);
341− hi = tmp;
342− }
343− if (write)
344− WREG32_NO_KIQ(mmMM_DATA, *buf++);
345− else
346− *buf++ = RREG32_NO_KIQ(mmMM_DATA);
391+ /* try to using vram apreature to access vram first */
392+ count = amdgpu_device_aper_access(adev, pos, buf, size, write);
393+ size -= count;
394+ if (size) {
395+ /* using MM to access rest vram */
396+ pos += count;
397+ buf += count;
398+ amdgpu_device_mm_access(adev, pos, buf, size, write);
347399 }
348− spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
349−
350−#ifdef CONFIG_64BIT
351−exit:
352−#endif
353− drm_dev_exit(idx);
354400 }
355401
356402 /*
@@ -518,7 +564,7 @@ void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev, · 161 unmodified lines
518564 adev->gfx.rlc.funcs &&
519565 adev->gfx.rlc.funcs->is_rlcg_access_range) {
520566 if (adev->gfx.rlc.funcs->is_rlcg_access_range(adev, reg))
521− return adev->gfx.rlc.funcs->rlcg_wreg(adev, reg, v, 0, 0);
567+ return adev->gfx.rlc.funcs->sriov_wreg(adev, reg, v, 0, 0);
522568 } else {
523569 writel(v, ((void __iomem *)adev->rmmio) + (reg * 4));
524570 }
@@ -1266,15 +1312,16 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev) · 741 unmodified lines
12661312 /**
12671313 * amdgpu_device_vga_set_decode - enable/disable vga decode
12681314 *
1269− * @cookie: amdgpu_device pointer
1315+ * @pdev: PCI device pointer
12701316 * @state: enable/disable vga decode
12711317 *
12721318 * Enable/disable vga decode (all asics).
12731319 * Returns VGA resource flags.
12741320 */
1275−static unsigned int amdgpu_device_vga_set_decode(void *cookie, bool state)
1321+static unsigned int amdgpu_device_vga_set_decode(struct pci_dev *pdev,
1322+ bool state)
12761323 {
1277− struct amdgpu_device *adev = cookie;
1324+ struct amdgpu_device *adev = drm_to_adev(pci_get_drvdata(pdev));
12781325 amdgpu_asic_set_vga_state(adev, state);
12791326 if (state)
12801327 return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
@@ -1394,6 +1441,10 @@ static int amdgpu_device_init_apu_flags(struct amdgpu_device *adev) · 113 unmodified lines
13941441 break;
13951442 case CHIP_YELLOW_CARP:
13961443 break;
1444+ case CHIP_CYAN_SKILLFISH:
1445+ if (adev->pdev->device == 0x13FE)
1446+ adev->apu_flags |= AMD_APU_IS_CYAN_SKILLFISH2;
1447+ break;
13971448 default:
13981449 return -EINVAL;
13991450 }
@@ -2100,6 +2151,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) · 700 unmodified lines
21002151 case CHIP_BEIGE_GOBY:
21012152 case CHIP_VANGOGH:
21022153 case CHIP_YELLOW_CARP:
2154+ case CHIP_CYAN_SKILLFISH:
21032155 if (adev->asic_type == CHIP_VANGOGH)
21042156 adev->family = AMDGPU_FAMILY_VGH;
21052157 else if (adev->asic_type == CHIP_YELLOW_CARP)
@@ -3594,9 +3646,9 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 1488 unmodified lines
35943646
35953647 fence_driver_init:
35963648 /* Fence driver */
3597− r = amdgpu_fence_driver_init(adev);
3649+ r = amdgpu_fence_driver_sw_init(adev);
35983650 if (r) {
3599− dev_err(adev->dev, "amdgpu_fence_driver_init failed\n");
3651+ dev_err(adev->dev, "amdgpu_fence_driver_sw_init failed\n");
36003652 amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_FENCE_INIT_FAIL, 0, 0);
36013653 goto failed;
36023654 }
@@ -3623,6 +3675,8 @@ fence_driver_init: · 20 unmodified lines
36233675 goto release_ras_con;
36243676 }
36253677
3678+ amdgpu_fence_driver_hw_init(adev);
3679+
36263680 dev_info(adev->dev,
36273681 "SE %d, SH per SE %d, CU per SH %d, active_cu_number %d\n",
36283682 adev->gfx.config.max_shader_engines,
@@ -3714,7 +3768,7 @@ fence_driver_init: · 85 unmodified lines
37143768 /* this will fail for cards that aren't VGA class devices, just
37153769 * ignore it */
37163770 if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
3717− vga_client_register(adev->pdev, adev, NULL, amdgpu_device_vga_set_decode);
3771+ vga_client_register(adev->pdev, amdgpu_device_vga_set_decode);
37183772
37193773 if (amdgpu_device_supports_px(ddev)) {
37203774 px = true;
@@ -3771,7 +3825,10 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) · 50 unmodified lines
37713825 {
37723826 dev_info(adev->dev, "amdgpu: finishing device.\n");
37733827 flush_delayed_work(&adev->delayed_init_work);
3774− ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
3828+ if (adev->mman.initialized) {
3829+ flush_delayed_work(&adev->mman.bdev.wq);
3830+ ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
3831+ }
37753832 adev->shutdown = true;
37763833
37773834 /* make sure IB test finished before entering exclusive mode
@@ -3790,7 +3847,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) · 12 unmodified lines
37903847 else
37913848 drm_atomic_helper_shutdown(adev_to_drm(adev));
37923849 }
3793− amdgpu_fence_driver_fini_hw(adev);
3850+ amdgpu_fence_driver_hw_fini(adev);
37943851
37953852 if (adev->pm_sysfs_en)
37963853 amdgpu_pm_sysfs_fini(adev);
@@ -3812,7 +3869,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) · 15 unmodified lines
38123869 void amdgpu_device_fini_sw(struct amdgpu_device *adev)
38133870 {
38143871 amdgpu_device_ip_fini(adev);
3815− amdgpu_fence_driver_fini_sw(adev);
3872+ amdgpu_fence_driver_sw_fini(adev);
38163873 release_firmware(adev->firmware.gpu_info_fw);
38173874 adev->firmware.gpu_info_fw = NULL;
38183875 adev->accel_working = false;
@@ -3833,7 +3890,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) · 14 unmodified lines
38333890 vga_switcheroo_fini_domain_pm_ops(adev->dev);
38343891 }
38353892 if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
3836− vga_client_register(adev->pdev, NULL, NULL, NULL);
3893+ vga_client_unregister(adev->pdev);
38373894
38383895 if (IS_ENABLED(CONFIG_PERF_EVENTS))
38393896 amdgpu_pmu_fini(adev);
@@ -3887,7 +3944,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) · 47 unmodified lines
38873944 /* evict vram memory */
38883945 amdgpu_bo_evict_vram(adev);
38893946
3890− amdgpu_fence_driver_suspend(adev);
3947+ amdgpu_fence_driver_hw_fini(adev);
38913948
38923949 amdgpu_device_ip_suspend_phase2(adev);
38933950 /* evict remaining vram memory
@@ -3932,8 +3989,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · 38 unmodified lines
39323989 dev_err(adev->dev, "amdgpu_device_ip_resume failed (%d).\n", r);
39333990 return r;
39343991 }
3935− amdgpu_fence_driver_resume(adev);
3936−
3992+ amdgpu_fence_driver_hw_init(adev);
39373993
39383994 r = amdgpu_device_ip_late_init(adev);
39393995 if (r)
@@ -4394,7 +4450,7 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev) · 454 unmodified lines
43944450 int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
43954451 struct amdgpu_reset_context *reset_context)
43964452 {
4397− int i, r = 0;
4453+ int i, j, r = 0;
43984454 struct amdgpu_job *job = NULL;
43994455 bool need_full_reset =
44004456 test_bit(AMDGPU_NEED_FULL_RESET, &reset_context->flags);
@@ -4418,11 +4474,22 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, · 17 unmodified lines
44184474 if (!ring || !ring->sched.thread)
44194475 continue;
44204476
4477+ /*clear job fence from fence drv to avoid force_completion
4478+ *leave NULL and vm flush fence in fence drv */
4479+ for (j = 0; j <= ring->fence_drv.num_fences_mask; j++) {
4480+ struct dma_fence *old, **ptr;
4481+
4482+ ptr = &ring->fence_drv.fences[j];
4483+ old = rcu_dereference_protected(*ptr, 1);
4484+ if (old && test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &old->flags)) {
4485+ RCU_INIT_POINTER(*ptr, NULL);
4486+ }
4487+ }
44214488 /* after all hw jobs are reset, hw fence is meaningless, so force_completion */
44224489 amdgpu_fence_driver_force_completion(ring);
44234490 }
44244491
4425− if(job)
4492+ if (job && job->vm)
44264493 drm_sched_increase_karma(&job->base);
44274494
44284495 r = amdgpu_reset_prepare_hwcontext(adev, reset_context);
@@ -4886,7 +4953,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 457 unmodified lines
48864953 DRM_INFO("Bailing on TDR for s_job:%llx, hive: %llx as another already in progress",
48874954 job ? job->base.id : -1, hive->hive_id);
48884955 amdgpu_put_xgmi_hive(hive);
4889− if (job)
4956+ if (job && job->vm)
48904957 drm_sched_increase_karma(&job->base);
48914958 return 0;
48924959 }
@@ -4910,7 +4977,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 17 unmodified lines
49104977 job ? job->base.id : -1);
49114978
49124979 /* even we skipped this reset, still need to set the job to guilty */
4913− if (job)
4980+ if (job && job->vm)
49144981 drm_sched_increase_karma(&job->base);
49154982 goto skip_recovery;
49164983 }
@@ -5277,6 +5344,10 @@ int amdgpu_device_baco_exit(struct drm_device *dev) · 360 unmodified lines
52775344 adev->nbio.funcs->enable_doorbell_interrupt)
52785345 adev->nbio.funcs->enable_doorbell_interrupt(adev, true);
52795346
5347+ if (amdgpu_passthrough(adev) &&
5348+ adev->nbio.funcs->clear_doorbell_interrupt)
5349+ adev->nbio.funcs->clear_doorbell_interrupt(adev);
5350+
52805351 return 0;
52815352 }
52825353
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c+0−65
@@ -42,48 +42,6 @@ · 41 unmodified lines
4242 #include <linux/pci-p2pdma.h>
4343 #include <linux/pm_runtime.h>
4444
45−static int
46−__dma_resv_make_exclusive(struct dma_resv *obj)
47−{
48− struct dma_fence **fences;
49− unsigned int count;
50− int r;
51−
52− if (!dma_resv_shared_list(obj)) /* no shared fences to convert */
53− return 0;
54−
55− r = dma_resv_get_fences(obj, NULL, &count, &fences);
56− if (r)
57− return r;
58−
59− if (count == 0) {
60− /* Now that was unexpected. */
61− } else if (count == 1) {
62− dma_resv_add_excl_fence(obj, fences[0]);
63− dma_fence_put(fences[0]);
64− kfree(fences);
65− } else {
66− struct dma_fence_array *array;
67−
68− array = dma_fence_array_create(count, fences,
69− dma_fence_context_alloc(1), 0,
70− false);
71− if (!array)
72− goto err_fences_put;
73−
74− dma_resv_add_excl_fence(obj, &array->base);
75− dma_fence_put(&array->base);
76− }
77−
78− return 0;
79−
80−err_fences_put:
81− while (count--)
82− dma_fence_put(fences[count]);
83− kfree(fences);
84− return -ENOMEM;
85−}
86−
8745 /**
8846 * amdgpu_dma_buf_attach - &dma_buf_ops.attach implementation
8947 *
@@ -110,24 +68,6 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf, · 20 unmodified lines
11068 if (r < 0)
11169 goto out;
11270
113− r = amdgpu_bo_reserve(bo, false);
114− if (unlikely(r != 0))
115− goto out;
116−
117− /*
118− * We only create shared fences for internal use, but importers
119− * of the dmabuf rely on exclusive fences for implicitly
120− * tracking write hazards. As any of the current fences may
121− * correspond to a write, we need to convert all existing
122− * fences on the reservation object into a single exclusive
123− * fence.
124− */
125− r = __dma_resv_make_exclusive(bo->tbo.base.resv);
126− if (r)
127− goto out;
128−
129− bo->prime_shared_count++;
130− amdgpu_bo_unreserve(bo);
13171 return 0;
13272
13373 out:
@@ -150,9 +90,6 @@ static void amdgpu_dma_buf_detach(struct dma_buf *dmabuf, · 16 unmodified lines
15090 struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
15191 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
15292
153− if (attach->dev->driver != adev->dev->driver && bo->prime_shared_count)
154− bo->prime_shared_count--;
155−
15693 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
15794 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
15895 }
@@ -418,8 +355,6 @@ amdgpu_dma_buf_create_obj(struct drm_device *dev, struct dma_buf *dma_buf) · 259 unmodified lines
418355 bo = gem_to_amdgpu_bo(gobj);
419356 bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT;
420357 bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT;
421− if (dma_buf->ops != &amdgpu_dmabuf_ops)
422− bo->prime_shared_count = 1;
423358
424359 dma_resv_unlock(resv);
425360 return gobj;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+11−10
@@ -870,11 +870,10 @@ MODULE_PARM_DESC(reset_method, "GPU reset method (-1 = auto (default), 0 = legac · 869 unmodified lines
870870 module_param_named(reset_method, amdgpu_reset_method, int, 0444);
871871
872872 /**
873− * DOC: bad_page_threshold (int)
874− * Bad page threshold is to specify the threshold value of faulty pages
875− * detected by RAS ECC, that may result in GPU entering bad status if total
876− * faulty pages by ECC exceed threshold value and leave it for user's further
877− * check.
873+ * DOC: bad_page_threshold (int) Bad page threshold is specifies the
874+ * threshold value of faulty pages detected by RAS ECC, which may
875+ * result in the GPU entering bad status when the number of total
876+ * faulty pages by ECC exceeds the threshold value.
878877 */
879878 MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default value), 0 = disable bad page retirement)");
880879 module_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int, 0444);
@@ -1213,6 +1212,9 @@ static const struct pci_device_id pciidlist[] = { · 332 unmodified lines
12131212 {0x1002, 0x740F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT},
12141213 {0x1002, 0x7410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT},
12151214
1215+ /* CYAN_SKILLFISH */
1216+ {0x1002, 0x13FE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYAN_SKILLFISH|AMD_IS_APU},
1217+
12161218 /* BEIGE_GOBY */
12171219 {0x1002, 0x7420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BEIGE_GOBY},
12181220 {0x1002, 0x7421, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BEIGE_GOBY},
@@ -1236,7 +1238,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, · 17 unmodified lines
12361238 int ret, retry = 0;
12371239 bool supports_atomic = false;
12381240
1239− if (!amdgpu_virtual_display &&
1241+ if (amdgpu_virtual_display ||
12401242 amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
12411243 supports_atomic = true;
12421244
@@ -1292,7 +1294,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, · 49 unmodified lines
12921294 #endif
12931295
12941296 /* Get rid of things like offb */
1295− ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "amdgpudrmfb");
1297+ ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, &amdgpu_kms_driver);
12961298 if (ret)
12971299 return ret;
12981300
@@ -1474,7 +1476,7 @@ static int amdgpu_pmops_suspend(struct device *dev) · 175 unmodified lines
14741476 struct amdgpu_device *adev = drm_to_adev(drm_dev);
14751477 int r;
14761478
1477− if (amdgpu_acpi_is_s0ix_supported(adev))
1479+ if (amdgpu_acpi_is_s0ix_active(adev))
14781480 adev->in_s0ix = true;
14791481 adev->in_s3 = true;
14801482 r = amdgpu_device_suspend(drm_dev, true);
@@ -1490,7 +1492,7 @@ static int amdgpu_pmops_resume(struct device *dev) · 9 unmodified lines
14901492 int r;
14911493
14921494 r = amdgpu_device_resume(drm_dev, true);
1493− if (amdgpu_acpi_is_s0ix_supported(adev))
1495+ if (amdgpu_acpi_is_s0ix_active(adev))
14941496 adev->in_s0ix = false;
14951497 return r;
14961498 }
@@ -1784,7 +1786,6 @@ static const struct drm_driver amdgpu_kms_driver = { · 287 unmodified lines
17841786 .open = amdgpu_driver_open_kms,
17851787 .postclose = amdgpu_driver_postclose_kms,
17861788 .lastclose = amdgpu_driver_lastclose_kms,
1787− .irq_handler = amdgpu_irq_handler,
17881789 .ioctls = amdgpu_ioctls_kms,
17891790 .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
17901791 .dumb_create = amdgpu_mode_dumb_create,
drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c+239−0
@@ -0,0 +1,239 @@
1+/*
2+ * Copyright 2021 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ */
23+
24+#include "amdgpu_eeprom.h"
25+#include "amdgpu.h"
26+
27+/* AT24CM02 and M24M02-R have a 256-byte write page size.
28+ */
29+#define EEPROM_PAGE_BITS 8
30+#define EEPROM_PAGE_SIZE (1U << EEPROM_PAGE_BITS)
31+#define EEPROM_PAGE_MASK (EEPROM_PAGE_SIZE - 1)
32+
33+#define EEPROM_OFFSET_SIZE 2
34+
35+/* EEPROM memory addresses are 19-bits long, which can
36+ * be partitioned into 3, 8, 8 bits, for a total of 19.
37+ * The upper 3 bits are sent as part of the 7-bit
38+ * "Device Type Identifier"--an I2C concept, which for EEPROM devices
39+ * is hard-coded as 1010b, indicating that it is an EEPROM
40+ * device--this is the wire format, followed by the upper
41+ * 3 bits of the 19-bit address, followed by the direction,
42+ * followed by two bytes holding the rest of the 16-bits of
43+ * the EEPROM memory address. The format on the wire for EEPROM
44+ * devices is: 1010XYZD, A15:A8, A7:A0,
45+ * Where D is the direction and sequenced out by the hardware.
46+ * Bits XYZ are memory address bits 18, 17 and 16.
47+ * These bits are compared to how pins 1-3 of the part are connected,
48+ * depending on the size of the part, more on that later.
49+ *
50+ * Note that of this wire format, a client is in control
51+ * of, and needs to specify only XYZ, A15:A8, A7:0, bits,
52+ * which is exactly the EEPROM memory address, or offset,
53+ * in order to address up to 8 EEPROM devices on the I2C bus.
54+ *
55+ * For instance, a 2-Mbit I2C EEPROM part, addresses all its bytes,
56+ * using an 18-bit address, bit 17 to 0 and thus would use all but one bit of
57+ * the 19 bits previously mentioned. The designer would then not connect
58+ * pins 1 and 2, and pin 3 usually named "A_2" or "E2", would be connected to
59+ * either Vcc or GND. This would allow for up to two 2-Mbit parts on
60+ * the same bus, where one would be addressable with bit 18 as 1, and
61+ * the other with bit 18 of the address as 0.
62+ *
63+ * For a 2-Mbit part, bit 18 is usually known as the "Chip Enable" or
64+ * "Hardware Address Bit". This bit is compared to the load on pin 3
65+ * of the device, described above, and if there is a match, then this
66+ * device responds to the command. This way, you can connect two
67+ * 2-Mbit EEPROM devices on the same bus, but see one contiguous
68+ * memory from 0 to 7FFFFh, where address 0 to 3FFFF is in the device
69+ * whose pin 3 is connected to GND, and address 40000 to 7FFFFh is in
70+ * the 2nd device, whose pin 3 is connected to Vcc.
71+ *
72+ * This addressing you encode in the 32-bit "eeprom_addr" below,
73+ * namely the 19-bits "XYZ,A15:A0", as a single 19-bit address. For
74+ * instance, eeprom_addr = 0x6DA01, is 110_1101_1010_0000_0001, where
75+ * XYZ=110b, and A15:A0=DA01h. The XYZ bits become part of the device
76+ * address, and the rest of the address bits are sent as the memory
77+ * address bytes.
78+ *
79+ * That is, for an I2C EEPROM driver everything is controlled by
80+ * the "eeprom_addr".
81+ *
82+ * P.S. If you need to write, lock and read the Identification Page,
83+ * (M24M02-DR device only, which we do not use), change the "7" to
84+ * "0xF" in the macro below, and let the client set bit 20 to 1 in
85+ * "eeprom_addr", and set A10 to 0 to write into it, and A10 and A1 to
86+ * 1 to lock it permanently.
87+ */
88+#define MAKE_I2C_ADDR(_aa) ((0xA << 3) | (((_aa) >> 16) & 7))
89+
90+static int __amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,
91+ u8 *eeprom_buf, u16 buf_size, bool read)
92+{
93+ u8 eeprom_offset_buf[EEPROM_OFFSET_SIZE];
94+ struct i2c_msg msgs[] = {
95+ {
96+ .flags = 0,
97+ .len = EEPROM_OFFSET_SIZE,
98+ .buf = eeprom_offset_buf,
99+ },
100+ {
101+ .flags = read ? I2C_M_RD : 0,
102+ },
103+ };
104+ const u8 *p = eeprom_buf;
105+ int r;
106+ u16 len;
107+
108+ for (r = 0; buf_size > 0;
109+ buf_size -= len, eeprom_addr += len, eeprom_buf += len) {
110+ /* Set the EEPROM address we want to write to/read from.
111+ */
112+ msgs[0].addr = MAKE_I2C_ADDR(eeprom_addr);
113+ msgs[1].addr = msgs[0].addr;
114+ msgs[0].buf[0] = (eeprom_addr >> 8) & 0xff;
115+ msgs[0].buf[1] = eeprom_addr & 0xff;
116+
117+ if (!read) {
118+ /* Write the maximum amount of data, without
119+ * crossing the device's page boundary, as per
120+ * its spec. Partial page writes are allowed,
121+ * starting at any location within the page,
122+ * so long as the page boundary isn't crossed
123+ * over (actually the page pointer rolls
124+ * over).
125+ *
126+ * As per the AT24CM02 EEPROM spec, after
127+ * writing into a page, the I2C driver should
128+ * terminate the transfer, i.e. in
129+ * "i2c_transfer()" below, with a STOP
130+ * condition, so that the self-timed write
131+ * cycle begins. This is implied for the
132+ * "i2c_transfer()" abstraction.
133+ */
134+ len = min(EEPROM_PAGE_SIZE - (eeprom_addr &
135+ EEPROM_PAGE_MASK),
136+ (u32)buf_size);
137+ } else {
138+ /* Reading from the EEPROM has no limitation
139+ * on the number of bytes read from the EEPROM
140+ * device--they are simply sequenced out.
141+ */
142+ len = buf_size;
143+ }
144+ msgs[1].len = len;
145+ msgs[1].buf = eeprom_buf;
146+
147+ /* This constitutes a START-STOP transaction.
148+ */
149+ r = i2c_transfer(i2c_adap, msgs, ARRAY_SIZE(msgs));
150+ if (r != ARRAY_SIZE(msgs))
151+ break;
152+
153+ if (!read) {
154+ /* According to EEPROM specs the length of the
155+ * self-writing cycle, tWR (tW), is 10 ms.
156+ *
157+ * TODO: Use polling on ACK, aka Acknowledge
158+ * Polling, to minimize waiting for the
159+ * internal write cycle to complete, as it is
160+ * usually smaller than tWR (tW).
161+ */
162+ msleep(10);
163+ }
164+ }
165+
166+ return r < 0 ? r : eeprom_buf - p;
167+}
168+
169+/**
170+ * amdgpu_eeprom_xfer -- Read/write from/to an I2C EEPROM device
171+ * @i2c_adap: pointer to the I2C adapter to use
172+ * @eeprom_addr: EEPROM address from which to read/write
173+ * @eeprom_buf: pointer to data buffer to read into/write from
174+ * @buf_size: the size of @eeprom_buf
175+ * @read: True if reading from the EEPROM, false if writing
176+ *
177+ * Returns the number of bytes read/written; -errno on error.
178+ */
179+static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,
180+ u8 *eeprom_buf, u16 buf_size, bool read)
181+{
182+ const struct i2c_adapter_quirks *quirks = i2c_adap->quirks;
183+ u16 limit;
184+
185+ if (!quirks)
186+ limit = 0;
187+ else if (read)
188+ limit = quirks->max_read_len;
189+ else
190+ limit = quirks->max_write_len;
191+
192+ if (limit == 0) {
193+ return __amdgpu_eeprom_xfer(i2c_adap, eeprom_addr,
194+ eeprom_buf, buf_size, read);
195+ } else if (limit <= EEPROM_OFFSET_SIZE) {
196+ dev_err_ratelimited(&i2c_adap->dev,
197+ "maddr:0x%04X size:0x%02X:quirk max_%s_len must be > %d",
198+ eeprom_addr, buf_size,
199+ read ? "read" : "write", EEPROM_OFFSET_SIZE);
200+ return -EINVAL;
201+ } else {
202+ u16 ps; /* Partial size */
203+ int res = 0, r;
204+
205+ /* The "limit" includes all data bytes sent/received,
206+ * which would include the EEPROM_OFFSET_SIZE bytes.
207+ * Account for them here.
208+ */
209+ limit -= EEPROM_OFFSET_SIZE;
210+ for ( ; buf_size > 0;
211+ buf_size -= ps, eeprom_addr += ps, eeprom_buf += ps) {
212+ ps = min(limit, buf_size);
213+
214+ r = __amdgpu_eeprom_xfer(i2c_adap, eeprom_addr,
215+ eeprom_buf, ps, read);
216+ if (r < 0)
217+ return r;
218+ res += r;
219+ }
220+
221+ return res;
222+ }
223+}
224+
225+int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,
226+ u32 eeprom_addr, u8 *eeprom_buf,
227+ u16 bytes)
228+{
229+ return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,
230+ true);
231+}
232+
233+int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap,
234+ u32 eeprom_addr, u8 *eeprom_buf,
235+ u16 bytes)
236+{
237+ return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,
238+ false);
239+}
drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h+37−0
@@ -0,0 +1,37 @@
1+/*
2+ * Copyright 2021 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ */
23+
24+#ifndef _AMDGPU_EEPROM_H
25+#define _AMDGPU_EEPROM_H
26+
27+#include <linux/i2c.h>
28+
29+int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,
30+ u32 eeprom_addr, u8 *eeprom_buf,
31+ u16 bytes);
32+
33+int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap,
34+ u32 eeprom_addr, u8 *eeprom_buf,
35+ u16 bytes);
36+
37+#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c+1−4
@@ -273,9 +273,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper, · 272 unmodified lines
273273 return 0;
274274
275275 out:
276− if (abo) {
277−
278− }
279276 if (fb && ret) {
280277 drm_gem_object_put(gobj);
281278 drm_framebuffer_unregister_private(fb);
@@ -344,7 +341,7 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev) · 62 unmodified lines
344341 }
345342
346343 /* disable all the possible outputs/crtcs before entering KMS mode */
347− if (!amdgpu_device_has_dc_support(adev))
344+ if (!amdgpu_device_has_dc_support(adev) && !amdgpu_virtual_display)
348345 drm_helper_disable_unused_functions(adev_to_drm(adev));
349346
350347 drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c+80−64
@@ -129,30 +129,50 @@ static u32 amdgpu_fence_read(struct amdgpu_ring *ring) · 128 unmodified lines
129129 *
130130 * @ring: ring the fence is associated with
131131 * @f: resulting fence object
132+ * @job: job the fence is embedded in
132133 * @flags: flags to pass into the subordinate .emit_fence() call
133134 *
134135 * Emits a fence command on the requested ring (all asics).
135136 * Returns 0 on success, -ENOMEM on failure.
136137 */
137−int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f,
138+int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, struct amdgpu_job *job,
138139 unsigned flags)
139140 {
140141 struct amdgpu_device *adev = ring->adev;
141− struct amdgpu_fence *fence;
142+ struct dma_fence *fence;
143+ struct amdgpu_fence *am_fence;
142144 struct dma_fence __rcu **ptr;
143145 uint32_t seq;
144146 int r;
145147
146− fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL);
147− if (fence == NULL)
148− return -ENOMEM;
148+ if (job == NULL) {
149+ /* create a sperate hw fence */
150+ am_fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_ATOMIC);
151+ if (am_fence == NULL)
152+ return -ENOMEM;
153+ fence = &am_fence->base;
154+ am_fence->ring = ring;
155+ } else {
156+ /* take use of job-embedded fence */
157+ fence = &job->hw_fence;
158+ }
149159
150160 seq = ++ring->fence_drv.sync_seq;
151− fence->ring = ring;
152− dma_fence_init(&fence->base, &amdgpu_fence_ops,
153− &ring->fence_drv.lock,
154− adev->fence_context + ring->idx,
155− seq);
161+ if (job != NULL && job->job_run_counter) {
162+ /* reinit seq for resubmitted jobs */
163+ fence->seqno = seq;
164+ } else {
165+ dma_fence_init(fence, &amdgpu_fence_ops,
166+ &ring->fence_drv.lock,
167+ adev->fence_context + ring->idx,
168+ seq);
169+ }
170+
171+ if (job != NULL) {
172+ /* mark this fence has a parent job */
173+ set_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &fence->flags);
174+ }
175+
156176 amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr,
157177 seq, flags | AMDGPU_FENCE_FLAG_INT);
158178 pm_runtime_get_noresume(adev_to_drm(adev)->dev);
@@ -175,9 +195,9 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, · 16 unmodified lines
175195 /* This function can't be called concurrently anyway, otherwise
176196 * emitting the fence would mess up the hardware ring buffer.
177197 */
178− rcu_assign_pointer(*ptr, dma_fence_get(&fence->base));
198+ rcu_assign_pointer(*ptr, dma_fence_get(fence));
179199
180− *f = &fence->base;
200+ *f = fence;
181201
182202 return 0;
183203 }
@@ -417,9 +437,6 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, · 233 unmodified lines
417437 }
418438 amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq));
419439
420− if (irq_src)
421− amdgpu_irq_get(adev, irq_src, irq_type);
422−
423440 ring->fence_drv.irq_src = irq_src;
424441 ring->fence_drv.irq_type = irq_type;
425442 ring->fence_drv.initialized = true;
@@ -490,7 +507,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, · 64 unmodified lines
490507
491508 r = drm_sched_init(&ring->sched, &amdgpu_sched_ops,
492509 num_hw_submission, amdgpu_job_hang_limit,
493− timeout, sched_score, ring->name);
510+ timeout, NULL, sched_score, ring->name);
494511 if (r) {
495512 DRM_ERROR("Failed to create scheduler on ring %s.\n",
496513 ring->name);
@@ -501,7 +518,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, · 4 unmodified lines
501518 }
502519
503520 /**
504− * amdgpu_fence_driver_init - init the fence driver
521+ * amdgpu_fence_driver_sw_init - init the fence driver
505522 * for all possible rings.
506523 *
507524 * @adev: amdgpu device pointer
@@ -512,20 +529,20 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, · 4 unmodified lines
512529 * amdgpu_fence_driver_start_ring().
513530 * Returns 0 for success.
514531 */
515−int amdgpu_fence_driver_init(struct amdgpu_device *adev)
532+int amdgpu_fence_driver_sw_init(struct amdgpu_device *adev)
516533 {
517534 return 0;
518535 }
519536
520537 /**
521− * amdgpu_fence_driver_fini - tear down the fence driver
538+ * amdgpu_fence_driver_hw_fini - tear down the fence driver
522539 * for all possible rings.
523540 *
524541 * @adev: amdgpu device pointer
525542 *
526543 * Tear down the fence driver for all possible rings (all asics).
527544 */
528−void amdgpu_fence_driver_fini_hw(struct amdgpu_device *adev)
545+void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)
529546 {
530547 int i, r;
531548
@@ -534,8 +551,7 @@ void amdgpu_fence_driver_fini_hw(struct amdgpu_device *adev) · 2 unmodified lines
534551
535552 if (!ring || !ring->fence_drv.initialized)
536553 continue;
537− if (!ring->no_scheduler)
538− drm_sched_fini(&ring->sched);
554+
539555 /* You can't wait for HW to signal if it's gone */
540556 if (!drm_dev_is_unplugged(&adev->ddev))
541557 r = amdgpu_fence_wait_empty(ring);
@@ -553,7 +569,7 @@ void amdgpu_fence_driver_fini_hw(struct amdgpu_device *adev) · 11 unmodified lines
553569 }
554570 }
555571
556−void amdgpu_fence_driver_fini_sw(struct amdgpu_device *adev)
572+void amdgpu_fence_driver_sw_fini(struct amdgpu_device *adev)
557573 {
558574 unsigned int i, j;
559575
@@ -563,6 +579,9 @@ void amdgpu_fence_driver_fini_sw(struct amdgpu_device *adev) · 3 unmodified lines
563579 if (!ring || !ring->fence_drv.initialized)
564580 continue;
565581
582+ if (!ring->no_scheduler)
583+ drm_sched_fini(&ring->sched);
584+
566585 for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j)
567586 dma_fence_put(ring->fence_drv.fences[j]);
568587 kfree(ring->fence_drv.fences);
@@ -572,49 +591,18 @@ void amdgpu_fence_driver_fini_sw(struct amdgpu_device *adev) · 3 unmodified lines
572591 }
573592
574593 /**
575− * amdgpu_fence_driver_suspend - suspend the fence driver
576− * for all possible rings.
577− *
578− * @adev: amdgpu device pointer
579− *
580− * Suspend the fence driver for all possible rings (all asics).
581− */
582−void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)
583−{
584− int i, r;
585−
586− for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
587− struct amdgpu_ring *ring = adev->rings[i];
588− if (!ring || !ring->fence_drv.initialized)
589− continue;
590−
591− /* wait for gpu to finish processing current batch */
592− r = amdgpu_fence_wait_empty(ring);
593− if (r) {
594− /* delay GPU reset to resume */
595− amdgpu_fence_driver_force_completion(ring);
596− }
597−
598− /* disable the interrupt */
599− if (ring->fence_drv.irq_src)
600− amdgpu_irq_put(adev, ring->fence_drv.irq_src,
601− ring->fence_drv.irq_type);
602− }
603−}
604−
605−/**
606− * amdgpu_fence_driver_resume - resume the fence driver
594+ * amdgpu_fence_driver_hw_init - enable the fence driver
607595 * for all possible rings.
608596 *
609597 * @adev: amdgpu device pointer
610598 *
611− * Resume the fence driver for all possible rings (all asics).
599+ * Enable the fence driver for all possible rings (all asics).
612600 * Not all asics have all rings, so each asic will only
613601 * start the fence driver on the rings it has using
614602 * amdgpu_fence_driver_start_ring().
615603 * Returns 0 for success.
616604 */
617−void amdgpu_fence_driver_resume(struct amdgpu_device *adev)
605+void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)
618606 {
619607 int i;
620608
@@ -653,8 +641,16 @@ static const char *amdgpu_fence_get_driver_name(struct dma_fence *fence) · 32 unmodified lines
653641
654642 static const char *amdgpu_fence_get_timeline_name(struct dma_fence *f)
655643 {
656− struct amdgpu_fence *fence = to_amdgpu_fence(f);
657− return (const char *)fence->ring->name;
644+ struct amdgpu_ring *ring;
645+
646+ if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) {
647+ struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence);
648+
649+ ring = to_amdgpu_ring(job->base.sched);
650+ } else {
651+ ring = to_amdgpu_fence(f)->ring;
652+ }
653+ return (const char *)ring->name;
658654 }
659655
660656 /**
@@ -667,13 +663,20 @@ static const char *amdgpu_fence_get_timeline_name(struct dma_fence *f) · 6 unmodified lines
667663 */
668664 static bool amdgpu_fence_enable_signaling(struct dma_fence *f)
669665 {
670− struct amdgpu_fence *fence = to_amdgpu_fence(f);
671− struct amdgpu_ring *ring = fence->ring;
666+ struct amdgpu_ring *ring;
667+
668+ if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) {
669+ struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence);
670+
671+ ring = to_amdgpu_ring(job->base.sched);
672+ } else {
673+ ring = to_amdgpu_fence(f)->ring;
674+ }
672675
673676 if (!timer_pending(&ring->fence_drv.fallback_timer))
674677 amdgpu_fence_schedule_fallback(ring);
675678
676− DMA_FENCE_TRACE(&fence->base, "armed on ring %i!\n", ring->idx);
679+ DMA_FENCE_TRACE(f, "armed on ring %i!\n", ring->idx);
677680
678681 return true;
679682 }
@@ -688,8 +691,20 @@ static bool amdgpu_fence_enable_signaling(struct dma_fence *f) · 8 unmodified lines
688691 static void amdgpu_fence_free(struct rcu_head *rcu)
689692 {
690693 struct dma_fence *f = container_of(rcu, struct dma_fence, rcu);
691− struct amdgpu_fence *fence = to_amdgpu_fence(f);
692− kmem_cache_free(amdgpu_fence_slab, fence);
694+
695+ if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) {
696+ /* free job if fence has a parent job */
697+ struct amdgpu_job *job;
698+
699+ job = container_of(f, struct amdgpu_job, hw_fence);
700+ kfree(job);
701+ } else {
702+ /* free fence_slab if it's separated fence*/
703+ struct amdgpu_fence *fence;
704+
705+ fence = to_amdgpu_fence(f);
706+ kmem_cache_free(amdgpu_fence_slab, fence);
707+ }
693708 }
694709
695710 /**
@@ -712,6 +727,7 @@ static const struct dma_fence_ops amdgpu_fence_ops = { · 16 unmodified lines
712727 .release = amdgpu_fence_release,
713728 };
714729
730+
715731 /*
716732 * Fence debugfs
717733 */
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c+10−22
@@ -27,10 +27,10 @@ · 26 unmodified lines
2727 #include "smu_v11_0_i2c.h"
2828 #include "atom.h"
2929 #include "amdgpu_fru_eeprom.h"
30+#include "amdgpu_eeprom.h"
3031
31−#define I2C_PRODUCT_INFO_ADDR 0xAC
32−#define I2C_PRODUCT_INFO_ADDR_SIZE 0x2
33−#define I2C_PRODUCT_INFO_OFFSET 0xC0
32+#define FRU_EEPROM_MADDR 0x60000
33+#define I2C_PRODUCT_INFO_OFFSET 0xC0
3434
3535 static bool is_fru_eeprom_supported(struct amdgpu_device *adev)
3636 {
@@ -62,19 +62,11 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev) · 25 unmodified lines
6262 }
6363
6464 static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,
65− unsigned char *buff)
65+ unsigned char *buff)
6666 {
6767 int ret, size;
68− struct i2c_msg msg = {
69− .addr = I2C_PRODUCT_INFO_ADDR,
70− .flags = I2C_M_RD,
71− .buf = buff,
72− };
73− buff[0] = 0;
74− buff[1] = addrptr;
75− msg.len = I2C_PRODUCT_INFO_ADDR_SIZE + 1;
76− ret = i2c_transfer(&adev->pm.smu_i2c, &msg, 1);
7768
69+ ret = amdgpu_eeprom_read(&adev->pm.smu_i2c, addrptr, buff, 1);
7870 if (ret < 1) {
7971 DRM_WARN("FRU: Failed to get size field");
8072 return ret;
@@ -83,13 +75,9 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr, · 2 unmodified lines
8375 /* The size returned by the i2c requires subtraction of 0xC0 since the
8476 * size apparently always reports as 0xC0+actual size.
8577 */
86− size = buff[2] - I2C_PRODUCT_INFO_OFFSET;
87− /* Add 1 since address field was 1 byte */
88− buff[1] = addrptr + 1;
89−
90− msg.len = I2C_PRODUCT_INFO_ADDR_SIZE + size;
91− ret = i2c_transfer(&adev->pm.smu_i2c, &msg, 1);
78+ size = buff[0] - I2C_PRODUCT_INFO_OFFSET;
9279
80+ ret = amdgpu_eeprom_read(&adev->pm.smu_i2c, addrptr + 1, buff, size);
9381 if (ret < 1) {
9482 DRM_WARN("FRU: Failed to get data field");
9583 return ret;
@@ -101,8 +89,8 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr, · 5 unmodified lines
10189 int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
10290 {
10391 unsigned char buff[34];
104− int addrptr, size;
105− int len;
92+ u32 addrptr;
93+ int size, len;
10694
10795 if (!is_fru_eeprom_supported(adev))
10896 return 0;
@@ -125,7 +113,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 16 unmodified lines
125113 * Bytes 8-a are all 1-byte and refer to the size of the entire struct,
126114 * and the language field, so just start from 0xb, manufacturer size
127115 */
128− addrptr = 0xb;
116+ addrptr = FRU_EEPROM_MADDR + 0xb;
129117 size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
130118 if (size < 1) {
131119 DRM_ERROR("Failed to read FRU Manufacturer, ret:%d", size);
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c+3−3
@@ -76,7 +76,7 @@ static int amdgpu_gart_dummy_page_init(struct amdgpu_device *adev) · 75 unmodified lines
7676 if (adev->dummy_page_addr)
7777 return 0;
7878 adev->dummy_page_addr = dma_map_page(&adev->pdev->dev, dummy_page, 0,
79− PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
79+ PAGE_SIZE, DMA_BIDIRECTIONAL);
8080 if (dma_mapping_error(&adev->pdev->dev, adev->dummy_page_addr)) {
8181 dev_err(&adev->pdev->dev, "Failed to DMA MAP the dummy page\n");
8282 adev->dummy_page_addr = 0;
@@ -96,8 +96,8 @@ void amdgpu_gart_dummy_page_fini(struct amdgpu_device *adev) · 13 unmodified lines
9696 {
9797 if (!adev->dummy_page_addr)
9898 return;
99− pci_unmap_page(adev->pdev, adev->dummy_page_addr,
100− PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
99+ dma_unmap_page(&adev->pdev->dev, adev->dummy_page_addr, PAGE_SIZE,
100+ DMA_BIDIRECTIONAL);
101101 adev->dummy_page_addr = 0;
102102 }
103103
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+4−3
@@ -621,7 +621,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, · 620 unmodified lines
621621
622622 if (operation == AMDGPU_VA_OP_MAP ||
623623 operation == AMDGPU_VA_OP_REPLACE) {
624− r = amdgpu_vm_bo_update(adev, bo_va, false);
624+ r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
625625 if (r)
626626 goto error;
627627 }
@@ -838,7 +838,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, · 210 unmodified lines
838838 break;
839839 }
840840 case AMDGPU_GEM_OP_SET_PLACEMENT:
841− if (robj->prime_shared_count && (args->value & AMDGPU_GEM_DOMAIN_VRAM)) {
841+ if (robj->tbo.base.import_attach &&
842+ args->value & AMDGPU_GEM_DOMAIN_VRAM) {
842843 r = -EINVAL;
843844 amdgpu_bo_unreserve(robj);
844845 break;
@@ -903,7 +904,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, · 58 unmodified lines
903904 DIV_ROUND_UP(args->bpp, 8), 0);
904905 args->size = (u64)args->pitch * args->height;
905906 args->size = ALIGN(args->size, PAGE_SIZE);
906− domain = amdgpu_bo_get_preferred_pin_domain(adev,
907+ domain = amdgpu_bo_get_preferred_domain(adev,
907908 amdgpu_display_supported_domains(adev, flags));
908909 r = amdgpu_gem_object_create(adev, args->size, 0, domain, flags,
909910 ttm_bo_type_device, NULL, &gobj);
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c+0−1
@@ -629,7 +629,6 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev) · 628 unmodified lines
629629 adev->gfx.ras_if->block = AMDGPU_RAS_BLOCK__GFX;
630630 adev->gfx.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
631631 adev->gfx.ras_if->sub_block_index = 0;
632− strcpy(adev->gfx.ras_if->name, "gfx");
633632 }
634633 fs_info.head = ih_info.head = *adev->gfx.ras_if;
635634 r = amdgpu_ras_late_init(adev, adev->gfx.ras_if,
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c+21−0
@@ -471,6 +471,27 @@ int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev) · 470 unmodified lines
471471 return r;
472472 }
473473
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;
486+ }
487+
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+ }
494+
474495 return 0;
475496 }
476497
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c+12−14
@@ -132,14 +132,11 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, · 131 unmodified lines
132132 struct amdgpu_gtt_node *node;
133133 int r;
134134
135− spin_lock(&mgr->lock);
136− if (tbo->resource && tbo->resource->mem_type != TTM_PL_TT &&
137− atomic64_read(&mgr->available) < num_pages) {
138− spin_unlock(&mgr->lock);
135+ if (!(place->flags & TTM_PL_FLAG_TEMPORARY) &&
136+ atomic64_add_return(num_pages, &mgr->used) > man->size) {
137+ atomic64_sub(num_pages, &mgr->used);
139138 return -ENOSPC;
140139 }
141− atomic64_sub(num_pages, &mgr->available);
142− spin_unlock(&mgr->lock);
143140
144141 node = kzalloc(struct_size(node, base.mm_nodes, 1), GFP_KERNEL);
145142 if (!node) {
@@ -175,7 +172,8 @@ err_free: · 29 unmodified lines
175172 kfree(node);
176173
177174 err_out:
178− atomic64_add(num_pages, &mgr->available);
175+ if (!(place->flags & TTM_PL_FLAG_TEMPORARY))
176+ atomic64_sub(num_pages, &mgr->used);
179177
180178 return r;
181179 }
@@ -198,7 +196,9 @@ static void amdgpu_gtt_mgr_del(struct ttm_resource_manager *man, · 16 unmodified lines
198196 if (drm_mm_node_allocated(&node->base.mm_nodes[0]))
199197 drm_mm_remove_node(&node->base.mm_nodes[0]);
200198 spin_unlock(&mgr->lock);
201− atomic64_add(res->num_pages, &mgr->available);
199+
200+ if (!(res->placement & TTM_PL_FLAG_TEMPORARY))
201+ atomic64_sub(res->num_pages, &mgr->used);
202202
203203 kfree(node);
204204 }
@@ -213,9 +213,8 @@ static void amdgpu_gtt_mgr_del(struct ttm_resource_manager *man, · 8 unmodified lines
213213 uint64_t amdgpu_gtt_mgr_usage(struct ttm_resource_manager *man)
214214 {
215215 struct amdgpu_gtt_mgr *mgr = to_gtt_mgr(man);
216− s64 result = man->size - atomic64_read(&mgr->available);
217216
218− return (result > 0 ? result : 0) * PAGE_SIZE;
217+ return atomic64_read(&mgr->used) * PAGE_SIZE;
219218 }
220219
221220 /**
@@ -265,9 +264,8 @@ static void amdgpu_gtt_mgr_debug(struct ttm_resource_manager *man, · 43 unmodified lines
265264 drm_mm_print(&mgr->mm, printer);
266265 spin_unlock(&mgr->lock);
267266
268− drm_printf(printer, "man size:%llu pages, gtt available:%lld pages, usage:%lluMB\n",
269− man->size, (u64)atomic64_read(&mgr->available),
270− amdgpu_gtt_mgr_usage(man) >> 20);
267+ drm_printf(printer, "man size:%llu pages, gtt used:%llu pages\n",
268+ man->size, atomic64_read(&mgr->used));
271269 }
272270
273271 static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func = {
@@ -299,7 +297,7 @@ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size) · 25 unmodified lines
299297 size = (adev->gmc.gart_size >> PAGE_SHIFT) - start;
300298 drm_mm_init(&mgr->mm, start, size);
301299 spin_lock_init(&mgr->lock);
302− atomic64_set(&mgr->available, gtt_size >> PAGE_SHIFT);
300+ atomic64_set(&mgr->used, 0);
303301
304302 ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_TT, &mgr->manager);
305303 ttm_resource_manager_set_used(man, true);
drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c+0−1
@@ -41,7 +41,6 @@ int amdgpu_hdp_ras_late_init(struct amdgpu_device *adev) · 40 unmodified lines
4141 adev->hdp.ras_if->block = AMDGPU_RAS_BLOCK__HDP;
4242 adev->hdp.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
4343 adev->hdp.ras_if->sub_block_index = 0;
44− strcpy(adev->hdp.ras_if->name, "hdp");
4544 }
4645 ih_info.head = fs_info.head = *adev->hdp.ras_if;
4746 r = amdgpu_ras_late_init(adev, adev->hdp.ras_if,
drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c+1−1
@@ -339,7 +339,7 @@ static void amdgpu_i2c_put_byte(struct amdgpu_i2c_chan *i2c_bus, · 338 unmodified lines
339339 void
340340 amdgpu_i2c_router_select_ddc_port(const struct amdgpu_connector *amdgpu_connector)
341341 {
342− u8 val;
342+ u8 val = 0;
343343
344344 if (!amdgpu_connector->router.ddc_valid)
345345 return;
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c+1−1
@@ -262,7 +262,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, · 261 unmodified lines
262262 fence_flags | AMDGPU_FENCE_FLAG_64BIT);
263263 }
264264
265− r = amdgpu_fence_emit(ring, f, fence_flags);
265+ r = amdgpu_fence_emit(ring, f, job, fence_flags);
266266 if (r) {
267267 dev_err(adev->dev, "failed to emit fence (%d)\n", r);
268268 if (job && job->vmid)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c+18−11
@@ -46,7 +46,6 @@ · 45 unmodified lines
4646 #include <linux/pci.h>
4747
4848 #include <drm/drm_crtc_helper.h>
49−#include <drm/drm_irq.h>
5049 #include <drm/drm_vblank.h>
5150 #include <drm/amdgpu_drm.h>
5251 #include <drm/drm_drv.h>
@@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev) · 131 unmodified lines
184183 * Returns:
185184 * result of handling the IRQ, as defined by &irqreturn_t
186185 */
187−irqreturn_t amdgpu_irq_handler(int irq, void *arg)
186+static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
188187 {
189188 struct drm_device *dev = (struct drm_device *) arg;
190189 struct amdgpu_device *adev = drm_to_adev(dev);
@@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev) · 116 unmodified lines
307306 int amdgpu_irq_init(struct amdgpu_device *adev)
308307 {
309308 int r = 0;
309+ unsigned int irq;
310310
311311 spin_lock_init(&adev->irq.lock);
312312
@@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev) · 36 unmodified lines
349349 INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
350350 INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
351351
352− adev->irq.installed = true;
353− /* Use vector 0 for MSI-X */
354− r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
352+ /* Use vector 0 for MSI-X. */
353+ r = pci_irq_vector(adev->pdev, 0);
354+ if (r < 0)
355+ return r;
356+ irq = r;
357+
358+ /* PCI devices require shared interrupts. */
359+ r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
360+ adev_to_drm(adev));
355361 if (r) {
356− adev->irq.installed = false;
357362 if (!amdgpu_device_has_dc_support(adev))
358363 flush_work(&adev->hotplug_work);
359364 return r;
360365 }
366+ adev->irq.installed = true;
367+ adev->irq.irq = irq;
361368 adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
362369
363370 DRM_DEBUG("amdgpu: irq initialized.\n");
@@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev) · 4 unmodified lines
368375 void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
369376 {
370377 if (adev->irq.installed) {
371− drm_irq_uninstall(&adev->ddev);
378+ free_irq(adev->irq.irq, adev_to_drm(adev));
372379 adev->irq.installed = false;
373380 if (adev->irq.msi_enabled)
374381 pci_free_irq_vectors(adev->pdev);
@@ -584,7 +591,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) · 209 unmodified lines
584591 {
585592 int i, j, k;
586593
587− if (amdgpu_sriov_vf(adev))
594+ if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
588595 amdgpu_restore_msix(adev);
589596
590597 for (i = 0; i < AMDGPU_IRQ_CLIENTID_MAX; ++i) {
@@ -617,7 +624,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) · 26 unmodified lines
617624 int amdgpu_irq_get(struct amdgpu_device *adev, struct amdgpu_irq_src *src,
618625 unsigned type)
619626 {
620− if (!adev_to_drm(adev)->irq_enabled)
627+ if (!adev->irq.installed)
621628 return -ENOENT;
622629
623630 if (type >= src->num_types)
@@ -647,7 +654,7 @@ int amdgpu_irq_get(struct amdgpu_device *adev, struct amdgpu_irq_src *src, · 23 unmodified lines
647654 int amdgpu_irq_put(struct amdgpu_device *adev, struct amdgpu_irq_src *src,
648655 unsigned type)
649656 {
650− if (!adev_to_drm(adev)->irq_enabled)
657+ if (!adev->irq.installed)
651658 return -ENOENT;
652659
653660 if (type >= src->num_types)
@@ -678,7 +685,7 @@ int amdgpu_irq_put(struct amdgpu_device *adev, struct amdgpu_irq_src *src, · 24 unmodified lines
678685 bool amdgpu_irq_enabled(struct amdgpu_device *adev, struct amdgpu_irq_src *src,
679686 unsigned type)
680687 {
681− if (!adev_to_drm(adev)->irq_enabled)
688+ if (!adev->irq.installed)
682689 return false;
683690
684691 if (type >= src->num_types)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h+1−1
@@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs { · 79 unmodified lines
8080
8181 struct amdgpu_irq {
8282 bool installed;
83+ unsigned int irq;
8384 spinlock_t lock;
8485 /* interrupt sources */
8586 struct amdgpu_irq_client client[AMDGPU_IRQ_CLIENTID_MAX];
@@ -100,7 +101,6 @@ struct amdgpu_irq { · 14 unmodified lines
100101 };
101102
102103 void amdgpu_irq_disable_all(struct amdgpu_device *adev);
103−irqreturn_t amdgpu_irq_handler(int irq, void *arg);
104104
105105 int amdgpu_irq_init(struct amdgpu_device *adev);
106106 void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c+28−11
@@ -127,11 +127,16 @@ void amdgpu_job_free_resources(struct amdgpu_job *job) · 126 unmodified lines
127127 {
128128 struct amdgpu_ring *ring = to_amdgpu_ring(job->base.sched);
129129 struct dma_fence *f;
130+ struct dma_fence *hw_fence;
130131 unsigned i;
131132
132− /* use sched fence if available */
133− f = job->base.s_fence ? &job->base.s_fence->finished : job->fence;
133+ if (job->hw_fence.ops == NULL)
134+ hw_fence = job->external_hw_fence;
135+ else
136+ hw_fence = &job->hw_fence;
134137
138+ /* use sched fence if available */
139+ f = job->base.s_fence ? &job->base.s_fence->finished : hw_fence;
135140 for (i = 0; i < job->num_ibs; ++i)
136141 amdgpu_ib_free(ring->adev, &job->ibs[i], f);
137142 }
@@ -142,20 +147,27 @@ static void amdgpu_job_free_cb(struct drm_sched_job *s_job) · 4 unmodified lines
142147
143148 drm_sched_job_cleanup(s_job);
144149
145− dma_fence_put(job->fence);
146150 amdgpu_sync_free(&job->sync);
147151 amdgpu_sync_free(&job->sched_sync);
148− kfree(job);
152+
153+ /* only put the hw fence if has embedded fence */
154+ if (job->hw_fence.ops != NULL)
155+ dma_fence_put(&job->hw_fence);
156+ else
157+ kfree(job);
149158 }
150159
151160 void amdgpu_job_free(struct amdgpu_job *job)
152161 {
153162 amdgpu_job_free_resources(job);
154−
155− dma_fence_put(job->fence);
156163 amdgpu_sync_free(&job->sync);
157164 amdgpu_sync_free(&job->sched_sync);
158− kfree(job);
165+
166+ /* only put the hw fence if has embedded fence */
167+ if (job->hw_fence.ops != NULL)
168+ dma_fence_put(&job->hw_fence);
169+ else
170+ kfree(job);
159171 }
160172
161173 int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,
@@ -184,11 +196,14 @@ int amdgpu_job_submit_direct(struct amdgpu_job *job, struct amdgpu_ring *ring, · 22 unmodified lines
184196
185197 job->base.sched = &ring->sched;
186198 r = amdgpu_ib_schedule(ring, job->num_ibs, job->ibs, NULL, fence);
187− job->fence = dma_fence_get(*fence);
199+ /* record external_hw_fence for direct submit */
200+ job->external_hw_fence = dma_fence_get(*fence);
188201 if (r)
189202 return r;
190203
191204 amdgpu_job_free(job);
205+ dma_fence_put(*fence);
206+
192207 return 0;
193208 }
194209
@@ -246,10 +261,12 @@ static struct dma_fence *amdgpu_job_run(struct drm_sched_job *sched_job) · 51 unmodified lines
246261 if (r)
247262 DRM_ERROR("Error scheduling IBs (%d)\n", r);
248263 }
249− /* if gpu reset, hw fence will be replaced here */
250− dma_fence_put(job->fence);
251− job->fence = dma_fence_get(fence);
252264
265+ if (!job->job_run_counter)
266+ dma_fence_get(fence);
267+ else if (finished->error < 0)
268+ dma_fence_put(&job->hw_fence);
269+ job->job_run_counter++;
253270 amdgpu_job_free_resources(job);
254271
255272 fence = r ? ERR_PTR(r) : fence;
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h+5−1
@@ -46,7 +46,8 @@ struct amdgpu_job { · 45 unmodified lines
4646 struct amdgpu_sync sync;
4747 struct amdgpu_sync sched_sync;
4848 struct amdgpu_ib *ibs;
49− struct dma_fence *fence; /* the hw fence */
49+ struct dma_fence hw_fence;
50+ struct dma_fence *external_hw_fence;
5051 uint32_t preamble_status;
5152 uint32_t preemption_status;
5253 uint32_t num_ibs;
@@ -62,6 +63,9 @@ struct amdgpu_job { · 9 unmodified lines
6263 /* user fence handling */
6364 uint64_t uf_addr;
6465 uint64_t uf_sequence;
66+
67+ /* job_run_counter >= 1 means a resubmit job */
68+ uint32_t job_run_counter;
6569 };
6670
6771 int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c+0−2
@@ -47,8 +47,6 @@ int amdgpu_jpeg_sw_fini(struct amdgpu_device *adev) · 46 unmodified lines
4747 {
4848 int i;
4949
50− cancel_delayed_work_sync(&adev->jpeg.idle_work);
51−
5250 for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
5351 if (adev->jpeg.harvest_config & (1 << i))
5452 continue;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+20−14
@@ -341,27 +341,27 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info, · 340 unmodified lines
341341 switch (query_fw->index) {
342342 case TA_FW_TYPE_PSP_XGMI:
343343 fw_info->ver = adev->psp.ta_fw_version;
344− fw_info->feature = adev->psp.ta_xgmi_ucode_version;
344+ fw_info->feature = adev->psp.xgmi.feature_version;
345345 break;
346346 case TA_FW_TYPE_PSP_RAS:
347347 fw_info->ver = adev->psp.ta_fw_version;
348− fw_info->feature = adev->psp.ta_ras_ucode_version;
348+ fw_info->feature = adev->psp.ras.feature_version;
349349 break;
350350 case TA_FW_TYPE_PSP_HDCP:
351351 fw_info->ver = adev->psp.ta_fw_version;
352− fw_info->feature = adev->psp.ta_hdcp_ucode_version;
352+ fw_info->feature = adev->psp.hdcp.feature_version;
353353 break;
354354 case TA_FW_TYPE_PSP_DTM:
355355 fw_info->ver = adev->psp.ta_fw_version;
356− fw_info->feature = adev->psp.ta_dtm_ucode_version;
356+ fw_info->feature = adev->psp.dtm.feature_version;
357357 break;
358358 case TA_FW_TYPE_PSP_RAP:
359359 fw_info->ver = adev->psp.ta_fw_version;
360− fw_info->feature = adev->psp.ta_rap_ucode_version;
360+ fw_info->feature = adev->psp.rap.feature_version;
361361 break;
362362 case TA_FW_TYPE_PSP_SECUREDISPLAY:
363363 fw_info->ver = adev->psp.ta_fw_version;
364− fw_info->feature = adev->psp.ta_securedisplay_ucode_version;
364+ fw_info->feature = adev->psp.securedisplay.feature_version;
365365 break;
366366 default:
367367 return -EINVAL;
@@ -374,12 +374,12 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info, · 6 unmodified lines
374374 fw_info->feature = adev->sdma.instance[query_fw->index].feature_version;
375375 break;
376376 case AMDGPU_INFO_FW_SOS:
377− fw_info->ver = adev->psp.sos_fw_version;
378− fw_info->feature = adev->psp.sos_feature_version;
377+ fw_info->ver = adev->psp.sos.fw_version;
378+ fw_info->feature = adev->psp.sos.feature_version;
379379 break;
380380 case AMDGPU_INFO_FW_ASD:
381− fw_info->ver = adev->psp.asd_fw_version;
382− fw_info->feature = adev->psp.asd_feature_version;
381+ fw_info->ver = adev->psp.asd.fw_version;
382+ fw_info->feature = adev->psp.asd.feature_version;
383383 break;
384384 case AMDGPU_INFO_FW_DMCU:
385385 fw_info->ver = adev->dm.dmcu_fw_version;
@@ -390,8 +390,8 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info, · 4 unmodified lines
390390 fw_info->feature = 0;
391391 break;
392392 case AMDGPU_INFO_FW_TOC:
393− fw_info->ver = adev->psp.toc_fw_version;
394− fw_info->feature = adev->psp.toc_feature_version;
393+ fw_info->ver = adev->psp.toc.fw_version;
394+ fw_info->feature = adev->psp.toc.feature_version;
395395 break;
396396 default:
397397 return -EINVAL;
@@ -1179,10 +1179,14 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) · 781 unmodified lines
11791179 pasid = 0;
11801180 }
11811181
1182− r = amdgpu_vm_init(adev, &fpriv->vm, pasid);
1182+ r = amdgpu_vm_init(adev, &fpriv->vm);
11831183 if (r)
11841184 goto error_pasid;
11851185
1186+ r = amdgpu_vm_set_pasid(adev, &fpriv->vm, pasid);
1187+ if (r)
1188+ goto error_vm;
1189+
11861190 fpriv->prt_va = amdgpu_vm_bo_add(adev, &fpriv->vm, NULL);
11871191 if (!fpriv->prt_va) {
11881192 r = -ENOMEM;
@@ -1210,8 +1214,10 @@ error_vm: · 21 unmodified lines
12101214 amdgpu_vm_fini(adev, &fpriv->vm);
12111215
12121216 error_pasid:
1213− if (pasid)
1217+ if (pasid) {
12141218 amdgpu_pasid_free(pasid);
1219+ amdgpu_vm_set_pasid(adev, &fpriv->vm, 0);
1220+ }
12151221
12161222 kfree(fpriv);
12171223
drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c+117−0
@@ -0,0 +1,117 @@
1+/*
2+ * Copyright 2021 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ */
23+#include "amdgpu_ras.h"
24+#include "amdgpu.h"
25+#include "amdgpu_mca.h"
26+
27+#include "umc/umc_6_7_0_offset.h"
28+#include "umc/umc_6_7_0_sh_mask.h"
29+
30+void amdgpu_mca_query_correctable_error_count(struct amdgpu_device *adev,
31+ uint64_t mc_status_addr,
32+ unsigned long *error_count)
33+{
34+ uint64_t mc_status = RREG64_PCIE(mc_status_addr * 4);
35+
36+ if (REG_GET_FIELD(mc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1 &&
37+ REG_GET_FIELD(mc_status, MCA_UMC_UMC0_MCUMC_STATUST0, CECC) == 1)
38+ *error_count += 1;
39+}
40+
41+void amdgpu_mca_query_uncorrectable_error_count(struct amdgpu_device *adev,
42+ uint64_t mc_status_addr,
43+ unsigned long *error_count)
44+{
45+ uint64_t mc_status = RREG64_PCIE(mc_status_addr * 4);
46+
47+ if ((REG_GET_FIELD(mc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1) &&
48+ (REG_GET_FIELD(mc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Deferred) == 1 ||
49+ REG_GET_FIELD(mc_status, MCA_UMC_UMC0_MCUMC_STATUST0, UECC) == 1 ||
50+ REG_GET_FIELD(mc_status, MCA_UMC_UMC0_MCUMC_STATUST0, PCC) == 1 ||
51+ REG_GET_FIELD(mc_status, MCA_UMC_UMC0_MCUMC_STATUST0, UC) == 1 ||
52+ REG_GET_FIELD(mc_status, MCA_UMC_UMC0_MCUMC_STATUST0, TCC) == 1))
53+ *error_count += 1;
54+}
55+
56+void amdgpu_mca_reset_error_count(struct amdgpu_device *adev,
57+ uint64_t mc_status_addr)
58+{
59+ WREG64_PCIE(mc_status_addr * 4, 0x0ULL);
60+}
61+
62+void amdgpu_mca_query_ras_error_count(struct amdgpu_device *adev,
63+ uint64_t mc_status_addr,
64+ void *ras_error_status)
65+{
66+ struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
67+
68+ amdgpu_mca_query_correctable_error_count(adev, mc_status_addr, &(err_data->ce_count));
69+ amdgpu_mca_query_uncorrectable_error_count(adev, mc_status_addr, &(err_data->ue_count));
70+
71+ amdgpu_mca_reset_error_count(adev, mc_status_addr);
72+}
73+
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->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
91+ mca_dev->ras_if->sub_block_index = 0;
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+
104+void amdgpu_mca_ras_fini(struct amdgpu_device *adev,
105+ struct amdgpu_mca_ras *mca_dev)
106+{
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;
117+}
drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h+72−0
@@ -0,0 +1,72 @@
1+/*
2+ * Copyright (C) 2021 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included
12+ * in all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+ */
21+#ifndef __AMDGPU_MCA_H__
22+#define __AMDGPU_MCA_H__
23+
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+ const char* sysfs_name;
33+};
34+
35+struct amdgpu_mca_ras {
36+ struct ras_common_if *ras_if;
37+ const struct amdgpu_mca_ras_funcs *ras_funcs;
38+};
39+
40+struct amdgpu_mca_funcs {
41+ void (*init)(struct amdgpu_device *adev);
42+};
43+
44+struct amdgpu_mca {
45+ const struct amdgpu_mca_funcs *funcs;
46+ struct amdgpu_mca_ras mp0;
47+ struct amdgpu_mca_ras mp1;
48+ struct amdgpu_mca_ras mpio;
49+};
50+
51+void amdgpu_mca_query_correctable_error_count(struct amdgpu_device *adev,
52+ uint64_t mc_status_addr,
53+ unsigned long *error_count);
54+
55+void amdgpu_mca_query_uncorrectable_error_count(struct amdgpu_device *adev,
56+ uint64_t mc_status_addr,
57+ unsigned long *error_count);
58+
59+void amdgpu_mca_reset_error_count(struct amdgpu_device *adev,
60+ uint64_t mc_status_addr);
61+
62+void amdgpu_mca_query_ras_error_count(struct amdgpu_device *adev,
63+ uint64_t mc_status_addr,
64+ void *ras_error_status);
65+
66+int amdgpu_mca_ras_late_init(struct amdgpu_device *adev,
67+ struct amdgpu_mca_ras *mca_dev);
68+
69+void amdgpu_mca_ras_fini(struct amdgpu_device *adev,
70+ struct amdgpu_mca_ras *mca_dev);
71+
72+#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c+0−1
@@ -41,7 +41,6 @@ int amdgpu_mmhub_ras_late_init(struct amdgpu_device *adev) · 40 unmodified lines
4141 adev->mmhub.ras_if->block = AMDGPU_RAS_BLOCK__MMHUB;
4242 adev->mmhub.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
4343 adev->mmhub.ras_if->sub_block_index = 0;
44− strcpy(adev->mmhub.ras_if->name, "mmhub");
4544 }
4645 ih_info.head = fs_info.head = *adev->mmhub.ras_if;
4746 r = amdgpu_ras_late_init(adev, adev->mmhub.ras_if,
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c+0−1
@@ -39,7 +39,6 @@ int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev) · 38 unmodified lines
3939 adev->nbio.ras_if->block = AMDGPU_RAS_BLOCK__PCIE_BIF;
4040 adev->nbio.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
4141 adev->nbio.ras_if->sub_block_index = 0;
42− strcpy(adev->nbio.ras_if->name, "pcie_bif");
4342 }
4443 ih_info.head = fs_info.head = *adev->nbio.ras_if;
4544 r = amdgpu_ras_late_init(adev, adev->nbio.ras_if,
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h+1−0
@@ -95,6 +95,7 @@ struct amdgpu_nbio_funcs { · 94 unmodified lines
9595 void (*program_aspm)(struct amdgpu_device *adev);
9696 void (*apply_lc_spc_mode_wa)(struct amdgpu_device *adev);
9797 void (*apply_l1_link_width_reconfig_wa)(struct amdgpu_device *adev);
98+ void (*clear_doorbell_interrupt)(struct amdgpu_device *adev);
9899 };
99100
100101 struct amdgpu_nbio {
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+7−7
@@ -196,7 +196,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) · 195 unmodified lines
196196 c++;
197197 }
198198
199− BUG_ON(c >= AMDGPU_BO_MAX_PLACEMENTS);
199+ BUG_ON(c > AMDGPU_BO_MAX_PLACEMENTS);
200200
201201 placement->num_placement = c;
202202 placement->placement = places;
@@ -731,7 +731,7 @@ retry: · 528 unmodified lines
731731 /**
732732 * amdgpu_bo_add_to_shadow_list - add a BO to the shadow list
733733 *
734− * @bo: BO that will be inserted into the shadow list
734+ * @vmbo: BO that will be inserted into the shadow list
735735 *
736736 * Insert a BO to the shadow list.
737737 */
@@ -913,7 +913,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · 175 unmodified lines
913913 return -EINVAL;
914914
915915 /* A shared bo cannot be migrated to VRAM */
916− if (bo->prime_shared_count || bo->tbo.base.import_attach) {
916+ if (bo->tbo.base.import_attach) {
917917 if (domain & AMDGPU_GEM_DOMAIN_GTT)
918918 domain = AMDGPU_GEM_DOMAIN_GTT;
919919 else
@@ -947,7 +947,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · 27 unmodified lines
947947 /* This assumes only APU display buffers are pinned with (VRAM|GTT).
948948 * See function amdgpu_display_supported_domains()
949949 */
950− domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
950+ domain = amdgpu_bo_get_preferred_domain(adev, domain);
951951
952952 if (bo->tbo.base.import_attach)
953953 dma_buf_pin(bo->tbo.base.import_attach);
@@ -1518,14 +1518,14 @@ u64 amdgpu_bo_gpu_offset_no_check(struct amdgpu_bo *bo) · 564 unmodified lines
15181518 }
15191519
15201520 /**
1521− * amdgpu_bo_get_preferred_pin_domain - get preferred domain for scanout
1521+ * amdgpu_bo_get_preferred_domain - get preferred domain
15221522 * @adev: amdgpu device object
15231523 * @domain: allowed :ref:`memory domains <amdgpu_memory_domains>`
15241524 *
15251525 * Returns:
1526− * Which of the allowed domains is preferred for pinning the BO for scanout.
1526+ * Which of the allowed domains is preferred for allocating the BO.
15271527 */
1528−uint32_t amdgpu_bo_get_preferred_pin_domain(struct amdgpu_device *adev,
1528+uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev,
15291529 uint32_t domain)
15301530 {
15311531 if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h+1−2
@@ -100,7 +100,6 @@ struct amdgpu_bo { · 99 unmodified lines
100100 struct ttm_buffer_object tbo;
101101 struct ttm_bo_kmap_obj kmap;
102102 u64 flags;
103− unsigned prime_shared_count;
104103 /* per VM structure for page tables and with virtual addresses */
105104 struct amdgpu_vm_bo_base *vm_bo;
106105 /* Constant after initialization */
@@ -334,7 +333,7 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo, uint64_t *vram_mem, · 227 unmodified lines
334333 void amdgpu_bo_add_to_shadow_list(struct amdgpu_bo_vm *vmbo);
335334 int amdgpu_bo_restore_shadow(struct amdgpu_bo *shadow,
336335 struct dma_fence **fence);
337−uint32_t amdgpu_bo_get_preferred_pin_domain(struct amdgpu_device *adev,
336+uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev,
338337 uint32_t domain);
339338
340339 /*
drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c+13−7
@@ -80,12 +80,17 @@ static void amdgpu_pll_reduce_ratio(unsigned *nom, unsigned *den, · 79 unmodified lines
8080 * Calculate feedback and reference divider for a given post divider. Makes
8181 * sure we stay within the limits.
8282 */
83−static void amdgpu_pll_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div,
84− unsigned fb_div_max, unsigned ref_div_max,
85− unsigned *fb_div, unsigned *ref_div)
83+static void amdgpu_pll_get_fb_ref_div(struct amdgpu_device *adev, unsigned int nom,
84+ unsigned int den, unsigned int post_div,
85+ unsigned int fb_div_max, unsigned int ref_div_max,
86+ unsigned int *fb_div, unsigned int *ref_div)
8687 {
88+
8789 /* limit reference * post divider to a maximum */
88− ref_div_max = min(128 / post_div, ref_div_max);
90+ if (adev->family == AMDGPU_FAMILY_SI)
91+ ref_div_max = min(100 / post_div, ref_div_max);
92+ else
93+ ref_div_max = min(128 / post_div, ref_div_max);
8994
9095 /* get matching reference and feedback divider */
9196 *ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max);
@@ -112,7 +117,8 @@ static void amdgpu_pll_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_ · 20 unmodified lines
112117 * Try to calculate the PLL parameters to generate the given frequency:
113118 * dot_clock = (ref_freq * feedback_div) / (ref_div * post_div)
114119 */
115−void amdgpu_pll_compute(struct amdgpu_pll *pll,
120+void amdgpu_pll_compute(struct amdgpu_device *adev,
121+ struct amdgpu_pll *pll,
116122 u32 freq,
117123 u32 *dot_clock_p,
118124 u32 *fb_div_p,
@@ -199,7 +205,7 @@ void amdgpu_pll_compute(struct amdgpu_pll *pll, · 80 unmodified lines
199205
200206 for (post_div = post_div_min; post_div <= post_div_max; ++post_div) {
201207 unsigned diff;
202− amdgpu_pll_get_fb_ref_div(nom, den, post_div, fb_div_max,
208+ amdgpu_pll_get_fb_ref_div(adev, nom, den, post_div, fb_div_max,
203209 ref_div_max, &fb_div, &ref_div);
204210 diff = abs(target_clock - (pll->reference_freq * fb_div) /
205211 (ref_div * post_div));
@@ -214,7 +220,7 @@ void amdgpu_pll_compute(struct amdgpu_pll *pll, · 8 unmodified lines
214220 post_div = post_div_best;
215221
216222 /* get the feedback and reference divider for the optimal value */
217− amdgpu_pll_get_fb_ref_div(nom, den, post_div, fb_div_max, ref_div_max,
223+ amdgpu_pll_get_fb_ref_div(adev, nom, den, post_div, fb_div_max, ref_div_max,
218224 &fb_div, &ref_div);
219225
220226 /* reduce the numbers to a simpler ratio once more */
drivers/gpu/drm/amd/amdgpu/amdgpu_pll.h+2−1
@@ -24,7 +24,8 @@ · 23 unmodified lines
2424 #ifndef __AMDGPU_PLL_H__
2525 #define __AMDGPU_PLL_H__
2626
27−void amdgpu_pll_compute(struct amdgpu_pll *pll,
27+void amdgpu_pll_compute(struct amdgpu_device *adev,
28+ struct amdgpu_pll *pll,
2829 u32 freq,
2930 u32 *dot_clock_p,
3031 u32 *fb_div_p,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c+655−460
@@ -24,16 +24,17 @@ · 23 unmodified lines
2424 */
2525
2626 #include <linux/firmware.h>
27−#include <linux/dma-mapping.h>
2827 #include <drm/drm_drv.h>
2928
3029 #include "amdgpu.h"
3130 #include "amdgpu_psp.h"
3231 #include "amdgpu_ucode.h"
32+#include "amdgpu_xgmi.h"
3333 #include "soc15_common.h"
3434 #include "psp_v3_1.h"
3535 #include "psp_v10_0.h"
3636 #include "psp_v11_0.h"
37+#include "psp_v11_0_8.h"
3738 #include "psp_v12_0.h"
3839 #include "psp_v13_0.h"
3940
@@ -41,8 +42,6 @@ · 1 unmodified line
4142 #include "amdgpu_securedisplay.h"
4243 #include "amdgpu_atomfirmware.h"
4344
44−#include <drm/drm_drv.h>
45−
4645 static int psp_sysfs_init(struct amdgpu_device *adev);
4746 static void psp_sysfs_fini(struct amdgpu_device *adev);
4847
@@ -122,6 +121,12 @@ static int psp_early_init(void *handle) · 73 unmodified lines
122121 psp_v13_0_set_psp_funcs(psp);
123122 psp->autoload_supported = true;
124123 break;
124+ case CHIP_CYAN_SKILLFISH:
125+ if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2) {
126+ psp_v11_0_8_set_psp_funcs(psp);
127+ psp->autoload_supported = false;
128+ }
129+ break;
125130 default:
126131 return -EINVAL;
127132 }
@@ -247,6 +252,12 @@ static int psp_sw_init(void *handle) · 119 unmodified lines
247252 struct psp_runtime_boot_cfg_entry boot_cfg_entry;
248253 struct psp_memory_training_context *mem_training_ctx = &psp->mem_train_ctx;
249254
255+ psp->cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
256+ if (!psp->cmd) {
257+ DRM_ERROR("Failed to allocate memory to command buffer!\n");
258+ ret = -ENOMEM;
259+ }
260+
250261 if (!amdgpu_sriov_vf(adev)) {
251262 ret = psp_init_microcode(psp);
252263 if (ret) {
@@ -309,25 +320,30 @@ static int psp_sw_init(void *handle) · 56 unmodified lines
309320 static int psp_sw_fini(void *handle)
310321 {
311322 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
323+ struct psp_context *psp = &adev->psp;
324+ struct psp_gfx_cmd_resp *cmd = psp->cmd;
312325
313− psp_memory_training_fini(&adev->psp);
314− if (adev->psp.sos_fw) {
315− release_firmware(adev->psp.sos_fw);
316− adev->psp.sos_fw = NULL;
326+ psp_memory_training_fini(psp);
327+ if (psp->sos_fw) {
328+ release_firmware(psp->sos_fw);
329+ psp->sos_fw = NULL;
317330 }
318− if (adev->psp.asd_fw) {
319− release_firmware(adev->psp.asd_fw);
320− adev->psp.asd_fw = NULL;
331+ if (psp->asd_fw) {
332+ release_firmware(psp->asd_fw);
333+ psp->asd_fw = NULL;
321334 }
322− if (adev->psp.ta_fw) {
323− release_firmware(adev->psp.ta_fw);
324− adev->psp.ta_fw = NULL;
335+ if (psp->ta_fw) {
336+ release_firmware(psp->ta_fw);
337+ psp->ta_fw = NULL;
325338 }
326339
327340 if (adev->asic_type == CHIP_NAVI10 ||
328341 adev->asic_type == CHIP_SIENNA_CICHLID)
329342 psp_sysfs_fini(adev);
330343
344+ kfree(cmd);
345+ cmd = NULL;
346+
331347 return 0;
332348 }
333349
@@ -356,6 +372,44 @@ int psp_wait_for(struct psp_context *psp, uint32_t reg_index, · 22 unmodified lines
356372 return -ETIME;
357373 }
358374
375+static const char *psp_gfx_cmd_name(enum psp_gfx_cmd_id cmd_id)
376+{
377+ switch (cmd_id) {
378+ case GFX_CMD_ID_LOAD_TA:
379+ return "LOAD_TA";
380+ case GFX_CMD_ID_UNLOAD_TA:
381+ return "UNLOAD_TA";
382+ case GFX_CMD_ID_INVOKE_CMD:
383+ return "INVOKE_CMD";
384+ case GFX_CMD_ID_LOAD_ASD:
385+ return "LOAD_ASD";
386+ case GFX_CMD_ID_SETUP_TMR:
387+ return "SETUP_TMR";
388+ case GFX_CMD_ID_LOAD_IP_FW:
389+ return "LOAD_IP_FW";
390+ case GFX_CMD_ID_DESTROY_TMR:
391+ return "DESTROY_TMR";
392+ case GFX_CMD_ID_SAVE_RESTORE:
393+ return "SAVE_RESTORE_IP_FW";
394+ case GFX_CMD_ID_SETUP_VMR:
395+ return "SETUP_VMR";
396+ case GFX_CMD_ID_DESTROY_VMR:
397+ return "DESTROY_VMR";
398+ case GFX_CMD_ID_PROG_REG:
399+ return "PROG_REG";
400+ case GFX_CMD_ID_GET_FW_ATTESTATION:
401+ return "GET_FW_ATTESTATION";
402+ case GFX_CMD_ID_LOAD_TOC:
403+ return "ID_LOAD_TOC";
404+ case GFX_CMD_ID_AUTOLOAD_RLC:
405+ return "AUTOLOAD_RLC";
406+ case GFX_CMD_ID_BOOT_CFG:
407+ return "BOOT_CFG";
408+ default:
409+ return "UNKNOWN CMD";
410+ }
411+}
412+
359413 static int
360414 psp_cmd_submit_buf(struct psp_context *psp,
361415 struct amdgpu_firmware_info *ucode,
@@ -373,8 +427,6 @@ psp_cmd_submit_buf(struct psp_context *psp, · 11 unmodified lines
373427 if (!drm_dev_enter(&psp->adev->ddev, &idx))
374428 return 0;
375429
376− mutex_lock(&psp->mutex);
377−
378430 memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);
379431
380432 memcpy(psp->cmd_buf_mem, cmd, sizeof(struct psp_gfx_cmd_resp));
@@ -417,10 +469,10 @@ psp_cmd_submit_buf(struct psp_context *psp, · 36 unmodified lines
417469 */
418470 if (!skip_unsupport && (psp->cmd_buf_mem->resp.status || !timeout) && !ras_intr) {
419471 if (ucode)
420− DRM_WARN("failed to load ucode id (%d) ",
421− ucode->ucode_id);
422− DRM_WARN("psp command (0x%X) failed and response status is (0x%X)\n",
423− psp->cmd_buf_mem->cmd_id,
472+ DRM_WARN("failed to load ucode (%s) ",
473+ amdgpu_ucode_name(ucode->ucode_id));
474+ DRM_WARN("psp gfx command (%s) failed and response status is (0x%X)\n",
475+ psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id),
424476 psp->cmd_buf_mem->resp.status);
425477 if (!timeout) {
426478 ret = -EINVAL;
@@ -434,11 +486,26 @@ psp_cmd_submit_buf(struct psp_context *psp, · 7 unmodified lines
434486 }
435487
436488 exit:
437− mutex_unlock(&psp->mutex);
438489 drm_dev_exit(idx);
439490 return ret;
440491 }
441492
493+static struct psp_gfx_cmd_resp *acquire_psp_cmd_buf(struct psp_context *psp)
494+{
495+ struct psp_gfx_cmd_resp *cmd = psp->cmd;
496+
497+ mutex_lock(&psp->mutex);
498+
499+ memset(cmd, 0, sizeof(struct psp_gfx_cmd_resp));
500+
501+ return cmd;
502+}
503+
504+void release_psp_cmd_buf(struct psp_context *psp)
505+{
506+ mutex_unlock(&psp->mutex);
507+}
508+
442509 static void psp_prep_tmr_cmd_buf(struct psp_context *psp,
443510 struct psp_gfx_cmd_resp *cmd,
444511 uint64_t tmr_mc, struct amdgpu_bo *tmr_bo)
@@ -473,21 +540,20 @@ static int psp_load_toc(struct psp_context *psp, · 28 unmodified lines
473540 uint32_t *tmr_size)
474541 {
475542 int ret;
476− struct psp_gfx_cmd_resp *cmd;
543+ struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
477544
478− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
479− if (!cmd)
480− return -ENOMEM;
481545 /* Copy toc to psp firmware private buffer */
482− psp_copy_fw(psp, psp->toc_start_addr, psp->toc_bin_size);
546+ psp_copy_fw(psp, psp->toc.start_addr, psp->toc.size_bytes);
483547
484− psp_prep_load_toc_cmd_buf(cmd, psp->fw_pri_mc_addr, psp->toc_bin_size);
548+ psp_prep_load_toc_cmd_buf(cmd, psp->fw_pri_mc_addr, psp->toc.size_bytes);
485549
486550 ret = psp_cmd_submit_buf(psp, NULL, cmd,
487551 psp->fence_buf_mc_addr);
488552 if (!ret)
489553 *tmr_size = psp->cmd_buf_mem->resp.tmr_size;
490− kfree(cmd);
554+
555+ release_psp_cmd_buf(psp);
556+
491557 return ret;
492558 }
493559
@@ -511,8 +577,8 @@ static int psp_tmr_init(struct psp_context *psp) · 17 unmodified lines
511577 /* For ASICs support RLC autoload, psp will parse the toc
512578 * and calculate the total size of TMR needed */
513579 if (!amdgpu_sriov_vf(psp->adev) &&
514− psp->toc_start_addr &&
515− psp->toc_bin_size &&
580+ psp->toc.start_addr &&
581+ psp->toc.size_bytes &&
516582 psp->fw_pri_buf) {
517583 ret = psp_load_toc(psp, &tmr_size);
518584 if (ret) {
@@ -552,9 +618,7 @@ static int psp_tmr_load(struct psp_context *psp) · 33 unmodified lines
552618 if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
553619 return 0;
554620
555− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
556− if (!cmd)
557− return -ENOMEM;
621+ cmd = acquire_psp_cmd_buf(psp);
558622
559623 psp_prep_tmr_cmd_buf(psp, cmd, psp->tmr_mc_addr, psp->tmr_bo);
560624 DRM_INFO("reserve 0x%lx from 0x%llx for PSP TMR\n",
@@ -563,13 +627,13 @@ static int psp_tmr_load(struct psp_context *psp) · 2 unmodified lines
563627 ret = psp_cmd_submit_buf(psp, NULL, cmd,
564628 psp->fence_buf_mc_addr);
565629
566− kfree(cmd);
630+ release_psp_cmd_buf(psp);
567631
568632 return ret;
569633 }
570634
571635 static void psp_prep_tmr_unload_cmd_buf(struct psp_context *psp,
572− struct psp_gfx_cmd_resp *cmd)
636+ struct psp_gfx_cmd_resp *cmd)
573637 {
574638 if (amdgpu_sriov_vf(psp->adev))
575639 cmd->cmd_id = GFX_CMD_ID_DESTROY_VMR;
@@ -580,11 +644,7 @@ static void psp_prep_tmr_unload_cmd_buf(struct psp_context *psp, · 4 unmodified lines
580644 static int psp_tmr_unload(struct psp_context *psp)
581645 {
582646 int ret;
583− struct psp_gfx_cmd_resp *cmd;
584−
585− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
586− if (!cmd)
587− return -ENOMEM;
647+ struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
588648
589649 psp_prep_tmr_unload_cmd_buf(psp, cmd);
590650 DRM_INFO("free PSP TMR buffer\n");
@@ -592,7 +652,7 @@ static int psp_tmr_unload(struct psp_context *psp) · 1 unmodified line
592652 ret = psp_cmd_submit_buf(psp, NULL, cmd,
593653 psp->fence_buf_mc_addr);
594654
595− kfree(cmd);
655+ release_psp_cmd_buf(psp);
596656
597657 return ret;
598658 }
@@ -626,9 +686,7 @@ int psp_get_fw_attestation_records_addr(struct psp_context *psp, · 27 unmodified lines
626686 if (amdgpu_sriov_vf(psp->adev))
627687 return 0;
628688
629− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
630− if (!cmd)
631− return -ENOMEM;
689+ cmd = acquire_psp_cmd_buf(psp);
632690
633691 cmd->cmd_id = GFX_CMD_ID_GET_FW_ATTESTATION;
634692
@@ -640,7 +698,7 @@ int psp_get_fw_attestation_records_addr(struct psp_context *psp, · 5 unmodified lines
640698 ((uint64_t)cmd->resp.uresp.fwar_db_info.fwar_db_addr_hi << 32);
641699 }
642700
643− kfree(cmd);
701+ release_psp_cmd_buf(psp);
644702
645703 return ret;
646704 }
@@ -648,13 +706,13 @@ int psp_get_fw_attestation_records_addr(struct psp_context *psp, · 1 unmodified line
648706 static int psp_boot_config_get(struct amdgpu_device *adev, uint32_t *boot_cfg)
649707 {
650708 struct psp_context *psp = &adev->psp;
651− struct psp_gfx_cmd_resp *cmd = psp->cmd;
709+ struct psp_gfx_cmd_resp *cmd;
652710 int ret;
653711
654712 if (amdgpu_sriov_vf(adev))
655713 return 0;
656714
657− memset(cmd, 0, sizeof(struct psp_gfx_cmd_resp));
715+ cmd = acquire_psp_cmd_buf(psp);
658716
659717 cmd->cmd_id = GFX_CMD_ID_BOOT_CFG;
660718 cmd->cmd.boot_cfg.sub_cmd = BOOTCFG_CMD_GET;
@@ -665,47 +723,59 @@ static int psp_boot_config_get(struct amdgpu_device *adev, uint32_t *boot_cfg) · 4 unmodified lines
665723 (cmd->resp.uresp.boot_cfg.boot_cfg & BOOT_CONFIG_GECC) ? 1 : 0;
666724 }
667725
726+ release_psp_cmd_buf(psp);
727+
668728 return ret;
669729 }
670730
671731 static int psp_boot_config_set(struct amdgpu_device *adev, uint32_t boot_cfg)
672732 {
733+ int ret;
673734 struct psp_context *psp = &adev->psp;
674− struct psp_gfx_cmd_resp *cmd = psp->cmd;
735+ struct psp_gfx_cmd_resp *cmd;
675736
676737 if (amdgpu_sriov_vf(adev))
677738 return 0;
678739
679− memset(cmd, 0, sizeof(struct psp_gfx_cmd_resp));
740+ cmd = acquire_psp_cmd_buf(psp);
680741
681742 cmd->cmd_id = GFX_CMD_ID_BOOT_CFG;
682743 cmd->cmd.boot_cfg.sub_cmd = BOOTCFG_CMD_SET;
683744 cmd->cmd.boot_cfg.boot_config = boot_cfg;
684745 cmd->cmd.boot_cfg.boot_config_valid = boot_cfg;
685746
686− return psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
747+ ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
748+
749+ release_psp_cmd_buf(psp);
750+
751+ return ret;
687752 }
688753
689754 static int psp_rl_load(struct amdgpu_device *adev)
690755 {
756+ int ret;
691757 struct psp_context *psp = &adev->psp;
692− struct psp_gfx_cmd_resp *cmd = psp->cmd;
758+ struct psp_gfx_cmd_resp *cmd;
693759
694− if (psp->rl_bin_size == 0)
760+ if (!is_psp_fw_valid(psp->rl))
695761 return 0;
696762
697− memset(psp->fw_pri_buf, 0, PSP_1_MEG);
698− memcpy(psp->fw_pri_buf, psp->rl_start_addr, psp->rl_bin_size);
763+ cmd = acquire_psp_cmd_buf(psp);
699764
700− memset(cmd, 0, sizeof(struct psp_gfx_cmd_resp));
765+ memset(psp->fw_pri_buf, 0, PSP_1_MEG);
766+ memcpy(psp->fw_pri_buf, psp->rl.start_addr, psp->rl.size_bytes);
701767
702768 cmd->cmd_id = GFX_CMD_ID_LOAD_IP_FW;
703769 cmd->cmd.cmd_load_ip_fw.fw_phy_addr_lo = lower_32_bits(psp->fw_pri_mc_addr);
704770 cmd->cmd.cmd_load_ip_fw.fw_phy_addr_hi = upper_32_bits(psp->fw_pri_mc_addr);
705− cmd->cmd.cmd_load_ip_fw.fw_size = psp->rl_bin_size;
771+ cmd->cmd.cmd_load_ip_fw.fw_size = psp->rl.size_bytes;
706772 cmd->cmd.cmd_load_ip_fw.fw_type = GFX_FW_TYPE_REG_LIST;
707773
708− return psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
774+ ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
775+
776+ release_psp_cmd_buf(psp);
777+
778+ return ret;
709779 }
710780
711781 static void psp_prep_asd_load_cmd_buf(struct psp_gfx_cmd_resp *cmd,
@@ -730,17 +800,15 @@ static int psp_asd_load(struct psp_context *psp) · 18 unmodified lines
730800 * add workaround to bypass it for sriov now.
731801 * TODO: add version check to make it common
732802 */
733− if (amdgpu_sriov_vf(psp->adev) || !psp->asd_ucode_size)
803+ if (amdgpu_sriov_vf(psp->adev) || !psp->asd.size_bytes)
734804 return 0;
735805
736− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
737− if (!cmd)
738− return -ENOMEM;
806+ cmd = acquire_psp_cmd_buf(psp);
739807
740− psp_copy_fw(psp, psp->asd_start_addr, psp->asd_ucode_size);
808+ psp_copy_fw(psp, psp->asd.start_addr, psp->asd.size_bytes);
741809
742810 psp_prep_asd_load_cmd_buf(cmd, psp->fw_pri_mc_addr,
743− psp->asd_ucode_size);
811+ psp->asd.size_bytes);
744812
745813 ret = psp_cmd_submit_buf(psp, NULL, cmd,
746814 psp->fence_buf_mc_addr);
@@ -749,7 +817,7 @@ static int psp_asd_load(struct psp_context *psp) · 2 unmodified lines
749817 psp->asd_context.session_id = cmd->resp.session_id;
750818 }
751819
752− kfree(cmd);
820+ release_psp_cmd_buf(psp);
753821
754822 return ret;
755823 }
@@ -772,9 +840,7 @@ static int psp_asd_unload(struct psp_context *psp) · 16 unmodified lines
772840 if (!psp->asd_context.asd_initialized)
773841 return 0;
774842
775− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
776− if (!cmd)
777− return -ENOMEM;
843+ cmd = acquire_psp_cmd_buf(psp);
778844
779845 psp_prep_ta_unload_cmd_buf(cmd, psp->asd_context.session_id);
780846
@@ -783,7 +849,7 @@ static int psp_asd_unload(struct psp_context *psp) · 2 unmodified lines
783849 if (!ret)
784850 psp->asd_context.asd_initialized = false;
785851
786− kfree(cmd);
852+ release_psp_cmd_buf(psp);
787853
788854 return ret;
789855 }
@@ -799,22 +865,21 @@ static void psp_prep_reg_prog_cmd_buf(struct psp_gfx_cmd_resp *cmd, · 9 unmodified lines
799865 int psp_reg_program(struct psp_context *psp, enum psp_reg_prog_id reg,
800866 uint32_t value)
801867 {
802− struct psp_gfx_cmd_resp *cmd = NULL;
868+ struct psp_gfx_cmd_resp *cmd;
803869 int ret = 0;
804870
805871 if (reg >= PSP_REG_LAST)
806872 return -EINVAL;
807873
808− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
809− if (!cmd)
810− return -ENOMEM;
874+ cmd = acquire_psp_cmd_buf(psp);
811875
812876 psp_prep_reg_prog_cmd_buf(cmd, reg, value);
813877 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
814878 if (ret)
815879 DRM_ERROR("PSP failed to program reg id %d", reg);
816880
817− kfree(cmd);
881+ release_psp_cmd_buf(psp);
882+
818883 return ret;
819884 }
820885
@@ -834,23 +899,37 @@ static void psp_prep_ta_load_cmd_buf(struct psp_gfx_cmd_resp *cmd, · 13 unmodified lines
834899 cmd->cmd.cmd_load_ta.cmd_buf_len = ta_shared_size;
835900 }
836901
837−static int psp_xgmi_init_shared_buf(struct psp_context *psp)
902+static int psp_ta_init_shared_buf(struct psp_context *psp,
903+ struct ta_mem_context *mem_ctx,
904+ uint32_t shared_mem_size)
838905 {
839906 int ret;
840907
841908 /*
842− * Allocate 16k memory aligned to 4k from Frame Buffer (local
843− * physical) for xgmi ta <-> Driver
844− */
845− ret = amdgpu_bo_create_kernel(psp->adev, PSP_XGMI_SHARED_MEM_SIZE,
846− PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
847− &psp->xgmi_context.xgmi_shared_bo,
848− &psp->xgmi_context.xgmi_shared_mc_addr,
849− &psp->xgmi_context.xgmi_shared_buf);
909+ * Allocate 16k memory aligned to 4k from Frame Buffer (local
910+ * physical) for ta to host memory
911+ */
912+ ret = amdgpu_bo_create_kernel(psp->adev, shared_mem_size, PAGE_SIZE,
913+ AMDGPU_GEM_DOMAIN_VRAM,
914+ &mem_ctx->shared_bo,
915+ &mem_ctx->shared_mc_addr,
916+ &mem_ctx->shared_buf);
850917
851918 return ret;
852919 }
853920
921+static void psp_ta_free_shared_buf(struct ta_mem_context *mem_ctx)
922+{
923+ amdgpu_bo_free_kernel(&mem_ctx->shared_bo, &mem_ctx->shared_mc_addr,
924+ &mem_ctx->shared_buf);
925+}
926+
927+static int psp_xgmi_init_shared_buf(struct psp_context *psp)
928+{
929+ return psp_ta_init_shared_buf(psp, &psp->xgmi_context.context.mem_context,
930+ PSP_XGMI_SHARED_MEM_SIZE);
931+}
932+
854933 static void psp_prep_ta_invoke_cmd_buf(struct psp_gfx_cmd_resp *cmd,
855934 uint32_t ta_cmd_id,
856935 uint32_t session_id)
@@ -865,18 +944,14 @@ static int psp_ta_invoke(struct psp_context *psp, · 8 unmodified lines
865944 uint32_t session_id)
866945 {
867946 int ret;
868− struct psp_gfx_cmd_resp *cmd;
869−
870− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
871− if (!cmd)
872− return -ENOMEM;
947+ struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
873948
874949 psp_prep_ta_invoke_cmd_buf(cmd, ta_cmd_id, session_id);
875950
876951 ret = psp_cmd_submit_buf(psp, NULL, cmd,
877952 psp->fence_buf_mc_addr);
878953
879− kfree(cmd);
954+ release_psp_cmd_buf(psp);
880955
881956 return ret;
882957 }
@@ -890,27 +965,25 @@ static int psp_xgmi_load(struct psp_context *psp) · 7 unmodified lines
890965 * TODO: bypass the loading in sriov for now
891966 */
892967
893− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
894− if (!cmd)
895− return -ENOMEM;
968+ cmd = acquire_psp_cmd_buf(psp);
896969
897− psp_copy_fw(psp, psp->ta_xgmi_start_addr, psp->ta_xgmi_ucode_size);
970+ psp_copy_fw(psp, psp->xgmi.start_addr, psp->xgmi.size_bytes);
898971
899972 psp_prep_ta_load_cmd_buf(cmd,
900973 psp->fw_pri_mc_addr,
901− psp->ta_xgmi_ucode_size,
902− psp->xgmi_context.xgmi_shared_mc_addr,
974+ psp->xgmi.size_bytes,
975+ psp->xgmi_context.context.mem_context.shared_mc_addr,
903976 PSP_XGMI_SHARED_MEM_SIZE);
904977
905978 ret = psp_cmd_submit_buf(psp, NULL, cmd,
906979 psp->fence_buf_mc_addr);
907980
908981 if (!ret) {
909− psp->xgmi_context.initialized = 1;
910− psp->xgmi_context.session_id = cmd->resp.session_id;
982+ psp->xgmi_context.context.initialized = true;
983+ psp->xgmi_context.context.session_id = cmd->resp.session_id;
911984 }
912985
913− kfree(cmd);
986+ release_psp_cmd_buf(psp);
914987
915988 return ret;
916989 }
@@ -930,57 +1003,56 @@ static int psp_xgmi_unload(struct psp_context *psp) · 13 unmodified lines
9301003 * TODO: bypass the unloading in sriov for now
9311004 */
9321005
933− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
934− if (!cmd)
935− return -ENOMEM;
1006+ cmd = acquire_psp_cmd_buf(psp);
9361007
937− psp_prep_ta_unload_cmd_buf(cmd, psp->xgmi_context.session_id);
1008+ psp_prep_ta_unload_cmd_buf(cmd, psp->xgmi_context.context.session_id);
9381009
9391010 ret = psp_cmd_submit_buf(psp, NULL, cmd,
9401011 psp->fence_buf_mc_addr);
9411012
942− kfree(cmd);
1013+ release_psp_cmd_buf(psp);
9431014
9441015 return ret;
9451016 }
9461017
9471018 int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
9481019 {
949− return psp_ta_invoke(psp, ta_cmd_id, psp->xgmi_context.session_id);
1020+ return psp_ta_invoke(psp, ta_cmd_id, psp->xgmi_context.context.session_id);
9501021 }
9511022
9521023 int psp_xgmi_terminate(struct psp_context *psp)
9531024 {
9541025 int ret;
9551026
956− if (!psp->xgmi_context.initialized)
1027+ if (!psp->xgmi_context.context.initialized)
9571028 return 0;
9581029
9591030 ret = psp_xgmi_unload(psp);
9601031 if (ret)
9611032 return ret;
9621033
963− psp->xgmi_context.initialized = 0;
1034+ psp->xgmi_context.context.initialized = false;
9641035
9651036 /* free xgmi shared memory */
966− amdgpu_bo_free_kernel(&psp->xgmi_context.xgmi_shared_bo,
967− &psp->xgmi_context.xgmi_shared_mc_addr,
968− &psp->xgmi_context.xgmi_shared_buf);
1037+ psp_ta_free_shared_buf(&psp->xgmi_context.context.mem_context);
9691038
9701039 return 0;
9711040 }
9721041
973−int psp_xgmi_initialize(struct psp_context *psp)
1042+int psp_xgmi_initialize(struct psp_context *psp, bool set_extended_data, bool load_ta)
9741043 {
9751044 struct ta_xgmi_shared_memory *xgmi_cmd;
9761045 int ret;
9771046
978− if (!psp->adev->psp.ta_fw ||
979− !psp->adev->psp.ta_xgmi_ucode_size ||
980− !psp->adev->psp.ta_xgmi_start_addr)
1047+ if (!psp->ta_fw ||
1048+ !psp->xgmi.size_bytes ||
1049+ !psp->xgmi.start_addr)
9811050 return -ENOENT;
9821051
983− if (!psp->xgmi_context.initialized) {
1052+ if (!load_ta)
1053+ goto invoke;
1054+
1055+ if (!psp->xgmi_context.context.initialized) {
9841056 ret = psp_xgmi_init_shared_buf(psp);
9851057 if (ret)
9861058 return ret;
@@ -991,9 +1063,11 @@ int psp_xgmi_initialize(struct psp_context *psp) · 4 unmodified lines
9911063 if (ret)
9921064 return ret;
9931065
1066+invoke:
9941067 /* Initialize XGMI session */
995− xgmi_cmd = (struct ta_xgmi_shared_memory *)(psp->xgmi_context.xgmi_shared_buf);
1068+ xgmi_cmd = (struct ta_xgmi_shared_memory *)(psp->xgmi_context.context.mem_context.shared_buf);
9961069 memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
1070+ xgmi_cmd->flag_extend_link_record = set_extended_data;
9971071 xgmi_cmd->cmd_id = TA_COMMAND_XGMI__INITIALIZE;
9981072
9991073 ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
@@ -1006,7 +1080,7 @@ int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id) · 6 unmodified lines
10061080 struct ta_xgmi_shared_memory *xgmi_cmd;
10071081 int ret;
10081082
1009− xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.xgmi_shared_buf;
1083+ xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.context.mem_context.shared_buf;
10101084 memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
10111085
10121086 xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_HIVE_ID;
@@ -1026,7 +1100,7 @@ int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id) · 13 unmodified lines
10261100 struct ta_xgmi_shared_memory *xgmi_cmd;
10271101 int ret;
10281102
1029− xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.xgmi_shared_buf;
1103+ xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.context.mem_context.shared_buf;
10301104 memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
10311105
10321106 xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_NODE_ID;
@@ -1041,9 +1115,62 @@ int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id) · 8 unmodified lines
10411115 return 0;
10421116 }
10431117
1118+static bool psp_xgmi_peer_link_info_supported(struct psp_context *psp)
1119+{
1120+ return psp->adev->asic_type == CHIP_ALDEBARAN &&
1121+ psp->xgmi.feature_version >= 0x2000000b;
1122+}
1123+
1124+/*
1125+ * Chips that support extended topology information require the driver to
1126+ * reflect topology information in the opposite direction. This is
1127+ * because the TA has already exceeded its link record limit and if the
1128+ * TA holds bi-directional information, the driver would have to do
1129+ * multiple fetches instead of just two.
1130+ */
1131+static void psp_xgmi_reflect_topology_info(struct psp_context *psp,
1132+ struct psp_xgmi_node_info node_info)
1133+{
1134+ struct amdgpu_device *mirror_adev;
1135+ struct amdgpu_hive_info *hive;
1136+ uint64_t src_node_id = psp->adev->gmc.xgmi.node_id;
1137+ uint64_t dst_node_id = node_info.node_id;
1138+ uint8_t dst_num_hops = node_info.num_hops;
1139+ uint8_t dst_num_links = node_info.num_links;
1140+
1141+ hive = amdgpu_get_xgmi_hive(psp->adev);
1142+ list_for_each_entry(mirror_adev, &hive->device_list, gmc.xgmi.head) {
1143+ struct psp_xgmi_topology_info *mirror_top_info;
1144+ int j;
1145+
1146+ if (mirror_adev->gmc.xgmi.node_id != dst_node_id)
1147+ continue;
1148+
1149+ mirror_top_info = &mirror_adev->psp.xgmi_context.top_info;
1150+ for (j = 0; j < mirror_top_info->num_nodes; j++) {
1151+ if (mirror_top_info->nodes[j].node_id != src_node_id)
1152+ continue;
1153+
1154+ mirror_top_info->nodes[j].num_hops = dst_num_hops;
1155+ /*
1156+ * prevent 0 num_links value re-reflection since reflection
1157+ * criteria is based on num_hops (direct or indirect).
1158+ *
1159+ */
1160+ if (dst_num_links)
1161+ mirror_top_info->nodes[j].num_links = dst_num_links;
1162+
1163+ break;
1164+ }
1165+
1166+ break;
1167+ }
1168+}
1169+
10441170 int psp_xgmi_get_topology_info(struct psp_context *psp,
10451171 int number_devices,
1046− struct psp_xgmi_topology_info *topology)
1172+ struct psp_xgmi_topology_info *topology,
1173+ bool get_extended_data)
10471174 {
10481175 struct ta_xgmi_shared_memory *xgmi_cmd;
10491176 struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
@@ -1054,8 +1181,9 @@ int psp_xgmi_get_topology_info(struct psp_context *psp, · 4 unmodified lines
10541181 if (!topology || topology->num_nodes > TA_XGMI__MAX_CONNECTED_NODES)
10551182 return -EINVAL;
10561183
1057− xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.xgmi_shared_buf;
1184+ xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.context.mem_context.shared_buf;
10581185 memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
1186+ xgmi_cmd->flag_extend_link_record = get_extended_data;
10591187
10601188 /* Fill in the shared memory with topology information as input */
10611189 topology_info_input = &xgmi_cmd->xgmi_in_message.get_topology_info;
@@ -1078,10 +1206,45 @@ int psp_xgmi_get_topology_info(struct psp_context *psp, · 16 unmodified lines
10781206 topology_info_output = &xgmi_cmd->xgmi_out_message.get_topology_info;
10791207 topology->num_nodes = xgmi_cmd->xgmi_out_message.get_topology_info.num_nodes;
10801208 for (i = 0; i < topology->num_nodes; i++) {
1081− topology->nodes[i].node_id = topology_info_output->nodes[i].node_id;
1082− topology->nodes[i].num_hops = topology_info_output->nodes[i].num_hops;
1083− topology->nodes[i].is_sharing_enabled = topology_info_output->nodes[i].is_sharing_enabled;
1084− topology->nodes[i].sdma_engine = topology_info_output->nodes[i].sdma_engine;
1209+ /* extended data will either be 0 or equal to non-extended data */
1210+ if (topology_info_output->nodes[i].num_hops)
1211+ topology->nodes[i].num_hops = topology_info_output->nodes[i].num_hops;
1212+
1213+ /* non-extended data gets everything here so no need to update */
1214+ if (!get_extended_data) {
1215+ topology->nodes[i].node_id = topology_info_output->nodes[i].node_id;
1216+ topology->nodes[i].is_sharing_enabled =
1217+ topology_info_output->nodes[i].is_sharing_enabled;
1218+ topology->nodes[i].sdma_engine =
1219+ topology_info_output->nodes[i].sdma_engine;
1220+ }
1221+
1222+ }
1223+
1224+ /* Invoke xgmi ta again to get the link information */
1225+ if (psp_xgmi_peer_link_info_supported(psp)) {
1226+ struct ta_xgmi_cmd_get_peer_link_info_output *link_info_output;
1227+
1228+ xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_PEER_LINKS;
1229+
1230+ ret = psp_xgmi_invoke(psp, TA_COMMAND_XGMI__GET_PEER_LINKS);
1231+
1232+ if (ret)
1233+ return ret;
1234+
1235+ link_info_output = &xgmi_cmd->xgmi_out_message.get_link_info;
1236+ for (i = 0; i < topology->num_nodes; i++) {
1237+ /* accumulate num_links on extended data */
1238+ topology->nodes[i].num_links = get_extended_data ?
1239+ topology->nodes[i].num_links +
1240+ link_info_output->nodes[i].num_links :
1241+ link_info_output->nodes[i].num_links;
1242+
1243+ /* reflect the topology information for bi-directionality */
1244+ if (psp->xgmi_context.supports_extended_data &&
1245+ get_extended_data && topology->nodes[i].num_hops)
1246+ psp_xgmi_reflect_topology_info(psp, topology->nodes[i]);
1247+ }
10851248 }
10861249
10871250 return 0;
@@ -1098,7 +1261,7 @@ int psp_xgmi_set_topology_info(struct psp_context *psp, · 10 unmodified lines
10981261 if (!topology || topology->num_nodes > TA_XGMI__MAX_CONNECTED_NODES)
10991262 return -EINVAL;
11001263
1101− xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.xgmi_shared_buf;
1264+ xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.context.mem_context.shared_buf;
11021265 memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
11031266
11041267 topology_info_input = &xgmi_cmd->xgmi_in_message.get_topology_info;
@@ -1119,19 +1282,8 @@ int psp_xgmi_set_topology_info(struct psp_context *psp, · 14 unmodified lines
11191282 // ras begin
11201283 static int psp_ras_init_shared_buf(struct psp_context *psp)
11211284 {
1122− int ret;
1123−
1124− /*
1125− * Allocate 16k memory aligned to 4k from Frame Buffer (local
1126− * physical) for ras ta <-> Driver
1127− */
1128− ret = amdgpu_bo_create_kernel(psp->adev, PSP_RAS_SHARED_MEM_SIZE,
1129− PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
1130− &psp->ras.ras_shared_bo,
1131− &psp->ras.ras_shared_mc_addr,
1132− &psp->ras.ras_shared_buf);
1133−
1134− return ret;
1285+ return psp_ta_init_shared_buf(psp, &psp->ras_context.context.mem_context,
1286+ PSP_RAS_SHARED_MEM_SIZE);
11351287 }
11361288
11371289 static int psp_ras_load(struct psp_context *psp)
@@ -1146,42 +1298,40 @@ static int psp_ras_load(struct psp_context *psp) · 8 unmodified lines
11461298 if (amdgpu_sriov_vf(psp->adev))
11471299 return 0;
11481300
1149− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1150− if (!cmd)
1151− return -ENOMEM;
1152−
1153− psp_copy_fw(psp, psp->ta_ras_start_addr, psp->ta_ras_ucode_size);
1301+ psp_copy_fw(psp, psp->ras.start_addr, psp->ras.size_bytes);
11541302
1155− ras_cmd = (struct ta_ras_shared_memory *)psp->ras.ras_shared_buf;
1303+ ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
11561304
11571305 if (psp->adev->gmc.xgmi.connected_to_cpu)
11581306 ras_cmd->ras_in_message.init_flags.poison_mode_en = 1;
11591307 else
11601308 ras_cmd->ras_in_message.init_flags.dgpu_mode = 1;
11611309
1310+ cmd = acquire_psp_cmd_buf(psp);
1311+
11621312 psp_prep_ta_load_cmd_buf(cmd,
11631313 psp->fw_pri_mc_addr,
1164− psp->ta_ras_ucode_size,
1165− psp->ras.ras_shared_mc_addr,
1314+ psp->ras.size_bytes,
1315+ psp->ras_context.context.mem_context.shared_mc_addr,
11661316 PSP_RAS_SHARED_MEM_SIZE);
11671317
11681318 ret = psp_cmd_submit_buf(psp, NULL, cmd,
11691319 psp->fence_buf_mc_addr);
11701320
11711321 if (!ret) {
1172− psp->ras.session_id = cmd->resp.session_id;
1322+ psp->ras_context.context.session_id = cmd->resp.session_id;
11731323
11741324 if (!ras_cmd->ras_status)
1175− psp->ras.ras_initialized = true;
1325+ psp->ras_context.context.initialized = true;
11761326 else
11771327 dev_warn(psp->adev->dev, "RAS Init Status: 0x%X\n", ras_cmd->ras_status);
11781328 }
11791329
1330+ release_psp_cmd_buf(psp);
1331+
11801332 if (ret || ras_cmd->ras_status)
11811333 amdgpu_ras_fini(psp->adev);
11821334
1183− kfree(cmd);
1184−
11851335 return ret;
11861336 }
11871337
@@ -1196,16 +1346,14 @@ static int psp_ras_unload(struct psp_context *psp) · 8 unmodified lines
11961346 if (amdgpu_sriov_vf(psp->adev))
11971347 return 0;
11981348
1199− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1200− if (!cmd)
1201− return -ENOMEM;
1349+ cmd = acquire_psp_cmd_buf(psp);
12021350
1203− psp_prep_ta_unload_cmd_buf(cmd, psp->ras.session_id);
1351+ psp_prep_ta_unload_cmd_buf(cmd, psp->ras_context.context.session_id);
12041352
12051353 ret = psp_cmd_submit_buf(psp, NULL, cmd,
12061354 psp->fence_buf_mc_addr);
12071355
1208− kfree(cmd);
1356+ release_psp_cmd_buf(psp);
12091357
12101358 return ret;
12111359 }
@@ -1215,7 +1363,7 @@ int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id) · 3 unmodified lines
12151363 struct ta_ras_shared_memory *ras_cmd;
12161364 int ret;
12171365
1218− ras_cmd = (struct ta_ras_shared_memory *)psp->ras.ras_shared_buf;
1366+ ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
12191367
12201368 /*
12211369 * TODO: bypass the loading in sriov for now
@@ -1223,7 +1371,7 @@ int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id) · 1 unmodified line
12231371 if (amdgpu_sriov_vf(psp->adev))
12241372 return 0;
12251373
1226− ret = psp_ta_invoke(psp, ta_cmd_id, psp->ras.session_id);
1374+ ret = psp_ta_invoke(psp, ta_cmd_id, psp->ras_context.context.session_id);
12271375
12281376 if (amdgpu_ras_intr_triggered())
12291377 return ret;
@@ -1279,10 +1427,10 @@ int psp_ras_enable_features(struct psp_context *psp, · 49 unmodified lines
12791427 struct ta_ras_shared_memory *ras_cmd;
12801428 int ret;
12811429
1282− if (!psp->ras.ras_initialized)
1430+ if (!psp->ras_context.context.initialized)
12831431 return -EINVAL;
12841432
1285− ras_cmd = (struct ta_ras_shared_memory *)psp->ras.ras_shared_buf;
1433+ ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
12861434 memset(ras_cmd, 0, sizeof(struct ta_ras_shared_memory));
12871435
12881436 if (enable)
@@ -1309,19 +1457,17 @@ static int psp_ras_terminate(struct psp_context *psp) · 20 unmodified lines
13091457 if (amdgpu_sriov_vf(psp->adev))
13101458 return 0;
13111459
1312− if (!psp->ras.ras_initialized)
1460+ if (!psp->ras_context.context.initialized)
13131461 return 0;
13141462
13151463 ret = psp_ras_unload(psp);
13161464 if (ret)
13171465 return ret;
13181466
1319− psp->ras.ras_initialized = false;
1467+ psp->ras_context.context.initialized = false;
13201468
13211469 /* free ras shared memory */
1322− amdgpu_bo_free_kernel(&psp->ras.ras_shared_bo,
1323− &psp->ras.ras_shared_mc_addr,
1324− &psp->ras.ras_shared_buf);
1470+ psp_ta_free_shared_buf(&psp->ras_context.context.mem_context);
13251471
13261472 return 0;
13271473 }
@@ -1338,8 +1484,8 @@ static int psp_ras_initialize(struct psp_context *psp) · 10 unmodified lines
13381484 if (amdgpu_sriov_vf(adev))
13391485 return 0;
13401486
1341− if (!adev->psp.ta_ras_ucode_size ||
1342− !adev->psp.ta_ras_start_addr) {
1487+ if (!adev->psp.ras.size_bytes ||
1488+ !adev->psp.ras.start_addr) {
13431489 dev_info(adev->dev, "RAS: optional ras ta ucode is not available\n");
13441490 return 0;
13451491 }
@@ -1385,7 +1531,7 @@ static int psp_ras_initialize(struct psp_context *psp) · 39 unmodified lines
13851531 }
13861532 }
13871533
1388− if (!psp->ras.ras_initialized) {
1534+ if (!psp->ras_context.context.initialized) {
13891535 ret = psp_ras_init_shared_buf(psp);
13901536 if (ret)
13911537 return ret;
@@ -1404,10 +1550,10 @@ int psp_ras_trigger_error(struct psp_context *psp, · 12 unmodified lines
14041550 struct ta_ras_shared_memory *ras_cmd;
14051551 int ret;
14061552
1407− if (!psp->ras.ras_initialized)
1553+ if (!psp->ras_context.context.initialized)
14081554 return -EINVAL;
14091555
1410− ras_cmd = (struct ta_ras_shared_memory *)psp->ras.ras_shared_buf;
1556+ ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
14111557 memset(ras_cmd, 0, sizeof(struct ta_ras_shared_memory));
14121558
14131559 ras_cmd->cmd_id = TA_RAS_COMMAND__TRIGGER_ERROR;
@@ -1429,19 +1575,8 @@ int psp_ras_trigger_error(struct psp_context *psp, · 15 unmodified lines
14291575 // HDCP start
14301576 static int psp_hdcp_init_shared_buf(struct psp_context *psp)
14311577 {
1432− int ret;
1433−
1434− /*
1435− * Allocate 16k memory aligned to 4k from Frame Buffer (local
1436− * physical) for hdcp ta <-> Driver
1437− */
1438− ret = amdgpu_bo_create_kernel(psp->adev, PSP_HDCP_SHARED_MEM_SIZE,
1439− PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
1440− &psp->hdcp_context.hdcp_shared_bo,
1441− &psp->hdcp_context.hdcp_shared_mc_addr,
1442− &psp->hdcp_context.hdcp_shared_buf);
1443−
1444− return ret;
1578+ return psp_ta_init_shared_buf(psp, &psp->hdcp_context.context.mem_context,
1579+ PSP_HDCP_SHARED_MEM_SIZE);
14451580 }
14461581
14471582 static int psp_hdcp_load(struct psp_context *psp)
@@ -1455,28 +1590,26 @@ static int psp_hdcp_load(struct psp_context *psp) · 7 unmodified lines
14551590 if (amdgpu_sriov_vf(psp->adev))
14561591 return 0;
14571592
1458− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1459− if (!cmd)
1460− return -ENOMEM;
1593+ psp_copy_fw(psp, psp->hdcp.start_addr,
1594+ psp->hdcp.size_bytes);
14611595
1462− psp_copy_fw(psp, psp->ta_hdcp_start_addr,
1463− psp->ta_hdcp_ucode_size);
1596+ cmd = acquire_psp_cmd_buf(psp);
14641597
14651598 psp_prep_ta_load_cmd_buf(cmd,
14661599 psp->fw_pri_mc_addr,
1467− psp->ta_hdcp_ucode_size,
1468− psp->hdcp_context.hdcp_shared_mc_addr,
1600+ psp->hdcp.size_bytes,
1601+ psp->hdcp_context.context.mem_context.shared_mc_addr,
14691602 PSP_HDCP_SHARED_MEM_SIZE);
14701603
14711604 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
14721605
14731606 if (!ret) {
1474− psp->hdcp_context.hdcp_initialized = true;
1475− psp->hdcp_context.session_id = cmd->resp.session_id;
1607+ psp->hdcp_context.context.initialized = true;
1608+ psp->hdcp_context.context.session_id = cmd->resp.session_id;
14761609 mutex_init(&psp->hdcp_context.mutex);
14771610 }
14781611
1479− kfree(cmd);
1612+ release_psp_cmd_buf(psp);
14801613
14811614 return ret;
14821615 }
@@ -1490,13 +1623,13 @@ static int psp_hdcp_initialize(struct psp_context *psp) · 7 unmodified lines
14901623 if (amdgpu_sriov_vf(psp->adev))
14911624 return 0;
14921625
1493− if (!psp->adev->psp.ta_hdcp_ucode_size ||
1494− !psp->adev->psp.ta_hdcp_start_addr) {
1626+ if (!psp->hdcp.size_bytes ||
1627+ !psp->hdcp.start_addr) {
14951628 dev_info(psp->adev->dev, "HDCP: optional hdcp ta ucode is not available\n");
14961629 return 0;
14971630 }
14981631
1499− if (!psp->hdcp_context.hdcp_initialized) {
1632+ if (!psp->hdcp_context.context.initialized) {
15001633 ret = psp_hdcp_init_shared_buf(psp);
15011634 if (ret)
15021635 return ret;
@@ -1520,15 +1653,13 @@ static int psp_hdcp_unload(struct psp_context *psp) · 17 unmodified lines
15201653 if (amdgpu_sriov_vf(psp->adev))
15211654 return 0;
15221655
1523− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1524− if (!cmd)
1525− return -ENOMEM;
1656+ cmd = acquire_psp_cmd_buf(psp);
15261657
1527− psp_prep_ta_unload_cmd_buf(cmd, psp->hdcp_context.session_id);
1658+ psp_prep_ta_unload_cmd_buf(cmd, psp->hdcp_context.context.session_id);
15281659
15291660 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
15301661
1531− kfree(cmd);
1662+ release_psp_cmd_buf(psp);
15321663
15331664 return ret;
15341665 }
@@ -1541,7 +1672,7 @@ int psp_hdcp_invoke(struct psp_context *psp, uint32_t ta_cmd_id) · 6 unmodified lines
15411672 if (amdgpu_sriov_vf(psp->adev))
15421673 return 0;
15431674
1544− return psp_ta_invoke(psp, ta_cmd_id, psp->hdcp_context.session_id);
1675+ return psp_ta_invoke(psp, ta_cmd_id, psp->hdcp_context.context.session_id);
15451676 }
15461677
15471678 static int psp_hdcp_terminate(struct psp_context *psp)
@@ -1554,8 +1685,8 @@ static int psp_hdcp_terminate(struct psp_context *psp) · 6 unmodified lines
15541685 if (amdgpu_sriov_vf(psp->adev))
15551686 return 0;
15561687
1557− if (!psp->hdcp_context.hdcp_initialized) {
1558− if (psp->hdcp_context.hdcp_shared_buf)
1688+ if (!psp->hdcp_context.context.initialized) {
1689+ if (psp->hdcp_context.context.mem_context.shared_buf)
15591690 goto out;
15601691 else
15611692 return 0;
@@ -1565,13 +1696,11 @@ static int psp_hdcp_terminate(struct psp_context *psp) · 3 unmodified lines
15651696 if (ret)
15661697 return ret;
15671698
1568− psp->hdcp_context.hdcp_initialized = false;
1699+ psp->hdcp_context.context.initialized = false;
15691700
15701701 out:
15711702 /* free hdcp shared memory */
1572− amdgpu_bo_free_kernel(&psp->hdcp_context.hdcp_shared_bo,
1573− &psp->hdcp_context.hdcp_shared_mc_addr,
1574− &psp->hdcp_context.hdcp_shared_buf);
1703+ psp_ta_free_shared_buf(&psp->hdcp_context.context.mem_context);
15751704
15761705 return 0;
15771706 }
@@ -1580,19 +1709,8 @@ out: · 2 unmodified lines
15801709 // DTM start
15811710 static int psp_dtm_init_shared_buf(struct psp_context *psp)
15821711 {
1583− int ret;
1584−
1585− /*
1586− * Allocate 16k memory aligned to 4k from Frame Buffer (local
1587− * physical) for dtm ta <-> Driver
1588− */
1589− ret = amdgpu_bo_create_kernel(psp->adev, PSP_DTM_SHARED_MEM_SIZE,
1590− PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
1591− &psp->dtm_context.dtm_shared_bo,
1592− &psp->dtm_context.dtm_shared_mc_addr,
1593− &psp->dtm_context.dtm_shared_buf);
1594−
1595− return ret;
1712+ return psp_ta_init_shared_buf(psp, &psp->dtm_context.context.mem_context,
1713+ PSP_DTM_SHARED_MEM_SIZE);
15961714 }
15971715
15981716 static int psp_dtm_load(struct psp_context *psp)
@@ -1606,27 +1724,25 @@ static int psp_dtm_load(struct psp_context *psp) · 7 unmodified lines
16061724 if (amdgpu_sriov_vf(psp->adev))
16071725 return 0;
16081726
1609− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1610− if (!cmd)
1611− return -ENOMEM;
1727+ psp_copy_fw(psp, psp->dtm.start_addr, psp->dtm.size_bytes);
16121728
1613− psp_copy_fw(psp, psp->ta_dtm_start_addr, psp->ta_dtm_ucode_size);
1729+ cmd = acquire_psp_cmd_buf(psp);
16141730
16151731 psp_prep_ta_load_cmd_buf(cmd,
16161732 psp->fw_pri_mc_addr,
1617− psp->ta_dtm_ucode_size,
1618− psp->dtm_context.dtm_shared_mc_addr,
1733+ psp->dtm.size_bytes,
1734+ psp->dtm_context.context.mem_context.shared_mc_addr,
16191735 PSP_DTM_SHARED_MEM_SIZE);
16201736
16211737 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
16221738
16231739 if (!ret) {
1624− psp->dtm_context.dtm_initialized = true;
1625− psp->dtm_context.session_id = cmd->resp.session_id;
1740+ psp->dtm_context.context.initialized = true;
1741+ psp->dtm_context.context.session_id = cmd->resp.session_id;
16261742 mutex_init(&psp->dtm_context.mutex);
16271743 }
16281744
1629− kfree(cmd);
1745+ release_psp_cmd_buf(psp);
16301746
16311747 return ret;
16321748 }
@@ -1641,13 +1757,13 @@ static int psp_dtm_initialize(struct psp_context *psp) · 8 unmodified lines
16411757 if (amdgpu_sriov_vf(psp->adev))
16421758 return 0;
16431759
1644− if (!psp->adev->psp.ta_dtm_ucode_size ||
1645− !psp->adev->psp.ta_dtm_start_addr) {
1760+ if (!psp->dtm.size_bytes ||
1761+ !psp->dtm.start_addr) {
16461762 dev_info(psp->adev->dev, "DTM: optional dtm ta ucode is not available\n");
16471763 return 0;
16481764 }
16491765
1650− if (!psp->dtm_context.dtm_initialized) {
1766+ if (!psp->dtm_context.context.initialized) {
16511767 ret = psp_dtm_init_shared_buf(psp);
16521768 if (ret)
16531769 return ret;
@@ -1671,15 +1787,13 @@ static int psp_dtm_unload(struct psp_context *psp) · 17 unmodified lines
16711787 if (amdgpu_sriov_vf(psp->adev))
16721788 return 0;
16731789
1674− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1675− if (!cmd)
1676− return -ENOMEM;
1790+ cmd = acquire_psp_cmd_buf(psp);
16771791
1678− psp_prep_ta_unload_cmd_buf(cmd, psp->dtm_context.session_id);
1792+ psp_prep_ta_unload_cmd_buf(cmd, psp->dtm_context.context.session_id);
16791793
16801794 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
16811795
1682− kfree(cmd);
1796+ release_psp_cmd_buf(psp);
16831797
16841798 return ret;
16851799 }
@@ -1692,7 +1806,7 @@ int psp_dtm_invoke(struct psp_context *psp, uint32_t ta_cmd_id) · 6 unmodified lines
16921806 if (amdgpu_sriov_vf(psp->adev))
16931807 return 0;
16941808
1695− return psp_ta_invoke(psp, ta_cmd_id, psp->dtm_context.session_id);
1809+ return psp_ta_invoke(psp, ta_cmd_id, psp->dtm_context.context.session_id);
16961810 }
16971811
16981812 static int psp_dtm_terminate(struct psp_context *psp)
@@ -1705,8 +1819,8 @@ static int psp_dtm_terminate(struct psp_context *psp) · 6 unmodified lines
17051819 if (amdgpu_sriov_vf(psp->adev))
17061820 return 0;
17071821
1708− if (!psp->dtm_context.dtm_initialized) {
1709− if (psp->dtm_context.dtm_shared_buf)
1822+ if (!psp->dtm_context.context.initialized) {
1823+ if (psp->dtm_context.context.mem_context.shared_buf)
17101824 goto out;
17111825 else
17121826 return 0;
@@ -1716,13 +1830,11 @@ static int psp_dtm_terminate(struct psp_context *psp) · 3 unmodified lines
17161830 if (ret)
17171831 return ret;
17181832
1719− psp->dtm_context.dtm_initialized = false;
1833+ psp->dtm_context.context.initialized = false;
17201834
17211835 out:
1722− /* free hdcp shared memory */
1723− amdgpu_bo_free_kernel(&psp->dtm_context.dtm_shared_bo,
1724− &psp->dtm_context.dtm_shared_mc_addr,
1725− &psp->dtm_context.dtm_shared_buf);
1836+ /* free dtm shared memory */
1837+ psp_ta_free_shared_buf(&psp->dtm_context.context.mem_context);
17261838
17271839 return 0;
17281840 }
@@ -1731,19 +1843,8 @@ out: · 2 unmodified lines
17311843 // RAP start
17321844 static int psp_rap_init_shared_buf(struct psp_context *psp)
17331845 {
1734− int ret;
1735−
1736− /*
1737− * Allocate 16k memory aligned to 4k from Frame Buffer (local
1738− * physical) for rap ta <-> Driver
1739− */
1740− ret = amdgpu_bo_create_kernel(psp->adev, PSP_RAP_SHARED_MEM_SIZE,
1741− PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
1742− &psp->rap_context.rap_shared_bo,
1743− &psp->rap_context.rap_shared_mc_addr,
1744− &psp->rap_context.rap_shared_buf);
1745−
1746− return ret;
1846+ return psp_ta_init_shared_buf(psp, &psp->rap_context.context.mem_context,
1847+ PSP_RAP_SHARED_MEM_SIZE);
17471848 }
17481849
17491850 static int psp_rap_load(struct psp_context *psp)
@@ -1751,27 +1852,25 @@ static int psp_rap_load(struct psp_context *psp) · 1 unmodified line
17511852 int ret;
17521853 struct psp_gfx_cmd_resp *cmd;
17531854
1754− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1755− if (!cmd)
1756− return -ENOMEM;
1855+ psp_copy_fw(psp, psp->rap.start_addr, psp->rap.size_bytes);
17571856
1758− psp_copy_fw(psp, psp->ta_rap_start_addr, psp->ta_rap_ucode_size);
1857+ cmd = acquire_psp_cmd_buf(psp);
17591858
17601859 psp_prep_ta_load_cmd_buf(cmd,
17611860 psp->fw_pri_mc_addr,
1762− psp->ta_rap_ucode_size,
1763− psp->rap_context.rap_shared_mc_addr,
1861+ psp->rap.size_bytes,
1862+ psp->rap_context.context.mem_context.shared_mc_addr,
17641863 PSP_RAP_SHARED_MEM_SIZE);
17651864
17661865 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
17671866
17681867 if (!ret) {
1769− psp->rap_context.rap_initialized = true;
1770− psp->rap_context.session_id = cmd->resp.session_id;
1868+ psp->rap_context.context.initialized = true;
1869+ psp->rap_context.context.session_id = cmd->resp.session_id;
17711870 mutex_init(&psp->rap_context.mutex);
17721871 }
17731872
1774− kfree(cmd);
1873+ release_psp_cmd_buf(psp);
17751874
17761875 return ret;
17771876 }
@@ -1779,17 +1878,13 @@ static int psp_rap_load(struct psp_context *psp) · 1 unmodified line
17791878 static int psp_rap_unload(struct psp_context *psp)
17801879 {
17811880 int ret;
1782− struct psp_gfx_cmd_resp *cmd;
1881+ struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
17831882
1784− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1785− if (!cmd)
1786− return -ENOMEM;
1787−
1788− psp_prep_ta_unload_cmd_buf(cmd, psp->rap_context.session_id);
1883+ psp_prep_ta_unload_cmd_buf(cmd, psp->rap_context.context.session_id);
17891884
17901885 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
17911886
1792− kfree(cmd);
1887+ release_psp_cmd_buf(psp);
17931888
17941889 return ret;
17951890 }
@@ -1805,13 +1900,13 @@ static int psp_rap_initialize(struct psp_context *psp) · 9 unmodified lines
18051900 if (amdgpu_sriov_vf(psp->adev))
18061901 return 0;
18071902
1808− if (!psp->adev->psp.ta_rap_ucode_size ||
1809− !psp->adev->psp.ta_rap_start_addr) {
1903+ if (!psp->rap.size_bytes ||
1904+ !psp->rap.start_addr) {
18101905 dev_info(psp->adev->dev, "RAP: optional rap ta ucode is not available\n");
18111906 return 0;
18121907 }
18131908
1814− if (!psp->rap_context.rap_initialized) {
1909+ if (!psp->rap_context.context.initialized) {
18151910 ret = psp_rap_init_shared_buf(psp);
18161911 if (ret)
18171912 return ret;
@@ -1825,11 +1920,9 @@ static int psp_rap_initialize(struct psp_context *psp) · 7 unmodified lines
18251920 if (ret || status != TA_RAP_STATUS__SUCCESS) {
18261921 psp_rap_unload(psp);
18271922
1828− amdgpu_bo_free_kernel(&psp->rap_context.rap_shared_bo,
1829− &psp->rap_context.rap_shared_mc_addr,
1830− &psp->rap_context.rap_shared_buf);
1923+ psp_ta_free_shared_buf(&psp->rap_context.context.mem_context);
18311924
1832− psp->rap_context.rap_initialized = false;
1925+ psp->rap_context.context.initialized = false;
18331926
18341927 dev_warn(psp->adev->dev, "RAP TA initialize fail (%d) status %d.\n",
18351928 ret, status);
@@ -1844,17 +1937,15 @@ static int psp_rap_terminate(struct psp_context *psp) · 8 unmodified lines
18441937 {
18451938 int ret;
18461939
1847− if (!psp->rap_context.rap_initialized)
1940+ if (!psp->rap_context.context.initialized)
18481941 return 0;
18491942
18501943 ret = psp_rap_unload(psp);
18511944
1852− psp->rap_context.rap_initialized = false;
1945+ psp->rap_context.context.initialized = false;
18531946
18541947 /* free rap shared memory */
1855− amdgpu_bo_free_kernel(&psp->rap_context.rap_shared_bo,
1856− &psp->rap_context.rap_shared_mc_addr,
1857− &psp->rap_context.rap_shared_buf);
1948+ psp_ta_free_shared_buf(&psp->rap_context.context.mem_context);
18581949
18591950 return ret;
18601951 }
@@ -1864,7 +1955,7 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id, enum ta_rap_stat · 3 unmodified lines
18641955 struct ta_rap_shared_memory *rap_cmd;
18651956 int ret = 0;
18661957
1867− if (!psp->rap_context.rap_initialized)
1958+ if (!psp->rap_context.context.initialized)
18681959 return 0;
18691960
18701961 if (ta_cmd_id != TA_CMD_RAP__INITIALIZE &&
@@ -1874,13 +1965,13 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id, enum ta_rap_stat · 3 unmodified lines
18741965 mutex_lock(&psp->rap_context.mutex);
18751966
18761967 rap_cmd = (struct ta_rap_shared_memory *)
1877− psp->rap_context.rap_shared_buf;
1968+ psp->rap_context.context.mem_context.shared_buf;
18781969 memset(rap_cmd, 0, sizeof(struct ta_rap_shared_memory));
18791970
18801971 rap_cmd->cmd_id = ta_cmd_id;
18811972 rap_cmd->validation_method_id = METHOD_A;
18821973
1883− ret = psp_ta_invoke(psp, rap_cmd->cmd_id, psp->rap_context.session_id);
1974+ ret = psp_ta_invoke(psp, rap_cmd->cmd_id, psp->rap_context.context.session_id);
18841975 if (ret)
18851976 goto out_unlock;
18861977
@@ -1897,67 +1988,48 @@ out_unlock: · 10 unmodified lines
18971988 /* securedisplay start */
18981989 static int psp_securedisplay_init_shared_buf(struct psp_context *psp)
18991990 {
1900− int ret;
1901−
1902− /*
1903− * Allocate 16k memory aligned to 4k from Frame Buffer (local
1904− * physical) for sa ta <-> Driver
1905− */
1906− ret = amdgpu_bo_create_kernel(psp->adev, PSP_SECUREDISPLAY_SHARED_MEM_SIZE,
1907− PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
1908− &psp->securedisplay_context.securedisplay_shared_bo,
1909− &psp->securedisplay_context.securedisplay_shared_mc_addr,
1910− &psp->securedisplay_context.securedisplay_shared_buf);
1911−
1912− return ret;
1991+ return psp_ta_init_shared_buf(
1992+ psp, &psp->securedisplay_context.context.mem_context,
1993+ PSP_SECUREDISPLAY_SHARED_MEM_SIZE);
19131994 }
19141995
19151996 static int psp_securedisplay_load(struct psp_context *psp)
19161997 {
19171998 int ret;
1918− struct psp_gfx_cmd_resp *cmd;
1919−
1920− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1921− if (!cmd)
1922− return -ENOMEM;
1999+ struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
19232000
19242001 memset(psp->fw_pri_buf, 0, PSP_1_MEG);
1925− memcpy(psp->fw_pri_buf, psp->ta_securedisplay_start_addr, psp->ta_securedisplay_ucode_size);
2002+ memcpy(psp->fw_pri_buf, psp->securedisplay.start_addr, psp->securedisplay.size_bytes);
19262003
19272004 psp_prep_ta_load_cmd_buf(cmd,
19282005 psp->fw_pri_mc_addr,
1929− psp->ta_securedisplay_ucode_size,
1930− psp->securedisplay_context.securedisplay_shared_mc_addr,
2006+ psp->securedisplay.size_bytes,
2007+ psp->securedisplay_context.context.mem_context.shared_mc_addr,
19312008 PSP_SECUREDISPLAY_SHARED_MEM_SIZE);
19322009
19332010 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
19342011
1935− if (ret)
1936− goto failed;
2012+ if (!ret) {
2013+ psp->securedisplay_context.context.initialized = true;
2014+ psp->securedisplay_context.context.session_id = cmd->resp.session_id;
2015+ mutex_init(&psp->securedisplay_context.mutex);
2016+ }
19372017
1938− psp->securedisplay_context.securedisplay_initialized = true;
1939− psp->securedisplay_context.session_id = cmd->resp.session_id;
1940− mutex_init(&psp->securedisplay_context.mutex);
2018+ release_psp_cmd_buf(psp);
19412019
1942−failed:
1943− kfree(cmd);
19442020 return ret;
19452021 }
19462022
19472023 static int psp_securedisplay_unload(struct psp_context *psp)
19482024 {
19492025 int ret;
1950− struct psp_gfx_cmd_resp *cmd;
1951−
1952− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
1953− if (!cmd)
1954− return -ENOMEM;
2026+ struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
19552027
1956− psp_prep_ta_unload_cmd_buf(cmd, psp->securedisplay_context.session_id);
2028+ psp_prep_ta_unload_cmd_buf(cmd, psp->securedisplay_context.context.session_id);
19572029
19582030 ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
19592031
1960− kfree(cmd);
2032+ release_psp_cmd_buf(psp);
19612033
19622034 return ret;
19632035 }
@@ -1973,13 +2045,13 @@ static int psp_securedisplay_initialize(struct psp_context *psp) · 9 unmodified lines
19732045 if (amdgpu_sriov_vf(psp->adev))
19742046 return 0;
19752047
1976− if (!psp->adev->psp.ta_securedisplay_ucode_size ||
1977− !psp->adev->psp.ta_securedisplay_start_addr) {
2048+ if (!psp->securedisplay.size_bytes ||
2049+ !psp->securedisplay.start_addr) {
19782050 dev_info(psp->adev->dev, "SECUREDISPLAY: securedisplay ta ucode is not available\n");
19792051 return 0;
19802052 }
19812053
1982− if (!psp->securedisplay_context.securedisplay_initialized) {
2054+ if (!psp->securedisplay_context.context.initialized) {
19832055 ret = psp_securedisplay_init_shared_buf(psp);
19842056 if (ret)
19852057 return ret;
@@ -1996,11 +2068,9 @@ static int psp_securedisplay_initialize(struct psp_context *psp) · 10 unmodified lines
19962068 if (ret) {
19972069 psp_securedisplay_unload(psp);
19982070
1999− amdgpu_bo_free_kernel(&psp->securedisplay_context.securedisplay_shared_bo,
2000− &psp->securedisplay_context.securedisplay_shared_mc_addr,
2001− &psp->securedisplay_context.securedisplay_shared_buf);
2071+ psp_ta_free_shared_buf(&psp->securedisplay_context.context.mem_context);
20022072
2003− psp->securedisplay_context.securedisplay_initialized = false;
2073+ psp->securedisplay_context.context.initialized = false;
20042074
20052075 dev_err(psp->adev->dev, "SECUREDISPLAY TA initialize fail.\n");
20062076 return -EINVAL;
@@ -2025,19 +2095,17 @@ static int psp_securedisplay_terminate(struct psp_context *psp) · 18 unmodified lines
20252095 if (amdgpu_sriov_vf(psp->adev))
20262096 return 0;
20272097
2028− if (!psp->securedisplay_context.securedisplay_initialized)
2098+ if (!psp->securedisplay_context.context.initialized)
20292099 return 0;
20302100
20312101 ret = psp_securedisplay_unload(psp);
20322102 if (ret)
20332103 return ret;
20342104
2035− psp->securedisplay_context.securedisplay_initialized = false;
2105+ psp->securedisplay_context.context.initialized = false;
20362106
20372107 /* free securedisplay shared memory */
2038− amdgpu_bo_free_kernel(&psp->securedisplay_context.securedisplay_shared_bo,
2039− &psp->securedisplay_context.securedisplay_shared_mc_addr,
2040− &psp->securedisplay_context.securedisplay_shared_buf);
2108+ psp_ta_free_shared_buf(&psp->securedisplay_context.context.mem_context);
20412109
20422110 return ret;
20432111 }
@@ -2046,7 +2114,7 @@ int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id) · 2 unmodified lines
20462114 {
20472115 int ret;
20482116
2049− if (!psp->securedisplay_context.securedisplay_initialized)
2117+ if (!psp->securedisplay_context.context.initialized)
20502118 return -EINVAL;
20512119
20522120 if (ta_cmd_id != TA_SECUREDISPLAY_COMMAND__QUERY_TA &&
@@ -2055,7 +2123,7 @@ int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id) · 2 unmodified lines
20552123
20562124 mutex_lock(&psp->securedisplay_context.mutex);
20572125
2058− ret = psp_ta_invoke(psp, ta_cmd_id, psp->securedisplay_context.session_id);
2126+ ret = psp_ta_invoke(psp, ta_cmd_id, psp->securedisplay_context.context.session_id);
20592127
20602128 mutex_unlock(&psp->securedisplay_context.mutex);
20612129
@@ -2069,7 +2137,7 @@ static int psp_hw_start(struct psp_context *psp) · 7 unmodified lines
20692137 int ret;
20702138
20712139 if (!amdgpu_sriov_vf(adev)) {
2072− if (psp->kdb_bin_size &&
2140+ if ((is_psp_fw_valid(psp->kdb)) &&
20732141 (psp->funcs->bootloader_load_kdb != NULL)) {
20742142 ret = psp_bootloader_load_kdb(psp);
20752143 if (ret) {
@@ -2078,7 +2146,8 @@ static int psp_hw_start(struct psp_context *psp) · 2 unmodified lines
20782146 }
20792147 }
20802148
2081− if (psp->spl_bin_size) {
2149+ if ((is_psp_fw_valid(psp->spl)) &&
2150+ (psp->funcs->bootloader_load_spl != NULL)) {
20822151 ret = psp_bootloader_load_spl(psp);
20832152 if (ret) {
20842153 DRM_ERROR("PSP load spl failed!\n");
@@ -2086,16 +2155,49 @@ static int psp_hw_start(struct psp_context *psp) · 1 unmodified line
20862155 }
20872156 }
20882157
2089− ret = psp_bootloader_load_sysdrv(psp);
2090− if (ret) {
2091− DRM_ERROR("PSP load sysdrv failed!\n");
2092− return ret;
2158+ if ((is_psp_fw_valid(psp->sys)) &&
2159+ (psp->funcs->bootloader_load_sysdrv != NULL)) {
2160+ ret = psp_bootloader_load_sysdrv(psp);
2161+ if (ret) {
2162+ DRM_ERROR("PSP load sys drv failed!\n");
2163+ return ret;
2164+ }
20932165 }
20942166
2095− ret = psp_bootloader_load_sos(psp);
2096− if (ret) {
2097− DRM_ERROR("PSP load sos failed!\n");
2098− return ret;
2167+ if ((is_psp_fw_valid(psp->soc_drv)) &&
2168+ (psp->funcs->bootloader_load_soc_drv != NULL)) {
2169+ ret = psp_bootloader_load_soc_drv(psp);
2170+ if (ret) {
2171+ DRM_ERROR("PSP load soc drv failed!\n");
2172+ return ret;
2173+ }
2174+ }
2175+
2176+ if ((is_psp_fw_valid(psp->intf_drv)) &&
2177+ (psp->funcs->bootloader_load_intf_drv != NULL)) {
2178+ ret = psp_bootloader_load_intf_drv(psp);
2179+ if (ret) {
2180+ DRM_ERROR("PSP load intf drv failed!\n");
2181+ return ret;
2182+ }
2183+ }
2184+
2185+ if ((is_psp_fw_valid(psp->dbg_drv)) &&
2186+ (psp->funcs->bootloader_load_dbg_drv != NULL)) {
2187+ ret = psp_bootloader_load_dbg_drv(psp);
2188+ if (ret) {
2189+ DRM_ERROR("PSP load dbg drv failed!\n");
2190+ return ret;
2191+ }
2192+ }
2193+
2194+ if ((is_psp_fw_valid(psp->sos)) &&
2195+ (psp->funcs->bootloader_load_sos != NULL)) {
2196+ ret = psp_bootloader_load_sos(psp);
2197+ if (ret) {
2198+ DRM_ERROR("PSP load sos failed!\n");
2199+ return ret;
2200+ }
20992201 }
21002202 }
21012203
@@ -2299,8 +2401,6 @@ static int psp_prep_load_ip_fw_cmd_buf(struct amdgpu_firmware_info *ucode, · 197 unmodified lines
22992401 int ret;
23002402 uint64_t fw_mem_mc_addr = ucode->mc_addr;
23012403
2302− memset(cmd, 0, sizeof(struct psp_gfx_cmd_resp));
2303−
23042404 cmd->cmd_id = GFX_CMD_ID_LOAD_IP_FW;
23052405 cmd->cmd.cmd_load_ip_fw.fw_phy_addr_lo = lower_32_bits(fw_mem_mc_addr);
23062406 cmd->cmd.cmd_load_ip_fw.fw_phy_addr_hi = upper_32_bits(fw_mem_mc_addr);
@@ -2313,17 +2413,19 @@ static int psp_prep_load_ip_fw_cmd_buf(struct amdgpu_firmware_info *ucode, · 6 unmodified lines
23132413 return ret;
23142414 }
23152415
2316−static int psp_execute_np_fw_load(struct psp_context *psp,
2416+static int psp_execute_non_psp_fw_load(struct psp_context *psp,
23172417 struct amdgpu_firmware_info *ucode)
23182418 {
23192419 int ret = 0;
2420+ struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
23202421
2321− ret = psp_prep_load_ip_fw_cmd_buf(ucode, psp->cmd);
2322− if (ret)
2323− return ret;
2422+ ret = psp_prep_load_ip_fw_cmd_buf(ucode, cmd);
2423+ if (!ret) {
2424+ ret = psp_cmd_submit_buf(psp, ucode, cmd,
2425+ psp->fence_buf_mc_addr);
2426+ }
23242427
2325− ret = psp_cmd_submit_buf(psp, ucode, psp->cmd,
2326− psp->fence_buf_mc_addr);
2428+ release_psp_cmd_buf(psp);
23272429
23282430 return ret;
23292431 }
@@ -2334,7 +2436,7 @@ static int psp_load_smu_fw(struct psp_context *psp) · 4 unmodified lines
23342436 struct amdgpu_device *adev = psp->adev;
23352437 struct amdgpu_firmware_info *ucode =
23362438 &adev->firmware.ucode[AMDGPU_UCODE_ID_SMC];
2337− struct amdgpu_ras *ras = psp->ras.ras;
2439+ struct amdgpu_ras *ras = psp->ras_context.ras;
23382440
23392441 if (!ucode->fw || amdgpu_sriov_vf(psp->adev))
23402442 return 0;
@@ -2349,7 +2451,7 @@ static int psp_load_smu_fw(struct psp_context *psp) · 8 unmodified lines
23492451 }
23502452 }
23512453
2352− ret = psp_execute_np_fw_load(psp, ucode);
2454+ ret = psp_execute_non_psp_fw_load(psp, ucode);
23532455
23542456 if (ret)
23552457 DRM_ERROR("PSP load smu failed!\n");
@@ -2404,14 +2506,14 @@ int psp_load_fw_list(struct psp_context *psp, · 48 unmodified lines
24042506 for (i = 0; i < ucode_count; ++i) {
24052507 ucode = ucode_list[i];
24062508 psp_print_fw_hdr(psp, ucode);
2407− ret = psp_execute_np_fw_load(psp, ucode);
2509+ ret = psp_execute_non_psp_fw_load(psp, ucode);
24082510 if (ret)
24092511 return ret;
24102512 }
24112513 return ret;
24122514 }
24132515
2414−static int psp_np_fw_load(struct psp_context *psp)
2516+static int psp_load_non_psp_fw(struct psp_context *psp)
24152517 {
24162518 int i, ret;
24172519 struct amdgpu_firmware_info *ucode;
@@ -2450,7 +2552,7 @@ static int psp_np_fw_load(struct psp_context *psp) · 32 unmodified lines
24502552
24512553 psp_print_fw_hdr(psp, ucode);
24522554
2453− ret = psp_execute_np_fw_load(psp, ucode);
2555+ ret = psp_execute_non_psp_fw_load(psp, ucode);
24542556 if (ret)
24552557 return ret;
24562558
@@ -2478,10 +2580,6 @@ static int psp_load_fw(struct amdgpu_device *adev) · 21 unmodified lines
24782580 goto skip_memalloc;
24792581 }
24802582
2481− psp->cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
2482− if (!psp->cmd)
2483− return -ENOMEM;
2484−
24852583 if (amdgpu_sriov_vf(adev)) {
24862584 ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
24872585 AMDGPU_GEM_DOMAIN_VRAM,
@@ -2527,7 +2625,7 @@ skip_memalloc: · 39 unmodified lines
25272625 if (ret)
25282626 goto failed;
25292627
2530− ret = psp_np_fw_load(psp);
2628+ ret = psp_load_non_psp_fw(psp);
25312629 if (ret)
25322630 goto failed;
25332631
@@ -2543,7 +2641,7 @@ skip_memalloc: · 9 unmodified lines
25432641 return ret;
25442642 }
25452643
2546− if (psp->adev->psp.ta_fw) {
2644+ if (psp->ta_fw) {
25472645 ret = psp_ras_initialize(psp);
25482646 if (ret)
25492647 dev_err(psp->adev->dev,
@@ -2615,7 +2713,7 @@ static int psp_hw_fini(void *handle) · 65 unmodified lines
26152713 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
26162714 struct psp_context *psp = &adev->psp;
26172715
2618− if (psp->adev->psp.ta_fw) {
2716+ if (psp->ta_fw) {
26192717 psp_ras_terminate(psp);
26202718 psp_securedisplay_terminate(psp);
26212719 psp_rap_terminate(psp);
@@ -2635,9 +2733,6 @@ static int psp_hw_fini(void *handle) · 13 unmodified lines
26352733 amdgpu_bo_free_kernel(&psp->cmd_buf_bo, &psp->cmd_buf_mc_addr,
26362734 (void **)&psp->cmd_buf_mem);
26372735
2638− kfree(psp->cmd);
2639− psp->cmd = NULL;
2640−
26412736 return 0;
26422737 }
26432738
@@ -2648,7 +2743,7 @@ static int psp_suspend(void *handle) · 4 unmodified lines
26482743 struct psp_context *psp = &adev->psp;
26492744
26502745 if (adev->gmc.xgmi.num_physical_nodes > 1 &&
2651− psp->xgmi_context.initialized == 1) {
2746+ psp->xgmi_context.context.initialized) {
26522747 ret = psp_xgmi_terminate(psp);
26532748 if (ret) {
26542749 DRM_ERROR("Failed to terminate xgmi ta\n");
@@ -2656,7 +2751,7 @@ static int psp_suspend(void *handle) · 1 unmodified line
26562751 }
26572752 }
26582753
2659− if (psp->adev->psp.ta_fw) {
2754+ if (psp->ta_fw) {
26602755 ret = psp_ras_terminate(psp);
26612756 if (ret) {
26622757 DRM_ERROR("Failed to terminate ras ta\n");
@@ -2727,7 +2822,7 @@ static int psp_resume(void *handle) · 64 unmodified lines
27272822 if (ret)
27282823 goto failed;
27292824
2730− ret = psp_np_fw_load(psp);
2825+ ret = psp_load_non_psp_fw(psp);
27312826 if (ret)
27322827 goto failed;
27332828
@@ -2738,7 +2833,7 @@ static int psp_resume(void *handle) · 4 unmodified lines
27382833 }
27392834
27402835 if (adev->gmc.xgmi.num_physical_nodes > 1) {
2741− ret = psp_xgmi_initialize(psp);
2836+ ret = psp_xgmi_initialize(psp, false, true);
27422837 /* Warning the XGMI seesion initialize failure
27432838 * Instead of stop driver initialization
27442839 */
@@ -2747,7 +2842,7 @@ static int psp_resume(void *handle) · 2 unmodified lines
27472842 "XGMI: Failed to initialize XGMI session\n");
27482843 }
27492844
2750− if (psp->adev->psp.ta_fw) {
2845+ if (psp->ta_fw) {
27512846 ret = psp_ras_initialize(psp);
27522847 if (ret)
27532848 dev_err(psp->adev->dev,
@@ -2801,17 +2896,15 @@ int psp_gpu_reset(struct amdgpu_device *adev) · 47 unmodified lines
28012896 int psp_rlc_autoload_start(struct psp_context *psp)
28022897 {
28032898 int ret;
2804− struct psp_gfx_cmd_resp *cmd;
2805−
2806− cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
2807− if (!cmd)
2808− return -ENOMEM;
2899+ struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
28092900
28102901 cmd->cmd_id = GFX_CMD_ID_AUTOLOAD_RLC;
28112902
28122903 ret = psp_cmd_submit_buf(psp, NULL, cmd,
28132904 psp->fence_buf_mc_addr);
2814− kfree(cmd);
2905+
2906+ release_psp_cmd_buf(psp);
2907+
28152908 return ret;
28162909 }
28172910
@@ -2825,7 +2918,7 @@ int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx, · 7 unmodified lines
28252918 ucode.mc_addr = cmd_gpu_addr;
28262919 ucode.ucode_size = cmd_size;
28272920
2828− return psp_execute_np_fw_load(&adev->psp, &ucode);
2921+ return psp_execute_non_psp_fw_load(&adev->psp, &ucode);
28292922 }
28302923
28312924 int psp_ring_cmd_submit(struct psp_context *psp,
@@ -2901,10 +2994,10 @@ int psp_init_asd_microcode(struct psp_context *psp, · 69 unmodified lines
29012994 goto out;
29022995
29032996 asd_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.asd_fw->data;
2904− adev->psp.asd_fw_version = le32_to_cpu(asd_hdr->header.ucode_version);
2905− adev->psp.asd_feature_version = le32_to_cpu(asd_hdr->sos.fw_version);
2906− adev->psp.asd_ucode_size = le32_to_cpu(asd_hdr->header.ucode_size_bytes);
2907− adev->psp.asd_start_addr = (uint8_t *)asd_hdr +
2997+ adev->psp.asd.fw_version = le32_to_cpu(asd_hdr->header.ucode_version);
2998+ adev->psp.asd.feature_version = le32_to_cpu(asd_hdr->sos.fw_version);
2999+ adev->psp.asd.size_bytes = le32_to_cpu(asd_hdr->header.ucode_size_bytes);
3000+ adev->psp.asd.start_addr = (uint8_t *)asd_hdr +
29083001 le32_to_cpu(asd_hdr->header.ucode_array_offset_bytes);
29093002 return 0;
29103003 out:
@@ -2918,7 +3011,7 @@ int psp_init_toc_microcode(struct psp_context *psp, · 7 unmodified lines
29183011 const char *chip_name)
29193012 {
29203013 struct amdgpu_device *adev = psp->adev;
2921− char fw_name[30];
3014+ char fw_name[PSP_FW_NAME_LEN];
29223015 const struct psp_firmware_header_v1_0 *toc_hdr;
29233016 int err = 0;
29243017
@@ -2937,10 +3030,10 @@ int psp_init_toc_microcode(struct psp_context *psp, · 12 unmodified lines
29373030 goto out;
29383031
29393032 toc_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.toc_fw->data;
2940− adev->psp.toc_fw_version = le32_to_cpu(toc_hdr->header.ucode_version);
2941− adev->psp.toc_feature_version = le32_to_cpu(toc_hdr->sos.fw_version);
2942− adev->psp.toc_bin_size = le32_to_cpu(toc_hdr->header.ucode_size_bytes);
2943− adev->psp.toc_start_addr = (uint8_t *)toc_hdr +
3033+ adev->psp.toc.fw_version = le32_to_cpu(toc_hdr->header.ucode_version);
3034+ adev->psp.toc.feature_version = le32_to_cpu(toc_hdr->sos.fw_version);
3035+ adev->psp.toc.size_bytes = le32_to_cpu(toc_hdr->header.ucode_size_bytes);
3036+ adev->psp.toc.start_addr = (uint8_t *)toc_hdr +
29443037 le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes);
29453038 return 0;
29463039 out:
@@ -2950,6 +3043,82 @@ out: · 3 unmodified lines
29503043 return err;
29513044 }
29523045
3046+static int parse_sos_bin_descriptor(struct psp_context *psp,
3047+ const struct psp_fw_bin_desc *desc,
3048+ const struct psp_firmware_header_v2_0 *sos_hdr)
3049+{
3050+ uint8_t *ucode_start_addr = NULL;
3051+
3052+ if (!psp || !desc || !sos_hdr)
3053+ return -EINVAL;
3054+
3055+ ucode_start_addr = (uint8_t *)sos_hdr +
3056+ le32_to_cpu(desc->offset_bytes) +
3057+ le32_to_cpu(sos_hdr->header.ucode_array_offset_bytes);
3058+
3059+ switch (desc->fw_type) {
3060+ case PSP_FW_TYPE_PSP_SOS:
3061+ psp->sos.fw_version = le32_to_cpu(desc->fw_version);
3062+ psp->sos.feature_version = le32_to_cpu(desc->fw_version);
3063+ psp->sos.size_bytes = le32_to_cpu(desc->size_bytes);
3064+ psp->sos.start_addr = ucode_start_addr;
3065+ break;
3066+ case PSP_FW_TYPE_PSP_SYS_DRV:
3067+ psp->sys.fw_version = le32_to_cpu(desc->fw_version);
3068+ psp->sys.feature_version = le32_to_cpu(desc->fw_version);
3069+ psp->sys.size_bytes = le32_to_cpu(desc->size_bytes);
3070+ psp->sys.start_addr = ucode_start_addr;
3071+ break;
3072+ case PSP_FW_TYPE_PSP_KDB:
3073+ psp->kdb.fw_version = le32_to_cpu(desc->fw_version);
3074+ psp->kdb.feature_version = le32_to_cpu(desc->fw_version);
3075+ psp->kdb.size_bytes = le32_to_cpu(desc->size_bytes);
3076+ psp->kdb.start_addr = ucode_start_addr;
3077+ break;
3078+ case PSP_FW_TYPE_PSP_TOC:
3079+ psp->toc.fw_version = le32_to_cpu(desc->fw_version);
3080+ psp->toc.feature_version = le32_to_cpu(desc->fw_version);
3081+ psp->toc.size_bytes = le32_to_cpu(desc->size_bytes);
3082+ psp->toc.start_addr = ucode_start_addr;
3083+ break;
3084+ case PSP_FW_TYPE_PSP_SPL:
3085+ psp->spl.fw_version = le32_to_cpu(desc->fw_version);
3086+ psp->spl.feature_version = le32_to_cpu(desc->fw_version);
3087+ psp->spl.size_bytes = le32_to_cpu(desc->size_bytes);
3088+ psp->spl.start_addr = ucode_start_addr;
3089+ break;
3090+ case PSP_FW_TYPE_PSP_RL:
3091+ psp->rl.fw_version = le32_to_cpu(desc->fw_version);
3092+ psp->rl.feature_version = le32_to_cpu(desc->fw_version);
3093+ psp->rl.size_bytes = le32_to_cpu(desc->size_bytes);
3094+ psp->rl.start_addr = ucode_start_addr;
3095+ break;
3096+ case PSP_FW_TYPE_PSP_SOC_DRV:
3097+ psp->soc_drv.fw_version = le32_to_cpu(desc->fw_version);
3098+ psp->soc_drv.feature_version = le32_to_cpu(desc->fw_version);
3099+ psp->soc_drv.size_bytes = le32_to_cpu(desc->size_bytes);
3100+ psp->soc_drv.start_addr = ucode_start_addr;
3101+ break;
3102+ case PSP_FW_TYPE_PSP_INTF_DRV:
3103+ psp->intf_drv.fw_version = le32_to_cpu(desc->fw_version);
3104+ psp->intf_drv.feature_version = le32_to_cpu(desc->fw_version);
3105+ psp->intf_drv.size_bytes = le32_to_cpu(desc->size_bytes);
3106+ psp->intf_drv.start_addr = ucode_start_addr;
3107+ break;
3108+ case PSP_FW_TYPE_PSP_DBG_DRV:
3109+ psp->dbg_drv.fw_version = le32_to_cpu(desc->fw_version);
3110+ psp->dbg_drv.feature_version = le32_to_cpu(desc->fw_version);
3111+ psp->dbg_drv.size_bytes = le32_to_cpu(desc->size_bytes);
3112+ psp->dbg_drv.start_addr = ucode_start_addr;
3113+ break;
3114+ default:
3115+ dev_warn(psp->adev->dev, "Unsupported PSP FW type: %d\n", desc->fw_type);
3116+ break;
3117+ }
3118+
3119+ return 0;
3120+}
3121+
29533122 static int psp_init_sos_base_fw(struct amdgpu_device *adev)
29543123 {
29553124 const struct psp_firmware_header_v1_0 *sos_hdr;
@@ -2961,32 +3130,34 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev) · 5 unmodified lines
29613130 le32_to_cpu(sos_hdr->header.ucode_array_offset_bytes);
29623131
29633132 if (adev->gmc.xgmi.connected_to_cpu || (adev->asic_type != CHIP_ALDEBARAN)) {
2964− adev->psp.sos_fw_version = le32_to_cpu(sos_hdr->header.ucode_version);
2965− adev->psp.sos_feature_version = le32_to_cpu(sos_hdr->sos.fw_version);
3133+ adev->psp.sos.fw_version = le32_to_cpu(sos_hdr->header.ucode_version);
3134+ adev->psp.sos.feature_version = le32_to_cpu(sos_hdr->sos.fw_version);
29663135
2967− adev->psp.sys_bin_size = le32_to_cpu(sos_hdr->sos.offset_bytes);
2968− adev->psp.sys_start_addr = ucode_array_start_addr;
3136+ adev->psp.sys.size_bytes = le32_to_cpu(sos_hdr->sos.offset_bytes);
3137+ adev->psp.sys.start_addr = ucode_array_start_addr;
29693138
2970− adev->psp.sos_bin_size = le32_to_cpu(sos_hdr->sos.size_bytes);
2971− adev->psp.sos_start_addr = ucode_array_start_addr +
3139+ adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr->sos.size_bytes);
3140+ adev->psp.sos.start_addr = ucode_array_start_addr +
29723141 le32_to_cpu(sos_hdr->sos.offset_bytes);
3142+ adev->psp.xgmi_context.supports_extended_data = false;
29733143 } else {
29743144 /* Load alternate PSP SOS FW */
29753145 sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3 *)adev->psp.sos_fw->data;
29763146
2977− adev->psp.sos_fw_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);
2978− adev->psp.sos_feature_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);
3147+ adev->psp.sos.fw_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);
3148+ adev->psp.sos.feature_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);
29793149
2980− adev->psp.sys_bin_size = le32_to_cpu(sos_hdr_v1_3->sys_drv_aux.size_bytes);
2981− adev->psp.sys_start_addr = ucode_array_start_addr +
3150+ adev->psp.sys.size_bytes = le32_to_cpu(sos_hdr_v1_3->sys_drv_aux.size_bytes);
3151+ adev->psp.sys.start_addr = ucode_array_start_addr +
29823152 le32_to_cpu(sos_hdr_v1_3->sys_drv_aux.offset_bytes);
29833153
2984− adev->psp.sos_bin_size = le32_to_cpu(sos_hdr_v1_3->sos_aux.size_bytes);
2985− adev->psp.sos_start_addr = ucode_array_start_addr +
3154+ adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr_v1_3->sos_aux.size_bytes);
3155+ adev->psp.sos.start_addr = ucode_array_start_addr +
29863156 le32_to_cpu(sos_hdr_v1_3->sos_aux.offset_bytes);
3157+ adev->psp.xgmi_context.supports_extended_data = true;
29873158 }
29883159
2989− if ((adev->psp.sys_bin_size == 0) || (adev->psp.sos_bin_size == 0)) {
3160+ if ((adev->psp.sys.size_bytes == 0) || (adev->psp.sos.size_bytes == 0)) {
29903161 dev_warn(adev->dev, "PSP SOS FW not available");
29913162 return -EINVAL;
29923163 }
@@ -3003,8 +3174,10 @@ int psp_init_sos_microcode(struct psp_context *psp, · 10 unmodified lines
30033174 const struct psp_firmware_header_v1_1 *sos_hdr_v1_1;
30043175 const struct psp_firmware_header_v1_2 *sos_hdr_v1_2;
30053176 const struct psp_firmware_header_v1_3 *sos_hdr_v1_3;
3177+ const struct psp_firmware_header_v2_0 *sos_hdr_v2_0;
30063178 int err = 0;
30073179 uint8_t *ucode_array_start_addr;
3180+ int fw_index = 0;
30083181
30093182 if (!chip_name) {
30103183 dev_err(adev->dev, "invalid chip name for sos microcode\n");
@@ -3033,35 +3206,52 @@ int psp_init_sos_microcode(struct psp_context *psp, · 22 unmodified lines
30333206
30343207 if (sos_hdr->header.header_version_minor == 1) {
30353208 sos_hdr_v1_1 = (const struct psp_firmware_header_v1_1 *)adev->psp.sos_fw->data;
3036− adev->psp.toc_bin_size = le32_to_cpu(sos_hdr_v1_1->toc.size_bytes);
3037− adev->psp.toc_start_addr = (uint8_t *)adev->psp.sys_start_addr +
3209+ adev->psp.toc.size_bytes = le32_to_cpu(sos_hdr_v1_1->toc.size_bytes);
3210+ adev->psp.toc.start_addr = (uint8_t *)adev->psp.sys.start_addr +
30383211 le32_to_cpu(sos_hdr_v1_1->toc.offset_bytes);
3039− adev->psp.kdb_bin_size = le32_to_cpu(sos_hdr_v1_1->kdb.size_bytes);
3040− adev->psp.kdb_start_addr = (uint8_t *)adev->psp.sys_start_addr +
3212+ adev->psp.kdb.size_bytes = le32_to_cpu(sos_hdr_v1_1->kdb.size_bytes);
3213+ adev->psp.kdb.start_addr = (uint8_t *)adev->psp.sys.start_addr +
30413214 le32_to_cpu(sos_hdr_v1_1->kdb.offset_bytes);
30423215 }
30433216 if (sos_hdr->header.header_version_minor == 2) {
30443217 sos_hdr_v1_2 = (const struct psp_firmware_header_v1_2 *)adev->psp.sos_fw->data;
3045− adev->psp.kdb_bin_size = le32_to_cpu(sos_hdr_v1_2->kdb.size_bytes);
3046− adev->psp.kdb_start_addr = (uint8_t *)adev->psp.sys_start_addr +
3218+ adev->psp.kdb.size_bytes = le32_to_cpu(sos_hdr_v1_2->kdb.size_bytes);
3219+ adev->psp.kdb.start_addr = (uint8_t *)adev->psp.sys.start_addr +
30473220 le32_to_cpu(sos_hdr_v1_2->kdb.offset_bytes);
30483221 }
30493222 if (sos_hdr->header.header_version_minor == 3) {
30503223 sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3 *)adev->psp.sos_fw->data;
3051− adev->psp.toc_bin_size = le32_to_cpu(sos_hdr_v1_3->v1_1.toc.size_bytes);
3052− adev->psp.toc_start_addr = ucode_array_start_addr +
3224+ adev->psp.toc.size_bytes = le32_to_cpu(sos_hdr_v1_3->v1_1.toc.size_bytes);
3225+ adev->psp.toc.start_addr = ucode_array_start_addr +
30533226 le32_to_cpu(sos_hdr_v1_3->v1_1.toc.offset_bytes);
3054− adev->psp.kdb_bin_size = le32_to_cpu(sos_hdr_v1_3->v1_1.kdb.size_bytes);
3055− adev->psp.kdb_start_addr = ucode_array_start_addr +
3227+ adev->psp.kdb.size_bytes = le32_to_cpu(sos_hdr_v1_3->v1_1.kdb.size_bytes);
3228+ adev->psp.kdb.start_addr = ucode_array_start_addr +
30563229 le32_to_cpu(sos_hdr_v1_3->v1_1.kdb.offset_bytes);
3057− adev->psp.spl_bin_size = le32_to_cpu(sos_hdr_v1_3->spl.size_bytes);
3058− adev->psp.spl_start_addr = ucode_array_start_addr +
3230+ adev->psp.spl.size_bytes = le32_to_cpu(sos_hdr_v1_3->spl.size_bytes);
3231+ adev->psp.spl.start_addr = ucode_array_start_addr +
30593232 le32_to_cpu(sos_hdr_v1_3->spl.offset_bytes);
3060− adev->psp.rl_bin_size = le32_to_cpu(sos_hdr_v1_3->rl.size_bytes);
3061− adev->psp.rl_start_addr = ucode_array_start_addr +
3233+ adev->psp.rl.size_bytes = le32_to_cpu(sos_hdr_v1_3->rl.size_bytes);
3234+ adev->psp.rl.start_addr = ucode_array_start_addr +
30623235 le32_to_cpu(sos_hdr_v1_3->rl.offset_bytes);
30633236 }
30643237 break;
3238+ case 2:
3239+ sos_hdr_v2_0 = (const struct psp_firmware_header_v2_0 *)adev->psp.sos_fw->data;
3240+
3241+ if (le32_to_cpu(sos_hdr_v2_0->psp_fw_bin_count) >= UCODE_MAX_PSP_PACKAGING) {
3242+ dev_err(adev->dev, "packed SOS count exceeds maximum limit\n");
3243+ err = -EINVAL;
3244+ goto out;
3245+ }
3246+
3247+ for (fw_index = 0; fw_index < le32_to_cpu(sos_hdr_v2_0->psp_fw_bin_count); fw_index++) {
3248+ err = parse_sos_bin_descriptor(psp,
3249+ &sos_hdr_v2_0->psp_fw_bin[fw_index],
3250+ sos_hdr_v2_0);
3251+ if (err)
3252+ goto out;
3253+ }
3254+ break;
30653255 default:
30663256 dev_err(adev->dev,
30673257 "unsupported psp sos firmware\n");
@@ -3080,7 +3270,7 @@ out: · 12 unmodified lines
30803270 }
30813271
30823272 static int parse_ta_bin_descriptor(struct psp_context *psp,
3083− const struct ta_fw_bin_desc *desc,
3273+ const struct psp_fw_bin_desc *desc,
30843274 const struct ta_firmware_header_v2_0 *ta_hdr)
30853275 {
30863276 uint8_t *ucode_start_addr = NULL;
@@ -3094,40 +3284,40 @@ static int parse_ta_bin_descriptor(struct psp_context *psp, · 7 unmodified lines
30943284
30953285 switch (desc->fw_type) {
30963286 case TA_FW_TYPE_PSP_ASD:
3097− psp->asd_fw_version = le32_to_cpu(desc->fw_version);
3098− psp->asd_feature_version = le32_to_cpu(desc->fw_version);
3099− psp->asd_ucode_size = le32_to_cpu(desc->size_bytes);
3100− psp->asd_start_addr = ucode_start_addr;
3287+ psp->asd.fw_version = le32_to_cpu(desc->fw_version);
3288+ psp->asd.feature_version = le32_to_cpu(desc->fw_version);
3289+ psp->asd.size_bytes = le32_to_cpu(desc->size_bytes);
3290+ psp->asd.start_addr = ucode_start_addr;
31013291 break;
31023292 case TA_FW_TYPE_PSP_XGMI:
3103− psp->ta_xgmi_ucode_version = le32_to_cpu(desc->fw_version);
3104− psp->ta_xgmi_ucode_size = le32_to_cpu(desc->size_bytes);
3105− psp->ta_xgmi_start_addr = ucode_start_addr;
3293+ psp->xgmi.feature_version = le32_to_cpu(desc->fw_version);
3294+ psp->xgmi.size_bytes = le32_to_cpu(desc->size_bytes);
3295+ psp->xgmi.start_addr = ucode_start_addr;
31063296 break;
31073297 case TA_FW_TYPE_PSP_RAS:
3108− psp->ta_ras_ucode_version = le32_to_cpu(desc->fw_version);
3109− psp->ta_ras_ucode_size = le32_to_cpu(desc->size_bytes);
3110− psp->ta_ras_start_addr = ucode_start_addr;
3298+ psp->ras.feature_version = le32_to_cpu(desc->fw_version);
3299+ psp->ras.size_bytes = le32_to_cpu(desc->size_bytes);
3300+ psp->ras.start_addr = ucode_start_addr;
31113301 break;
31123302 case TA_FW_TYPE_PSP_HDCP:
3113− psp->ta_hdcp_ucode_version = le32_to_cpu(desc->fw_version);
3114− psp->ta_hdcp_ucode_size = le32_to_cpu(desc->size_bytes);
3115− psp->ta_hdcp_start_addr = ucode_start_addr;
3303+ psp->hdcp.feature_version = le32_to_cpu(desc->fw_version);
3304+ psp->hdcp.size_bytes = le32_to_cpu(desc->size_bytes);
3305+ psp->hdcp.start_addr = ucode_start_addr;
31163306 break;
31173307 case TA_FW_TYPE_PSP_DTM:
3118− psp->ta_dtm_ucode_version = le32_to_cpu(desc->fw_version);
3119− psp->ta_dtm_ucode_size = le32_to_cpu(desc->size_bytes);
3120− psp->ta_dtm_start_addr = ucode_start_addr;
3308+ psp->dtm.feature_version = le32_to_cpu(desc->fw_version);
3309+ psp->dtm.size_bytes = le32_to_cpu(desc->size_bytes);
3310+ psp->dtm.start_addr = ucode_start_addr;
31213311 break;
31223312 case TA_FW_TYPE_PSP_RAP:
3123− psp->ta_rap_ucode_version = le32_to_cpu(desc->fw_version);
3124− psp->ta_rap_ucode_size = le32_to_cpu(desc->size_bytes);
3125− psp->ta_rap_start_addr = ucode_start_addr;
3313+ psp->rap.feature_version = le32_to_cpu(desc->fw_version);
3314+ psp->rap.size_bytes = le32_to_cpu(desc->size_bytes);
3315+ psp->rap.start_addr = ucode_start_addr;
31263316 break;
31273317 case TA_FW_TYPE_PSP_SECUREDISPLAY:
3128− psp->ta_securedisplay_ucode_version = le32_to_cpu(desc->fw_version);
3129− psp->ta_securedisplay_ucode_size = le32_to_cpu(desc->size_bytes);
3130− psp->ta_securedisplay_start_addr = ucode_start_addr;
3318+ psp->securedisplay.feature_version = le32_to_cpu(desc->fw_version);
3319+ psp->securedisplay.size_bytes = le32_to_cpu(desc->size_bytes);
3320+ psp->securedisplay.start_addr = ucode_start_addr;
31313321 break;
31323322 default:
31333323 dev_warn(psp->adev->dev, "Unsupported TA type: %d\n", desc->fw_type);
@@ -3168,7 +3358,7 @@ int psp_init_ta_microcode(struct psp_context *psp, · 34 unmodified lines
31683358 goto out;
31693359 }
31703360
3171− if (le32_to_cpu(ta_hdr->ta_fw_bin_count) >= UCODE_MAX_TA_PACKAGING) {
3361+ if (le32_to_cpu(ta_hdr->ta_fw_bin_count) >= UCODE_MAX_PSP_PACKAGING) {
31723362 dev_err(adev->dev, "packed TA count exceeds maximum limit\n");
31733363 err = -EINVAL;
31743364 goto out;
@@ -3235,11 +3425,12 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev, · 60 unmodified lines
32353425 {
32363426 struct drm_device *ddev = dev_get_drvdata(dev);
32373427 struct amdgpu_device *adev = drm_to_adev(ddev);
3238− void *cpu_addr;
3239− dma_addr_t dma_addr;
32403428 int ret, idx;
32413429 char fw_name[100];
32423430 const struct firmware *usbc_pd_fw;
3431+ struct amdgpu_bo *fw_buf_bo = NULL;
3432+ uint64_t fw_pri_mc_addr;
3433+ void *fw_pri_cpu_addr;
32433434
32443435 if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) {
32453436 DRM_INFO("PSP block is not ready yet.");
@@ -3254,31 +3445,24 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev, · 8 unmodified lines
32543445 if (ret)
32553446 goto fail;
32563447
3257− /* We need contiguous physical mem to place the FW for psp to access */
3258− cpu_addr = dma_alloc_coherent(adev->dev, usbc_pd_fw->size, &dma_addr, GFP_KERNEL);
3259−
3260− ret = dma_mapping_error(adev->dev, dma_addr);
3448+ /* LFB address which is aligned to 1MB boundary per PSP request */
3449+ ret = amdgpu_bo_create_kernel(adev, usbc_pd_fw->size, 0x100000,
3450+ AMDGPU_GEM_DOMAIN_VRAM,
3451+ &fw_buf_bo,
3452+ &fw_pri_mc_addr,
3453+ &fw_pri_cpu_addr);
32613454 if (ret)
32623455 goto rel_buf;
32633456
3264− memcpy_toio(cpu_addr, usbc_pd_fw->data, usbc_pd_fw->size);
3265−
3266− /*
3267− * x86 specific workaround.
3268− * Without it the buffer is invisible in PSP.
3269− *
3270− * TODO Remove once PSP starts snooping CPU cache
3271− */
3272−#ifdef CONFIG_X86
3273− clflush_cache_range(cpu_addr, (usbc_pd_fw->size & ~(L1_CACHE_BYTES - 1)));
3274−#endif
3457+ memcpy_toio(fw_pri_cpu_addr, usbc_pd_fw->data, usbc_pd_fw->size);
32753458
32763459 mutex_lock(&adev->psp.mutex);
3277− ret = psp_load_usbc_pd_fw(&adev->psp, dma_addr);
3460+ ret = psp_load_usbc_pd_fw(&adev->psp, fw_pri_mc_addr);
32783461 mutex_unlock(&adev->psp.mutex);
32793462
3463+ amdgpu_bo_free_kernel(&fw_buf_bo, &fw_pri_mc_addr, &fw_pri_cpu_addr);
3464+
32803465 rel_buf:
3281− dma_free_coherent(adev->dev, usbc_pd_fw->size, cpu_addr, dma_addr);
32823466 release_firmware(usbc_pd_fw);
32833467 fail:
32843468 if (ret) {
@@ -3307,7 +3491,10 @@ static DEVICE_ATTR(usbc_pd_fw, S_IRUGO | S_IWUSR, · 22 unmodified lines
33073491 psp_usbc_pd_fw_sysfs_read,
33083492 psp_usbc_pd_fw_sysfs_write);
33093493
3310−
3494+int is_psp_fw_valid(struct psp_bin_desc bin)
3495+{
3496+ return bin.size_bytes;
3497+}
33113498
33123499 const struct amd_ip_funcs psp_ip_funcs = {
33133500 .name = "psp",
@@ -3369,6 +3556,14 @@ const struct amdgpu_ip_block_version psp_v11_0_ip_block = · 55 unmodified lines
33693556 .funcs = &psp_ip_funcs,
33703557 };
33713558
3559+const struct amdgpu_ip_block_version psp_v11_0_8_ip_block = {
3560+ .type = AMD_IP_BLOCK_TYPE_PSP,
3561+ .major = 11,
3562+ .minor = 0,
3563+ .rev = 8,
3564+ .funcs = &psp_ip_funcs,
3565+};
3566+
33723567 const struct amdgpu_ip_block_version psp_v12_0_ip_block =
33733568 {
33743569 .type = AMD_IP_BLOCK_TYPE_PSP,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h+68−97
@@ -48,11 +48,15 @@ · 47 unmodified lines
4848 struct psp_context;
4949 struct psp_xgmi_node_info;
5050 struct psp_xgmi_topology_info;
51+struct psp_bin_desc;
5152
5253 enum psp_bootloader_cmd {
5354 PSP_BL__LOAD_SYSDRV = 0x10000,
5455 PSP_BL__LOAD_SOSDRV = 0x20000,
5556 PSP_BL__LOAD_KEY_DATABASE = 0x80000,
57+ PSP_BL__LOAD_SOCDRV = 0xB0000,
58+ PSP_BL__LOAD_INTFDRV = 0xC0000,
59+ PSP_BL__LOAD_DBGDRV = 0xD0000,
5660 PSP_BL__DRAM_LONG_TRAIN = 0x100000,
5761 PSP_BL__DRAM_SHORT_TRAIN = 0x200000,
5862 PSP_BL__LOAD_TOS_SPL_TABLE = 0x10000000,
@@ -93,6 +97,9 @@ struct psp_funcs · 34 unmodified lines
9397 int (*bootloader_load_kdb)(struct psp_context *psp);
9498 int (*bootloader_load_spl)(struct psp_context *psp);
9599 int (*bootloader_load_sysdrv)(struct psp_context *psp);
100+ int (*bootloader_load_soc_drv)(struct psp_context *psp);
101+ int (*bootloader_load_intf_drv)(struct psp_context *psp);
102+ int (*bootloader_load_dbg_drv)(struct psp_context *psp);
96103 int (*bootloader_load_sos)(struct psp_context *psp);
97104 int (*ring_init)(struct psp_context *psp, enum psp_ring_type ring_type);
98105 int (*ring_create)(struct psp_context *psp,
@@ -106,7 +113,7 @@ struct psp_funcs · 7 unmodified lines
106113 int (*mem_training)(struct psp_context *psp, uint32_t ops);
107114 uint32_t (*ring_get_wptr)(struct psp_context *psp);
108115 void (*ring_set_wptr)(struct psp_context *psp, uint32_t value);
109− int (*load_usbc_pd_fw)(struct psp_context *psp, dma_addr_t dma_addr);
116+ int (*load_usbc_pd_fw)(struct psp_context *psp, uint64_t fw_pri_mc_addr);
110117 int (*read_usbc_pd_fw)(struct psp_context *psp, uint32_t *fw_ver);
111118 };
112119
@@ -116,6 +123,7 @@ struct psp_xgmi_node_info { · 3 unmodified lines
116123 uint8_t num_hops;
117124 uint8_t is_sharing_enabled;
118125 enum ta_xgmi_assigned_sdma_engine sdma_engine;
126+ uint8_t num_links;
119127 };
120128
121129 struct psp_xgmi_topology_info {
@@ -128,59 +136,32 @@ struct psp_asd_context { · 6 unmodified lines
128136 uint32_t session_id;
129137 };
130138
131−struct psp_xgmi_context {
132− uint8_t initialized;
133− uint32_t session_id;
134− struct amdgpu_bo *xgmi_shared_bo;
135− uint64_t xgmi_shared_mc_addr;
136− void *xgmi_shared_buf;
137− struct psp_xgmi_topology_info top_info;
138−};
139−
140−struct psp_ras_context {
141− /*ras fw*/
142− bool ras_initialized;
143− uint32_t session_id;
144− struct amdgpu_bo *ras_shared_bo;
145− uint64_t ras_shared_mc_addr;
146− void *ras_shared_buf;
147− struct amdgpu_ras *ras;
139+struct ta_mem_context {
140+ struct amdgpu_bo *shared_bo;
141+ uint64_t shared_mc_addr;
142+ void *shared_buf;
148143 };
149144
150−struct psp_hdcp_context {
151− bool hdcp_initialized;
145+struct ta_context {
146+ bool initialized;
152147 uint32_t session_id;
153− struct amdgpu_bo *hdcp_shared_bo;
154− uint64_t hdcp_shared_mc_addr;
155− void *hdcp_shared_buf;
156− struct mutex mutex;
148+ struct ta_mem_context mem_context;
157149 };
158150
159−struct psp_dtm_context {
160− bool dtm_initialized;
161− uint32_t session_id;
162− struct amdgpu_bo *dtm_shared_bo;
163− uint64_t dtm_shared_mc_addr;
164− void *dtm_shared_buf;
165− struct mutex mutex;
151+struct ta_cp_context {
152+ struct ta_context context;
153+ struct mutex mutex;
166154 };
167155
168−struct psp_rap_context {
169− bool rap_initialized;
170− uint32_t session_id;
171− struct amdgpu_bo *rap_shared_bo;
172− uint64_t rap_shared_mc_addr;
173− void *rap_shared_buf;
174− struct mutex mutex;
156+struct psp_xgmi_context {
157+ struct ta_context context;
158+ struct psp_xgmi_topology_info top_info;
159+ bool supports_extended_data;
175160 };
176161
177−struct psp_securedisplay_context {
178− bool securedisplay_initialized;
179− uint32_t session_id;
180− struct amdgpu_bo *securedisplay_shared_bo;
181− uint64_t securedisplay_shared_mc_addr;
182− void *securedisplay_shared_buf;
183− struct mutex mutex;
162+struct psp_ras_context {
163+ struct ta_context context;
164+ struct amdgpu_ras *ras;
184165 };
185166
186167 #define MEM_TRAIN_SYSTEM_SIGNATURE 0x54534942
@@ -282,6 +263,13 @@ struct psp_runtime_boot_cfg_entry { · 95 unmodified lines
282263 uint32_t reserved;
283264 };
284265
266+struct psp_bin_desc {
267+ uint32_t fw_version;
268+ uint32_t feature_version;
269+ uint32_t size_bytes;
270+ uint8_t *start_addr;
271+};
272+
285273 struct psp_context
286274 {
287275 struct amdgpu_device *adev;
@@ -297,36 +285,26 @@ struct psp_context · 9 unmodified lines
297285
298286 /* sos firmware */
299287 const struct firmware *sos_fw;
300− uint32_t sos_fw_version;
301− uint32_t sos_feature_version;
302− uint32_t sys_bin_size;
303− uint32_t sos_bin_size;
304− uint32_t toc_bin_size;
305− uint32_t kdb_bin_size;
306− uint32_t spl_bin_size;
307− uint32_t rl_bin_size;
308− uint8_t *sys_start_addr;
309− uint8_t *sos_start_addr;
310− uint8_t *toc_start_addr;
311− uint8_t *kdb_start_addr;
312− uint8_t *spl_start_addr;
313− uint8_t *rl_start_addr;
288+ struct psp_bin_desc sys;
289+ struct psp_bin_desc sos;
290+ struct psp_bin_desc toc;
291+ struct psp_bin_desc kdb;
292+ struct psp_bin_desc spl;
293+ struct psp_bin_desc rl;
294+ struct psp_bin_desc soc_drv;
295+ struct psp_bin_desc intf_drv;
296+ struct psp_bin_desc dbg_drv;
314297
315298 /* tmr buffer */
316299 struct amdgpu_bo *tmr_bo;
317300 uint64_t tmr_mc_addr;
318301
319302 /* asd firmware */
320− const struct firmware *asd_fw;
321− uint32_t asd_fw_version;
322− uint32_t asd_feature_version;
323− uint32_t asd_ucode_size;
324− uint8_t *asd_start_addr;
303+ const struct firmware *asd_fw;
304+ struct psp_bin_desc asd;
325305
326306 /* toc firmware */
327307 const struct firmware *toc_fw;
328− uint32_t toc_fw_version;
329− uint32_t toc_feature_version;
330308
331309 /* fence buffer */
332310 struct amdgpu_bo *fence_buf_bo;
@@ -348,36 +326,20 @@ struct psp_context · 15 unmodified lines
348326 /* xgmi ta firmware and buffer */
349327 const struct firmware *ta_fw;
350328 uint32_t ta_fw_version;
351− uint32_t ta_xgmi_ucode_version;
352− uint32_t ta_xgmi_ucode_size;
353− uint8_t *ta_xgmi_start_addr;
354− uint32_t ta_ras_ucode_version;
355− uint32_t ta_ras_ucode_size;
356− uint8_t *ta_ras_start_addr;
357−
358− uint32_t ta_hdcp_ucode_version;
359− uint32_t ta_hdcp_ucode_size;
360− uint8_t *ta_hdcp_start_addr;
361−
362− uint32_t ta_dtm_ucode_version;
363− uint32_t ta_dtm_ucode_size;
364− uint8_t *ta_dtm_start_addr;
365−
366− uint32_t ta_rap_ucode_version;
367− uint32_t ta_rap_ucode_size;
368− uint8_t *ta_rap_start_addr;
369−
370− uint32_t ta_securedisplay_ucode_version;
371− uint32_t ta_securedisplay_ucode_size;
372− uint8_t *ta_securedisplay_start_addr;
329+ struct psp_bin_desc xgmi;
330+ struct psp_bin_desc ras;
331+ struct psp_bin_desc hdcp;
332+ struct psp_bin_desc dtm;
333+ struct psp_bin_desc rap;
334+ struct psp_bin_desc securedisplay;
373335
374336 struct psp_asd_context asd_context;
375337 struct psp_xgmi_context xgmi_context;
376− struct psp_ras_context ras;
377− struct psp_hdcp_context hdcp_context;
378− struct psp_dtm_context dtm_context;
379− struct psp_rap_context rap_context;
380− struct psp_securedisplay_context securedisplay_context;
338+ struct psp_ras_context ras_context;
339+ struct ta_cp_context hdcp_context;
340+ struct ta_cp_context dtm_context;
341+ struct ta_cp_context rap_context;
342+ struct ta_cp_context securedisplay_context;
381343 struct mutex mutex;
382344 struct psp_memory_training_context mem_train_ctx;
383345
@@ -402,6 +364,12 @@ struct amdgpu_psp_funcs { · 18 unmodified lines
402364 ((psp)->funcs->bootloader_load_spl ? (psp)->funcs->bootloader_load_spl((psp)) : 0)
403365 #define psp_bootloader_load_sysdrv(psp) \
404366 ((psp)->funcs->bootloader_load_sysdrv ? (psp)->funcs->bootloader_load_sysdrv((psp)) : 0)
367+#define psp_bootloader_load_soc_drv(psp) \
368+ ((psp)->funcs->bootloader_load_soc_drv ? (psp)->funcs->bootloader_load_soc_drv((psp)) : 0)
369+#define psp_bootloader_load_intf_drv(psp) \
370+ ((psp)->funcs->bootloader_load_intf_drv ? (psp)->funcs->bootloader_load_intf_drv((psp)) : 0)
371+#define psp_bootloader_load_dbg_drv(psp) \
372+ ((psp)->funcs->bootloader_load_dbg_drv ? (psp)->funcs->bootloader_load_dbg_drv((psp)) : 0)
405373 #define psp_bootloader_load_sos(psp) \
406374 ((psp)->funcs->bootloader_load_sos ? (psp)->funcs->bootloader_load_sos((psp)) : 0)
407375 #define psp_smu_reload_quirk(psp) \
@@ -414,9 +382,9 @@ struct amdgpu_psp_funcs { · 6 unmodified lines
414382 #define psp_ring_get_wptr(psp) (psp)->funcs->ring_get_wptr((psp))
415383 #define psp_ring_set_wptr(psp, value) (psp)->funcs->ring_set_wptr((psp), (value))
416384
417−#define psp_load_usbc_pd_fw(psp, dma_addr) \
385+#define psp_load_usbc_pd_fw(psp, fw_pri_mc_addr) \
418386 ((psp)->funcs->load_usbc_pd_fw ? \
419− (psp)->funcs->load_usbc_pd_fw((psp), (dma_addr)) : -EINVAL)
387+ (psp)->funcs->load_usbc_pd_fw((psp), (fw_pri_mc_addr)) : -EINVAL)
420388
421389 #define psp_read_usbc_pd_fw(psp, fw_ver) \
422390 ((psp)->funcs->read_usbc_pd_fw ? \
@@ -427,6 +395,7 @@ extern const struct amd_ip_funcs psp_ip_funcs; · 4 unmodified lines
427395 extern const struct amdgpu_ip_block_version psp_v3_1_ip_block;
428396 extern const struct amdgpu_ip_block_version psp_v10_0_ip_block;
429397 extern const struct amdgpu_ip_block_version psp_v11_0_ip_block;
398+extern const struct amdgpu_ip_block_version psp_v11_0_8_ip_block;
430399 extern const struct amdgpu_ip_block_version psp_v12_0_ip_block;
431400 extern const struct amdgpu_ip_block_version psp_v13_0_ip_block;
432401
@@ -437,14 +406,15 @@ int psp_gpu_reset(struct amdgpu_device *adev); · 4 unmodified lines
437406 int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx,
438407 uint64_t cmd_gpu_addr, int cmd_size);
439408
440−int psp_xgmi_initialize(struct psp_context *psp);
409+int psp_xgmi_initialize(struct psp_context *psp, bool set_extended_data, bool load_ta);
441410 int psp_xgmi_terminate(struct psp_context *psp);
442411 int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
443412 int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id);
444413 int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id);
445414 int psp_xgmi_get_topology_info(struct psp_context *psp,
446415 int number_devices,
447− struct psp_xgmi_topology_info *topology);
416+ struct psp_xgmi_topology_info *topology,
417+ bool get_extended_data);
448418 int psp_xgmi_set_topology_info(struct psp_context *psp,
449419 int number_devices,
450420 struct psp_xgmi_topology_info *topology);
@@ -483,4 +453,5 @@ int psp_load_fw_list(struct psp_context *psp, · 32 unmodified lines
483453 struct amdgpu_firmware_info **ucode_list, int ucode_count);
484454 void psp_copy_fw(struct psp_context *psp, uint8_t *start_addr, uint32_t bin_size);
485455
456+int is_psp_fw_valid(struct psp_bin_desc bin);
486457 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c+2−2
@@ -76,7 +76,7 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf, · 75 unmodified lines
7676 dev_info(adev->dev, "RAP L0 validate test success.\n");
7777 } else {
7878 rap_shared_mem = (struct ta_rap_shared_memory *)
79− adev->psp.rap_context.rap_shared_buf;
79+ adev->psp.rap_context.context.mem_context.shared_buf;
8080 rap_cmd_output = &(rap_shared_mem->rap_out_message.output);
8181
8282 dev_info(adev->dev, "RAP test failed, the output is:\n");
@@ -119,7 +119,7 @@ void amdgpu_rap_debugfs_init(struct amdgpu_device *adev) · 36 unmodified lines
119119 #if defined(CONFIG_DEBUG_FS)
120120 struct drm_minor *minor = adev_to_drm(adev)->primary;
121121
122− if (!adev->psp.rap_context.rap_initialized)
122+ if (!adev->psp.rap_context.context.initialized)
123123 return;
124124
125125 debugfs_create_file("rap_test", S_IWUSR, minor->debugfs_root,
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c+63−57
@@ -64,15 +64,14 @@ const char *ras_block_string[] = { · 63 unmodified lines
6464 };
6565
6666 #define ras_err_str(i) (ras_error_string[ffs(i)])
67−#define ras_block_str(i) (ras_block_string[i])
6867
6968 #define RAS_DEFAULT_FLAGS (AMDGPU_RAS_FLAG_INIT_BY_VBIOS)
7069
7170 /* inject address is 52 bits */
7271 #define RAS_UMC_INJECT_ADDR_LIMIT (0x1ULL << 52)
7372
74−/* typical ECC bad page rate(1 bad page per 100MB VRAM) */
75−#define RAS_BAD_PAGE_RATE (100 * 1024 * 1024ULL)
73+/* typical ECC bad page rate is 1 bad page per 100MB VRAM */
74+#define RAS_BAD_PAGE_COVER (100 * 1024 * 1024ULL)
7675
7776 enum amdgpu_ras_retire_page_reservation {
7877 AMDGPU_RAS_RETIRE_PAGE_RESERVED,
@@ -355,8 +354,9 @@ static int amdgpu_ras_debugfs_ctrl_parse_data(struct file *f, · 276 unmodified lines
355354 * to see which blocks support RAS on a particular asic.
356355 *
357356 */
358−static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, const char __user *buf,
359− size_t size, loff_t *pos)
357+static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f,
358+ const char __user *buf,
359+ size_t size, loff_t *pos)
360360 {
361361 struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
362362 struct ras_debug_if data;
@@ -370,7 +370,7 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, const char __user * · 7 unmodified lines
370370
371371 ret = amdgpu_ras_debugfs_ctrl_parse_data(f, buf, size, pos, &data);
372372 if (ret)
373− return -EINVAL;
373+ return ret;
374374
375375 if (data.op == 3) {
376376 ret = amdgpu_reserve_page_direct(adev, data.inject.address);
@@ -403,9 +403,9 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, const char __user * · 26 unmodified lines
403403 /* umc ce/ue error injection for a bad page is not allowed */
404404 if ((data.head.block == AMDGPU_RAS_BLOCK__UMC) &&
405405 amdgpu_ras_check_bad_page(adev, data.inject.address)) {
406− dev_warn(adev->dev, "RAS WARN: 0x%llx has been marked "
407− "as bad before error injection!\n",
408− data.inject.address);
406+ dev_warn(adev->dev, "RAS WARN: inject: 0x%llx has "
407+ "already been marked as bad!\n",
408+ data.inject.address);
409409 break;
410410 }
411411
@@ -439,21 +439,24 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, const char __user * · 27 unmodified lines
439439 * will reset EEPROM table to 0 entries.
440440 *
441441 */
442−static ssize_t amdgpu_ras_debugfs_eeprom_write(struct file *f, const char __user *buf,
443− size_t size, loff_t *pos)
442+static ssize_t amdgpu_ras_debugfs_eeprom_write(struct file *f,
443+ const char __user *buf,
444+ size_t size, loff_t *pos)
444445 {
445446 struct amdgpu_device *adev =
446447 (struct amdgpu_device *)file_inode(f)->i_private;
447448 int ret;
448449
449450 ret = amdgpu_ras_eeprom_reset_table(
450− &(amdgpu_ras_get_context(adev)->eeprom_control));
451+ &(amdgpu_ras_get_context(adev)->eeprom_control));
451452
452− if (ret == 1) {
453+ if (!ret) {
454+ /* Something was written to EEPROM.
455+ */
453456 amdgpu_ras_get_context(adev)->flags = RAS_DEFAULT_FLAGS;
454457 return size;
455458 } else {
456− return -EIO;
459+ return ret;
457460 }
458461 }
459462
@@ -526,7 +529,7 @@ static inline void put_obj(struct ras_manager *obj) · 66 unmodified lines
526529 if (obj && (--obj->use == 0))
527530 list_del(&obj->node);
528531 if (obj && (obj->use < 0))
529− DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);
532+ DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", ras_block_str(obj->head.block));
530533 }
531534
532535 /* make one obj and return it. */
@@ -789,7 +792,6 @@ static int amdgpu_ras_enable_all_features(struct amdgpu_device *adev, · 256 unmodified lines
789792 .type = default_ras_type,
790793 .sub_block_index = 0,
791794 };
792− strcpy(head.name, ras_block_str(i));
793795 if (bypass) {
794796 /*
795797 * bypass psp. vbios enable ras for us.
@@ -1316,6 +1318,12 @@ static struct dentry *amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device * · 520 unmodified lines
13161318 &con->bad_page_cnt_threshold);
13171319 debugfs_create_x32("ras_hw_enabled", 0444, dir, &adev->ras_hw_enabled);
13181320 debugfs_create_x32("ras_enabled", 0444, dir, &adev->ras_enabled);
1321+ debugfs_create_file("ras_eeprom_size", S_IRUGO, dir, adev,
1322+ &amdgpu_ras_debugfs_eeprom_size_ops);
1323+ con->de_ras_eeprom_table = debugfs_create_file("ras_eeprom_table",
1324+ S_IRUGO, dir, adev,
1325+ &amdgpu_ras_debugfs_eeprom_table_ops);
1326+ amdgpu_ras_debugfs_set_ret_size(&con->eeprom_control);
13191327
13201328 /*
13211329 * After one uncorrectable error happens, usually GPU recovery will
@@ -1833,13 +1841,12 @@ int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev) · 511 unmodified lines
18331841
18341842 control = &con->eeprom_control;
18351843 data = con->eh_data;
1836− save_count = data->count - control->num_recs;
1844+ save_count = data->count - control->ras_num_recs;
18371845 /* only new entries are saved */
18381846 if (save_count > 0) {
1839− if (amdgpu_ras_eeprom_process_recods(control,
1840− &data->bps[control->num_recs],
1841− true,
1842− save_count)) {
1847+ if (amdgpu_ras_eeprom_append(control,
1848+ &data->bps[control->ras_num_recs],
1849+ save_count)) {
18431850 dev_err(adev->dev, "Failed to save EEPROM table data!");
18441851 return -EIO;
18451852 }
@@ -1857,28 +1864,24 @@ int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev) · 11 unmodified lines
18571864 static int amdgpu_ras_load_bad_pages(struct amdgpu_device *adev)
18581865 {
18591866 struct amdgpu_ras_eeprom_control *control =
1860− &adev->psp.ras.ras->eeprom_control;
1861− struct eeprom_table_record *bps = NULL;
1862− int ret = 0;
1867+ &adev->psp.ras_context.ras->eeprom_control;
1868+ struct eeprom_table_record *bps;
1869+ int ret;
18631870
18641871 /* no bad page record, skip eeprom access */
1865− if (!control->num_recs || (amdgpu_bad_page_threshold == 0))
1866− return ret;
1872+ if (control->ras_num_recs == 0 || amdgpu_bad_page_threshold == 0)
1873+ return 0;
18671874
1868− bps = kcalloc(control->num_recs, sizeof(*bps), GFP_KERNEL);
1875+ bps = kcalloc(control->ras_num_recs, sizeof(*bps), GFP_KERNEL);
18691876 if (!bps)
18701877 return -ENOMEM;
18711878
1872− if (amdgpu_ras_eeprom_process_recods(control, bps, false,
1873− control->num_recs)) {
1879+ ret = amdgpu_ras_eeprom_read(control, bps, control->ras_num_recs);
1880+ if (ret)
18741881 dev_err(adev->dev, "Failed to load EEPROM table records!");
1875− ret = -EIO;
1876− goto out;
1877− }
1878−
1879− ret = amdgpu_ras_add_bad_pages(adev, bps, control->num_recs);
1882+ else
1883+ ret = amdgpu_ras_add_bad_pages(adev, bps, control->ras_num_recs);
18801884
1881−out:
18821885 kfree(bps);
18831886 return ret;
18841887 }
@@ -1918,11 +1921,9 @@ static bool amdgpu_ras_check_bad_page(struct amdgpu_device *adev, · 33 unmodified lines
19181921 }
19191922
19201923 static void amdgpu_ras_validate_threshold(struct amdgpu_device *adev,
1921− uint32_t max_length)
1924+ uint32_t max_count)
19221925 {
19231926 struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
1924− int tmp_threshold = amdgpu_bad_page_threshold;
1925− u64 val;
19261927
19271928 /*
19281929 * Justification of value bad_page_cnt_threshold in ras structure
@@ -1943,18 +1944,15 @@ static void amdgpu_ras_validate_threshold(struct amdgpu_device *adev, · 14 unmodified lines
19431944 * take no effect.
19441945 */
19451946
1946− if (tmp_threshold < -1)
1947− tmp_threshold = -1;
1948− else if (tmp_threshold > max_length)
1949− tmp_threshold = max_length;
1947+ if (amdgpu_bad_page_threshold < 0) {
1948+ u64 val = adev->gmc.mc_vram_size;
19501949
1951− if (tmp_threshold == -1) {
1952− val = adev->gmc.mc_vram_size;
1953− do_div(val, RAS_BAD_PAGE_RATE);
1950+ do_div(val, RAS_BAD_PAGE_COVER);
19541951 con->bad_page_cnt_threshold = min(lower_32_bits(val),
1955− max_length);
1952+ max_count);
19561953 } else {
1957− con->bad_page_cnt_threshold = tmp_threshold;
1954+ con->bad_page_cnt_threshold = min_t(int, max_count,
1955+ amdgpu_bad_page_threshold);
19581956 }
19591957 }
19601958
@@ -1962,15 +1960,24 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) · 1 unmodified line
19621960 {
19631961 struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
19641962 struct ras_err_handler_data **data;
1965− uint32_t max_eeprom_records_len = 0;
1963+ u32 max_eeprom_records_count = 0;
19661964 bool exc_err_limit = false;
19671965 int ret;
19681966
1969− if (adev->ras_enabled && con)
1970− data = &con->eh_data;
1971− else
1967+ if (!con)
19721968 return 0;
19731969
1970+ /* Allow access to RAS EEPROM via debugfs, when the ASIC
1971+ * supports RAS and debugfs is enabled, but when
1972+ * adev->ras_enabled is unset, i.e. when "ras_enable"
1973+ * module parameter is set to 0.
1974+ */
1975+ con->adev = adev;
1976+
1977+ if (!adev->ras_enabled)
1978+ return 0;
1979+
1980+ data = &con->eh_data;
19741981 *data = kmalloc(sizeof(**data), GFP_KERNEL | __GFP_ZERO);
19751982 if (!*data) {
19761983 ret = -ENOMEM;
@@ -1980,10 +1987,9 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) · 3 unmodified lines
19801987 mutex_init(&con->recovery_lock);
19811988 INIT_WORK(&con->recovery_work, amdgpu_ras_do_recovery);
19821989 atomic_set(&con->in_recovery, 0);
1983− con->adev = adev;
19841990
1985− max_eeprom_records_len = amdgpu_ras_eeprom_get_record_max_length();
1986− amdgpu_ras_validate_threshold(adev, max_eeprom_records_len);
1991+ max_eeprom_records_count = amdgpu_ras_eeprom_max_record_count();
1992+ amdgpu_ras_validate_threshold(adev, max_eeprom_records_count);
19871993
19881994 /* Todo: During test the SMU might fail to read the eeprom through I2C
19891995 * when the GPU is pending on XGMI reset during probe time
@@ -1999,13 +2005,13 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) · 9 unmodified lines
19992005 if (exc_err_limit || ret)
20002006 goto free;
20012007
2002− if (con->eeprom_control.num_recs) {
2008+ if (con->eeprom_control.ras_num_recs) {
20032009 ret = amdgpu_ras_load_bad_pages(adev);
20042010 if (ret)
20052011 goto free;
20062012
20072013 if (adev->smu.ppt_funcs && adev->smu.ppt_funcs->send_hbm_bad_pages_num)
2008− adev->smu.ppt_funcs->send_hbm_bad_pages_num(&adev->smu, con->eeprom_control.num_recs);
2014+ adev->smu.ppt_funcs->send_hbm_bad_pages_num(&adev->smu, con->eeprom_control.ras_num_recs);
20092015 }
20102016
20112017 return 0;
@@ -2015,7 +2021,7 @@ free: · 3 unmodified lines
20152021 kfree(*data);
20162022 con->eh_data = NULL;
20172023 out:
2018− dev_warn(adev->dev, "Failed to initialize ras recovery!\n");
2024+ dev_warn(adev->dev, "Failed to initialize ras recovery! (%d)\n", ret);
20192025
20202026 /*
20212027 * Except error threshold exceeding case, other failure cases in this
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h+8−4
@@ -49,10 +49,14 @@ enum amdgpu_ras_block { · 48 unmodified lines
4949 AMDGPU_RAS_BLOCK__MP0,
5050 AMDGPU_RAS_BLOCK__MP1,
5151 AMDGPU_RAS_BLOCK__FUSE,
52+ AMDGPU_RAS_BLOCK__MPIO,
5253
5354 AMDGPU_RAS_BLOCK__LAST
5455 };
5556
57+extern const char *ras_block_string[];
58+
59+#define ras_block_str(i) (ras_block_string[i])
5660 #define AMDGPU_RAS_BLOCK_COUNT AMDGPU_RAS_BLOCK__LAST
5761 #define AMDGPU_RAS_BLOCK_MASK ((1ULL << AMDGPU_RAS_BLOCK_COUNT) - 1)
5862
@@ -306,7 +310,6 @@ struct ras_common_if { · 247 unmodified lines
306310 enum amdgpu_ras_block block;
307311 enum amdgpu_ras_error_type type;
308312 uint32_t sub_block_index;
309− /* block name */
310313 char name[32];
311314 };
312315
@@ -318,6 +321,7 @@ struct amdgpu_ras { · 5 unmodified lines
318321 /* sysfs */
319322 struct device_attribute features_attr;
320323 struct bin_attribute badpages_attr;
324+ struct dentry *de_ras_eeprom_table;
321325 /* block array */
322326 struct ras_manager *objs;
323327
@@ -417,7 +421,7 @@ struct ras_badpage { · 93 unmodified lines
417421 /* interfaces for IP */
418422 struct ras_fs_if {
419423 struct ras_common_if head;
420− char sysfs_name[32];
424+ const char* sysfs_name;
421425 char debugfs_name[32];
422426 };
423427
@@ -469,8 +473,8 @@ struct ras_debug_if { · 45 unmodified lines
469473 * 8: feature disable
470474 */
471475
472−#define amdgpu_ras_get_context(adev) ((adev)->psp.ras.ras)
473−#define amdgpu_ras_set_context(adev, ras_con) ((adev)->psp.ras.ras = (ras_con))
476+#define amdgpu_ras_get_context(adev) ((adev)->psp.ras_context.ras)
477+#define amdgpu_ras_set_context(adev, ras_con) ((adev)->psp.ras_context.ras = (ras_con))
474478
475479 /* check if ras is supported on block, say, sdma, gfx */
476480 static inline int amdgpu_ras_is_supported(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c+871−408
@@ -26,94 +26,131 @@ · 25 unmodified lines
2626 #include "amdgpu_ras.h"
2727 #include <linux/bits.h>
2828 #include "atom.h"
29+#include "amdgpu_eeprom.h"
2930 #include "amdgpu_atomfirmware.h"
31+#include <linux/debugfs.h>
32+#include <linux/uaccess.h>
3033
31−#define EEPROM_I2C_TARGET_ADDR_VEGA20 0xA0
32−#define EEPROM_I2C_TARGET_ADDR_ARCTURUS 0xA8
33−#define EEPROM_I2C_TARGET_ADDR_ARCTURUS_D342 0xA0
34−#define EEPROM_I2C_TARGET_ADDR_SIENNA_CICHLID 0xA0
35−#define EEPROM_I2C_TARGET_ADDR_ALDEBARAN 0xA0
34+#define EEPROM_I2C_MADDR_VEGA20 0x0
35+#define EEPROM_I2C_MADDR_ARCTURUS 0x40000
36+#define EEPROM_I2C_MADDR_ARCTURUS_D342 0x0
37+#define EEPROM_I2C_MADDR_SIENNA_CICHLID 0x0
38+#define EEPROM_I2C_MADDR_ALDEBARAN 0x0
3639
3740 /*
3841 * The 2 macros bellow represent the actual size in bytes that
3942 * those entities occupy in the EEPROM memory.
40− * EEPROM_TABLE_RECORD_SIZE is different than sizeof(eeprom_table_record) which
43+ * RAS_TABLE_RECORD_SIZE is different than sizeof(eeprom_table_record) which
4144 * uses uint64 to store 6b fields such as retired_page.
4245 */
43−#define EEPROM_TABLE_HEADER_SIZE 20
44−#define EEPROM_TABLE_RECORD_SIZE 24
45−
46−#define EEPROM_ADDRESS_SIZE 0x2
46+#define RAS_TABLE_HEADER_SIZE 20
47+#define RAS_TABLE_RECORD_SIZE 24
4748
4849 /* Table hdr is 'AMDR' */
49−#define EEPROM_TABLE_HDR_VAL 0x414d4452
50−#define EEPROM_TABLE_VER 0x00010000
50+#define RAS_TABLE_HDR_VAL 0x414d4452
51+#define RAS_TABLE_VER 0x00010000
5152
5253 /* Bad GPU tag ‘BADG’ */
53−#define EEPROM_TABLE_HDR_BAD 0x42414447
54+#define RAS_TABLE_HDR_BAD 0x42414447
55+
56+/* Assume 2-Mbit size EEPROM and take up the whole space. */
57+#define RAS_TBL_SIZE_BYTES (256 * 1024)
58+#define RAS_TABLE_START 0
59+#define RAS_HDR_START RAS_TABLE_START
60+#define RAS_RECORD_START (RAS_HDR_START + RAS_TABLE_HEADER_SIZE)
61+#define RAS_MAX_RECORD_COUNT ((RAS_TBL_SIZE_BYTES - RAS_TABLE_HEADER_SIZE) \
62+ / RAS_TABLE_RECORD_SIZE)
63+
64+/* Given a zero-based index of an EEPROM RAS record, yields the EEPROM
65+ * offset off of RAS_TABLE_START. That is, this is something you can
66+ * add to control->i2c_address, and then tell I2C layer to read
67+ * from/write to there. _N is the so called absolute index,
68+ * because it starts right after the table header.
69+ */
70+#define RAS_INDEX_TO_OFFSET(_C, _N) ((_C)->ras_record_offset + \
71+ (_N) * RAS_TABLE_RECORD_SIZE)
72+
73+#define RAS_OFFSET_TO_INDEX(_C, _O) (((_O) - \
74+ (_C)->ras_record_offset) / RAS_TABLE_RECORD_SIZE)
75+
76+/* Given a 0-based relative record index, 0, 1, 2, ..., etc., off
77+ * of "fri", return the absolute record index off of the end of
78+ * the table header.
79+ */
80+#define RAS_RI_TO_AI(_C, _I) (((_I) + (_C)->ras_fri) % \
81+ (_C)->ras_max_record_count)
5482
55−/* Assume 2 Mbit size */
56−#define EEPROM_SIZE_BYTES 256000
57−#define EEPROM_PAGE__SIZE_BYTES 256
58−#define EEPROM_HDR_START 0
59−#define EEPROM_RECORD_START (EEPROM_HDR_START + EEPROM_TABLE_HEADER_SIZE)
60−#define EEPROM_MAX_RECORD_NUM ((EEPROM_SIZE_BYTES - EEPROM_TABLE_HEADER_SIZE) / EEPROM_TABLE_RECORD_SIZE)
61−#define EEPROM_ADDR_MSB_MASK GENMASK(17, 8)
83+#define RAS_NUM_RECS(_tbl_hdr) (((_tbl_hdr)->tbl_size - \
84+ RAS_TABLE_HEADER_SIZE) / RAS_TABLE_RECORD_SIZE)
6285
6386 #define to_amdgpu_device(x) (container_of(x, struct amdgpu_ras, eeprom_control))->adev
6487
6588 static bool __is_ras_eeprom_supported(struct amdgpu_device *adev)
6689 {
67− if ((adev->asic_type == CHIP_VEGA20) ||
68− (adev->asic_type == CHIP_ARCTURUS) ||
69− (adev->asic_type == CHIP_SIENNA_CICHLID) ||
70− (adev->asic_type == CHIP_ALDEBARAN))
71− return true;
72−
73− return false;
90+ return adev->asic_type == CHIP_VEGA20 ||
91+ adev->asic_type == CHIP_ARCTURUS ||
92+ adev->asic_type == CHIP_SIENNA_CICHLID ||
93+ adev->asic_type == CHIP_ALDEBARAN;
7494 }
7595
7696 static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev,
77− uint16_t *i2c_addr)
97+ struct amdgpu_ras_eeprom_control *control)
7898 {
7999 struct atom_context *atom_ctx = adev->mode_info.atom_context;
80100
81− if (!i2c_addr || !atom_ctx)
101+ if (!control || !atom_ctx)
82102 return false;
83103
84104 if (strnstr(atom_ctx->vbios_version,
85105 "D342",
86106 sizeof(atom_ctx->vbios_version)))
87− *i2c_addr = EEPROM_I2C_TARGET_ADDR_ARCTURUS_D342;
107+ control->i2c_address = EEPROM_I2C_MADDR_ARCTURUS_D342;
88108 else
89− *i2c_addr = EEPROM_I2C_TARGET_ADDR_ARCTURUS;
109+ control->i2c_address = EEPROM_I2C_MADDR_ARCTURUS;
90110
91111 return true;
92112 }
93113
94114 static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
95− uint16_t *i2c_addr)
115+ struct amdgpu_ras_eeprom_control *control)
96116 {
97− if (!i2c_addr)
117+ uint8_t ras_rom_i2c_slave_addr;
118+
119+ if (!control)
98120 return false;
99121
100− if (amdgpu_atomfirmware_ras_rom_addr(adev, (uint8_t*)i2c_addr))
101− return true;
122+ control->i2c_address = 0;
123+
124+ if (amdgpu_atomfirmware_ras_rom_addr(adev, &ras_rom_i2c_slave_addr))
125+ {
126+ switch (ras_rom_i2c_slave_addr) {
127+ case 0xA0:
128+ control->i2c_address = 0;
129+ return true;
130+ case 0xA8:
131+ control->i2c_address = 0x40000;
132+ return true;
133+ default:
134+ dev_warn(adev->dev, "RAS EEPROM I2C slave address %02x not supported",
135+ ras_rom_i2c_slave_addr);
136+ return false;
137+ }
138+ }
102139
103140 switch (adev->asic_type) {
104141 case CHIP_VEGA20:
105− *i2c_addr = EEPROM_I2C_TARGET_ADDR_VEGA20;
142+ control->i2c_address = EEPROM_I2C_MADDR_VEGA20;
106143 break;
107144
108145 case CHIP_ARCTURUS:
109− return __get_eeprom_i2c_addr_arct(adev, i2c_addr);
146+ return __get_eeprom_i2c_addr_arct(adev, control);
110147
111148 case CHIP_SIENNA_CICHLID:
112− *i2c_addr = EEPROM_I2C_TARGET_ADDR_SIENNA_CICHLID;
149+ control->i2c_address = EEPROM_I2C_MADDR_SIENNA_CICHLID;
113150 break;
114151
115152 case CHIP_ALDEBARAN:
116− *i2c_addr = EEPROM_I2C_TARGET_ADDR_ALDEBARAN;
153+ control->i2c_address = EEPROM_I2C_MADDR_ALDEBARAN;
117154 break;
118155
119156 default:
@@ -123,10 +160,11 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev, · 3 unmodified lines
123160 return true;
124161 }
125162
126−static void __encode_table_header_to_buff(struct amdgpu_ras_eeprom_table_header *hdr,
127− unsigned char *buff)
163+static void
164+__encode_table_header_to_buf(struct amdgpu_ras_eeprom_table_header *hdr,
165+ unsigned char *buf)
128166 {
129− uint32_t *pp = (uint32_t *) buff;
167+ u32 *pp = (uint32_t *)buf;
130168
131169 pp[0] = cpu_to_le32(hdr->header);
132170 pp[1] = cpu_to_le32(hdr->version);
@@ -135,10 +173,11 @@ static void __encode_table_header_to_buff(struct amdgpu_ras_eeprom_table_header · 2 unmodified lines
135173 pp[4] = cpu_to_le32(hdr->checksum);
136174 }
137175
138−static void __decode_table_header_from_buff(struct amdgpu_ras_eeprom_table_header *hdr,
139− unsigned char *buff)
176+static void
177+__decode_table_header_from_buf(struct amdgpu_ras_eeprom_table_header *hdr,
178+ unsigned char *buf)
140179 {
141− uint32_t *pp = (uint32_t *)buff;
180+ u32 *pp = (uint32_t *)buf;
142181
143182 hdr->header = le32_to_cpu(pp[0]);
144183 hdr->version = le32_to_cpu(pp[1]);
@@ -147,303 +186,168 @@ static void __decode_table_header_from_buff(struct amdgpu_ras_eeprom_table_heade · 2 unmodified lines
147186 hdr->checksum = le32_to_cpu(pp[4]);
148187 }
149188
150−static int __update_table_header(struct amdgpu_ras_eeprom_control *control,
151− unsigned char *buff)
189+static int __write_table_header(struct amdgpu_ras_eeprom_control *control)
152190 {
153− int ret = 0;
191+ u8 buf[RAS_TABLE_HEADER_SIZE];
154192 struct amdgpu_device *adev = to_amdgpu_device(control);
155− struct i2c_msg msg = {
156− .addr = 0,
157− .flags = 0,
158− .len = EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE,
159− .buf = buff,
160− };
161−
193+ int res;
162194
163− *(uint16_t *)buff = EEPROM_HDR_START;
164− __encode_table_header_to_buff(&control->tbl_hdr, buff + EEPROM_ADDRESS_SIZE);
165−
166− msg.addr = control->i2c_address;
195+ memset(buf, 0, sizeof(buf));
196+ __encode_table_header_to_buf(&control->tbl_hdr, buf);
167197
168198 /* i2c may be unstable in gpu reset */
169199 down_read(&adev->reset_sem);
170− ret = i2c_transfer(&adev->pm.smu_i2c, &msg, 1);
200+ res = amdgpu_eeprom_write(&adev->pm.smu_i2c,
201+ control->i2c_address +
202+ control->ras_header_offset,
203+ buf, RAS_TABLE_HEADER_SIZE);
171204 up_read(&adev->reset_sem);
172205
173− if (ret < 1)
174− DRM_ERROR("Failed to write EEPROM table header, ret:%d", ret);
175−
176− return ret;
177−}
178−
179−static uint32_t __calc_hdr_byte_sum(struct amdgpu_ras_eeprom_control *control)
180−{
181− int i;
182− uint32_t tbl_sum = 0;
183−
184− /* Header checksum, skip checksum field in the calculation */
185− for (i = 0; i < sizeof(control->tbl_hdr) - sizeof(control->tbl_hdr.checksum); i++)
186− tbl_sum += *(((unsigned char *)&control->tbl_hdr) + i);
187−
188− return tbl_sum;
189−}
190−
191−static uint32_t __calc_recs_byte_sum(struct eeprom_table_record *records,
192− int num)
193−{
194− int i, j;
195− uint32_t tbl_sum = 0;
196−
197− /* Records checksum */
198− for (i = 0; i < num; i++) {
199− struct eeprom_table_record *record = &records[i];
200−
201− for (j = 0; j < sizeof(*record); j++) {
202− tbl_sum += *(((unsigned char *)record) + j);
203− }
206+ if (res < 0) {
207+ DRM_ERROR("Failed to write EEPROM table header:%d", res);
208+ } else if (res < RAS_TABLE_HEADER_SIZE) {
209+ DRM_ERROR("Short write:%d out of %d\n",
210+ res, RAS_TABLE_HEADER_SIZE);
211+ res = -EIO;
212+ } else {
213+ res = 0;
204214 }
205215
206− return tbl_sum;
207−}
208−
209−static inline uint32_t __calc_tbl_byte_sum(struct amdgpu_ras_eeprom_control *control,
210− struct eeprom_table_record *records, int num)
211−{
212− return __calc_hdr_byte_sum(control) + __calc_recs_byte_sum(records, num);
213−}
214−
215−/* Checksum = 256 -((sum of all table entries) mod 256) */
216−static void __update_tbl_checksum(struct amdgpu_ras_eeprom_control *control,
217− struct eeprom_table_record *records, int num,
218− uint32_t old_hdr_byte_sum)
219−{
220− /*
221− * This will update the table sum with new records.
222− *
223− * TODO: What happens when the EEPROM table is to be wrapped around
224− * and old records from start will get overridden.
225− */
226−
227− /* need to recalculate updated header byte sum */
228− control->tbl_byte_sum -= old_hdr_byte_sum;
229− control->tbl_byte_sum += __calc_tbl_byte_sum(control, records, num);
230−
231− control->tbl_hdr.checksum = 256 - (control->tbl_byte_sum % 256);
216+ return res;
232217 }
233218
234−/* table sum mod 256 + checksum must equals 256 */
235−static bool __validate_tbl_checksum(struct amdgpu_ras_eeprom_control *control,
236− struct eeprom_table_record *records, int num)
219+static u8 __calc_hdr_byte_sum(const struct amdgpu_ras_eeprom_control *control)
237220 {
238− control->tbl_byte_sum = __calc_tbl_byte_sum(control, records, num);
221+ int ii;
222+ u8 *pp, csum;
223+ size_t sz;
239224
240− if (control->tbl_hdr.checksum + (control->tbl_byte_sum % 256) != 256) {
241− DRM_WARN("Checksum mismatch, checksum: %u ", control->tbl_hdr.checksum);
242− return false;
243− }
225+ /* Header checksum, skip checksum field in the calculation */
226+ sz = sizeof(control->tbl_hdr) - sizeof(control->tbl_hdr.checksum);
227+ pp = (u8 *) &control->tbl_hdr;
228+ csum = 0;
229+ for (ii = 0; ii < sz; ii++, pp++)
230+ csum += *pp;
244231
245− return true;
232+ return csum;
246233 }
247234
248235 static int amdgpu_ras_eeprom_correct_header_tag(
249− struct amdgpu_ras_eeprom_control *control,
250− uint32_t header)
236+ struct amdgpu_ras_eeprom_control *control,
237+ uint32_t header)
251238 {
252− unsigned char buff[EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE];
253239 struct amdgpu_ras_eeprom_table_header *hdr = &control->tbl_hdr;
254− int ret = 0;
255−
256− memset(buff, 0, EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE);
257−
258− mutex_lock(&control->tbl_mutex);
240+ u8 *hh;
241+ int res;
242+ u8 csum;
243+
244+ csum = -hdr->checksum;
245+
246+ hh = (void *) &hdr->header;
247+ csum -= (hh[0] + hh[1] + hh[2] + hh[3]);
248+ hh = (void *) &header;
249+ csum += hh[0] + hh[1] + hh[2] + hh[3];
250+ csum = -csum;
251+ mutex_lock(&control->ras_tbl_mutex);
259252 hdr->header = header;
260− ret = __update_table_header(control, buff);
261− mutex_unlock(&control->tbl_mutex);
253+ hdr->checksum = csum;
254+ res = __write_table_header(control);
255+ mutex_unlock(&control->ras_tbl_mutex);
262256
263− return ret;
257+ return res;
264258 }
265259
260+/**
261+ * amdgpu_ras_eeprom_reset_table -- Reset the RAS EEPROM table
262+ * @control: pointer to control structure
263+ *
264+ * Reset the contents of the header of the RAS EEPROM table.
265+ * Return 0 on success, -errno on error.
266+ */
266267 int amdgpu_ras_eeprom_reset_table(struct amdgpu_ras_eeprom_control *control)
267268 {
268− unsigned char buff[EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE] = { 0 };
269269 struct amdgpu_ras_eeprom_table_header *hdr = &control->tbl_hdr;
270− int ret = 0;
271−
272− mutex_lock(&control->tbl_mutex);
273−
274− hdr->header = EEPROM_TABLE_HDR_VAL;
275− hdr->version = EEPROM_TABLE_VER;
276− hdr->first_rec_offset = EEPROM_RECORD_START;
277− hdr->tbl_size = EEPROM_TABLE_HEADER_SIZE;
278−
279− control->tbl_byte_sum = 0;
280− __update_tbl_checksum(control, NULL, 0, 0);
281− control->next_addr = EEPROM_RECORD_START;
282−
283− ret = __update_table_header(control, buff);
284−
285− mutex_unlock(&control->tbl_mutex);
286−
287− return ret;
288−
289−}
290−
291−int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
292− bool *exceed_err_limit)
293−{
294− int ret = 0;
295− struct amdgpu_device *adev = to_amdgpu_device(control);
296− unsigned char buff[EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE] = { 0 };
297− struct amdgpu_ras_eeprom_table_header *hdr = &control->tbl_hdr;
298− struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
299− struct i2c_msg msg = {
300− .addr = 0,
301− .flags = I2C_M_RD,
302− .len = EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE,
303− .buf = buff,
304− };
305−
306− *exceed_err_limit = false;
307−
308− if (!__is_ras_eeprom_supported(adev))
309− return 0;
310−
311− /* Verify i2c adapter is initialized */
312− if (!adev->pm.smu_i2c.algo)
313− return -ENOENT;
270+ u8 csum;
271+ int res;
314272
315− if (!__get_eeprom_i2c_addr(adev, &control->i2c_address))
316− return -EINVAL;
273+ mutex_lock(&control->ras_tbl_mutex);
317274
318− mutex_init(&control->tbl_mutex);
275+ hdr->header = RAS_TABLE_HDR_VAL;
276+ hdr->version = RAS_TABLE_VER;
277+ hdr->first_rec_offset = RAS_RECORD_START;
278+ hdr->tbl_size = RAS_TABLE_HEADER_SIZE;
319279
320− msg.addr = control->i2c_address;
321− /* Read/Create table header from EEPROM address 0 */
322− ret = i2c_transfer(&adev->pm.smu_i2c, &msg, 1);
323− if (ret < 1) {
324− DRM_ERROR("Failed to read EEPROM table header, ret:%d", ret);
325− return ret;
326− }
280+ csum = __calc_hdr_byte_sum(control);
281+ csum = -csum;
282+ hdr->checksum = csum;
283+ res = __write_table_header(control);
327284
328− __decode_table_header_from_buff(hdr, &buff[2]);
285+ control->ras_num_recs = 0;
286+ control->ras_fri = 0;
329287
330− if (hdr->header == EEPROM_TABLE_HDR_VAL) {
331− control->num_recs = (hdr->tbl_size - EEPROM_TABLE_HEADER_SIZE) /
332− EEPROM_TABLE_RECORD_SIZE;
333− control->tbl_byte_sum = __calc_hdr_byte_sum(control);
334− control->next_addr = EEPROM_RECORD_START;
288+ amdgpu_ras_debugfs_set_ret_size(control);
335289
336− DRM_DEBUG_DRIVER("Found existing EEPROM table with %d records",
337− control->num_recs);
338−
339− } else if ((hdr->header == EEPROM_TABLE_HDR_BAD) &&
340− (amdgpu_bad_page_threshold != 0)) {
341− if (ras->bad_page_cnt_threshold > control->num_recs) {
342− dev_info(adev->dev, "Using one valid bigger bad page "
343− "threshold and correcting eeprom header tag.\n");
344− ret = amdgpu_ras_eeprom_correct_header_tag(control,
345− EEPROM_TABLE_HDR_VAL);
346− } else {
347− *exceed_err_limit = true;
348− dev_err(adev->dev, "Exceeding the bad_page_threshold parameter, "
349− "disabling the GPU.\n");
350− }
351− } else {
352− DRM_INFO("Creating new EEPROM table");
290+ mutex_unlock(&control->ras_tbl_mutex);
353291
354− ret = amdgpu_ras_eeprom_reset_table(control);
355− }
356−
357− return ret == 1 ? 0 : -EIO;
292+ return res;
358293 }
359294
360−static void __encode_table_record_to_buff(struct amdgpu_ras_eeprom_control *control,
361− struct eeprom_table_record *record,
362− unsigned char *buff)
295+static void
296+__encode_table_record_to_buf(struct amdgpu_ras_eeprom_control *control,
297+ struct eeprom_table_record *record,
298+ unsigned char *buf)
363299 {
364300 __le64 tmp = 0;
365301 int i = 0;
366302
367303 /* Next are all record fields according to EEPROM page spec in LE foramt */
368− buff[i++] = record->err_type;
304+ buf[i++] = record->err_type;
369305
370− buff[i++] = record->bank;
306+ buf[i++] = record->bank;
371307
372308 tmp = cpu_to_le64(record->ts);
373− memcpy(buff + i, &tmp, 8);
309+ memcpy(buf + i, &tmp, 8);
374310 i += 8;
375311
376312 tmp = cpu_to_le64((record->offset & 0xffffffffffff));
377− memcpy(buff + i, &tmp, 6);
313+ memcpy(buf + i, &tmp, 6);
378314 i += 6;
379315
380− buff[i++] = record->mem_channel;
381− buff[i++] = record->mcumc_id;
316+ buf[i++] = record->mem_channel;
317+ buf[i++] = record->mcumc_id;
382318
383319 tmp = cpu_to_le64((record->retired_page & 0xffffffffffff));
384− memcpy(buff + i, &tmp, 6);
320+ memcpy(buf + i, &tmp, 6);
385321 }
386322
387−static void __decode_table_record_from_buff(struct amdgpu_ras_eeprom_control *control,
388− struct eeprom_table_record *record,
389− unsigned char *buff)
323+static void
324+__decode_table_record_from_buf(struct amdgpu_ras_eeprom_control *control,
325+ struct eeprom_table_record *record,
326+ unsigned char *buf)
390327 {
391328 __le64 tmp = 0;
392329 int i = 0;
393330
394331 /* Next are all record fields according to EEPROM page spec in LE foramt */
395− record->err_type = buff[i++];
332+ record->err_type = buf[i++];
396333
397− record->bank = buff[i++];
334+ record->bank = buf[i++];
398335
399− memcpy(&tmp, buff + i, 8);
336+ memcpy(&tmp, buf + i, 8);
400337 record->ts = le64_to_cpu(tmp);
401338 i += 8;
402339
403− memcpy(&tmp, buff + i, 6);
340+ memcpy(&tmp, buf + i, 6);
404341 record->offset = (le64_to_cpu(tmp) & 0xffffffffffff);
405342 i += 6;
406343
407− record->mem_channel = buff[i++];
408− record->mcumc_id = buff[i++];
344+ record->mem_channel = buf[i++];
345+ record->mcumc_id = buf[i++];
409346
410− memcpy(&tmp, buff + i, 6);
347+ memcpy(&tmp, buf + i, 6);
411348 record->retired_page = (le64_to_cpu(tmp) & 0xffffffffffff);
412349 }
413350
414−/*
415− * When reaching end of EEPROM memory jump back to 0 record address
416− * When next record access will go beyond EEPROM page boundary modify bits A17/A8
417− * in I2C selector to go to next page
418− */
419−static uint32_t __correct_eeprom_dest_address(uint32_t curr_address)
420−{
421− uint32_t next_address = curr_address + EEPROM_TABLE_RECORD_SIZE;
422−
423− /* When all EEPROM memory used jump back to 0 address */
424− if (next_address > EEPROM_SIZE_BYTES) {
425− DRM_INFO("Reached end of EEPROM memory, jumping to 0 "
426− "and overriding old record");
427− return EEPROM_RECORD_START;
428− }
429−
430− /*
431− * To check if we overflow page boundary compare next address with
432− * current and see if bits 17/8 of the EEPROM address will change
433− * If they do start from the next 256b page
434− *
435− * https://www.st.com/resource/en/datasheet/m24m02-dr.pdf sec. 5.1.2
436− */
437− if ((curr_address & EEPROM_ADDR_MSB_MASK) != (next_address & EEPROM_ADDR_MSB_MASK)) {
438− DRM_DEBUG_DRIVER("Reached end of EEPROM memory page, jumping to next: %lx",
439− (next_address & EEPROM_ADDR_MSB_MASK));
440−
441− return (next_address & EEPROM_ADDR_MSB_MASK);
442− }
443−
444− return curr_address;
445−}
446−
447351 bool amdgpu_ras_eeprom_check_err_threshold(struct amdgpu_device *adev)
448352 {
449353 struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
@@ -458,197 +362,756 @@ bool amdgpu_ras_eeprom_check_err_threshold(struct amdgpu_device *adev) · 8 unmodified lines
458362 if (!(con->features & BIT(AMDGPU_RAS_BLOCK__UMC)))
459363 return false;
460364
461− if (con->eeprom_control.tbl_hdr.header == EEPROM_TABLE_HDR_BAD) {
365+ if (con->eeprom_control.tbl_hdr.header == RAS_TABLE_HDR_BAD) {
462366 dev_warn(adev->dev, "This GPU is in BAD status.");
463− dev_warn(adev->dev, "Please retire it or setting one bigger "
464− "threshold value when reloading driver.\n");
367+ dev_warn(adev->dev, "Please retire it or set a larger "
368+ "threshold value when reloading driver.\n");
465369 return true;
466370 }
467371
468372 return false;
469373 }
470374
471−int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control,
472− struct eeprom_table_record *records,
473− bool write,
474− int num)
375+/**
376+ * __amdgpu_ras_eeprom_write -- write indexed from buffer to EEPROM
377+ * @control: pointer to control structure
378+ * @buf: pointer to buffer containing data to write
379+ * @fri: start writing at this index
380+ * @num: number of records to write
381+ *
382+ * The caller must hold the table mutex in @control.
383+ * Return 0 on success, -errno otherwise.
384+ */
385+static int __amdgpu_ras_eeprom_write(struct amdgpu_ras_eeprom_control *control,
386+ u8 *buf, const u32 fri, const u32 num)
475387 {
476− int i, ret = 0;
477− struct i2c_msg *msgs, *msg;
478− unsigned char *buffs, *buff;
479− struct eeprom_table_record *record;
480388 struct amdgpu_device *adev = to_amdgpu_device(control);
481− struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
389+ u32 buf_size;
390+ int res;
482391
483− if (!__is_ras_eeprom_supported(adev))
484− return 0;
392+ /* i2c may be unstable in gpu reset */
393+ down_read(&adev->reset_sem);
394+ buf_size = num * RAS_TABLE_RECORD_SIZE;
395+ res = amdgpu_eeprom_write(&adev->pm.smu_i2c,
396+ control->i2c_address +
397+ RAS_INDEX_TO_OFFSET(control, fri),
398+ buf, buf_size);
399+ up_read(&adev->reset_sem);
400+ if (res < 0) {
401+ DRM_ERROR("Writing %d EEPROM table records error:%d",
402+ num, res);
403+ } else if (res < buf_size) {
404+ /* Short write, return error.
405+ */
406+ DRM_ERROR("Wrote %d records out of %d",
407+ res / RAS_TABLE_RECORD_SIZE, num);
408+ res = -EIO;
409+ } else {
410+ res = 0;
411+ }
485412
486− buffs = kcalloc(num, EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE,
487− GFP_KERNEL);
488− if (!buffs)
489− return -ENOMEM;
413+ return res;
414+}
490415
491− mutex_lock(&control->tbl_mutex);
416+static int
417+amdgpu_ras_eeprom_append_table(struct amdgpu_ras_eeprom_control *control,
418+ struct eeprom_table_record *record,
419+ const u32 num)
420+{
421+ u32 a, b, i;
422+ u8 *buf, *pp;
423+ int res;
424+
425+ buf = kcalloc(num, RAS_TABLE_RECORD_SIZE, GFP_KERNEL);
426+ if (!buf)
427+ return -ENOMEM;
492428
493− msgs = kcalloc(num, sizeof(*msgs), GFP_KERNEL);
494− if (!msgs) {
495− ret = -ENOMEM;
496− goto free_buff;
429+ /* Encode all of them in one go.
430+ */
431+ pp = buf;
432+ for (i = 0; i < num; i++, pp += RAS_TABLE_RECORD_SIZE)
433+ __encode_table_record_to_buf(control, &record[i], pp);
434+
435+ /* a, first record index to write into.
436+ * b, last record index to write into.
437+ * a = first index to read (fri) + number of records in the table,
438+ * b = a + @num - 1.
439+ * Let N = control->ras_max_num_record_count, then we have,
440+ * case 0: 0 <= a <= b < N,
441+ * just append @num records starting at a;
442+ * case 1: 0 <= a < N <= b,
443+ * append (N - a) records starting at a, and
444+ * append the remainder, b % N + 1, starting at 0.
445+ * case 2: 0 <= fri < N <= a <= b, then modulo N we get two subcases,
446+ * case 2a: 0 <= a <= b < N
447+ * append num records starting at a; and fix fri if b overwrote it,
448+ * and since a <= b, if b overwrote it then a must've also,
449+ * and if b didn't overwrite it, then a didn't also.
450+ * case 2b: 0 <= b < a < N
451+ * write num records starting at a, which wraps around 0=N
452+ * and overwrite fri unconditionally. Now from case 2a,
453+ * this means that b eclipsed fri to overwrite it and wrap
454+ * around 0 again, i.e. b = 2N+r pre modulo N, so we unconditionally
455+ * set fri = b + 1 (mod N).
456+ * Now, since fri is updated in every case, except the trivial case 0,
457+ * the number of records present in the table after writing, is,
458+ * num_recs - 1 = b - fri (mod N), and we take the positive value,
459+ * by adding an arbitrary multiple of N before taking the modulo N
460+ * as shown below.
461+ */
462+ a = control->ras_fri + control->ras_num_recs;
463+ b = a + num - 1;
464+ if (b < control->ras_max_record_count) {
465+ res = __amdgpu_ras_eeprom_write(control, buf, a, num);
466+ } else if (a < control->ras_max_record_count) {
467+ u32 g0, g1;
468+
469+ g0 = control->ras_max_record_count - a;
470+ g1 = b % control->ras_max_record_count + 1;
471+ res = __amdgpu_ras_eeprom_write(control, buf, a, g0);
472+ if (res)
473+ goto Out;
474+ res = __amdgpu_ras_eeprom_write(control,
475+ buf + g0 * RAS_TABLE_RECORD_SIZE,
476+ 0, g1);
477+ if (res)
478+ goto Out;
479+ if (g1 > control->ras_fri)
480+ control->ras_fri = g1 % control->ras_max_record_count;
481+ } else {
482+ a %= control->ras_max_record_count;
483+ b %= control->ras_max_record_count;
484+
485+ if (a <= b) {
486+ /* Note that, b - a + 1 = num. */
487+ res = __amdgpu_ras_eeprom_write(control, buf, a, num);
488+ if (res)
489+ goto Out;
490+ if (b >= control->ras_fri)
491+ control->ras_fri = (b + 1) % control->ras_max_record_count;
492+ } else {
493+ u32 g0, g1;
494+
495+ /* b < a, which means, we write from
496+ * a to the end of the table, and from
497+ * the start of the table to b.
498+ */
499+ g0 = control->ras_max_record_count - a;
500+ g1 = b + 1;
501+ res = __amdgpu_ras_eeprom_write(control, buf, a, g0);
502+ if (res)
503+ goto Out;
504+ res = __amdgpu_ras_eeprom_write(control,
505+ buf + g0 * RAS_TABLE_RECORD_SIZE,
506+ 0, g1);
507+ if (res)
508+ goto Out;
509+ control->ras_fri = g1 % control->ras_max_record_count;
510+ }
497511 }
512+ control->ras_num_recs = 1 + (control->ras_max_record_count + b
513+ - control->ras_fri)
514+ % control->ras_max_record_count;
515+Out:
516+ kfree(buf);
517+ return res;
518+}
498519
499− /*
500− * If saved bad pages number exceeds the bad page threshold for
501− * the whole VRAM, update table header to mark the BAD GPU tag
502− * and schedule one ras recovery after eeprom write is done,
503− * this can avoid the missing for latest records.
504− *
505− * This new header will be picked up and checked in the bootup
506− * by ras recovery, which may break bootup process to notify
507− * user this GPU is in bad state and to retire such GPU for
508− * further check.
520+static int
521+amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)
522+{
523+ struct amdgpu_device *adev = to_amdgpu_device(control);
524+ struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
525+ u8 *buf, *pp, csum;
526+ u32 buf_size;
527+ int res;
528+
529+ /* Modify the header if it exceeds.
509530 */
510− if (write && (amdgpu_bad_page_threshold != 0) &&
511− ((control->num_recs + num) >= ras->bad_page_cnt_threshold)) {
531+ if (amdgpu_bad_page_threshold != 0 &&
532+ control->ras_num_recs >= ras->bad_page_cnt_threshold) {
512533 dev_warn(adev->dev,
513− "Saved bad pages(%d) reaches threshold value(%d).\n",
514− control->num_recs + num, ras->bad_page_cnt_threshold);
515− control->tbl_hdr.header = EEPROM_TABLE_HDR_BAD;
534+ "Saved bad pages %d reaches threshold value %d\n",
535+ control->ras_num_recs, ras->bad_page_cnt_threshold);
536+ control->tbl_hdr.header = RAS_TABLE_HDR_BAD;
537+ }
538+
539+ control->tbl_hdr.version = RAS_TABLE_VER;
540+ control->tbl_hdr.first_rec_offset = RAS_INDEX_TO_OFFSET(control, control->ras_fri);
541+ control->tbl_hdr.tbl_size = RAS_TABLE_HEADER_SIZE + control->ras_num_recs * RAS_TABLE_RECORD_SIZE;
542+ control->tbl_hdr.checksum = 0;
543+
544+ buf_size = control->ras_num_recs * RAS_TABLE_RECORD_SIZE;
545+ buf = kcalloc(control->ras_num_recs, RAS_TABLE_RECORD_SIZE, GFP_KERNEL);
546+ if (!buf) {
547+ DRM_ERROR("allocating memory for table of size %d bytes failed\n",
548+ control->tbl_hdr.tbl_size);
549+ res = -ENOMEM;
550+ goto Out;
516551 }
517552
518− /* In case of overflow just start from beginning to not lose newest records */
519− if (write && (control->next_addr + EEPROM_TABLE_RECORD_SIZE * num > EEPROM_SIZE_BYTES))
520− control->next_addr = EEPROM_RECORD_START;
553+ down_read(&adev->reset_sem);
554+ res = amdgpu_eeprom_read(&adev->pm.smu_i2c,
555+ control->i2c_address +
556+ control->ras_record_offset,
557+ buf, buf_size);
558+ up_read(&adev->reset_sem);
559+ if (res < 0) {
560+ DRM_ERROR("EEPROM failed reading records:%d\n",
561+ res);
562+ goto Out;
563+ } else if (res < buf_size) {
564+ DRM_ERROR("EEPROM read %d out of %d bytes\n",
565+ res, buf_size);
566+ res = -EIO;
567+ goto Out;
568+ }
521569
522− /*
523− * TODO Currently makes EEPROM writes for each record, this creates
524− * internal fragmentation. Optimized the code to do full page write of
525− * 256b
570+ /* Recalc the checksum.
526571 */
527− for (i = 0; i < num; i++) {
528− buff = &buffs[i * (EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE)];
529− record = &records[i];
530− msg = &msgs[i];
572+ csum = 0;
573+ for (pp = buf; pp < buf + buf_size; pp++)
574+ csum += *pp;
575+
576+ csum += __calc_hdr_byte_sum(control);
577+ /* avoid sign extension when assigning to "checksum" */
578+ csum = -csum;
579+ control->tbl_hdr.checksum = csum;
580+ res = __write_table_header(control);
581+Out:
582+ kfree(buf);
583+ return res;
584+}
531585
532− control->next_addr = __correct_eeprom_dest_address(control->next_addr);
586+/**
587+ * amdgpu_ras_eeprom_append -- append records to the EEPROM RAS table
588+ * @control: pointer to control structure
589+ * @record: array of records to append
590+ * @num: number of records in @record array
591+ *
592+ * Append @num records to the table, calculate the checksum and write
593+ * the table back to EEPROM. The maximum number of records that
594+ * can be appended is between 1 and control->ras_max_record_count,
595+ * regardless of how many records are already stored in the table.
596+ *
597+ * Return 0 on success or if EEPROM is not supported, -errno on error.
598+ */
599+int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control,
600+ struct eeprom_table_record *record,
601+ const u32 num)
602+{
603+ struct amdgpu_device *adev = to_amdgpu_device(control);
604+ int res;
533605
534− /*
535− * Update bits 16,17 of EEPROM address in I2C address by setting them
536− * to bits 1,2 of Device address byte
537− */
538− msg->addr = control->i2c_address |
539− ((control->next_addr & EEPROM_ADDR_MSB_MASK) >> 15);
540− msg->flags = write ? 0 : I2C_M_RD;
541− msg->len = EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE;
542− msg->buf = buff;
543−
544− /* Insert the EEPROM dest addess, bits 0-15 */
545− buff[0] = ((control->next_addr >> 8) & 0xff);
546− buff[1] = (control->next_addr & 0xff);
547−
548− /* EEPROM table content is stored in LE format */
549− if (write)
550− __encode_table_record_to_buff(control, record, buff + EEPROM_ADDRESS_SIZE);
551−
552− /*
553− * The destination EEPROM address might need to be corrected to account
554− * for page or entire memory wrapping
555− */
556− control->next_addr += EEPROM_TABLE_RECORD_SIZE;
606+ if (!__is_ras_eeprom_supported(adev))
607+ return 0;
608+
609+ if (num == 0) {
610+ DRM_ERROR("will not append 0 records\n");
611+ return -EINVAL;
612+ } else if (num > control->ras_max_record_count) {
613+ DRM_ERROR("cannot append %d records than the size of table %d\n",
614+ num, control->ras_max_record_count);
615+ return -EINVAL;
557616 }
558617
618+ mutex_lock(&control->ras_tbl_mutex);
619+
620+ res = amdgpu_ras_eeprom_append_table(control, record, num);
621+ if (!res)
622+ res = amdgpu_ras_eeprom_update_header(control);
623+ if (!res)
624+ amdgpu_ras_debugfs_set_ret_size(control);
625+
626+ mutex_unlock(&control->ras_tbl_mutex);
627+ return res;
628+}
629+
630+/**
631+ * __amdgpu_ras_eeprom_read -- read indexed from EEPROM into buffer
632+ * @control: pointer to control structure
633+ * @buf: pointer to buffer to read into
634+ * @fri: first record index, start reading at this index, absolute index
635+ * @num: number of records to read
636+ *
637+ * The caller must hold the table mutex in @control.
638+ * Return 0 on success, -errno otherwise.
639+ */
640+static int __amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
641+ u8 *buf, const u32 fri, const u32 num)
642+{
643+ struct amdgpu_device *adev = to_amdgpu_device(control);
644+ u32 buf_size;
645+ int res;
646+
559647 /* i2c may be unstable in gpu reset */
560648 down_read(&adev->reset_sem);
561− ret = i2c_transfer(&adev->pm.smu_i2c, msgs, num);
649+ buf_size = num * RAS_TABLE_RECORD_SIZE;
650+ res = amdgpu_eeprom_read(&adev->pm.smu_i2c,
651+ control->i2c_address +
652+ RAS_INDEX_TO_OFFSET(control, fri),
653+ buf, buf_size);
562654 up_read(&adev->reset_sem);
655+ if (res < 0) {
656+ DRM_ERROR("Reading %d EEPROM table records error:%d",
657+ num, res);
658+ } else if (res < buf_size) {
659+ /* Short read, return error.
660+ */
661+ DRM_ERROR("Read %d records out of %d",
662+ res / RAS_TABLE_RECORD_SIZE, num);
663+ res = -EIO;
664+ } else {
665+ res = 0;
666+ }
667+
668+ return res;
669+}
670+
671+/**
672+ * amdgpu_ras_eeprom_read -- read EEPROM
673+ * @control: pointer to control structure
674+ * @record: array of records to read into
675+ * @num: number of records in @record
676+ *
677+ * Reads num records from the RAS table in EEPROM and
678+ * writes the data into @record array.
679+ *
680+ * Returns 0 on success, -errno on error.
681+ */
682+int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
683+ struct eeprom_table_record *record,
684+ const u32 num)
685+{
686+ struct amdgpu_device *adev = to_amdgpu_device(control);
687+ int i, res;
688+ u8 *buf, *pp;
689+ u32 g0, g1;
563690
564− if (ret < 1) {
565− DRM_ERROR("Failed to process EEPROM table records, ret:%d", ret);
691+ if (!__is_ras_eeprom_supported(adev))
692+ return 0;
566693
567− /* TODO Restore prev next EEPROM address ? */
568− goto free_msgs;
694+ if (num == 0) {
695+ DRM_ERROR("will not read 0 records\n");
696+ return -EINVAL;
697+ } else if (num > control->ras_num_recs) {
698+ DRM_ERROR("too many records to read:%d available:%d\n",
699+ num, control->ras_num_recs);
700+ return -EINVAL;
569701 }
570702
703+ buf = kcalloc(num, RAS_TABLE_RECORD_SIZE, GFP_KERNEL);
704+ if (!buf)
705+ return -ENOMEM;
571706
572− if (!write) {
573− for (i = 0; i < num; i++) {
574− buff = &buffs[i*(EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE)];
575− record = &records[i];
707+ /* Determine how many records to read, from the first record
708+ * index, fri, to the end of the table, and from the beginning
709+ * of the table, such that the total number of records is
710+ * @num, and we handle wrap around when fri > 0 and
711+ * fri + num > RAS_MAX_RECORD_COUNT.
712+ *
713+ * First we compute the index of the last element
714+ * which would be fetched from each region,
715+ * g0 is in [fri, fri + num - 1], and
716+ * g1 is in [0, RAS_MAX_RECORD_COUNT - 1].
717+ * Then, if g0 < RAS_MAX_RECORD_COUNT, the index of
718+ * the last element to fetch, we set g0 to _the number_
719+ * of elements to fetch, @num, since we know that the last
720+ * indexed to be fetched does not exceed the table.
721+ *
722+ * If, however, g0 >= RAS_MAX_RECORD_COUNT, then
723+ * we set g0 to the number of elements to read
724+ * until the end of the table, and g1 to the number of
725+ * elements to read from the beginning of the table.
726+ */
727+ g0 = control->ras_fri + num - 1;
728+ g1 = g0 % control->ras_max_record_count;
729+ if (g0 < control->ras_max_record_count) {
730+ g0 = num;
731+ g1 = 0;
732+ } else {
733+ g0 = control->ras_max_record_count - control->ras_fri;
734+ g1 += 1;
735+ }
576736
577− __decode_table_record_from_buff(control, record, buff + EEPROM_ADDRESS_SIZE);
578− }
737+ mutex_lock(&control->ras_tbl_mutex);
738+ res = __amdgpu_ras_eeprom_read(control, buf, control->ras_fri, g0);
739+ if (res)
740+ goto Out;
741+ if (g1) {
742+ res = __amdgpu_ras_eeprom_read(control,
743+ buf + g0 * RAS_TABLE_RECORD_SIZE,
744+ 0, g1);
745+ if (res)
746+ goto Out;
579747 }
580748
581− if (write) {
582− uint32_t old_hdr_byte_sum = __calc_hdr_byte_sum(control);
749+ res = 0;
750+
751+ /* Read up everything? Then transform.
752+ */
753+ pp = buf;
754+ for (i = 0; i < num; i++, pp += RAS_TABLE_RECORD_SIZE)
755+ __decode_table_record_from_buf(control, &record[i], pp);
756+Out:
757+ kfree(buf);
758+ mutex_unlock(&control->ras_tbl_mutex);
759+
760+ return res;
761+}
762+
763+inline uint32_t amdgpu_ras_eeprom_max_record_count(void)
764+{
765+ return RAS_MAX_RECORD_COUNT;
766+}
767+
768+static ssize_t
769+amdgpu_ras_debugfs_eeprom_size_read(struct file *f, char __user *buf,
770+ size_t size, loff_t *pos)
771+{
772+ struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
773+ struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
774+ struct amdgpu_ras_eeprom_control *control = ras ? &ras->eeprom_control : NULL;
775+ u8 data[50];
776+ int res;
777+
778+ if (!size)
779+ return size;
780+
781+ if (!ras || !control) {
782+ res = snprintf(data, sizeof(data), "Not supported\n");
783+ } else {
784+ res = snprintf(data, sizeof(data), "%d bytes or %d records\n",
785+ RAS_TBL_SIZE_BYTES, control->ras_max_record_count);
786+ }
787+
788+ if (*pos >= res)
789+ return 0;
790+
791+ res -= *pos;
792+ res = min_t(size_t, res, size);
793+
794+ if (copy_to_user(buf, &data[*pos], res))
795+ return -EFAULT;
796+
797+ *pos += res;
583798
584− /*
585− * Update table header with size and CRC and account for table
586− * wrap around where the assumption is that we treat it as empty
587− * table
588− *
589− * TODO - Check the assumption is correct
799+ return res;
800+}
801+
802+const struct file_operations amdgpu_ras_debugfs_eeprom_size_ops = {
803+ .owner = THIS_MODULE,
804+ .read = amdgpu_ras_debugfs_eeprom_size_read,
805+ .write = NULL,
806+ .llseek = default_llseek,
807+};
808+
809+static const char *tbl_hdr_str = " Signature Version FirstOffs Size Checksum\n";
810+static const char *tbl_hdr_fmt = "0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n";
811+#define tbl_hdr_fmt_size (5 * (2+8) + 4 + 1)
812+static const char *rec_hdr_str = "Index Offset ErrType Bank/CU TimeStamp Offs/Addr MemChl MCUMCID RetiredPage\n";
813+static const char *rec_hdr_fmt = "%5d 0x%05X %7s 0x%02X 0x%016llX 0x%012llX 0x%02X 0x%02X 0x%012llX\n";
814+#define rec_hdr_fmt_size (5 + 1 + 7 + 1 + 7 + 1 + 7 + 1 + 18 + 1 + 14 + 1 + 6 + 1 + 7 + 1 + 14 + 1)
815+
816+static const char *record_err_type_str[AMDGPU_RAS_EEPROM_ERR_COUNT] = {
817+ "ignore",
818+ "re",
819+ "ue",
820+};
821+
822+static loff_t amdgpu_ras_debugfs_table_size(struct amdgpu_ras_eeprom_control *control)
823+{
824+ return strlen(tbl_hdr_str) + tbl_hdr_fmt_size +
825+ strlen(rec_hdr_str) + rec_hdr_fmt_size * control->ras_num_recs;
826+}
827+
828+void amdgpu_ras_debugfs_set_ret_size(struct amdgpu_ras_eeprom_control *control)
829+{
830+ struct amdgpu_ras *ras = container_of(control, struct amdgpu_ras,
831+ eeprom_control);
832+ struct dentry *de = ras->de_ras_eeprom_table;
833+
834+ if (de)
835+ d_inode(de)->i_size = amdgpu_ras_debugfs_table_size(control);
836+}
837+
838+static ssize_t amdgpu_ras_debugfs_table_read(struct file *f, char __user *buf,
839+ size_t size, loff_t *pos)
840+{
841+ struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
842+ struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
843+ struct amdgpu_ras_eeprom_control *control = &ras->eeprom_control;
844+ const size_t orig_size = size;
845+ int res = -EFAULT;
846+ size_t data_len;
847+
848+ mutex_lock(&control->ras_tbl_mutex);
849+
850+ /* We want *pos - data_len > 0, which means there's
851+ * bytes to be printed from data.
852+ */
853+ data_len = strlen(tbl_hdr_str);
854+ if (*pos < data_len) {
855+ data_len -= *pos;
856+ data_len = min_t(size_t, data_len, size);
857+ if (copy_to_user(buf, &tbl_hdr_str[*pos], data_len))
858+ goto Out;
859+ buf += data_len;
860+ size -= data_len;
861+ *pos += data_len;
862+ }
863+
864+ data_len = strlen(tbl_hdr_str) + tbl_hdr_fmt_size;
865+ if (*pos < data_len && size > 0) {
866+ u8 data[tbl_hdr_fmt_size + 1];
867+ loff_t lpos;
868+
869+ snprintf(data, sizeof(data), tbl_hdr_fmt,
870+ control->tbl_hdr.header,
871+ control->tbl_hdr.version,
872+ control->tbl_hdr.first_rec_offset,
873+ control->tbl_hdr.tbl_size,
874+ control->tbl_hdr.checksum);
875+
876+ data_len -= *pos;
877+ data_len = min_t(size_t, data_len, size);
878+ lpos = *pos - strlen(tbl_hdr_str);
879+ if (copy_to_user(buf, &data[lpos], data_len))
880+ goto Out;
881+ buf += data_len;
882+ size -= data_len;
883+ *pos += data_len;
884+ }
885+
886+ data_len = strlen(tbl_hdr_str) + tbl_hdr_fmt_size + strlen(rec_hdr_str);
887+ if (*pos < data_len && size > 0) {
888+ loff_t lpos;
889+
890+ data_len -= *pos;
891+ data_len = min_t(size_t, data_len, size);
892+ lpos = *pos - strlen(tbl_hdr_str) - tbl_hdr_fmt_size;
893+ if (copy_to_user(buf, &rec_hdr_str[lpos], data_len))
894+ goto Out;
895+ buf += data_len;
896+ size -= data_len;
897+ *pos += data_len;
898+ }
899+
900+ data_len = amdgpu_ras_debugfs_table_size(control);
901+ if (*pos < data_len && size > 0) {
902+ u8 dare[RAS_TABLE_RECORD_SIZE];
903+ u8 data[rec_hdr_fmt_size + 1];
904+ struct eeprom_table_record record;
905+ int s, r;
906+
907+ /* Find the starting record index
590908 */
591− control->num_recs += num;
592− control->num_recs %= EEPROM_MAX_RECORD_NUM;
593− control->tbl_hdr.tbl_size += EEPROM_TABLE_RECORD_SIZE * num;
594− if (control->tbl_hdr.tbl_size > EEPROM_SIZE_BYTES)
595− control->tbl_hdr.tbl_size = EEPROM_TABLE_HEADER_SIZE +
596− control->num_recs * EEPROM_TABLE_RECORD_SIZE;
597−
598− __update_tbl_checksum(control, records, num, old_hdr_byte_sum);
599−
600− __update_table_header(control, buffs);
601− } else if (!__validate_tbl_checksum(control, records, num)) {
602− DRM_WARN("EEPROM Table checksum mismatch!");
603− /* TODO Uncomment when EEPROM read/write is relliable */
604− /* ret = -EIO; */
909+ s = *pos - strlen(tbl_hdr_str) - tbl_hdr_fmt_size -
910+ strlen(rec_hdr_str);
911+ s = s / rec_hdr_fmt_size;
912+ r = *pos - strlen(tbl_hdr_str) - tbl_hdr_fmt_size -
913+ strlen(rec_hdr_str);
914+ r = r % rec_hdr_fmt_size;
915+
916+ for ( ; size > 0 && s < control->ras_num_recs; s++) {
917+ u32 ai = RAS_RI_TO_AI(control, s);
918+ /* Read a single record
919+ */
920+ res = __amdgpu_ras_eeprom_read(control, dare, ai, 1);
921+ if (res)
922+ goto Out;
923+ __decode_table_record_from_buf(control, &record, dare);
924+ snprintf(data, sizeof(data), rec_hdr_fmt,
925+ s,
926+ RAS_INDEX_TO_OFFSET(control, ai),
927+ record_err_type_str[record.err_type],
928+ record.bank,
929+ record.ts,
930+ record.offset,
931+ record.mem_channel,
932+ record.mcumc_id,
933+ record.retired_page);
934+
935+ data_len = min_t(size_t, rec_hdr_fmt_size - r, size);
936+ if (copy_to_user(buf, &data[r], data_len)) {
937+ res = -EFAULT;
938+ goto Out;
939+ }
940+ buf += data_len;
941+ size -= data_len;
942+ *pos += data_len;
943+ r = 0;
944+ }
605945 }
946+ res = 0;
947+Out:
948+ mutex_unlock(&control->ras_tbl_mutex);
949+ return res < 0 ? res : orig_size - size;
950+}
606951
607−free_msgs:
608− kfree(msgs);
952+static ssize_t
953+amdgpu_ras_debugfs_eeprom_table_read(struct file *f, char __user *buf,
954+ size_t size, loff_t *pos)
955+{
956+ struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
957+ struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
958+ struct amdgpu_ras_eeprom_control *control = ras ? &ras->eeprom_control : NULL;
959+ u8 data[81];
960+ int res;
961+
962+ if (!size)
963+ return size;
964+
965+ if (!ras || !control) {
966+ res = snprintf(data, sizeof(data), "Not supported\n");
967+ if (*pos >= res)
968+ return 0;
969+
970+ res -= *pos;
971+ res = min_t(size_t, res, size);
609972
610−free_buff:
611− kfree(buffs);
973+ if (copy_to_user(buf, &data[*pos], res))
974+ return -EFAULT;
612975
613− mutex_unlock(&control->tbl_mutex);
976+ *pos += res;
614977
615− return ret == num ? 0 : -EIO;
978+ return res;
979+ } else {
980+ return amdgpu_ras_debugfs_table_read(f, buf, size, pos);
981+ }
616982 }
617983
618−inline uint32_t amdgpu_ras_eeprom_get_record_max_length(void)
984+const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops = {
985+ .owner = THIS_MODULE,
986+ .read = amdgpu_ras_debugfs_eeprom_table_read,
987+ .write = NULL,
988+ .llseek = default_llseek,
989+};
990+
991+/**
992+ * __verify_ras_table_checksum -- verify the RAS EEPROM table checksum
993+ * @control: pointer to control structure
994+ *
995+ * Check the checksum of the stored in EEPROM RAS table.
996+ *
997+ * Return 0 if the checksum is correct,
998+ * positive if it is not correct, and
999+ * -errno on I/O error.
1000+ */
1001+static int __verify_ras_table_checksum(struct amdgpu_ras_eeprom_control *control)
6191002 {
620− return EEPROM_MAX_RECORD_NUM;
1003+ struct amdgpu_device *adev = to_amdgpu_device(control);
1004+ int buf_size, res;
1005+ u8 csum, *buf, *pp;
1006+
1007+ buf_size = RAS_TABLE_HEADER_SIZE +
1008+ control->ras_num_recs * RAS_TABLE_RECORD_SIZE;
1009+ buf = kzalloc(buf_size, GFP_KERNEL);
1010+ if (!buf) {
1011+ DRM_ERROR("Out of memory checking RAS table checksum.\n");
1012+ return -ENOMEM;
1013+ }
1014+
1015+ res = amdgpu_eeprom_read(&adev->pm.smu_i2c,
1016+ control->i2c_address +
1017+ control->ras_header_offset,
1018+ buf, buf_size);
1019+ if (res < buf_size) {
1020+ DRM_ERROR("Partial read for checksum, res:%d\n", res);
1021+ /* On partial reads, return -EIO.
1022+ */
1023+ if (res >= 0)
1024+ res = -EIO;
1025+ goto Out;
1026+ }
1027+
1028+ csum = 0;
1029+ for (pp = buf; pp < buf + buf_size; pp++)
1030+ csum += *pp;
1031+Out:
1032+ kfree(buf);
1033+ return res < 0 ? res : csum;
6211034 }
6221035
623−/* Used for testing if bugs encountered */
624−#if 0
625−void amdgpu_ras_eeprom_test(struct amdgpu_ras_eeprom_control *control)
1036+int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
1037+ bool *exceed_err_limit)
6261038 {
627− int i;
628− struct eeprom_table_record *recs = kcalloc(1, sizeof(*recs), GFP_KERNEL);
1039+ struct amdgpu_device *adev = to_amdgpu_device(control);
1040+ unsigned char buf[RAS_TABLE_HEADER_SIZE] = { 0 };
1041+ struct amdgpu_ras_eeprom_table_header *hdr = &control->tbl_hdr;
1042+ struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
1043+ int res;
1044+
1045+ *exceed_err_limit = false;
1046+
1047+ if (!__is_ras_eeprom_supported(adev))
1048+ return 0;
6291049
630− if (!recs)
631− return;
1050+ /* Verify i2c adapter is initialized */
1051+ if (!adev->pm.smu_i2c.algo)
1052+ return -ENOENT;
6321053
633− for (i = 0; i < 1 ; i++) {
634− recs[i].address = 0xdeadbeef;
635− recs[i].retired_page = i;
1054+ if (!__get_eeprom_i2c_addr(adev, control))
1055+ return -EINVAL;
1056+
1057+ control->ras_header_offset = RAS_HDR_START;
1058+ control->ras_record_offset = RAS_RECORD_START;
1059+ control->ras_max_record_count = RAS_MAX_RECORD_COUNT;
1060+ mutex_init(&control->ras_tbl_mutex);
1061+
1062+ /* Read the table header from EEPROM address */
1063+ res = amdgpu_eeprom_read(&adev->pm.smu_i2c,
1064+ control->i2c_address + control->ras_header_offset,
1065+ buf, RAS_TABLE_HEADER_SIZE);
1066+ if (res < RAS_TABLE_HEADER_SIZE) {
1067+ DRM_ERROR("Failed to read EEPROM table header, res:%d", res);
1068+ return res >= 0 ? -EIO : res;
6361069 }
6371070
638− if (!amdgpu_ras_eeprom_process_recods(control, recs, true, 1)) {
1071+ __decode_table_header_from_buf(hdr, buf);
6391072
640− memset(recs, 0, sizeof(*recs) * 1);
1073+ control->ras_num_recs = RAS_NUM_RECS(hdr);
1074+ control->ras_fri = RAS_OFFSET_TO_INDEX(control, hdr->first_rec_offset);
6411075
642− control->next_addr = EEPROM_RECORD_START;
1076+ if (hdr->header == RAS_TABLE_HDR_VAL) {
1077+ DRM_DEBUG_DRIVER("Found existing EEPROM table with %d records",
1078+ control->ras_num_recs);
1079+ res = __verify_ras_table_checksum(control);
1080+ if (res)
1081+ DRM_ERROR("RAS table incorrect checksum or error:%d\n",
1082+ res);
1083+ } else if (hdr->header == RAS_TABLE_HDR_BAD &&
1084+ amdgpu_bad_page_threshold != 0) {
1085+ res = __verify_ras_table_checksum(control);
1086+ if (res)
1087+ DRM_ERROR("RAS Table incorrect checksum or error:%d\n",
1088+ res);
1089+ if (ras->bad_page_cnt_threshold > control->ras_num_recs) {
1090+ /* This means that, the threshold was increased since
1091+ * the last time the system was booted, and now,
1092+ * ras->bad_page_cnt_threshold - control->num_recs > 0,
1093+ * so that at least one more record can be saved,
1094+ * before the page count threshold is reached.
1095+ */
1096+ dev_info(adev->dev,
1097+ "records:%d threshold:%d, resetting "
1098+ "RAS table header signature",
1099+ control->ras_num_recs,
1100+ ras->bad_page_cnt_threshold);
1101+ res = amdgpu_ras_eeprom_correct_header_tag(control,
1102+ RAS_TABLE_HDR_VAL);
1103+ } else {
1104+ *exceed_err_limit = true;
1105+ dev_err(adev->dev,
1106+ "RAS records:%d exceed threshold:%d, "
1107+ "maybe retire this GPU?",
1108+ control->ras_num_recs, ras->bad_page_cnt_threshold);
1109+ }
1110+ } else {
1111+ DRM_INFO("Creating a new EEPROM table");
6431112
644− if (!amdgpu_ras_eeprom_process_recods(control, recs, false, 1)) {
645− for (i = 0; i < 1; i++)
646− DRM_INFO("rec.address :0x%llx, rec.retired_page :%llu",
647− recs[i].address, recs[i].retired_page);
648− } else
649− DRM_ERROR("Failed in reading from table");
1113+ res = amdgpu_ras_eeprom_reset_table(control);
1114+ }
6501115
651− } else
652− DRM_ERROR("Failed in writing to table");
1116+ return res < 0 ? res : 0;
6531117 }
654−#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h+53−17
@@ -28,10 +28,11 @@ · 27 unmodified lines
2828
2929 struct amdgpu_device;
3030
31−enum amdgpu_ras_eeprom_err_type{
32− AMDGPU_RAS_EEPROM_ERR_PLACE_HOLDER,
31+enum amdgpu_ras_eeprom_err_type {
32+ AMDGPU_RAS_EEPROM_ERR_NA,
3333 AMDGPU_RAS_EEPROM_ERR_RECOVERABLE,
34− AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE
34+ AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE,
35+ AMDGPU_RAS_EEPROM_ERR_COUNT,
3536 };
3637
3738 struct amdgpu_ras_eeprom_table_header {
@@ -40,15 +41,45 @@ struct amdgpu_ras_eeprom_table_header { · 2 unmodified lines
4041 uint32_t first_rec_offset;
4142 uint32_t tbl_size;
4243 uint32_t checksum;
43−}__attribute__((__packed__));
44+} __packed;
4445
4546 struct amdgpu_ras_eeprom_control {
4647 struct amdgpu_ras_eeprom_table_header tbl_hdr;
47− uint32_t next_addr;
48− unsigned int num_recs;
49− struct mutex tbl_mutex;
50− uint32_t tbl_byte_sum;
51− uint16_t i2c_address; // 8-bit represented address
48+
49+ /* Base I2C EEPPROM 19-bit memory address,
50+ * where the table is located. For more information,
51+ * see top of amdgpu_eeprom.c.
52+ */
53+ u32 i2c_address;
54+
55+ /* The byte offset off of @i2c_address
56+ * where the table header is found,
57+ * and where the records start--always
58+ * right after the header.
59+ */
60+ u32 ras_header_offset;
61+ u32 ras_record_offset;
62+
63+ /* Number of records in the table.
64+ */
65+ u32 ras_num_recs;
66+
67+ /* First record index to read, 0-based.
68+ * Range is [0, num_recs-1]. This is
69+ * an absolute index, starting right after
70+ * the table header.
71+ */
72+ u32 ras_fri;
73+
74+ /* Maximum possible number of records
75+ * we could store, i.e. the maximum capacity
76+ * of the table.
77+ */
78+ u32 ras_max_record_count;
79+
80+ /* Protect table access via this mutex.
81+ */
82+ struct mutex ras_tbl_mutex;
5283 };
5384
5485 /*
@@ -74,21 +105,26 @@ struct eeprom_table_record { · 19 unmodified lines
74105
75106 unsigned char mem_channel;
76107 unsigned char mcumc_id;
77−}__attribute__((__packed__));
108+} __packed;
78109
79110 int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
80− bool *exceed_err_limit);
111+ bool *exceed_err_limit);
112+
81113 int amdgpu_ras_eeprom_reset_table(struct amdgpu_ras_eeprom_control *control);
82114
83115 bool amdgpu_ras_eeprom_check_err_threshold(struct amdgpu_device *adev);
84116
85−int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control,
86− struct eeprom_table_record *records,
87− bool write,
88− int num);
117+int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
118+ struct eeprom_table_record *records, const u32 num);
119+
120+int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control,
121+ struct eeprom_table_record *records, const u32 num);
122+
123+inline uint32_t amdgpu_ras_eeprom_max_record_count(void);
89124
90−inline uint32_t amdgpu_ras_eeprom_get_record_max_length(void);
125+void amdgpu_ras_debugfs_set_ret_size(struct amdgpu_ras_eeprom_control *control);
91126
92−void amdgpu_ras_eeprom_test(struct amdgpu_ras_eeprom_control *control);
127+extern const struct file_operations amdgpu_ras_debugfs_eeprom_size_ops;
128+extern const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops;
93129
94130 #endif // _AMDGPU_RAS_EEPROM_H
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h+8−6
@@ -48,6 +48,9 @@ · 47 unmodified lines
4848 #define AMDGPU_FENCE_FLAG_INT (1 << 1)
4949 #define AMDGPU_FENCE_FLAG_TC_WB_ONLY (1 << 2)
5050
51+/* fence flag bit to indicate the face is embedded in job*/
52+#define AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT (DMA_FENCE_FLAG_USER_BITS + 1)
53+
5154 #define to_amdgpu_ring(s) container_of((s), struct amdgpu_ring, sched)
5255
5356 #define AMDGPU_IB_POOL_SIZE (1024 * 1024)
@@ -106,9 +109,6 @@ struct amdgpu_fence_driver { · 52 unmodified lines
106109 struct dma_fence **fences;
107110 };
108111
109−int amdgpu_fence_driver_init(struct amdgpu_device *adev);
110−void amdgpu_fence_driver_fini_hw(struct amdgpu_device *adev);
111−void amdgpu_fence_driver_fini_sw(struct amdgpu_device *adev);
112112 void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring);
113113
114114 int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
@@ -117,9 +117,11 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, · 2 unmodified lines
117117 int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
118118 struct amdgpu_irq_src *irq_src,
119119 unsigned irq_type);
120−void amdgpu_fence_driver_suspend(struct amdgpu_device *adev);
121−void amdgpu_fence_driver_resume(struct amdgpu_device *adev);
122−int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **fence,
120+void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev);
121+void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev);
122+int amdgpu_fence_driver_sw_init(struct amdgpu_device *adev);
123+void amdgpu_fence_driver_sw_fini(struct amdgpu_device *adev);
124+int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **fence, struct amdgpu_job *job,
123125 unsigned flags);
124126 int amdgpu_fence_emit_polling(struct amdgpu_ring *ring, uint32_t *s,
125127 uint32_t timeout);
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h+2−2
@@ -127,8 +127,8 @@ 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 (*rlcg_wreg)(struct amdgpu_device *adev, u32 offset, u32 v, u32 acc_flags, u32 hwip);
131− u32 (*rlcg_rreg)(struct amdgpu_device *adev, u32 offset, u32 acc_flags, u32 hwip);
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);
132132 bool (*is_rlcg_access_range)(struct amdgpu_device *adev, uint32_t reg);
133133 };
134134
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c+0−1
@@ -105,7 +105,6 @@ int amdgpu_sdma_ras_late_init(struct amdgpu_device *adev, · 104 unmodified lines
105105 adev->sdma.ras_if->block = AMDGPU_RAS_BLOCK__SDMA;
106106 adev->sdma.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
107107 adev->sdma.ras_if->sub_block_index = 0;
108− strcpy(adev->sdma.ras_if->name, "sdma");
109108 }
110109 fs_info.head = ih_info->head = *adev->sdma.ras_if;
111110
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c+2−2
@@ -80,7 +80,7 @@ void psp_securedisplay_parse_resp_status(struct psp_context *psp, · 79 unmodified lines
8080 void psp_prep_securedisplay_cmd_buf(struct psp_context *psp, struct securedisplay_cmd **cmd,
8181 enum ta_securedisplay_command command_id)
8282 {
83− *cmd = (struct securedisplay_cmd *)psp->securedisplay_context.securedisplay_shared_buf;
83+ *cmd = (struct securedisplay_cmd *)psp->securedisplay_context.context.mem_context.shared_buf;
8484 memset(*cmd, 0, sizeof(struct securedisplay_cmd));
8585 (*cmd)->status = TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE;
8686 (*cmd)->cmd_id = command_id;
@@ -170,7 +170,7 @@ void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev) · 83 unmodified lines
170170 {
171171 #if defined(CONFIG_DEBUG_FS)
172172
173− if (!adev->psp.securedisplay_context.securedisplay_initialized)
173+ if (!adev->psp.securedisplay_context.context.initialized)
174174 return;
175175
176176 debugfs_create_file("securedisplay_test", S_IWUSR, adev_to_drm(adev)->primary->debugfs_root,
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c+68−50
@@ -28,6 +28,8 @@ · 27 unmodified lines
2828 * Christian König <christian.koenig@amd.com>
2929 */
3030
31+#include <linux/dma-fence-chain.h>
32+
3133 #include "amdgpu.h"
3234 #include "amdgpu_trace.h"
3335 #include "amdgpu_amdkfd.h"
@@ -186,6 +188,55 @@ int amdgpu_sync_vm_fence(struct amdgpu_sync *sync, struct dma_fence *fence) · 152 unmodified lines
186188 return amdgpu_sync_fence(sync, fence);
187189 }
188190
191+/* Determine based on the owner and mode if we should sync to a fence or not */
192+static bool amdgpu_sync_test_fence(struct amdgpu_device *adev,
193+ enum amdgpu_sync_mode mode,
194+ void *owner, struct dma_fence *f)
195+{
196+ void *fence_owner = amdgpu_sync_get_owner(f);
197+
198+ /* Always sync to moves, no matter what */
199+ if (fence_owner == AMDGPU_FENCE_OWNER_UNDEFINED)
200+ return true;
201+
202+ /* We only want to trigger KFD eviction fences on
203+ * evict or move jobs. Skip KFD fences otherwise.
204+ */
205+ if (fence_owner == AMDGPU_FENCE_OWNER_KFD &&
206+ owner != AMDGPU_FENCE_OWNER_UNDEFINED)
207+ return false;
208+
209+ /* Never sync to VM updates either. */
210+ if (fence_owner == AMDGPU_FENCE_OWNER_VM &&
211+ owner != AMDGPU_FENCE_OWNER_UNDEFINED)
212+ return false;
213+
214+ /* Ignore fences depending on the sync mode */
215+ switch (mode) {
216+ case AMDGPU_SYNC_ALWAYS:
217+ return true;
218+
219+ case AMDGPU_SYNC_NE_OWNER:
220+ if (amdgpu_sync_same_dev(adev, f) &&
221+ fence_owner == owner)
222+ return false;
223+ break;
224+
225+ case AMDGPU_SYNC_EQ_OWNER:
226+ if (amdgpu_sync_same_dev(adev, f) &&
227+ fence_owner != owner)
228+ return false;
229+ break;
230+
231+ case AMDGPU_SYNC_EXPLICIT:
232+ return false;
233+ }
234+
235+ WARN(debug_evictions && fence_owner == AMDGPU_FENCE_OWNER_KFD,
236+ "Adding eviction fence to sync obj");
237+ return true;
238+}
239+
189240 /**
190241 * amdgpu_sync_resv - sync to a reservation object
191242 *
@@ -211,67 +262,34 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync, · 19 unmodified lines
211262
212263 /* always sync to the exclusive fence */
213264 f = dma_resv_excl_fence(resv);
214− r = amdgpu_sync_fence(sync, f);
265+ dma_fence_chain_for_each(f, f) {
266+ struct dma_fence_chain *chain = to_dma_fence_chain(f);
267+
268+ if (amdgpu_sync_test_fence(adev, mode, owner, chain ?
269+ chain->fence : f)) {
270+ r = amdgpu_sync_fence(sync, f);
271+ dma_fence_put(f);
272+ if (r)
273+ return r;
274+ break;
275+ }
276+ }
215277
216278 flist = dma_resv_shared_list(resv);
217− if (!flist || r)
218− return r;
279+ if (!flist)
280+ return 0;
219281
220282 for (i = 0; i < flist->shared_count; ++i) {
221− void *fence_owner;
222−
223283 f = rcu_dereference_protected(flist->shared[i],
224284 dma_resv_held(resv));
225285
226− fence_owner = amdgpu_sync_get_owner(f);
227−
228− /* Always sync to moves, no matter what */
229− if (fence_owner == AMDGPU_FENCE_OWNER_UNDEFINED) {
286+ if (amdgpu_sync_test_fence(adev, mode, owner, f)) {
230287 r = amdgpu_sync_fence(sync, f);
231288 if (r)
232− break;
233− }
234−
235− /* We only want to trigger KFD eviction fences on
236− * evict or move jobs. Skip KFD fences otherwise.
237− */
238− if (fence_owner == AMDGPU_FENCE_OWNER_KFD &&
239− owner != AMDGPU_FENCE_OWNER_UNDEFINED)
240− continue;
241−
242− /* Never sync to VM updates either. */
243− if (fence_owner == AMDGPU_FENCE_OWNER_VM &&
244− owner != AMDGPU_FENCE_OWNER_UNDEFINED)
245− continue;
246−
247− /* Ignore fences depending on the sync mode */
248− switch (mode) {
249− case AMDGPU_SYNC_ALWAYS:
250− break;
251−
252− case AMDGPU_SYNC_NE_OWNER:
253− if (amdgpu_sync_same_dev(adev, f) &&
254− fence_owner == owner)
255− continue;
256− break;
257−
258− case AMDGPU_SYNC_EQ_OWNER:
259− if (amdgpu_sync_same_dev(adev, f) &&
260− fence_owner != owner)
261− continue;
262− break;
263−
264− case AMDGPU_SYNC_EXPLICIT:
265− continue;
289+ return r;
266290 }
267−
268− WARN(debug_evictions && fence_owner == AMDGPU_FENCE_OWNER_KFD,
269− "Adding eviction fence to sync obj");
270− r = amdgpu_sync_fence(sync, f);
271− if (r)
272− break;
273291 }
274− return r;
292+ return 0;
275293 }
276294
277295 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+56−46
@@ -149,14 +149,16 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, · 148 unmodified lines
149149 * BOs to be evicted from VRAM
150150 */
151151 amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM |
152− AMDGPU_GEM_DOMAIN_GTT);
152+ AMDGPU_GEM_DOMAIN_GTT |
153+ AMDGPU_GEM_DOMAIN_CPU);
153154 abo->placements[0].fpfn = adev->gmc.visible_vram_size >> PAGE_SHIFT;
154155 abo->placements[0].lpfn = 0;
155156 abo->placement.busy_placement = &abo->placements[1];
156157 abo->placement.num_busy_placement = 1;
157158 } else {
158159 /* Move to GTT memory */
159− amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT);
160+ amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT |
161+ AMDGPU_GEM_DOMAIN_CPU);
160162 }
161163 break;
162164 case TTM_PL_TT:
@@ -521,7 +523,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, · 358 unmodified lines
521523 hop->fpfn = 0;
522524 hop->lpfn = 0;
523525 hop->mem_type = TTM_PL_TT;
524− hop->flags = 0;
526+ hop->flags = TTM_PL_FLAG_TEMPORARY;
525527 return -EMULTIHOP;
526528 }
527529
@@ -1121,7 +1123,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_device *bdev, · 593 unmodified lines
11211123 struct amdgpu_ttm_tt *gtt = (void *)ttm;
11221124
11231125 /* user pages are bound by amdgpu_ttm_tt_pin_userptr() */
1124− if (gtt && gtt->userptr) {
1126+ if (gtt->userptr) {
11251127 ttm->sg = kzalloc(sizeof(struct sg_table), GFP_KERNEL);
11261128 if (!ttm->sg)
11271129 return -ENOMEM;
@@ -1146,7 +1148,7 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_device *bdev, · 18 unmodified lines
11461148 struct amdgpu_ttm_tt *gtt = (void *)ttm;
11471149 struct amdgpu_device *adev;
11481150
1149− if (gtt && gtt->userptr) {
1151+ if (gtt->userptr) {
11501152 amdgpu_ttm_tt_set_user_pages(ttm, NULL);
11511153 kfree(ttm->sg);
11521154 ttm->sg = NULL;
@@ -1394,6 +1396,41 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, · 241 unmodified lines
13941396 return ttm_bo_eviction_valuable(bo, place);
13951397 }
13961398
1399+static void amdgpu_ttm_vram_mm_access(struct amdgpu_device *adev, loff_t pos,
1400+ void *buf, size_t size, bool write)
1401+{
1402+ while (size) {
1403+ uint64_t aligned_pos = ALIGN_DOWN(pos, 4);
1404+ uint64_t bytes = 4 - (pos & 0x3);
1405+ uint32_t shift = (pos & 0x3) * 8;
1406+ uint32_t mask = 0xffffffff << shift;
1407+ uint32_t value = 0;
1408+
1409+ if (size < bytes) {
1410+ mask &= 0xffffffff >> (bytes - size) * 8;
1411+ bytes = size;
1412+ }
1413+
1414+ if (mask != 0xffffffff) {
1415+ amdgpu_device_mm_access(adev, aligned_pos, &value, 4, false);
1416+ if (write) {
1417+ value &= ~mask;
1418+ value |= (*(uint32_t *)buf << shift) & mask;
1419+ amdgpu_device_mm_access(adev, aligned_pos, &value, 4, true);
1420+ } else {
1421+ value = (value & mask) >> shift;
1422+ memcpy(buf, &value, bytes);
1423+ }
1424+ } else {
1425+ amdgpu_device_mm_access(adev, aligned_pos, buf, 4, write);
1426+ }
1427+
1428+ pos += bytes;
1429+ buf += bytes;
1430+ size -= bytes;
1431+ }
1432+}
1433+
13971434 /**
13981435 * amdgpu_ttm_access_memory - Read or Write memory that backs a buffer object.
13991436 *
@@ -1413,8 +1450,6 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, · 13 unmodified lines
14131450 struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);
14141451 struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
14151452 struct amdgpu_res_cursor cursor;
1416− unsigned long flags;
1417− uint32_t value = 0;
14181453 int ret = 0;
14191454
14201455 if (bo->resource->mem_type != TTM_PL_VRAM)
@@ -1422,41 +1457,21 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, · 1 unmodified line
14221457
14231458 amdgpu_res_first(bo->resource, offset, len, &cursor);
14241459 while (cursor.remaining) {
1425− uint64_t aligned_pos = cursor.start & ~(uint64_t)3;
1426− uint64_t bytes = 4 - (cursor.start & 3);
1427− uint32_t shift = (cursor.start & 3) * 8;
1428− uint32_t mask = 0xffffffff << shift;
1429−
1430− if (cursor.size < bytes) {
1431− mask &= 0xffffffff >> (bytes - cursor.size) * 8;
1432− bytes = cursor.size;
1433− }
1434−
1435− if (mask != 0xffffffff) {
1436− spin_lock_irqsave(&adev->mmio_idx_lock, flags);
1437− WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t)aligned_pos) | 0x80000000);
1438− WREG32_NO_KIQ(mmMM_INDEX_HI, aligned_pos >> 31);
1439− value = RREG32_NO_KIQ(mmMM_DATA);
1440− if (write) {
1441− value &= ~mask;
1442− value |= (*(uint32_t *)buf << shift) & mask;
1443− WREG32_NO_KIQ(mmMM_DATA, value);
1444− }
1445− spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
1446− if (!write) {
1447− value = (value & mask) >> shift;
1448− memcpy(buf, &value, bytes);
1449− }
1450− } else {
1451− bytes = cursor.size & ~0x3ULL;
1452− amdgpu_device_vram_access(adev, cursor.start,
1453− (uint32_t *)buf, bytes,
1454− write);
1460+ size_t count, size = cursor.size;
1461+ loff_t pos = cursor.start;
1462+
1463+ count = amdgpu_device_aper_access(adev, pos, buf, size, write);
1464+ size -= count;
1465+ if (size) {
1466+ /* using MM to access rest vram and handle un-aligned address */
1467+ pos += count;
1468+ buf += count;
1469+ amdgpu_ttm_vram_mm_access(adev, pos, buf, size, write);
14551470 }
14561471
1457− ret += bytes;
1458− buf = (uint8_t *)buf + bytes;
1459− amdgpu_res_next(&cursor, bytes);
1472+ ret += cursor.size;
1473+ buf += cursor.size;
1474+ amdgpu_res_next(&cursor, cursor.size);
14601475 }
14611476
14621477 return ret;
@@ -2146,7 +2161,6 @@ static ssize_t amdgpu_ttm_vram_write(struct file *f, const char __user *buf, · 683 unmodified lines
21462161 return -ENXIO;
21472162
21482163 while (size) {
2149− unsigned long flags;
21502164 uint32_t value;
21512165
21522166 if (*pos >= adev->gmc.mc_vram_size)
@@ -2156,11 +2170,7 @@ static ssize_t amdgpu_ttm_vram_write(struct file *f, const char __user *buf, · 3 unmodified lines
21562170 if (r)
21572171 return r;
21582172
2159− spin_lock_irqsave(&adev->mmio_idx_lock, flags);
2160− WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t)*pos) | 0x80000000);
2161− WREG32_NO_KIQ(mmMM_INDEX_HI, *pos >> 31);
2162− WREG32_NO_KIQ(mmMM_DATA, value);
2163− spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
2173+ amdgpu_device_mm_access(adev, *pos, &value, 4, true);
21642174
21652175 result += 4;
21662176 buf += 4;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h+1−1
@@ -52,7 +52,7 @@ struct amdgpu_gtt_mgr { · 51 unmodified lines
5252 struct ttm_resource_manager manager;
5353 struct drm_mm mm;
5454 spinlock_t lock;
55− atomic64_t available;
55+ atomic64_t used;
5656 };
5757
5858 struct amdgpu_preempt_mgr {
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c+88−4
@@ -409,6 +409,12 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type) · 408 unmodified lines
409409 return AMDGPU_FW_LOAD_DIRECT;
410410 else
411411 return AMDGPU_FW_LOAD_PSP;
412+ case CHIP_CYAN_SKILLFISH:
413+ if (!(load_type &&
414+ adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2))
415+ return AMDGPU_FW_LOAD_DIRECT;
416+ else
417+ return AMDGPU_FW_LOAD_PSP;
412418 default:
413419 DRM_ERROR("Unknown firmware load type\n");
414420 }
@@ -416,6 +422,84 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type) · 1 unmodified line
416422 return AMDGPU_FW_LOAD_DIRECT;
417423 }
418424
425+const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id)
426+{
427+ switch (ucode_id) {
428+ case AMDGPU_UCODE_ID_SDMA0:
429+ return "SDMA0";
430+ case AMDGPU_UCODE_ID_SDMA1:
431+ return "SDMA1";
432+ case AMDGPU_UCODE_ID_SDMA2:
433+ return "SDMA2";
434+ case AMDGPU_UCODE_ID_SDMA3:
435+ return "SDMA3";
436+ case AMDGPU_UCODE_ID_SDMA4:
437+ return "SDMA4";
438+ case AMDGPU_UCODE_ID_SDMA5:
439+ return "SDMA5";
440+ case AMDGPU_UCODE_ID_SDMA6:
441+ return "SDMA6";
442+ case AMDGPU_UCODE_ID_SDMA7:
443+ return "SDMA7";
444+ case AMDGPU_UCODE_ID_CP_CE:
445+ return "CP_CE";
446+ case AMDGPU_UCODE_ID_CP_PFP:
447+ return "CP_PFP";
448+ case AMDGPU_UCODE_ID_CP_ME:
449+ return "CP_ME";
450+ case AMDGPU_UCODE_ID_CP_MEC1:
451+ return "CP_MEC1";
452+ case AMDGPU_UCODE_ID_CP_MEC1_JT:
453+ return "CP_MEC1_JT";
454+ case AMDGPU_UCODE_ID_CP_MEC2:
455+ return "CP_MEC2";
456+ case AMDGPU_UCODE_ID_CP_MEC2_JT:
457+ return "CP_MEC2_JT";
458+ case AMDGPU_UCODE_ID_CP_MES:
459+ return "CP_MES";
460+ case AMDGPU_UCODE_ID_CP_MES_DATA:
461+ return "CP_MES_DATA";
462+ case AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL:
463+ return "RLC_RESTORE_LIST_CNTL";
464+ case AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM:
465+ return "RLC_RESTORE_LIST_GPM_MEM";
466+ case AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM:
467+ return "RLC_RESTORE_LIST_SRM_MEM";
468+ case AMDGPU_UCODE_ID_RLC_IRAM:
469+ return "RLC_IRAM";
470+ case AMDGPU_UCODE_ID_RLC_DRAM:
471+ return "RLC_DRAM";
472+ case AMDGPU_UCODE_ID_RLC_G:
473+ return "RLC_G";
474+ case AMDGPU_UCODE_ID_STORAGE:
475+ return "STORAGE";
476+ case AMDGPU_UCODE_ID_SMC:
477+ return "SMC";
478+ case AMDGPU_UCODE_ID_UVD:
479+ return "UVD";
480+ case AMDGPU_UCODE_ID_UVD1:
481+ return "UVD1";
482+ case AMDGPU_UCODE_ID_VCE:
483+ return "VCE";
484+ case AMDGPU_UCODE_ID_VCN:
485+ return "VCN";
486+ case AMDGPU_UCODE_ID_VCN1:
487+ return "VCN1";
488+ case AMDGPU_UCODE_ID_DMCU_ERAM:
489+ return "DMCU_ERAM";
490+ case AMDGPU_UCODE_ID_DMCU_INTV:
491+ return "DMCU_INTV";
492+ case AMDGPU_UCODE_ID_VCN0_RAM:
493+ return "VCN0_RAM";
494+ case AMDGPU_UCODE_ID_VCN1_RAM:
495+ return "VCN1_RAM";
496+ case AMDGPU_UCODE_ID_DMCUB:
497+ return "DMCUB";
498+ default:
499+ return "UNKNOWN UCODE";
500+ }
501+}
502+
419503 #define FW_VERSION_ATTR(name, mode, field) \
420504 static ssize_t show_##name(struct device *dev, \
421505 struct device_attribute *attr, \
@@ -440,10 +524,10 @@ FW_VERSION_ATTR(rlc_srlg_fw_version, 0444, gfx.rlc_srlg_fw_version); · 18 unmodified lines
440524 FW_VERSION_ATTR(rlc_srls_fw_version, 0444, gfx.rlc_srls_fw_version);
441525 FW_VERSION_ATTR(mec_fw_version, 0444, gfx.mec_fw_version);
442526 FW_VERSION_ATTR(mec2_fw_version, 0444, gfx.mec2_fw_version);
443−FW_VERSION_ATTR(sos_fw_version, 0444, psp.sos_fw_version);
444−FW_VERSION_ATTR(asd_fw_version, 0444, psp.asd_fw_version);
445−FW_VERSION_ATTR(ta_ras_fw_version, 0444, psp.ta_ras_ucode_version);
446−FW_VERSION_ATTR(ta_xgmi_fw_version, 0444, psp.ta_xgmi_ucode_version);
527+FW_VERSION_ATTR(sos_fw_version, 0444, psp.sos.fw_version);
528+FW_VERSION_ATTR(asd_fw_version, 0444, psp.asd.fw_version);
529+FW_VERSION_ATTR(ta_ras_fw_version, 0444, psp.ras.feature_version);
530+FW_VERSION_ATTR(ta_xgmi_fw_version, 0444, psp.xgmi.feature_version);
447531 FW_VERSION_ATTR(smc_fw_version, 0444, pm.fw_version);
448532 FW_VERSION_ATTR(sdma_fw_version, 0444, sdma.instance[0].fw_version);
449533 FW_VERSION_ATTR(sdma2_fw_version, 0444, sdma.instance[1].fw_version);
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h+47−34
@@ -71,7 +71,7 @@ struct smc_firmware_header_v2_1 { · 70 unmodified lines
7171 uint32_t pptable_entry_offset;
7272 };
7373
74−struct psp_fw_bin_desc {
74+struct psp_fw_legacy_bin_desc {
7575 uint32_t fw_version;
7676 uint32_t offset_bytes;
7777 uint32_t size_bytes;
@@ -80,50 +80,67 @@ struct psp_fw_bin_desc { · 2 unmodified lines
8080 /* version_major=1, version_minor=0 */
8181 struct psp_firmware_header_v1_0 {
8282 struct common_firmware_header header;
83− struct psp_fw_bin_desc sos;
83+ struct psp_fw_legacy_bin_desc sos;
8484 };
8585
8686 /* version_major=1, version_minor=1 */
8787 struct psp_firmware_header_v1_1 {
8888 struct psp_firmware_header_v1_0 v1_0;
89− struct psp_fw_bin_desc toc;
90− struct psp_fw_bin_desc kdb;
89+ struct psp_fw_legacy_bin_desc toc;
90+ struct psp_fw_legacy_bin_desc kdb;
9191 };
9292
9393 /* version_major=1, version_minor=2 */
9494 struct psp_firmware_header_v1_2 {
9595 struct psp_firmware_header_v1_0 v1_0;
96− struct psp_fw_bin_desc res;
97− struct psp_fw_bin_desc kdb;
96+ struct psp_fw_legacy_bin_desc res;
97+ struct psp_fw_legacy_bin_desc kdb;
9898 };
9999
100100 /* version_major=1, version_minor=3 */
101101 struct psp_firmware_header_v1_3 {
102102 struct psp_firmware_header_v1_1 v1_1;
103− struct psp_fw_bin_desc spl;
104− struct psp_fw_bin_desc rl;
105− struct psp_fw_bin_desc sys_drv_aux;
106− struct psp_fw_bin_desc sos_aux;
103+ struct psp_fw_legacy_bin_desc spl;
104+ struct psp_fw_legacy_bin_desc rl;
105+ struct psp_fw_legacy_bin_desc sys_drv_aux;
106+ struct psp_fw_legacy_bin_desc sos_aux;
107+};
108+
109+struct psp_fw_bin_desc {
110+ uint32_t fw_type;
111+ uint32_t fw_version;
112+ uint32_t offset_bytes;
113+ uint32_t size_bytes;
114+};
115+
116+enum psp_fw_type {
117+ PSP_FW_TYPE_UNKOWN,
118+ PSP_FW_TYPE_PSP_SOS,
119+ PSP_FW_TYPE_PSP_SYS_DRV,
120+ PSP_FW_TYPE_PSP_KDB,
121+ PSP_FW_TYPE_PSP_TOC,
122+ PSP_FW_TYPE_PSP_SPL,
123+ PSP_FW_TYPE_PSP_RL,
124+ PSP_FW_TYPE_PSP_SOC_DRV,
125+ PSP_FW_TYPE_PSP_INTF_DRV,
126+ PSP_FW_TYPE_PSP_DBG_DRV,
127+};
128+
129+/* version_major=2, version_minor=0 */
130+struct psp_firmware_header_v2_0 {
131+ struct common_firmware_header header;
132+ uint32_t psp_fw_bin_count;
133+ struct psp_fw_bin_desc psp_fw_bin[];
107134 };
108135
109136 /* version_major=1, version_minor=0 */
110137 struct ta_firmware_header_v1_0 {
111138 struct common_firmware_header header;
112− uint32_t ta_xgmi_ucode_version;
113− uint32_t ta_xgmi_offset_bytes;
114− uint32_t ta_xgmi_size_bytes;
115− uint32_t ta_ras_ucode_version;
116− uint32_t ta_ras_offset_bytes;
117− uint32_t ta_ras_size_bytes;
118− uint32_t ta_hdcp_ucode_version;
119− uint32_t ta_hdcp_offset_bytes;
120− uint32_t ta_hdcp_size_bytes;
121− uint32_t ta_dtm_ucode_version;
122− uint32_t ta_dtm_offset_bytes;
123− uint32_t ta_dtm_size_bytes;
124− uint32_t ta_securedisplay_ucode_version;
125− uint32_t ta_securedisplay_offset_bytes;
126− uint32_t ta_securedisplay_size_bytes;
139+ struct psp_fw_legacy_bin_desc xgmi;
140+ struct psp_fw_legacy_bin_desc ras;
141+ struct psp_fw_legacy_bin_desc hdcp;
142+ struct psp_fw_legacy_bin_desc dtm;
143+ struct psp_fw_legacy_bin_desc securedisplay;
127144 };
128145
129146 enum ta_fw_type {
@@ -138,18 +155,11 @@ enum ta_fw_type { · 8 unmodified lines
138155 TA_FW_TYPE_MAX_INDEX,
139156 };
140157
141−struct ta_fw_bin_desc {
142− uint32_t fw_type;
143− uint32_t fw_version;
144− uint32_t offset_bytes;
145− uint32_t size_bytes;
146−};
147−
148158 /* version_major=2, version_minor=0 */
149159 struct ta_firmware_header_v2_0 {
150160 struct common_firmware_header header;
151161 uint32_t ta_fw_bin_count;
152− struct ta_fw_bin_desc ta_fw_bin[];
162+ struct psp_fw_bin_desc ta_fw_bin[];
153163 };
154164
155165 /* version_major=1, version_minor=0 */
@@ -312,6 +322,7 @@ union amdgpu_firmware_header { · 156 unmodified lines
312322 struct psp_firmware_header_v1_0 psp;
313323 struct psp_firmware_header_v1_1 psp_v1_1;
314324 struct psp_firmware_header_v1_3 psp_v1_3;
325+ struct psp_firmware_header_v2_0 psp_v2_0;
315326 struct ta_firmware_header_v1_0 ta;
316327 struct ta_firmware_header_v2_0 ta_v2_0;
317328 struct gfx_firmware_header_v1_0 gfx;
@@ -326,7 +337,7 @@ union amdgpu_firmware_header { · 8 unmodified lines
326337 uint8_t raw[0x100];
327338 };
328339
329−#define UCODE_MAX_TA_PACKAGING ((sizeof(union amdgpu_firmware_header) - sizeof(struct common_firmware_header) - 4) / sizeof(struct ta_fw_bin_desc))
340+#define UCODE_MAX_PSP_PACKAGING ((sizeof(union amdgpu_firmware_header) - sizeof(struct common_firmware_header) - 4) / sizeof(struct psp_fw_bin_desc))
330341
331342 /*
332343 * fw loading support
@@ -449,4 +460,6 @@ void amdgpu_ucode_sysfs_fini(struct amdgpu_device *adev); · 116 unmodified lines
449460 enum amdgpu_firmware_load_type
450461 amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type);
451462
463+const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id);
464+
452465 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c+1−2
@@ -41,7 +41,6 @@ int amdgpu_umc_ras_late_init(struct amdgpu_device *adev) · 40 unmodified lines
4141 adev->umc.ras_if->block = AMDGPU_RAS_BLOCK__UMC;
4242 adev->umc.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
4343 adev->umc.ras_if->sub_block_index = 0;
44− strcpy(adev->umc.ras_if->name, "umc");
4544 }
4645 ih_info.head = fs_info.head = *adev->umc.ras_if;
4746
@@ -134,7 +133,7 @@ int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev, · 86 unmodified lines
134133 amdgpu_ras_save_bad_pages(adev);
135134
136135 if (adev->smu.ppt_funcs && adev->smu.ppt_funcs->send_hbm_bad_pages_num)
137− adev->smu.ppt_funcs->send_hbm_bad_pages_num(&adev->smu, con->eeprom_control.num_recs);
136+ adev->smu.ppt_funcs->send_hbm_bad_pages_num(&adev->smu, con->eeprom_control.ras_num_recs);
138137 }
139138
140139 amdgpu_ras_reset_gpu(adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c+0−1
@@ -326,7 +326,6 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) · 325 unmodified lines
326326 {
327327 int i, j;
328328
329− cancel_delayed_work_sync(&adev->uvd.idle_work);
330329 drm_sched_entity_destroy(&adev->uvd.entity);
331330
332331 for (j = 0; j < adev->uvd.num_uvd_inst; ++j) {
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c+0−1
@@ -218,7 +218,6 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev) · 217 unmodified lines
218218 if (adev->vce.vcpu_bo == NULL)
219219 return 0;
220220
221− cancel_delayed_work_sync(&adev->vce.idle_work);
222221 drm_sched_entity_destroy(&adev->vce.entity);
223222
224223 amdgpu_bo_free_kernel(&adev->vce.vcpu_bo, &adev->vce.gpu_addr,
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c+0−2
@@ -258,8 +258,6 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev) · 257 unmodified lines
258258 {
259259 int i, j;
260260
261− cancel_delayed_work_sync(&adev->vcn.idle_work);
262−
263261 for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
264262 if (adev->vcn.harvest_config & (1 << j))
265263 continue;
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c+4−4
@@ -531,10 +531,10 @@ static void amdgpu_virt_populate_vf2pf_ucode_info(struct amdgpu_device *adev) · 530 unmodified lines
531531 POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_RLC_SRLS, adev->gfx.rlc_srls_fw_version);
532532 POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_MEC, adev->gfx.mec_fw_version);
533533 POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_MEC2, adev->gfx.mec2_fw_version);
534− POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_SOS, adev->psp.sos_fw_version);
535− POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_ASD, adev->psp.asd_fw_version);
536− POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_TA_RAS, adev->psp.ta_ras_ucode_version);
537− POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_TA_XGMI, adev->psp.ta_xgmi_ucode_version);
534+ POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_SOS, adev->psp.sos.fw_version);
535+ POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_ASD, adev->psp.asd.fw_version);
536+ POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_TA_RAS, adev->psp.ras.feature_version);
537+ POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_TA_XGMI, adev->psp.xgmi.feature_version);
538538 POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_SMC, adev->pm.fw_version);
539539 POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_SDMA, adev->sdma.instance[0].fw_version);
540540 POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_SDMA2, adev->sdma.instance[1].fw_version);
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c+643−0
@@ -0,0 +1,643 @@
1+// SPDX-License-Identifier: GPL-2.0+
2+
3+#include <drm/drm_atomic_helper.h>
4+#include <drm/drm_simple_kms_helper.h>
5+#include <drm/drm_vblank.h>
6+
7+#include "amdgpu.h"
8+#ifdef CONFIG_DRM_AMDGPU_SI
9+#include "dce_v6_0.h"
10+#endif
11+#ifdef CONFIG_DRM_AMDGPU_CIK
12+#include "dce_v8_0.h"
13+#endif
14+#include "dce_v10_0.h"
15+#include "dce_v11_0.h"
16+#include "ivsrcid/ivsrcid_vislands30.h"
17+#include "amdgpu_vkms.h"
18+#include "amdgpu_display.h"
19+
20+/**
21+ * DOC: amdgpu_vkms
22+ *
23+ * The amdgpu vkms interface provides a virtual KMS interface for several use
24+ * cases: devices without display hardware, platforms where the actual display
25+ * hardware is not useful (e.g., servers), SR-IOV virtual functions, device
26+ * emulation/simulation, and device bring up prior to display hardware being
27+ * usable. We previously emulated a legacy KMS interface, but there was a desire
28+ * to move to the atomic KMS interface. The vkms driver did everything we
29+ * needed, but we wanted KMS support natively in the driver without buffer
30+ * sharing and the ability to support an instance of VKMS per device. We first
31+ * looked at splitting vkms into a stub driver and a helper module that other
32+ * drivers could use to implement a virtual display, but this strategy ended up
33+ * being messy due to driver specific callbacks needed for buffer management.
34+ * Ultimately, it proved easier to import the vkms code as it mostly used core
35+ * drm helpers anyway.
36+ */
37+
38+static const u32 amdgpu_vkms_formats[] = {
39+ DRM_FORMAT_XRGB8888,
40+};
41+
42+static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer)
43+{
44+ struct amdgpu_vkms_output *output = container_of(timer,
45+ struct amdgpu_vkms_output,
46+ vblank_hrtimer);
47+ struct drm_crtc *crtc = &output->crtc;
48+ u64 ret_overrun;
49+ bool ret;
50+
51+ ret_overrun = hrtimer_forward_now(&output->vblank_hrtimer,
52+ output->period_ns);
53+ WARN_ON(ret_overrun != 1);
54+
55+ ret = drm_crtc_handle_vblank(crtc);
56+ if (!ret)
57+ DRM_ERROR("amdgpu_vkms failure on handling vblank");
58+
59+ return HRTIMER_RESTART;
60+}
61+
62+static int amdgpu_vkms_enable_vblank(struct drm_crtc *crtc)
63+{
64+ struct drm_device *dev = crtc->dev;
65+ unsigned int pipe = drm_crtc_index(crtc);
66+ struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
67+ struct amdgpu_vkms_output *out = drm_crtc_to_amdgpu_vkms_output(crtc);
68+
69+ drm_calc_timestamping_constants(crtc, &crtc->mode);
70+
71+ hrtimer_init(&out->vblank_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
72+ out->vblank_hrtimer.function = &amdgpu_vkms_vblank_simulate;
73+ out->period_ns = ktime_set(0, vblank->framedur_ns);
74+ hrtimer_start(&out->vblank_hrtimer, out->period_ns, HRTIMER_MODE_REL);
75+
76+ return 0;
77+}
78+
79+static void amdgpu_vkms_disable_vblank(struct drm_crtc *crtc)
80+{
81+ struct amdgpu_vkms_output *out = drm_crtc_to_amdgpu_vkms_output(crtc);
82+
83+ hrtimer_cancel(&out->vblank_hrtimer);
84+}
85+
86+static bool amdgpu_vkms_get_vblank_timestamp(struct drm_crtc *crtc,
87+ int *max_error,
88+ ktime_t *vblank_time,
89+ bool in_vblank_irq)
90+{
91+ struct drm_device *dev = crtc->dev;
92+ unsigned int pipe = crtc->index;
93+ struct amdgpu_vkms_output *output = drm_crtc_to_amdgpu_vkms_output(crtc);
94+ struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
95+
96+ if (!READ_ONCE(vblank->enabled)) {
97+ *vblank_time = ktime_get();
98+ return true;
99+ }
100+
101+ *vblank_time = READ_ONCE(output->vblank_hrtimer.node.expires);
102+
103+ if (WARN_ON(*vblank_time == vblank->time))
104+ return true;
105+
106+ /*
107+ * To prevent races we roll the hrtimer forward before we do any
108+ * interrupt processing - this is how real hw works (the interrupt is
109+ * only generated after all the vblank registers are updated) and what
110+ * the vblank core expects. Therefore we need to always correct the
111+ * timestampe by one frame.
112+ */
113+ *vblank_time -= output->period_ns;
114+
115+ return true;
116+}
117+
118+static const struct drm_crtc_funcs amdgpu_vkms_crtc_funcs = {
119+ .set_config = drm_atomic_helper_set_config,
120+ .destroy = drm_crtc_cleanup,
121+ .page_flip = drm_atomic_helper_page_flip,
122+ .reset = drm_atomic_helper_crtc_reset,
123+ .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
124+ .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
125+ .enable_vblank = amdgpu_vkms_enable_vblank,
126+ .disable_vblank = amdgpu_vkms_disable_vblank,
127+ .get_vblank_timestamp = amdgpu_vkms_get_vblank_timestamp,
128+};
129+
130+static void amdgpu_vkms_crtc_atomic_enable(struct drm_crtc *crtc,
131+ struct drm_atomic_state *state)
132+{
133+ drm_crtc_vblank_on(crtc);
134+}
135+
136+static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc,
137+ struct drm_atomic_state *state)
138+{
139+ drm_crtc_vblank_off(crtc);
140+}
141+
142+static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc,
143+ struct drm_atomic_state *state)
144+{
145+ if (crtc->state->event) {
146+ spin_lock(&crtc->dev->event_lock);
147+
148+ if (drm_crtc_vblank_get(crtc) != 0)
149+ drm_crtc_send_vblank_event(crtc, crtc->state->event);
150+ else
151+ drm_crtc_arm_vblank_event(crtc, crtc->state->event);
152+
153+ spin_unlock(&crtc->dev->event_lock);
154+
155+ crtc->state->event = NULL;
156+ }
157+}
158+
159+static const struct drm_crtc_helper_funcs amdgpu_vkms_crtc_helper_funcs = {
160+ .atomic_flush = amdgpu_vkms_crtc_atomic_flush,
161+ .atomic_enable = amdgpu_vkms_crtc_atomic_enable,
162+ .atomic_disable = amdgpu_vkms_crtc_atomic_disable,
163+};
164+
165+static int amdgpu_vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
166+ struct drm_plane *primary, struct drm_plane *cursor)
167+{
168+ int ret;
169+
170+ ret = drm_crtc_init_with_planes(dev, crtc, primary, cursor,
171+ &amdgpu_vkms_crtc_funcs, NULL);
172+ if (ret) {
173+ DRM_ERROR("Failed to init CRTC\n");
174+ return ret;
175+ }
176+
177+ drm_crtc_helper_add(crtc, &amdgpu_vkms_crtc_helper_funcs);
178+
179+ return ret;
180+}
181+
182+static const struct drm_connector_funcs amdgpu_vkms_connector_funcs = {
183+ .fill_modes = drm_helper_probe_single_connector_modes,
184+ .destroy = drm_connector_cleanup,
185+ .reset = drm_atomic_helper_connector_reset,
186+ .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
187+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
188+};
189+
190+static int amdgpu_vkms_conn_get_modes(struct drm_connector *connector)
191+{
192+ struct drm_device *dev = connector->dev;
193+ struct drm_display_mode *mode = NULL;
194+ unsigned i;
195+ static const struct mode_size {
196+ int w;
197+ int h;
198+ } common_modes[] = {
199+ { 640, 480},
200+ { 720, 480},
201+ { 800, 600},
202+ { 848, 480},
203+ {1024, 768},
204+ {1152, 768},
205+ {1280, 720},
206+ {1280, 800},
207+ {1280, 854},
208+ {1280, 960},
209+ {1280, 1024},
210+ {1440, 900},
211+ {1400, 1050},
212+ {1680, 1050},
213+ {1600, 1200},
214+ {1920, 1080},
215+ {1920, 1200},
216+ {2560, 1440},
217+ {4096, 3112},
218+ {3656, 2664},
219+ {3840, 2160},
220+ {4096, 2160},
221+ };
222+
223+ for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
224+ mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false);
225+ drm_mode_probed_add(connector, mode);
226+ }
227+
228+ drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
229+
230+ return ARRAY_SIZE(common_modes);
231+}
232+
233+static const struct drm_connector_helper_funcs amdgpu_vkms_conn_helper_funcs = {
234+ .get_modes = amdgpu_vkms_conn_get_modes,
235+};
236+
237+static const struct drm_plane_funcs amdgpu_vkms_plane_funcs = {
238+ .update_plane = drm_atomic_helper_update_plane,
239+ .disable_plane = drm_atomic_helper_disable_plane,
240+ .destroy = drm_plane_cleanup,
241+ .reset = drm_atomic_helper_plane_reset,
242+ .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
243+ .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
244+};
245+
246+static void amdgpu_vkms_plane_atomic_update(struct drm_plane *plane,
247+ struct drm_atomic_state *old_state)
248+{
249+ return;
250+}
251+
252+static int amdgpu_vkms_plane_atomic_check(struct drm_plane *plane,
253+ struct drm_atomic_state *state)
254+{
255+ struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
256+ plane);
257+ struct drm_crtc_state *crtc_state;
258+ int ret;
259+
260+ if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc))
261+ return 0;
262+
263+ crtc_state = drm_atomic_get_crtc_state(state,
264+ new_plane_state->crtc);
265+ if (IS_ERR(crtc_state))
266+ return PTR_ERR(crtc_state);
267+
268+ ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
269+ DRM_PLANE_HELPER_NO_SCALING,
270+ DRM_PLANE_HELPER_NO_SCALING,
271+ false, true);
272+ if (ret != 0)
273+ return ret;
274+
275+ /* for now primary plane must be visible and full screen */
276+ if (!new_plane_state->visible)
277+ return -EINVAL;
278+
279+ return 0;
280+}
281+
282+static int amdgpu_vkms_prepare_fb(struct drm_plane *plane,
283+ struct drm_plane_state *new_state)
284+{
285+ struct amdgpu_framebuffer *afb;
286+ struct drm_gem_object *obj;
287+ struct amdgpu_device *adev;
288+ struct amdgpu_bo *rbo;
289+ struct list_head list;
290+ struct ttm_validate_buffer tv;
291+ struct ww_acquire_ctx ticket;
292+ uint32_t domain;
293+ int r;
294+
295+ if (!new_state->fb) {
296+ DRM_DEBUG_KMS("No FB bound\n");
297+ return 0;
298+ }
299+ afb = to_amdgpu_framebuffer(new_state->fb);
300+ obj = new_state->fb->obj[0];
301+ rbo = gem_to_amdgpu_bo(obj);
302+ adev = amdgpu_ttm_adev(rbo->tbo.bdev);
303+ INIT_LIST_HEAD(&list);
304+
305+ tv.bo = &rbo->tbo;
306+ tv.num_shared = 1;
307+ list_add(&tv.head, &list);
308+
309+ r = ttm_eu_reserve_buffers(&ticket, &list, false, NULL);
310+ if (r) {
311+ dev_err(adev->dev, "fail to reserve bo (%d)\n", r);
312+ return r;
313+ }
314+
315+ if (plane->type != DRM_PLANE_TYPE_CURSOR)
316+ domain = amdgpu_display_supported_domains(adev, rbo->flags);
317+ else
318+ domain = AMDGPU_GEM_DOMAIN_VRAM;
319+
320+ r = amdgpu_bo_pin(rbo, domain);
321+ if (unlikely(r != 0)) {
322+ if (r != -ERESTARTSYS)
323+ DRM_ERROR("Failed to pin framebuffer with error %d\n", r);
324+ ttm_eu_backoff_reservation(&ticket, &list);
325+ return r;
326+ }
327+
328+ r = amdgpu_ttm_alloc_gart(&rbo->tbo);
329+ if (unlikely(r != 0)) {
330+ amdgpu_bo_unpin(rbo);
331+ ttm_eu_backoff_reservation(&ticket, &list);
332+ DRM_ERROR("%p bind failed\n", rbo);
333+ return r;
334+ }
335+
336+ ttm_eu_backoff_reservation(&ticket, &list);
337+
338+ afb->address = amdgpu_bo_gpu_offset(rbo);
339+
340+ amdgpu_bo_ref(rbo);
341+
342+ return 0;
343+}
344+
345+static void amdgpu_vkms_cleanup_fb(struct drm_plane *plane,
346+ struct drm_plane_state *old_state)
347+{
348+ struct amdgpu_bo *rbo;
349+ int r;
350+
351+ if (!old_state->fb)
352+ return;
353+
354+ rbo = gem_to_amdgpu_bo(old_state->fb->obj[0]);
355+ r = amdgpu_bo_reserve(rbo, false);
356+ if (unlikely(r)) {
357+ DRM_ERROR("failed to reserve rbo before unpin\n");
358+ return;
359+ }
360+
361+ amdgpu_bo_unpin(rbo);
362+ amdgpu_bo_unreserve(rbo);
363+ amdgpu_bo_unref(&rbo);
364+}
365+
366+static const struct drm_plane_helper_funcs amdgpu_vkms_primary_helper_funcs = {
367+ .atomic_update = amdgpu_vkms_plane_atomic_update,
368+ .atomic_check = amdgpu_vkms_plane_atomic_check,
369+ .prepare_fb = amdgpu_vkms_prepare_fb,
370+ .cleanup_fb = amdgpu_vkms_cleanup_fb,
371+};
372+
373+static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev,
374+ enum drm_plane_type type,
375+ int index)
376+{
377+ struct drm_plane *plane;
378+ int ret;
379+
380+ plane = kzalloc(sizeof(*plane), GFP_KERNEL);
381+ if (!plane)
382+ return ERR_PTR(-ENOMEM);
383+
384+ ret = drm_universal_plane_init(dev, plane, 1 << index,
385+ &amdgpu_vkms_plane_funcs,
386+ amdgpu_vkms_formats,
387+ ARRAY_SIZE(amdgpu_vkms_formats),
388+ NULL, type, NULL);
389+ if (ret) {
390+ kfree(plane);
391+ return ERR_PTR(ret);
392+ }
393+
394+ drm_plane_helper_add(plane, &amdgpu_vkms_primary_helper_funcs);
395+
396+ return plane;
397+}
398+
399+int amdgpu_vkms_output_init(struct drm_device *dev,
400+ struct amdgpu_vkms_output *output, int index)
401+{
402+ struct drm_connector *connector = &output->connector;
403+ struct drm_encoder *encoder = &output->encoder;
404+ struct drm_crtc *crtc = &output->crtc;
405+ struct drm_plane *primary, *cursor = NULL;
406+ int ret;
407+
408+ primary = amdgpu_vkms_plane_init(dev, DRM_PLANE_TYPE_PRIMARY, index);
409+ if (IS_ERR(primary))
410+ return PTR_ERR(primary);
411+
412+ ret = amdgpu_vkms_crtc_init(dev, crtc, primary, cursor);
413+ if (ret)
414+ goto err_crtc;
415+
416+ ret = drm_connector_init(dev, connector, &amdgpu_vkms_connector_funcs,
417+ DRM_MODE_CONNECTOR_VIRTUAL);
418+ if (ret) {
419+ DRM_ERROR("Failed to init connector\n");
420+ goto err_connector;
421+ }
422+
423+ drm_connector_helper_add(connector, &amdgpu_vkms_conn_helper_funcs);
424+
425+ ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
426+ if (ret) {
427+ DRM_ERROR("Failed to init encoder\n");
428+ goto err_encoder;
429+ }
430+ encoder->possible_crtcs = 1 << index;
431+
432+ ret = drm_connector_attach_encoder(connector, encoder);
433+ if (ret) {
434+ DRM_ERROR("Failed to attach connector to encoder\n");
435+ goto err_attach;
436+ }
437+
438+ drm_mode_config_reset(dev);
439+
440+ return 0;
441+
442+err_attach:
443+ drm_encoder_cleanup(encoder);
444+
445+err_encoder:
446+ drm_connector_cleanup(connector);
447+
448+err_connector:
449+ drm_crtc_cleanup(crtc);
450+
451+err_crtc:
452+ drm_plane_cleanup(primary);
453+
454+ return ret;
455+}
456+
457+const struct drm_mode_config_funcs amdgpu_vkms_mode_funcs = {
458+ .fb_create = amdgpu_display_user_framebuffer_create,
459+ .atomic_check = drm_atomic_helper_check,
460+ .atomic_commit = drm_atomic_helper_commit,
461+};
462+
463+static int amdgpu_vkms_sw_init(void *handle)
464+{
465+ int r, i;
466+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
467+
468+ adev_to_drm(adev)->max_vblank_count = 0;
469+
470+ adev_to_drm(adev)->mode_config.funcs = &amdgpu_vkms_mode_funcs;
471+
472+ adev_to_drm(adev)->mode_config.max_width = XRES_MAX;
473+ adev_to_drm(adev)->mode_config.max_height = YRES_MAX;
474+
475+ adev_to_drm(adev)->mode_config.preferred_depth = 24;
476+ adev_to_drm(adev)->mode_config.prefer_shadow = 1;
477+
478+ adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
479+
480+ r = amdgpu_display_modeset_create_props(adev);
481+ if (r)
482+ return r;
483+
484+ adev->amdgpu_vkms_output = kcalloc(adev->mode_info.num_crtc, sizeof(struct amdgpu_vkms_output), GFP_KERNEL);
485+ if (!adev->amdgpu_vkms_output)
486+ return -ENOMEM;
487+
488+ /* allocate crtcs, encoders, connectors */
489+ for (i = 0; i < adev->mode_info.num_crtc; i++) {
490+ r = amdgpu_vkms_output_init(adev_to_drm(adev), &adev->amdgpu_vkms_output[i], i);
491+ if (r)
492+ return r;
493+ }
494+
495+ drm_kms_helper_poll_init(adev_to_drm(adev));
496+
497+ adev->mode_info.mode_config_initialized = true;
498+ return 0;
499+}
500+
501+static int amdgpu_vkms_sw_fini(void *handle)
502+{
503+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
504+ int i = 0;
505+
506+ for (i = 0; i < adev->mode_info.num_crtc; i++)
507+ if (adev->mode_info.crtcs[i])
508+ hrtimer_cancel(&adev->mode_info.crtcs[i]->vblank_timer);
509+
510+ kfree(adev->mode_info.bios_hardcoded_edid);
511+ kfree(adev->amdgpu_vkms_output);
512+
513+ drm_kms_helper_poll_fini(adev_to_drm(adev));
514+
515+ adev->mode_info.mode_config_initialized = false;
516+ return 0;
517+}
518+
519+static int amdgpu_vkms_hw_init(void *handle)
520+{
521+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
522+
523+ switch (adev->asic_type) {
524+#ifdef CONFIG_DRM_AMDGPU_SI
525+ case CHIP_TAHITI:
526+ case CHIP_PITCAIRN:
527+ case CHIP_VERDE:
528+ case CHIP_OLAND:
529+ dce_v6_0_disable_dce(adev);
530+ break;
531+#endif
532+#ifdef CONFIG_DRM_AMDGPU_CIK
533+ case CHIP_BONAIRE:
534+ case CHIP_HAWAII:
535+ case CHIP_KAVERI:
536+ case CHIP_KABINI:
537+ case CHIP_MULLINS:
538+ dce_v8_0_disable_dce(adev);
539+ break;
540+#endif
541+ case CHIP_FIJI:
542+ case CHIP_TONGA:
543+ dce_v10_0_disable_dce(adev);
544+ break;
545+ case CHIP_CARRIZO:
546+ case CHIP_STONEY:
547+ case CHIP_POLARIS10:
548+ case CHIP_POLARIS11:
549+ case CHIP_VEGAM:
550+ dce_v11_0_disable_dce(adev);
551+ break;
552+ case CHIP_TOPAZ:
553+#ifdef CONFIG_DRM_AMDGPU_SI
554+ case CHIP_HAINAN:
555+#endif
556+ /* no DCE */
557+ break;
558+ default:
559+ break;
560+ }
561+ return 0;
562+}
563+
564+static int amdgpu_vkms_hw_fini(void *handle)
565+{
566+ return 0;
567+}
568+
569+static int amdgpu_vkms_suspend(void *handle)
570+{
571+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
572+ int r;
573+
574+ r = drm_mode_config_helper_suspend(adev_to_drm(adev));
575+ if (r)
576+ return r;
577+ return amdgpu_vkms_hw_fini(handle);
578+}
579+
580+static int amdgpu_vkms_resume(void *handle)
581+{
582+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
583+ int r;
584+
585+ r = amdgpu_vkms_hw_init(handle);
586+ if (r)
587+ return r;
588+ return drm_mode_config_helper_resume(adev_to_drm(adev));
589+}
590+
591+static bool amdgpu_vkms_is_idle(void *handle)
592+{
593+ return true;
594+}
595+
596+static int amdgpu_vkms_wait_for_idle(void *handle)
597+{
598+ return 0;
599+}
600+
601+static int amdgpu_vkms_soft_reset(void *handle)
602+{
603+ return 0;
604+}
605+
606+static int amdgpu_vkms_set_clockgating_state(void *handle,
607+ enum amd_clockgating_state state)
608+{
609+ return 0;
610+}
611+
612+static int amdgpu_vkms_set_powergating_state(void *handle,
613+ enum amd_powergating_state state)
614+{
615+ return 0;
616+}
617+
618+static const struct amd_ip_funcs amdgpu_vkms_ip_funcs = {
619+ .name = "amdgpu_vkms",
620+ .early_init = NULL,
621+ .late_init = NULL,
622+ .sw_init = amdgpu_vkms_sw_init,
623+ .sw_fini = amdgpu_vkms_sw_fini,
624+ .hw_init = amdgpu_vkms_hw_init,
625+ .hw_fini = amdgpu_vkms_hw_fini,
626+ .suspend = amdgpu_vkms_suspend,
627+ .resume = amdgpu_vkms_resume,
628+ .is_idle = amdgpu_vkms_is_idle,
629+ .wait_for_idle = amdgpu_vkms_wait_for_idle,
630+ .soft_reset = amdgpu_vkms_soft_reset,
631+ .set_clockgating_state = amdgpu_vkms_set_clockgating_state,
632+ .set_powergating_state = amdgpu_vkms_set_powergating_state,
633+};
634+
635+const struct amdgpu_ip_block_version amdgpu_vkms_ip_block =
636+{
637+ .type = AMD_IP_BLOCK_TYPE_DCE,
638+ .major = 1,
639+ .minor = 0,
640+ .rev = 0,
641+ .funcs = &amdgpu_vkms_ip_funcs,
642+};
643+
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h+26−0
@@ -0,0 +1,26 @@
1+/* SPDX-License-Identifier: GPL-2.0+ */
2+
3+#ifndef _AMDGPU_VKMS_H_
4+#define _AMDGPU_VKMS_H_
5+
6+#define XRES_DEF 1024
7+#define YRES_DEF 768
8+
9+#define XRES_MAX 16384
10+#define YRES_MAX 16384
11+
12+#define drm_crtc_to_amdgpu_vkms_output(target) \
13+ container_of(target, struct amdgpu_vkms_output, crtc)
14+
15+extern const struct amdgpu_ip_block_version amdgpu_vkms_ip_block;
16+
17+struct amdgpu_vkms_output {
18+ struct drm_crtc crtc;
19+ struct drm_encoder encoder;
20+ struct drm_connector connector;
21+ struct hrtimer vblank_hrtimer;
22+ ktime_t period_ns;
23+ struct drm_pending_vblank_event *event;
24+};
25+
26+#endif /* _AMDGPU_VKMS_H_ */
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+69−98
@@ -88,6 +88,46 @@ struct amdgpu_prt_cb { · 87 unmodified lines
8888 struct dma_fence_cb cb;
8989 };
9090
91+/**
92+ * amdgpu_vm_set_pasid - manage pasid and vm ptr mapping
93+ *
94+ * @adev: amdgpu_device pointer
95+ * @vm: amdgpu_vm pointer
96+ * @pasid: the pasid the VM is using on this GPU
97+ *
98+ * Set the pasid this VM is using on this GPU, can also be used to remove the
99+ * pasid by passing in zero.
100+ *
101+ */
102+int amdgpu_vm_set_pasid(struct amdgpu_device *adev, struct amdgpu_vm *vm,
103+ u32 pasid)
104+{
105+ int r;
106+
107+ if (vm->pasid == pasid)
108+ return 0;
109+
110+ if (vm->pasid) {
111+ r = xa_err(xa_erase_irq(&adev->vm_manager.pasids, vm->pasid));
112+ if (r < 0)
113+ return r;
114+
115+ vm->pasid = 0;
116+ }
117+
118+ if (pasid) {
119+ r = xa_err(xa_store_irq(&adev->vm_manager.pasids, pasid, vm,
120+ GFP_KERNEL));
121+ if (r < 0)
122+ return r;
123+
124+ vm->pasid = pasid;
125+ }
126+
127+
128+ return 0;
129+}
130+
91131 /*
92132 * vm eviction_lock can be taken in MMU notifiers. Make sure no reclaim-FS
93133 * happens while holding this lock anywhere to prevent deadlocks when
@@ -886,7 +926,7 @@ static int amdgpu_vm_pt_create(struct amdgpu_device *adev, · 792 unmodified lines
886926 bp.size = amdgpu_vm_bo_size(adev, level);
887927 bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
888928 bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
889− bp.domain = amdgpu_bo_get_preferred_pin_domain(adev, bp.domain);
929+ bp.domain = amdgpu_bo_get_preferred_domain(adev, bp.domain);
890930 bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
891931 AMDGPU_GEM_CREATE_CPU_GTT_USWC;
892932
@@ -1178,7 +1218,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, · 285 unmodified lines
11781218 amdgpu_gmc_emit_pasid_mapping(ring, job->vmid, job->pasid);
11791219
11801220 if (vm_flush_needed || pasid_mapping_needed) {
1181− r = amdgpu_fence_emit(ring, &fence, 0);
1221+ r = amdgpu_fence_emit(ring, &fence, NULL, 0);
11821222 if (r)
11831223 return r;
11841224 }
@@ -1758,7 +1798,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · 573 unmodified lines
17581798 r = vm->update_funcs->commit(&params, fence);
17591799
17601800 if (table_freed)
1761− *table_freed = params.table_freed;
1801+ *table_freed = *table_freed || params.table_freed;
17621802
17631803 error_unlock:
17641804 amdgpu_vm_eviction_unlock(vm);
@@ -1816,6 +1856,7 @@ void amdgpu_vm_get_memory(struct amdgpu_vm *vm, uint64_t *vram_mem, · 51 unmodified lines
18161856 * @adev: amdgpu_device pointer
18171857 * @bo_va: requested BO and VM object
18181858 * @clear: if true clear the entries
1859+ * @table_freed: return true if page table is freed
18191860 *
18201861 * Fill in the page table entries for @bo_va.
18211862 *
@@ -1823,7 +1864,7 @@ void amdgpu_vm_get_memory(struct amdgpu_vm *vm, uint64_t *vram_mem, · 1 unmodified line
18231864 * 0 for success, -EINVAL for failure.
18241865 */
18251866 int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
1826− bool clear)
1867+ bool clear, bool *table_freed)
18271868 {
18281869 struct amdgpu_bo *bo = bo_va->base.bo;
18291870 struct amdgpu_vm *vm = bo_va->base.vm;
@@ -1902,7 +1943,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va, · 72 unmodified lines
19021943 resv, mapping->start,
19031944 mapping->last, update_flags,
19041945 mapping->offset, mem,
1905− pages_addr, last_update, NULL);
1946+ pages_addr, last_update, table_freed);
19061947 if (r)
19071948 return r;
19081949 }
@@ -2154,7 +2195,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · 245 unmodified lines
21542195
21552196 list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
21562197 /* Per VM BOs never need to bo cleared in the page tables */
2157− r = amdgpu_vm_bo_update(adev, bo_va, false);
2198+ r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
21582199 if (r)
21592200 return r;
21602201 }
@@ -2173,7 +2214,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · 12 unmodified lines
21732214 else
21742215 clear = true;
21752216
2176− r = amdgpu_vm_bo_update(adev, bo_va, clear);
2217+ r = amdgpu_vm_bo_update(adev, bo_va, clear, NULL);
21772218 if (r)
21782219 return r;
21792220
@@ -2863,14 +2904,13 @@ long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout) · 683 unmodified lines
28632904 *
28642905 * @adev: amdgpu_device pointer
28652906 * @vm: requested vm
2866− * @pasid: Process address space identifier
28672907 *
28682908 * Init @vm fields.
28692909 *
28702910 * Returns:
28712911 * 0 for success, error for failure.
28722912 */
2873−int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, u32 pasid)
2913+int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
28742914 {
28752915 struct amdgpu_bo *root_bo;
28762916 struct amdgpu_bo_vm *root;
@@ -2944,19 +2984,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, u32 pasid) · 67 unmodified lines
29442984
29452985 amdgpu_bo_unreserve(vm->root.bo);
29462986
2947− if (pasid) {
2948− unsigned long flags;
2949−
2950− spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
2951− r = idr_alloc(&adev->vm_manager.pasid_idr, vm, pasid, pasid + 1,
2952− GFP_ATOMIC);
2953− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
2954− if (r < 0)
2955− goto error_free_root;
2956−
2957− vm->pasid = pasid;
2958− }
2959−
29602987 INIT_KFIFO(vm->faults);
29612988
29622989 return 0;
@@ -3012,7 +3039,6 @@ static int amdgpu_vm_check_clean_reserved(struct amdgpu_device *adev, · 49 unmodified lines
30123039 *
30133040 * @adev: amdgpu_device pointer
30143041 * @vm: requested vm
3015− * @pasid: pasid to use
30163042 *
30173043 * This only works on GFX VMs that don't have any BOs added and no
30183044 * page tables allocated yet.
@@ -3020,7 +3046,6 @@ static int amdgpu_vm_check_clean_reserved(struct amdgpu_device *adev, · 1 unmodified line
30203046 * Changes the following VM parameters:
30213047 * - use_cpu_for_update
30223048 * - pte_supports_ats
3023− * - pasid (old PASID is released, because compute manages its own PASIDs)
30243049 *
30253050 * Reinitializes the page directory to reflect the changed ATS
30263051 * setting.
@@ -3028,8 +3053,7 @@ static int amdgpu_vm_check_clean_reserved(struct amdgpu_device *adev, · 1 unmodified line
30283053 * Returns:
30293054 * 0 for success, -errno for errors.
30303055 */
3031−int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm,
3032− u32 pasid)
3056+int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
30333057 {
30343058 bool pte_support_ats = (adev->asic_type == CHIP_RAVEN);
30353059 int r;
@@ -3043,19 +3067,6 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 7 unmodified lines
30433067 if (r)
30443068 goto unreserve_bo;
30453069
3046− if (pasid) {
3047− unsigned long flags;
3048−
3049− spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
3050− r = idr_alloc(&adev->vm_manager.pasid_idr, vm, pasid, pasid + 1,
3051− GFP_ATOMIC);
3052− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
3053−
3054− if (r == -ENOSPC)
3055− goto unreserve_bo;
3056− r = 0;
3057− }
3058−
30593070 /* Check if PD needs to be reinitialized and do it before
30603071 * changing any other state, in case it fails.
30613072 */
@@ -3065,7 +3076,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 3 unmodified lines
30653076 to_amdgpu_bo_vm(vm->root.bo),
30663077 false);
30673078 if (r)
3068− goto free_idr;
3079+ goto unreserve_bo;
30693080 }
30703081
30713082 /* Update VM state */
@@ -3082,7 +3093,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 10 unmodified lines
30823093 r = amdgpu_bo_sync_wait(vm->root.bo,
30833094 AMDGPU_FENCE_OWNER_UNDEFINED, true);
30843095 if (r)
3085− goto free_idr;
3096+ goto unreserve_bo;
30863097
30873098 vm->update_funcs = &amdgpu_vm_cpu_funcs;
30883099 } else {
@@ -3092,36 +3103,11 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 3 unmodified lines
30923103 vm->last_update = NULL;
30933104 vm->is_compute_context = true;
30943105
3095− if (vm->pasid) {
3096− unsigned long flags;
3097−
3098− spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
3099− idr_remove(&adev->vm_manager.pasid_idr, vm->pasid);
3100− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
3101−
3102− /* Free the original amdgpu allocated pasid
3103− * Will be replaced with kfd allocated pasid
3104− */
3105− amdgpu_pasid_free(vm->pasid);
3106− vm->pasid = 0;
3107− }
3108−
31093106 /* Free the shadow bo for compute VM */
31103107 amdgpu_bo_unref(&to_amdgpu_bo_vm(vm->root.bo)->shadow);
31113108
3112− if (pasid)
3113− vm->pasid = pasid;
3114−
31153109 goto unreserve_bo;
31163110
3117−free_idr:
3118− if (pasid) {
3119− unsigned long flags;
3120−
3121− spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
3122− idr_remove(&adev->vm_manager.pasid_idr, pasid);
3123− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
3124− }
31253111 unreserve_bo:
31263112 amdgpu_bo_unreserve(vm->root.bo);
31273113 return r;
@@ -3137,14 +3123,7 @@ unreserve_bo: · 9 unmodified lines
31373123 */
31383124 void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
31393125 {
3140− if (vm->pasid) {
3141− unsigned long flags;
3142−
3143− spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
3144− idr_remove(&adev->vm_manager.pasid_idr, vm->pasid);
3145− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
3146− }
3147− vm->pasid = 0;
3126+ amdgpu_vm_set_pasid(adev, vm, 0);
31483127 vm->is_compute_context = false;
31493128 }
31503129
@@ -3168,15 +3147,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 17 unmodified lines
31683147
31693148 root = amdgpu_bo_ref(vm->root.bo);
31703149 amdgpu_bo_reserve(root, true);
3171− if (vm->pasid) {
3172− unsigned long flags;
3173−
3174− spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
3175− idr_remove(&adev->vm_manager.pasid_idr, vm->pasid);
3176− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
3177− vm->pasid = 0;
3178− }
3179−
3150+ amdgpu_vm_set_pasid(adev, vm, 0);
31803151 dma_fence_wait(vm->last_unlocked, false);
31813152 dma_fence_put(vm->last_unlocked);
31823153
@@ -3258,8 +3229,7 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev) · 75 unmodified lines
32583229 adev->vm_manager.vm_update_mode = 0;
32593230 #endif
32603231
3261− idr_init(&adev->vm_manager.pasid_idr);
3262− spin_lock_init(&adev->vm_manager.pasid_lock);
3232+ xa_init_flags(&adev->vm_manager.pasids, XA_FLAGS_LOCK_IRQ);
32633233 }
32643234
32653235 /**
@@ -3271,8 +3241,8 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev) · 5 unmodified lines
32713241 */
32723242 void amdgpu_vm_manager_fini(struct amdgpu_device *adev)
32733243 {
3274− WARN_ON(!idr_is_empty(&adev->vm_manager.pasid_idr));
3275− idr_destroy(&adev->vm_manager.pasid_idr);
3244+ WARN_ON(!xa_empty(&adev->vm_manager.pasids));
3245+ xa_destroy(&adev->vm_manager.pasids);
32763246
32773247 amdgpu_vmid_mgr_fini(adev);
32783248 }
@@ -3341,13 +3311,13 @@ void amdgpu_vm_get_task_info(struct amdgpu_device *adev, u32 pasid, · 62 unmodified lines
33413311 struct amdgpu_vm *vm;
33423312 unsigned long flags;
33433313
3344− spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
3314+ xa_lock_irqsave(&adev->vm_manager.pasids, flags);
33453315
3346− vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
3316+ vm = xa_load(&adev->vm_manager.pasids, pasid);
33473317 if (vm)
33483318 *task_info = vm->task_info;
33493319
3350− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
3320+ xa_unlock_irqrestore(&adev->vm_manager.pasids, flags);
33513321 }
33523322
33533323 /**
@@ -3375,12 +3345,13 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm) · 21 unmodified lines
33753345 * @adev: amdgpu device pointer
33763346 * @pasid: PASID of the VM
33773347 * @addr: Address of the fault
3348+ * @write_fault: true is write fault, false is read fault
33783349 *
33793350 * Try to gracefully handle a VM fault. Return true if the fault was handled and
33803351 * shouldn't be reported any more.
33813352 */
33823353 bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
3383− uint64_t addr)
3354+ uint64_t addr, bool write_fault)
33843355 {
33853356 bool is_compute_context = false;
33863357 struct amdgpu_bo *root;
@@ -3389,15 +3360,15 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid, · 2 unmodified lines
33893360 struct amdgpu_vm *vm;
33903361 int r;
33913362
3392− spin_lock_irqsave(&adev->vm_manager.pasid_lock, irqflags);
3393− vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
3363+ xa_lock_irqsave(&adev->vm_manager.pasids, irqflags);
3364+ vm = xa_load(&adev->vm_manager.pasids, pasid);
33943365 if (vm) {
33953366 root = amdgpu_bo_ref(vm->root.bo);
33963367 is_compute_context = vm->is_compute_context;
33973368 } else {
33983369 root = NULL;
33993370 }
3400− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, irqflags);
3371+ xa_unlock_irqrestore(&adev->vm_manager.pasids, irqflags);
34013372
34023373 if (!root)
34033374 return false;
@@ -3405,7 +3376,7 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid, · 1 unmodified line
34053376 addr /= AMDGPU_GPU_PAGE_SIZE;
34063377
34073378 if (is_compute_context &&
3408− !svm_range_restore_pages(adev, pasid, addr)) {
3379+ !svm_range_restore_pages(adev, pasid, addr, write_fault)) {
34093380 amdgpu_bo_unref(&root);
34103381 return true;
34113382 }
@@ -3415,11 +3386,11 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid, · 3 unmodified lines
34153386 goto error_unref;
34163387
34173388 /* Double check that the VM still exists */
3418− spin_lock_irqsave(&adev->vm_manager.pasid_lock, irqflags);
3419− vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
3389+ xa_lock_irqsave(&adev->vm_manager.pasids, irqflags);
3390+ vm = xa_load(&adev->vm_manager.pasids, pasid);
34203391 if (vm && vm->root.bo != root)
34213392 vm = NULL;
3422− spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, irqflags);
3393+ xa_unlock_irqrestore(&adev->vm_manager.pasids, irqflags);
34233394 if (!vm)
34243395 goto error_unlock;
34253396
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h+8−6
@@ -359,8 +359,7 @@ struct amdgpu_vm_manager { · 358 unmodified lines
359359 /* PASID to VM mapping, will be used in interrupt context to
360360 * look up VM of a page fault
361361 */
362− struct idr pasid_idr;
363− spinlock_t pasid_lock;
362+ struct xarray pasids;
364363 };
365364
366365 struct amdgpu_bo_va_mapping;
@@ -375,9 +374,12 @@ extern const struct amdgpu_vm_update_funcs amdgpu_vm_sdma_funcs; · 8 unmodified lines
375374 void amdgpu_vm_manager_init(struct amdgpu_device *adev);
376375 void amdgpu_vm_manager_fini(struct amdgpu_device *adev);
377376
377+int amdgpu_vm_set_pasid(struct amdgpu_device *adev, struct amdgpu_vm *vm,
378+ u32 pasid);
379+
378380 long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout);
379−int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, u32 pasid);
380−int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, u32 pasid);
381+int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
382+int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
381383 void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
382384 void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
383385 void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
@@ -406,7 +408,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · 22 unmodified lines
406408 struct dma_fence **fence, bool *free_table);
407409 int amdgpu_vm_bo_update(struct amdgpu_device *adev,
408410 struct amdgpu_bo_va *bo_va,
409− bool clear);
411+ bool clear, bool *table_freed);
410412 bool amdgpu_vm_evictable(struct amdgpu_bo *bo);
411413 void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
412414 struct amdgpu_bo *bo, bool evicted);
@@ -446,7 +448,7 @@ void amdgpu_vm_check_compute_bug(struct amdgpu_device *adev); · 33 unmodified lines
446448 void amdgpu_vm_get_task_info(struct amdgpu_device *adev, u32 pasid,
447449 struct amdgpu_task_info *task_info);
448450 bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
449− uint64_t addr);
451+ uint64_t addr, bool write_fault);
450452
451453 void amdgpu_vm_set_task_info(struct amdgpu_vm *vm);
452454
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c+136−4
@@ -32,6 +32,10 @@ · 31 unmodified lines
3232 #include "wafl/wafl2_4_0_0_smn.h"
3333 #include "wafl/wafl2_4_0_0_sh_mask.h"
3434
35+#define smnPCS_XGMI23_PCS_ERROR_STATUS 0x11a01210
36+#define smnPCS_XGMI3X16_PCS_ERROR_STATUS 0x11a0020c
37+#define smnPCS_GOPX1_PCS_ERROR_STATUS 0x12200210
38+
3539 static DEFINE_MUTEX(xgmi_mutex);
3640
3741 #define AMDGPU_MAX_XGMI_DEVICE_PER_HIVE 4
@@ -63,6 +67,33 @@ static const int wafl_pcs_err_status_reg_arct[] = { · 25 unmodified lines
6367 smnPCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS + 0x100000,
6468 };
6569
70+static const int xgmi23_pcs_err_status_reg_aldebaran[] = {
71+ smnPCS_XGMI23_PCS_ERROR_STATUS,
72+ smnPCS_XGMI23_PCS_ERROR_STATUS + 0x100000,
73+ smnPCS_XGMI23_PCS_ERROR_STATUS + 0x200000,
74+ smnPCS_XGMI23_PCS_ERROR_STATUS + 0x300000,
75+ smnPCS_XGMI23_PCS_ERROR_STATUS + 0x400000,
76+ smnPCS_XGMI23_PCS_ERROR_STATUS + 0x500000,
77+ smnPCS_XGMI23_PCS_ERROR_STATUS + 0x600000,
78+ smnPCS_XGMI23_PCS_ERROR_STATUS + 0x700000
79+};
80+
81+static const int xgmi3x16_pcs_err_status_reg_aldebaran[] = {
82+ smnPCS_XGMI3X16_PCS_ERROR_STATUS,
83+ smnPCS_XGMI3X16_PCS_ERROR_STATUS + 0x100000,
84+ smnPCS_XGMI3X16_PCS_ERROR_STATUS + 0x200000,
85+ smnPCS_XGMI3X16_PCS_ERROR_STATUS + 0x300000,
86+ smnPCS_XGMI3X16_PCS_ERROR_STATUS + 0x400000,
87+ smnPCS_XGMI3X16_PCS_ERROR_STATUS + 0x500000,
88+ smnPCS_XGMI3X16_PCS_ERROR_STATUS + 0x600000,
89+ smnPCS_XGMI3X16_PCS_ERROR_STATUS + 0x700000
90+};
91+
92+static const int walf_pcs_err_status_reg_aldebaran[] = {
93+ smnPCS_GOPX1_PCS_ERROR_STATUS,
94+ smnPCS_GOPX1_PCS_ERROR_STATUS + 0x100000
95+};
96+
6697 static const struct amdgpu_pcs_ras_field xgmi_pcs_ras_fields[] = {
6798 {"XGMI PCS DataLossErr",
6899 SOC15_REG_FIELD(XGMI0_PCS_GOPX16_PCS_ERROR_STATUS, DataLossErr)},
@@ -486,6 +517,44 @@ int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev, · 417 unmodified lines
486517 return -EINVAL;
487518 }
488519
520+int amdgpu_xgmi_get_num_links(struct amdgpu_device *adev,
521+ struct amdgpu_device *peer_adev)
522+{
523+ struct psp_xgmi_topology_info *top = &adev->psp.xgmi_context.top_info;
524+ int i;
525+
526+ for (i = 0 ; i < top->num_nodes; ++i)
527+ if (top->nodes[i].node_id == peer_adev->gmc.xgmi.node_id)
528+ return top->nodes[i].num_links;
529+ return -EINVAL;
530+}
531+
532+/*
533+ * Devices that support extended data require the entire hive to initialize with
534+ * the shared memory buffer flag set.
535+ *
536+ * Hive locks and conditions apply - see amdgpu_xgmi_add_device
537+ */
538+static int amdgpu_xgmi_initialize_hive_get_data_partition(struct amdgpu_hive_info *hive,
539+ bool set_extended_data)
540+{
541+ struct amdgpu_device *tmp_adev;
542+ int ret;
543+
544+ list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {
545+ ret = psp_xgmi_initialize(&tmp_adev->psp, set_extended_data, false);
546+ if (ret) {
547+ dev_err(tmp_adev->dev,
548+ "XGMI: Failed to initialize xgmi session for data partition %i\n",
549+ set_extended_data);
550+ return ret;
551+ }
552+
553+ }
554+
555+ return 0;
556+}
557+
489558 int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
490559 {
491560 struct psp_xgmi_topology_info *top_info;
@@ -500,7 +569,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · 8 unmodified lines
500569
501570 if (!adev->gmc.xgmi.pending_reset &&
502571 amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP)) {
503− ret = psp_xgmi_initialize(&adev->psp);
572+ ret = psp_xgmi_initialize(&adev->psp, false, true);
504573 if (ret) {
505574 dev_err(adev->dev,
506575 "XGMI: Failed to initialize xgmi session\n");
@@ -563,7 +632,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · 56 unmodified lines
563632 /* get latest topology info for each device from psp */
564633 list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {
565634 ret = psp_xgmi_get_topology_info(&tmp_adev->psp, count,
566− &tmp_adev->psp.xgmi_context.top_info);
635+ &tmp_adev->psp.xgmi_context.top_info, false);
567636 if (ret) {
568637 dev_err(tmp_adev->dev,
569638 "XGMI: Get topology failure on device %llx, hive %llx, ret %d",
@@ -573,6 +642,34 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · 3 unmodified lines
573642 goto exit_unlock;
574643 }
575644 }
645+
646+ /* get topology again for hives that support extended data */
647+ if (adev->psp.xgmi_context.supports_extended_data) {
648+
649+ /* initialize the hive to get extended data. */
650+ ret = amdgpu_xgmi_initialize_hive_get_data_partition(hive, true);
651+ if (ret)
652+ goto exit_unlock;
653+
654+ /* get the extended data. */
655+ list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {
656+ ret = psp_xgmi_get_topology_info(&tmp_adev->psp, count,
657+ &tmp_adev->psp.xgmi_context.top_info, true);
658+ if (ret) {
659+ dev_err(tmp_adev->dev,
660+ "XGMI: Get topology for extended data failure on device %llx, hive %llx, ret %d",
661+ tmp_adev->gmc.xgmi.node_id,
662+ tmp_adev->gmc.xgmi.hive_id, ret);
663+ goto exit_unlock;
664+ }
665+ }
666+
667+ /* initialize the hive to get non-extended data for the next round. */
668+ ret = amdgpu_xgmi_initialize_hive_get_data_partition(hive, false);
669+ if (ret)
670+ goto exit_unlock;
671+
672+ }
576673 }
577674
578675 if (!ret && !adev->gmc.xgmi.pending_reset)
@@ -651,7 +748,6 @@ static int amdgpu_xgmi_ras_late_init(struct amdgpu_device *adev) · 72 unmodified lines
651748 adev->gmc.xgmi.ras_if->block = AMDGPU_RAS_BLOCK__XGMI_WAFL;
652749 adev->gmc.xgmi.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
653750 adev->gmc.xgmi.ras_if->sub_block_index = 0;
654− strcpy(adev->gmc.xgmi.ras_if->name, "xgmi_wafl");
655751 }
656752 ih_info.head = fs_info.head = *adev->gmc.xgmi.ras_if;
657753 r = amdgpu_ras_late_init(adev, adev->gmc.xgmi.ras_if,
@@ -706,6 +802,17 @@ static void amdgpu_xgmi_reset_ras_error_count(struct amdgpu_device *adev) · 48 unmodified lines
706802 pcs_clear_status(adev,
707803 xgmi_pcs_err_status_reg_vg20[i]);
708804 break;
805+ case CHIP_ALDEBARAN:
806+ for (i = 0; i < ARRAY_SIZE(xgmi23_pcs_err_status_reg_aldebaran); i++)
807+ pcs_clear_status(adev,
808+ xgmi23_pcs_err_status_reg_aldebaran[i]);
809+ for (i = 0; i < ARRAY_SIZE(xgmi23_pcs_err_status_reg_aldebaran); i++)
810+ pcs_clear_status(adev,
811+ xgmi23_pcs_err_status_reg_aldebaran[i]);
812+ for (i = 0; i < ARRAY_SIZE(walf_pcs_err_status_reg_aldebaran); i++)
813+ pcs_clear_status(adev,
814+ walf_pcs_err_status_reg_aldebaran[i]);
815+ break;
709816 default:
710817 break;
711818 }
@@ -783,7 +890,6 @@ static int amdgpu_xgmi_query_ras_error_count(struct amdgpu_device *adev, · 71 unmodified lines
783890 }
784891 break;
785892 case CHIP_VEGA20:
786− default:
787893 /* check xgmi pcs error */
788894 for (i = 0; i < ARRAY_SIZE(xgmi_pcs_err_status_reg_vg20); i++) {
789895 data = RREG32_PCIE(xgmi_pcs_err_status_reg_vg20[i]);
@@ -799,6 +905,32 @@ static int amdgpu_xgmi_query_ras_error_count(struct amdgpu_device *adev, · 9 unmodified lines
799905 data, &ue_cnt, &ce_cnt, false);
800906 }
801907 break;
908+ case CHIP_ALDEBARAN:
909+ /* check xgmi23 pcs error */
910+ for (i = 0; i < ARRAY_SIZE(xgmi23_pcs_err_status_reg_aldebaran); i++) {
911+ data = RREG32_PCIE(xgmi23_pcs_err_status_reg_aldebaran[i]);
912+ if (data)
913+ amdgpu_xgmi_query_pcs_error_status(adev,
914+ data, &ue_cnt, &ce_cnt, true);
915+ }
916+ /* check xgmi3x16 pcs error */
917+ for (i = 0; i < ARRAY_SIZE(xgmi3x16_pcs_err_status_reg_aldebaran); i++) {
918+ data = RREG32_PCIE(xgmi3x16_pcs_err_status_reg_aldebaran[i]);
919+ if (data)
920+ amdgpu_xgmi_query_pcs_error_status(adev,
921+ data, &ue_cnt, &ce_cnt, true);
922+ }
923+ /* check wafl pcs error */
924+ for (i = 0; i < ARRAY_SIZE(walf_pcs_err_status_reg_aldebaran); i++) {
925+ data = RREG32_PCIE(walf_pcs_err_status_reg_aldebaran[i]);
926+ if (data)
927+ amdgpu_xgmi_query_pcs_error_status(adev,
928+ data, &ue_cnt, &ce_cnt, false);
929+ }
930+ break;
931+ default:
932+ dev_warn(adev->dev, "XGMI RAS error query not supported");
933+ break;
802934 }
803935
804936 adev->gmc.xgmi.ras_funcs->reset_ras_error_count(adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h+2−0
@@ -59,6 +59,8 @@ int amdgpu_xgmi_remove_device(struct amdgpu_device *adev); · 58 unmodified lines
5959 int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate);
6060 int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev,
6161 struct amdgpu_device *peer_adev);
62+int amdgpu_xgmi_get_num_links(struct amdgpu_device *adev,
63+ struct amdgpu_device *peer_adev);
6264 uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev,
6365 uint64_t addr);
6466 static inline bool amdgpu_xgmi_same_hive(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c+1−1
@@ -851,7 +851,7 @@ void amdgpu_atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode · 850 unmodified lines
851851 pll->reference_div = amdgpu_crtc->pll_reference_div;
852852 pll->post_div = amdgpu_crtc->pll_post_div;
853853
854− amdgpu_pll_compute(pll, amdgpu_crtc->adjusted_clock, &pll_clock,
854+ amdgpu_pll_compute(adev, pll, amdgpu_crtc->adjusted_clock, &pll_clock,
855855 &fb_div, &frac_fb_div, &ref_div, &post_div);
856856
857857 amdgpu_atombios_crtc_program_ss(adev, ATOM_DISABLE, amdgpu_crtc->pll_id,
drivers/gpu/drm/amd/amdgpu/cik.c+5−5
@@ -70,7 +70,7 @@ · 69 unmodified lines
7070
7171 #include "amdgpu_dm.h"
7272 #include "amdgpu_amdkfd.h"
73−#include "dce_virtual.h"
73+#include "amdgpu_vkms.h"
7474
7575 static const struct amdgpu_video_codec_info cik_video_codecs_encode_array[] =
7676 {
@@ -2259,7 +2259,7 @@ int cik_set_ip_blocks(struct amdgpu_device *adev) · 2182 unmodified lines
22592259 amdgpu_device_ip_block_add(adev, &cik_sdma_ip_block);
22602260 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
22612261 if (adev->enable_virtual_display)
2262− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2262+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
22632263 #if defined(CONFIG_DRM_AMD_DC)
22642264 else if (amdgpu_device_has_dc_support(adev))
22652265 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2277,7 +2277,7 @@ int cik_set_ip_blocks(struct amdgpu_device *adev) · 11 unmodified lines
22772277 amdgpu_device_ip_block_add(adev, &cik_sdma_ip_block);
22782278 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
22792279 if (adev->enable_virtual_display)
2280− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2280+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
22812281 #if defined(CONFIG_DRM_AMD_DC)
22822282 else if (amdgpu_device_has_dc_support(adev))
22832283 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2295,7 +2295,7 @@ int cik_set_ip_blocks(struct amdgpu_device *adev) · 11 unmodified lines
22952295 amdgpu_device_ip_block_add(adev, &cik_sdma_ip_block);
22962296 amdgpu_device_ip_block_add(adev, &kv_smu_ip_block);
22972297 if (adev->enable_virtual_display)
2298− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2298+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
22992299 #if defined(CONFIG_DRM_AMD_DC)
23002300 else if (amdgpu_device_has_dc_support(adev))
23012301 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2315,7 +2315,7 @@ int cik_set_ip_blocks(struct amdgpu_device *adev) · 13 unmodified lines
23152315 amdgpu_device_ip_block_add(adev, &cik_sdma_ip_block);
23162316 amdgpu_device_ip_block_add(adev, &kv_smu_ip_block);
23172317 if (adev->enable_virtual_display)
2318− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2318+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
23192319 #if defined(CONFIG_DRM_AMD_DC)
23202320 else if (amdgpu_device_has_dc_support(adev))
23212321 amdgpu_device_ip_block_add(adev, &dm_ip_block);
drivers/gpu/drm/amd/amdgpu/cyan_skillfish_reg_init.c+51−0
@@ -0,0 +1,51 @@
1+/*
2+ * Copyright 2018 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ */
23+#include "amdgpu.h"
24+#include "nv.h"
25+
26+#include "soc15_common.h"
27+#include "soc15_hw_ip.h"
28+#include "cyan_skillfish_ip_offset.h"
29+
30+int cyan_skillfish_reg_base_init(struct amdgpu_device *adev)
31+{
32+ /* HW has more IP blocks, only initialized the blocke needed by driver */
33+ uint32_t i;
34+ for (i = 0 ; i < MAX_INSTANCE ; ++i) {
35+ adev->reg_offset[GC_HWIP][i] = (uint32_t *)(&(GC_BASE.instance[i]));
36+ adev->reg_offset[HDP_HWIP][i] = (uint32_t *)(&(HDP_BASE.instance[i]));
37+ adev->reg_offset[MMHUB_HWIP][i] = (uint32_t *)(&(MMHUB_BASE.instance[i]));
38+ adev->reg_offset[ATHUB_HWIP][i] = (uint32_t *)(&(ATHUB_BASE.instance[i]));
39+ adev->reg_offset[NBIO_HWIP][i] = (uint32_t *)(&(NBIO_BASE.instance[i]));
40+ adev->reg_offset[MP0_HWIP][i] = (uint32_t *)(&(MP0_BASE.instance[i]));
41+ adev->reg_offset[MP1_HWIP][i] = (uint32_t *)(&(MP1_BASE.instance[i]));
42+ adev->reg_offset[VCN_HWIP][i] = (uint32_t *)(&(UVD0_BASE.instance[i]));
43+ adev->reg_offset[DF_HWIP][i] = (uint32_t *)(&(DF_BASE.instance[i]));
44+ adev->reg_offset[DCE_HWIP][i] = (uint32_t *)(&(DMU_BASE.instance[i]));
45+ adev->reg_offset[OSSSYS_HWIP][i] = (uint32_t *)(&(OSSSYS_BASE.instance[i]));
46+ adev->reg_offset[SDMA0_HWIP][i] = (uint32_t *)(&(GC_BASE.instance[i]));
47+ adev->reg_offset[SDMA1_HWIP][i] = (uint32_t *)(&(GC_BASE.instance[i]));
48+ adev->reg_offset[SMUIO_HWIP][i] = (uint32_t *)(&(SMUIO_BASE.instance[i]));
49+ }
50+ return 0;
51+}
drivers/gpu/drm/amd/amdgpu/dce_virtual.c+0−780
@@ -1,780 +0,0 @@
1−/*
2− * Copyright 2014 Advanced Micro Devices, Inc.
3− *
4− * Permission is hereby granted, free of charge, to any person obtaining a
5− * copy of this software and associated documentation files (the "Software"),
6− * to deal in the Software without restriction, including without limitation
7− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8− * and/or sell copies of the Software, and to permit persons to whom the
9− * Software is furnished to do so, subject to the following conditions:
10− *
11− * The above copyright notice and this permission notice shall be included in
12− * all copies or substantial portions of the Software.
13− *
14− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17− * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20− * OTHER DEALINGS IN THE SOFTWARE.
21− *
22− */
23−
24−#include <drm/drm_vblank.h>
25−
26−#include "amdgpu.h"
27−#include "amdgpu_pm.h"
28−#include "amdgpu_i2c.h"
29−#include "atom.h"
30−#include "amdgpu_pll.h"
31−#include "amdgpu_connectors.h"
32−#ifdef CONFIG_DRM_AMDGPU_SI
33−#include "dce_v6_0.h"
34−#endif
35−#ifdef CONFIG_DRM_AMDGPU_CIK
36−#include "dce_v8_0.h"
37−#endif
38−#include "dce_v10_0.h"
39−#include "dce_v11_0.h"
40−#include "dce_virtual.h"
41−#include "ivsrcid/ivsrcid_vislands30.h"
42−#include "amdgpu_display.h"
43−
44−#define DCE_VIRTUAL_VBLANK_PERIOD 16666666
45−
46−
47−static void dce_virtual_set_display_funcs(struct amdgpu_device *adev);
48−static void dce_virtual_set_irq_funcs(struct amdgpu_device *adev);
49−static int dce_virtual_connector_encoder_init(struct amdgpu_device *adev,
50− int index);
51−static int dce_virtual_pageflip(struct amdgpu_device *adev,
52− unsigned crtc_id);
53−static enum hrtimer_restart dce_virtual_vblank_timer_handle(struct hrtimer *vblank_timer);
54−static void dce_virtual_set_crtc_vblank_interrupt_state(struct amdgpu_device *adev,
55− int crtc,
56− enum amdgpu_interrupt_state state);
57−
58−static u32 dce_virtual_vblank_get_counter(struct amdgpu_device *adev, int crtc)
59−{
60− return 0;
61−}
62−
63−static void dce_virtual_page_flip(struct amdgpu_device *adev,
64− int crtc_id, u64 crtc_base, bool async)
65−{
66− return;
67−}
68−
69−static int dce_virtual_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc,
70− u32 *vbl, u32 *position)
71−{
72− *vbl = 0;
73− *position = 0;
74−
75− return -EINVAL;
76−}
77−
78−static bool dce_virtual_hpd_sense(struct amdgpu_device *adev,
79− enum amdgpu_hpd_id hpd)
80−{
81− return true;
82−}
83−
84−static void dce_virtual_hpd_set_polarity(struct amdgpu_device *adev,
85− enum amdgpu_hpd_id hpd)
86−{
87− return;
88−}
89−
90−static u32 dce_virtual_hpd_get_gpio_reg(struct amdgpu_device *adev)
91−{
92− return 0;
93−}
94−
95−/**
96− * dce_virtual_bandwidth_update - program display watermarks
97− *
98− * @adev: amdgpu_device pointer
99− *
100− * Calculate and program the display watermarks and line
101− * buffer allocation (CIK).
102− */
103−static void dce_virtual_bandwidth_update(struct amdgpu_device *adev)
104−{
105− return;
106−}
107−
108−static int dce_virtual_crtc_gamma_set(struct drm_crtc *crtc, u16 *red,
109− u16 *green, u16 *blue, uint32_t size,
110− struct drm_modeset_acquire_ctx *ctx)
111−{
112− return 0;
113−}
114−
115−static void dce_virtual_crtc_destroy(struct drm_crtc *crtc)
116−{
117− struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
118−
119− drm_crtc_cleanup(crtc);
120− kfree(amdgpu_crtc);
121−}
122−
123−static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
124− .cursor_set2 = NULL,
125− .cursor_move = NULL,
126− .gamma_set = dce_virtual_crtc_gamma_set,
127− .set_config = amdgpu_display_crtc_set_config,
128− .destroy = dce_virtual_crtc_destroy,
129− .page_flip_target = amdgpu_display_crtc_page_flip_target,
130− .get_vblank_counter = amdgpu_get_vblank_counter_kms,
131− .enable_vblank = amdgpu_enable_vblank_kms,
132− .disable_vblank = amdgpu_disable_vblank_kms,
133− .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
134−};
135−
136−static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
137−{
138− struct drm_device *dev = crtc->dev;
139− struct amdgpu_device *adev = drm_to_adev(dev);
140− struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
141− unsigned type;
142−
143− switch (mode) {
144− case DRM_MODE_DPMS_ON:
145− amdgpu_crtc->enabled = true;
146− /* Make sure VBLANK interrupts are still enabled */
147− type = amdgpu_display_crtc_idx_to_irq_type(adev,
148− amdgpu_crtc->crtc_id);
149− amdgpu_irq_update(adev, &adev->crtc_irq, type);
150− drm_crtc_vblank_on(crtc);
151− break;
152− case DRM_MODE_DPMS_STANDBY:
153− case DRM_MODE_DPMS_SUSPEND:
154− case DRM_MODE_DPMS_OFF:
155− drm_crtc_vblank_off(crtc);
156− amdgpu_crtc->enabled = false;
157− break;
158− }
159−}
160−
161−
162−static void dce_virtual_crtc_prepare(struct drm_crtc *crtc)
163−{
164− dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
165−}
166−
167−static void dce_virtual_crtc_commit(struct drm_crtc *crtc)
168−{
169− dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
170−}
171−
172−static void dce_virtual_crtc_disable(struct drm_crtc *crtc)
173−{
174− struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
175− struct drm_device *dev = crtc->dev;
176−
177− if (dev->num_crtcs)
178− drm_crtc_vblank_off(crtc);
179−
180− amdgpu_crtc->enabled = false;
181− amdgpu_crtc->pll_id = ATOM_PPLL_INVALID;
182− amdgpu_crtc->encoder = NULL;
183− amdgpu_crtc->connector = NULL;
184−}
185−
186−static int dce_virtual_crtc_mode_set(struct drm_crtc *crtc,
187− struct drm_display_mode *mode,
188− struct drm_display_mode *adjusted_mode,
189− int x, int y, struct drm_framebuffer *old_fb)
190−{
191− struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
192−
193− /* update the hw version fpr dpm */
194− amdgpu_crtc->hw_mode = *adjusted_mode;
195−
196− return 0;
197−}
198−
199−static bool dce_virtual_crtc_mode_fixup(struct drm_crtc *crtc,
200− const struct drm_display_mode *mode,
201− struct drm_display_mode *adjusted_mode)
202−{
203− return true;
204−}
205−
206−
207−static int dce_virtual_crtc_set_base(struct drm_crtc *crtc, int x, int y,
208− struct drm_framebuffer *old_fb)
209−{
210− return 0;
211−}
212−
213−static int dce_virtual_crtc_set_base_atomic(struct drm_crtc *crtc,
214− struct drm_framebuffer *fb,
215− int x, int y, enum mode_set_atomic state)
216−{
217− return 0;
218−}
219−
220−static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
221− .dpms = dce_virtual_crtc_dpms,
222− .mode_fixup = dce_virtual_crtc_mode_fixup,
223− .mode_set = dce_virtual_crtc_mode_set,
224− .mode_set_base = dce_virtual_crtc_set_base,
225− .mode_set_base_atomic = dce_virtual_crtc_set_base_atomic,
226− .prepare = dce_virtual_crtc_prepare,
227− .commit = dce_virtual_crtc_commit,
228− .disable = dce_virtual_crtc_disable,
229− .get_scanout_position = amdgpu_crtc_get_scanout_position,
230−};
231−
232−static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
233−{
234− struct amdgpu_crtc *amdgpu_crtc;
235−
236− amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) +
237− (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL);
238− if (amdgpu_crtc == NULL)
239− return -ENOMEM;
240−
241− drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_virtual_crtc_funcs);
242−
243− drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256);
244− amdgpu_crtc->crtc_id = index;
245− adev->mode_info.crtcs[index] = amdgpu_crtc;
246−
247− amdgpu_crtc->pll_id = ATOM_PPLL_INVALID;
248− amdgpu_crtc->encoder = NULL;
249− amdgpu_crtc->connector = NULL;
250− amdgpu_crtc->vsync_timer_enabled = AMDGPU_IRQ_STATE_DISABLE;
251− drm_crtc_helper_add(&amdgpu_crtc->base, &dce_virtual_crtc_helper_funcs);
252−
253− hrtimer_init(&amdgpu_crtc->vblank_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
254− hrtimer_set_expires(&amdgpu_crtc->vblank_timer, DCE_VIRTUAL_VBLANK_PERIOD);
255− amdgpu_crtc->vblank_timer.function = dce_virtual_vblank_timer_handle;
256− hrtimer_start(&amdgpu_crtc->vblank_timer,
257− DCE_VIRTUAL_VBLANK_PERIOD, HRTIMER_MODE_REL);
258− return 0;
259−}
260−
261−static int dce_virtual_early_init(void *handle)
262−{
263− struct amdgpu_device *adev = (struct amdgpu_device *)handle;
264−
265− dce_virtual_set_display_funcs(adev);
266− dce_virtual_set_irq_funcs(adev);
267−
268− adev->mode_info.num_hpd = 1;
269− adev->mode_info.num_dig = 1;
270− return 0;
271−}
272−
273−static struct drm_encoder *
274−dce_virtual_encoder(struct drm_connector *connector)
275−{
276− struct drm_encoder *encoder;
277−
278− drm_connector_for_each_possible_encoder(connector, encoder) {
279− if (encoder->encoder_type == DRM_MODE_ENCODER_VIRTUAL)
280− return encoder;
281− }
282−
283− /* pick the first one */
284− drm_connector_for_each_possible_encoder(connector, encoder)
285− return encoder;
286−
287− return NULL;
288−}
289−
290−static int dce_virtual_get_modes(struct drm_connector *connector)
291−{
292− struct drm_device *dev = connector->dev;
293− struct drm_display_mode *mode = NULL;
294− unsigned i;
295− static const struct mode_size {
296− int w;
297− int h;
298− } common_modes[] = {
299− { 640, 480},
300− { 720, 480},
301− { 800, 600},
302− { 848, 480},
303− {1024, 768},
304− {1152, 768},
305− {1280, 720},
306− {1280, 800},
307− {1280, 854},
308− {1280, 960},
309− {1280, 1024},
310− {1440, 900},
311− {1400, 1050},
312− {1680, 1050},
313− {1600, 1200},
314− {1920, 1080},
315− {1920, 1200},
316− {2560, 1440},
317− {4096, 3112},
318− {3656, 2664},
319− {3840, 2160},
320− {4096, 2160},
321− };
322−
323− for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
324− mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false);
325− drm_mode_probed_add(connector, mode);
326− }
327−
328− return 0;
329−}
330−
331−static enum drm_mode_status dce_virtual_mode_valid(struct drm_connector *connector,
332− struct drm_display_mode *mode)
333−{
334− return MODE_OK;
335−}
336−
337−static int
338−dce_virtual_dpms(struct drm_connector *connector, int mode)
339−{
340− return 0;
341−}
342−
343−static int
344−dce_virtual_set_property(struct drm_connector *connector,
345− struct drm_property *property,
346− uint64_t val)
347−{
348− return 0;
349−}
350−
351−static void dce_virtual_destroy(struct drm_connector *connector)
352−{
353− drm_connector_unregister(connector);
354− drm_connector_cleanup(connector);
355− kfree(connector);
356−}
357−
358−static void dce_virtual_force(struct drm_connector *connector)
359−{
360− return;
361−}
362−
363−static const struct drm_connector_helper_funcs dce_virtual_connector_helper_funcs = {
364− .get_modes = dce_virtual_get_modes,
365− .mode_valid = dce_virtual_mode_valid,
366− .best_encoder = dce_virtual_encoder,
367−};
368−
369−static const struct drm_connector_funcs dce_virtual_connector_funcs = {
370− .dpms = dce_virtual_dpms,
371− .fill_modes = drm_helper_probe_single_connector_modes,
372− .set_property = dce_virtual_set_property,
373− .destroy = dce_virtual_destroy,
374− .force = dce_virtual_force,
375−};
376−
377−static int dce_virtual_sw_init(void *handle)
378−{
379− int r, i;
380− struct amdgpu_device *adev = (struct amdgpu_device *)handle;
381−
382− r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, VISLANDS30_IV_SRCID_SMU_DISP_TIMER2_TRIGGER, &adev->crtc_irq);
383− if (r)
384− return r;
385−
386− adev_to_drm(adev)->max_vblank_count = 0;
387−
388− adev_to_drm(adev)->mode_config.funcs = &amdgpu_mode_funcs;
389−
390− adev_to_drm(adev)->mode_config.max_width = 16384;
391− adev_to_drm(adev)->mode_config.max_height = 16384;
392−
393− adev_to_drm(adev)->mode_config.preferred_depth = 24;
394− adev_to_drm(adev)->mode_config.prefer_shadow = 1;
395−
396− adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
397−
398− r = amdgpu_display_modeset_create_props(adev);
399− if (r)
400− return r;
401−
402− adev_to_drm(adev)->mode_config.max_width = 16384;
403− adev_to_drm(adev)->mode_config.max_height = 16384;
404−
405− /* allocate crtcs, encoders, connectors */
406− for (i = 0; i < adev->mode_info.num_crtc; i++) {
407− r = dce_virtual_crtc_init(adev, i);
408− if (r)
409− return r;
410− r = dce_virtual_connector_encoder_init(adev, i);
411− if (r)
412− return r;
413− }
414−
415− drm_kms_helper_poll_init(adev_to_drm(adev));
416−
417− adev->mode_info.mode_config_initialized = true;
418− return 0;
419−}
420−
421−static int dce_virtual_sw_fini(void *handle)
422−{
423− struct amdgpu_device *adev = (struct amdgpu_device *)handle;
424− int i = 0;
425−
426− for (i = 0; i < adev->mode_info.num_crtc; i++)
427− if (adev->mode_info.crtcs[i])
428− hrtimer_cancel(&adev->mode_info.crtcs[i]->vblank_timer);
429−
430− kfree(adev->mode_info.bios_hardcoded_edid);
431−
432− drm_kms_helper_poll_fini(adev_to_drm(adev));
433−
434− drm_mode_config_cleanup(adev_to_drm(adev));
435− /* clear crtcs pointer to avoid dce irq finish routine access freed data */
436− memset(adev->mode_info.crtcs, 0, sizeof(adev->mode_info.crtcs[0]) * AMDGPU_MAX_CRTCS);
437− adev->mode_info.mode_config_initialized = false;
438− return 0;
439−}
440−
441−static int dce_virtual_hw_init(void *handle)
442−{
443− struct amdgpu_device *adev = (struct amdgpu_device *)handle;
444−
445− switch (adev->asic_type) {
446−#ifdef CONFIG_DRM_AMDGPU_SI
447− case CHIP_TAHITI:
448− case CHIP_PITCAIRN:
449− case CHIP_VERDE:
450− case CHIP_OLAND:
451− dce_v6_0_disable_dce(adev);
452− break;
453−#endif
454−#ifdef CONFIG_DRM_AMDGPU_CIK
455− case CHIP_BONAIRE:
456− case CHIP_HAWAII:
457− case CHIP_KAVERI:
458− case CHIP_KABINI:
459− case CHIP_MULLINS:
460− dce_v8_0_disable_dce(adev);
461− break;
462−#endif
463− case CHIP_FIJI:
464− case CHIP_TONGA:
465− dce_v10_0_disable_dce(adev);
466− break;
467− case CHIP_CARRIZO:
468− case CHIP_STONEY:
469− case CHIP_POLARIS10:
470− case CHIP_POLARIS11:
471− case CHIP_VEGAM:
472− dce_v11_0_disable_dce(adev);
473− break;
474− case CHIP_TOPAZ:
475−#ifdef CONFIG_DRM_AMDGPU_SI
476− case CHIP_HAINAN:
477−#endif
478− /* no DCE */
479− break;
480− default:
481− break;
482− }
483− return 0;
484−}
485−
486−static int dce_virtual_hw_fini(void *handle)
487−{
488− return 0;
489−}
490−
491−static int dce_virtual_suspend(void *handle)
492−{
493− struct amdgpu_device *adev = (struct amdgpu_device *)handle;
494− int r;
495−
496− r = amdgpu_display_suspend_helper(adev);
497− if (r)
498− return r;
499− return dce_virtual_hw_fini(handle);
500−}
501−
502−static int dce_virtual_resume(void *handle)
503−{
504− struct amdgpu_device *adev = (struct amdgpu_device *)handle;
505− int r;
506−
507− r = dce_virtual_hw_init(handle);
508− if (r)
509− return r;
510− return amdgpu_display_resume_helper(adev);
511−}
512−
513−static bool dce_virtual_is_idle(void *handle)
514−{
515− return true;
516−}
517−
518−static int dce_virtual_wait_for_idle(void *handle)
519−{
520− return 0;
521−}
522−
523−static int dce_virtual_soft_reset(void *handle)
524−{
525− return 0;
526−}
527−
528−static int dce_virtual_set_clockgating_state(void *handle,
529− enum amd_clockgating_state state)
530−{
531− return 0;
532−}
533−
534−static int dce_virtual_set_powergating_state(void *handle,
535− enum amd_powergating_state state)
536−{
537− return 0;
538−}
539−
540−static const struct amd_ip_funcs dce_virtual_ip_funcs = {
541− .name = "dce_virtual",
542− .early_init = dce_virtual_early_init,
543− .late_init = NULL,
544− .sw_init = dce_virtual_sw_init,
545− .sw_fini = dce_virtual_sw_fini,
546− .hw_init = dce_virtual_hw_init,
547− .hw_fini = dce_virtual_hw_fini,
548− .suspend = dce_virtual_suspend,
549− .resume = dce_virtual_resume,
550− .is_idle = dce_virtual_is_idle,
551− .wait_for_idle = dce_virtual_wait_for_idle,
552− .soft_reset = dce_virtual_soft_reset,
553− .set_clockgating_state = dce_virtual_set_clockgating_state,
554− .set_powergating_state = dce_virtual_set_powergating_state,
555−};
556−
557−/* these are handled by the primary encoders */
558−static void dce_virtual_encoder_prepare(struct drm_encoder *encoder)
559−{
560− return;
561−}
562−
563−static void dce_virtual_encoder_commit(struct drm_encoder *encoder)
564−{
565− return;
566−}
567−
568−static void
569−dce_virtual_encoder_mode_set(struct drm_encoder *encoder,
570− struct drm_display_mode *mode,
571− struct drm_display_mode *adjusted_mode)
572−{
573− return;
574−}
575−
576−static void dce_virtual_encoder_disable(struct drm_encoder *encoder)
577−{
578− return;
579−}
580−
581−static void
582−dce_virtual_encoder_dpms(struct drm_encoder *encoder, int mode)
583−{
584− return;
585−}
586−
587−static bool dce_virtual_encoder_mode_fixup(struct drm_encoder *encoder,
588− const struct drm_display_mode *mode,
589− struct drm_display_mode *adjusted_mode)
590−{
591− return true;
592−}
593−
594−static const struct drm_encoder_helper_funcs dce_virtual_encoder_helper_funcs = {
595− .dpms = dce_virtual_encoder_dpms,
596− .mode_fixup = dce_virtual_encoder_mode_fixup,
597− .prepare = dce_virtual_encoder_prepare,
598− .mode_set = dce_virtual_encoder_mode_set,
599− .commit = dce_virtual_encoder_commit,
600− .disable = dce_virtual_encoder_disable,
601−};
602−
603−static void dce_virtual_encoder_destroy(struct drm_encoder *encoder)
604−{
605− drm_encoder_cleanup(encoder);
606− kfree(encoder);
607−}
608−
609−static const struct drm_encoder_funcs dce_virtual_encoder_funcs = {
610− .destroy = dce_virtual_encoder_destroy,
611−};
612−
613−static int dce_virtual_connector_encoder_init(struct amdgpu_device *adev,
614− int index)
615−{
616− struct drm_encoder *encoder;
617− struct drm_connector *connector;
618−
619− /* add a new encoder */
620− encoder = kzalloc(sizeof(struct drm_encoder), GFP_KERNEL);
621− if (!encoder)
622− return -ENOMEM;
623− encoder->possible_crtcs = 1 << index;
624− drm_encoder_init(adev_to_drm(adev), encoder, &dce_virtual_encoder_funcs,
625− DRM_MODE_ENCODER_VIRTUAL, NULL);
626− drm_encoder_helper_add(encoder, &dce_virtual_encoder_helper_funcs);
627−
628− connector = kzalloc(sizeof(struct drm_connector), GFP_KERNEL);
629− if (!connector) {
630− kfree(encoder);
631− return -ENOMEM;
632− }
633−
634− /* add a new connector */
635− drm_connector_init(adev_to_drm(adev), connector, &dce_virtual_connector_funcs,
636− DRM_MODE_CONNECTOR_VIRTUAL);
637− drm_connector_helper_add(connector, &dce_virtual_connector_helper_funcs);
638− connector->display_info.subpixel_order = SubPixelHorizontalRGB;
639− connector->interlace_allowed = false;
640− connector->doublescan_allowed = false;
641−
642− /* link them */
643− drm_connector_attach_encoder(connector, encoder);
644−
645− return 0;
646−}
647−
648−static const struct amdgpu_display_funcs dce_virtual_display_funcs = {
649− .bandwidth_update = &dce_virtual_bandwidth_update,
650− .vblank_get_counter = &dce_virtual_vblank_get_counter,
651− .backlight_set_level = NULL,
652− .backlight_get_level = NULL,
653− .hpd_sense = &dce_virtual_hpd_sense,
654− .hpd_set_polarity = &dce_virtual_hpd_set_polarity,
655− .hpd_get_gpio_reg = &dce_virtual_hpd_get_gpio_reg,
656− .page_flip = &dce_virtual_page_flip,
657− .page_flip_get_scanoutpos = &dce_virtual_crtc_get_scanoutpos,
658− .add_encoder = NULL,
659− .add_connector = NULL,
660−};
661−
662−static void dce_virtual_set_display_funcs(struct amdgpu_device *adev)
663−{
664− adev->mode_info.funcs = &dce_virtual_display_funcs;
665−}
666−
667−static int dce_virtual_pageflip(struct amdgpu_device *adev,
668− unsigned crtc_id)
669−{
670− unsigned long flags;
671− struct amdgpu_crtc *amdgpu_crtc;
672− struct amdgpu_flip_work *works;
673−
674− amdgpu_crtc = adev->mode_info.crtcs[crtc_id];
675−
676− if (crtc_id >= adev->mode_info.num_crtc) {
677− DRM_ERROR("invalid pageflip crtc %d\n", crtc_id);
678− return -EINVAL;
679− }
680−
681− /* IRQ could occur when in initial stage */
682− if (amdgpu_crtc == NULL)
683− return 0;
684−
685− spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);
686− works = amdgpu_crtc->pflip_works;
687− if (amdgpu_crtc->pflip_status != AMDGPU_FLIP_SUBMITTED) {
688− DRM_DEBUG_DRIVER("amdgpu_crtc->pflip_status = %d != "
689− "AMDGPU_FLIP_SUBMITTED(%d)\n",
690− amdgpu_crtc->pflip_status,
691− AMDGPU_FLIP_SUBMITTED);
692− spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags);
693− return 0;
694− }
695−
696− /* page flip completed. clean up */
697− amdgpu_crtc->pflip_status = AMDGPU_FLIP_NONE;
698− amdgpu_crtc->pflip_works = NULL;
699−
700− /* wakeup usersapce */
701− if (works->event)
702− drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event);
703−
704− spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags);
705−
706− drm_crtc_vblank_put(&amdgpu_crtc->base);
707− amdgpu_bo_unref(&works->old_abo);
708− kfree(works->shared);
709− kfree(works);
710−
711− return 0;
712−}
713−
714−static enum hrtimer_restart dce_virtual_vblank_timer_handle(struct hrtimer *vblank_timer)
715−{
716− struct amdgpu_crtc *amdgpu_crtc = container_of(vblank_timer,
717− struct amdgpu_crtc, vblank_timer);
718− struct drm_device *ddev = amdgpu_crtc->base.dev;
719− struct amdgpu_device *adev = drm_to_adev(ddev);
720− struct amdgpu_irq_src *source = adev->irq.client[AMDGPU_IRQ_CLIENTID_LEGACY].sources
721− [VISLANDS30_IV_SRCID_SMU_DISP_TIMER2_TRIGGER];
722− int irq_type = amdgpu_display_crtc_idx_to_irq_type(adev,
723− amdgpu_crtc->crtc_id);
724−
725− if (amdgpu_irq_enabled(adev, source, irq_type)) {
726− drm_handle_vblank(ddev, amdgpu_crtc->crtc_id);
727− dce_virtual_pageflip(adev, amdgpu_crtc->crtc_id);
728− }
729− hrtimer_start(vblank_timer, DCE_VIRTUAL_VBLANK_PERIOD,
730− HRTIMER_MODE_REL);
731−
732− return HRTIMER_NORESTART;
733−}
734−
735−static void dce_virtual_set_crtc_vblank_interrupt_state(struct amdgpu_device *adev,
736− int crtc,
737− enum amdgpu_interrupt_state state)
738−{
739− if (crtc >= adev->mode_info.num_crtc || !adev->mode_info.crtcs[crtc]) {
740− DRM_DEBUG("invalid crtc %d\n", crtc);
741− return;
742− }
743−
744− adev->mode_info.crtcs[crtc]->vsync_timer_enabled = state;
745− DRM_DEBUG("[FM]set crtc %d vblank interrupt state %d\n", crtc, state);
746−}
747−
748−
749−static int dce_virtual_set_crtc_irq_state(struct amdgpu_device *adev,
750− struct amdgpu_irq_src *source,
751− unsigned type,
752− enum amdgpu_interrupt_state state)
753−{
754− if (type > AMDGPU_CRTC_IRQ_VBLANK6)
755− return -EINVAL;
756−
757− dce_virtual_set_crtc_vblank_interrupt_state(adev, type, state);
758−
759− return 0;
760−}
761−
762−static const struct amdgpu_irq_src_funcs dce_virtual_crtc_irq_funcs = {
763− .set = dce_virtual_set_crtc_irq_state,
764− .process = NULL,
765−};
766−
767−static void dce_virtual_set_irq_funcs(struct amdgpu_device *adev)
768−{
769− adev->crtc_irq.num_types = adev->mode_info.num_crtc;
770− adev->crtc_irq.funcs = &dce_virtual_crtc_irq_funcs;
771−}
772−
773−const struct amdgpu_ip_block_version dce_virtual_ip_block =
774−{
775− .type = AMD_IP_BLOCK_TYPE_DCE,
776− .major = 1,
777− .minor = 0,
778− .rev = 0,
779− .funcs = &dce_virtual_ip_funcs,
780−};
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+143−18
@@ -56,6 +56,10 @@ · 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+
5963 #define F32_CE_PROGRAM_RAM_SIZE 65536
6064 #define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L
6165
@@ -181,6 +185,9 @@ · 119 unmodified lines
181185 #define GFX_RLCG_GC_READ (0x1 << 28)
182186 #define GFX_RLCG_MMHUB_WRITE (0x2 << 28)
183187
188+#define RLCG_ERROR_REPORT_ENABLED(adev) \
189+ (amdgpu_sriov_reg_indirect_mmhub(adev) || amdgpu_sriov_reg_indirect_gc(adev))
190+
184191 MODULE_FIRMWARE("amdgpu/navi10_ce.bin");
185192 MODULE_FIRMWARE("amdgpu/navi10_pfp.bin");
186193 MODULE_FIRMWARE("amdgpu/navi10_me.bin");
@@ -249,6 +256,39 @@ MODULE_FIRMWARE("amdgpu/yellow_carp_mec.bin"); · 62 unmodified lines
249256 MODULE_FIRMWARE("amdgpu/yellow_carp_mec2.bin");
250257 MODULE_FIRMWARE("amdgpu/yellow_carp_rlc.bin");
251258
259+MODULE_FIRMWARE("amdgpu/cyan_skillfish_ce.bin");
260+MODULE_FIRMWARE("amdgpu/cyan_skillfish_pfp.bin");
261+MODULE_FIRMWARE("amdgpu/cyan_skillfish_me.bin");
262+MODULE_FIRMWARE("amdgpu/cyan_skillfish_mec.bin");
263+MODULE_FIRMWARE("amdgpu/cyan_skillfish_mec2.bin");
264+MODULE_FIRMWARE("amdgpu/cyan_skillfish_rlc.bin");
265+
266+MODULE_FIRMWARE("amdgpu/cyan_skillfish2_ce.bin");
267+MODULE_FIRMWARE("amdgpu/cyan_skillfish2_pfp.bin");
268+MODULE_FIRMWARE("amdgpu/cyan_skillfish2_me.bin");
269+MODULE_FIRMWARE("amdgpu/cyan_skillfish2_mec.bin");
270+MODULE_FIRMWARE("amdgpu/cyan_skillfish2_mec2.bin");
271+MODULE_FIRMWARE("amdgpu/cyan_skillfish2_rlc.bin");
272+
273+static const struct soc15_reg_golden golden_settings_gc_10_0[] =
274+{
275+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_INDEX, 0xffffffff, 0x00000000),
276+ /* TA_GRAD_ADJ_UCONFIG -> TA_GRAD_ADJ */
277+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2544c382),
278+ /* VGT_TF_RING_SIZE_UMD -> VGT_TF_RING_SIZE */
279+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2262c24e),
280+ /* VGT_HS_OFFCHIP_PARAM_UMD -> VGT_HS_OFFCHIP_PARAM */
281+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x226cc24f),
282+ /* VGT_TF_MEMORY_BASE_UMD -> VGT_TF_MEMORY_BASE */
283+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x226ec250),
284+ /* VGT_TF_MEMORY_BASE_HI_UMD -> VGT_TF_MEMORY_BASE_HI */
285+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2278c261),
286+ /* VGT_ESGS_RING_SIZE_UMD -> VGT_ESGS_RING_SIZE */
287+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2232c240),
288+ /* VGT_GSVS_RING_SIZE_UMD -> VGT_GSVS_RING_SIZE */
289+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2233c241),
290+};
291+
252292 static const struct soc15_reg_golden golden_settings_gc_10_1[] =
253293 {
254294 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
@@ -1486,6 +1526,7 @@ static u32 gfx_v10_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32 · 1231 unmodified lines
14861526 uint32_t i = 0;
14871527 uint32_t retries = 50000;
14881528 u32 ret = 0;
1529+ u32 tmp;
14891530
14901531 scratch_reg0 = adev->rmmio +
14911532 (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG0) * 4;
@@ -1519,9 +1560,8 @@ static u32 gfx_v10_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32 · 27 unmodified lines
15191560 writel(v, scratch_reg0);
15201561 writel(offset | flag, scratch_reg1);
15211562 writel(1, spare_int);
1522− for (i = 0; i < retries; i++) {
1523− u32 tmp;
15241563
1564+ for (i = 0; i < retries; i++) {
15251565 tmp = readl(scratch_reg1);
15261566 if (!(tmp & flag))
15271567 break;
@@ -1529,8 +1569,19 @@ static u32 gfx_v10_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32 · 1 unmodified line
15291569 udelay(10);
15301570 }
15311571
1532− if (i >= retries)
1533− pr_err("timeout: rlcg program reg:0x%05x failed !\n", offset);
1572+ if (i >= retries) {
1573+ if (RLCG_ERROR_REPORT_ENABLED(adev)) {
1574+ if (tmp & RLCG_VFGATE_DISABLED)
1575+ pr_err("The vfgate is disabled, program reg:0x%05x failed!\n", offset);
1576+ else if (tmp & RLCG_WRONG_OPERATION_TYPE)
1577+ pr_err("Wrong operation type, program reg:0x%05x failed!\n", offset);
1578+ else if (tmp & RLCG_NOT_IN_RANGE)
1579+ pr_err("The register is not in range, program reg:0x%05x failed!\n", offset);
1580+ else
1581+ pr_err("Unknown error type, program reg:0x%05x failed!\n", offset);
1582+ } else
1583+ pr_err("timeout: rlcg program reg:0x%05x failed!\n", offset);
1584+ }
15341585 }
15351586
15361587 ret = readl(scratch_reg0);
@@ -1538,7 +1589,7 @@ static u32 gfx_v10_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32 · 1 unmodified line
15381589 return ret;
15391590 }
15401591
1541−static void gfx_v10_rlcg_wreg(struct amdgpu_device *adev, u32 offset, u32 value, u32 acc_flags, u32 hwip)
1592+static void gfx_v10_sriov_wreg(struct amdgpu_device *adev, u32 offset, u32 value, u32 acc_flags, u32 hwip)
15421593 {
15431594 u32 rlcg_flag;
15441595
@@ -1554,7 +1605,7 @@ static void gfx_v10_rlcg_wreg(struct amdgpu_device *adev, u32 offset, u32 value, · 9 unmodified lines
15541605 WREG32(offset, value);
15551606 }
15561607
1557−static u32 gfx_v10_rlcg_rreg(struct amdgpu_device *adev, u32 offset, u32 acc_flags, u32 hwip)
1608+static u32 gfx_v10_sriov_rreg(struct amdgpu_device *adev, u32 offset, u32 acc_flags, u32 hwip)
15581609 {
15591610 u32 rlcg_flag;
15601611
@@ -3488,12 +3539,51 @@ static const struct soc15_reg_golden golden_settings_gc_10_3_5[] = { · 1927 unmodified lines
34883539 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffbfffff, 0x00a00000)
34893540 };
34903541
3542+static const struct soc15_reg_golden golden_settings_gc_10_0_cyan_skillfish[] = {
3543+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xffffffff, 0xe0000000),
3544+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGE_FAST_CLKS, 0x3fffffff, 0x0000493e),
3545+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),
3546+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CLK_CTRL, 0xff7f0fff, 0x3c000100),
3547+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_3, 0xa0000000, 0xa0000000),
3548+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0x00008000, 0x003c8014),
3549+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCH_DRAM_BURST_CTRL, 0x00000010, 0x00000017),
3550+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCH_PIPE_STEER, 0xffffffff, 0xd8d8d8d8),
3551+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCH_VC5_ENABLE, 0x00000003, 0x00000003),
3552+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_SD_CNTL, 0x800007ff, 0x000005ff),
3553+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG, 0xffffffff, 0x20000000),
3554+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG3, 0xffffffff, 0x00000200),
3555+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0xffffffff, 0x04800000),
3556+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_LAST_OF_BURST_CONFIG, 0xffffffff, 0x03860210),
3557+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0x0c1800ff, 0x00000044),
3558+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL, 0x00009d00, 0x00008500),
3559+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCMC_VM_CACHEABLE_DRAM_ADDRESS_END, 0xffffffff, 0x000fffff),
3560+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL1_DRAM_BURST_CTRL, 0x00000010, 0x00000017),
3561+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL1_PIPE_STEER, 0xfcfcfcfc, 0xd8d8d8d8),
3562+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_0, 0x77707770, 0x21302130),
3563+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_1, 0x77707770, 0x21302130),
3564+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2A_ADDR_MATCH_MASK, 0xffffffff, 0xffffffcf),
3565+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_ADDR_MATCH_MASK, 0xffffffff, 0xffffffcf),
3566+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CGTT_SCLK_CTRL, 0x10000000, 0x10000100),
3567+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CTRL2, 0xfc02002f, 0x9402002f),
3568+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CTRL3, 0x00002188, 0x00000188),
3569+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE, 0x08000009, 0x08000009),
3570+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_BINNER_EVENT_CNTL_0, 0xcc3fcc03, 0x842a4c02),
3571+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_LINE_STIPPLE_STATE, 0x0000000f, 0x00000000),
3572+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmRMI_SPARE, 0xffff3109, 0xffff3101),
3573+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_ARB_CONFIG, 0x00000100, 0x00000130),
3574+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_LDS_CLK_CTRL, 0xffffffff, 0xffffffff),
3575+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0x00030008, 0x01030000),
3576+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x00800000, 0x00800000)
3577+};
3578+
34913579 #define DEFAULT_SH_MEM_CONFIG \
34923580 ((SH_MEM_ADDRESS_MODE_64 << SH_MEM_CONFIG__ADDRESS_MODE__SHIFT) | \
34933581 (SH_MEM_ALIGNMENT_MODE_UNALIGNED << SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | \
34943582 (SH_MEM_RETRY_MODE_ALL << SH_MEM_CONFIG__RETRY_MODE__SHIFT) | \
34953583 (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT))
34963584
3585+/* TODO: pending on golden setting value of gb address config */
3586+#define CYAN_SKILLFISH_GB_ADDR_CONFIG_GOLDEN 0x00100044
34973587
34983588 static void gfx_v10_0_set_ring_funcs(struct amdgpu_device *adev);
34993589 static void gfx_v10_0_set_irq_funcs(struct amdgpu_device *adev);
@@ -3718,6 +3808,14 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev) · 218 unmodified lines
37183808 golden_settings_gc_10_3_5,
37193809 (const u32)ARRAY_SIZE(golden_settings_gc_10_3_5));
37203810 break;
3811+ case CHIP_CYAN_SKILLFISH:
3812+ soc15_program_register_sequence(adev,
3813+ golden_settings_gc_10_0,
3814+ (const u32)ARRAY_SIZE(golden_settings_gc_10_0));
3815+ soc15_program_register_sequence(adev,
3816+ golden_settings_gc_10_0_cyan_skillfish,
3817+ (const u32)ARRAY_SIZE(golden_settings_gc_10_0_cyan_skillfish));
3818+ break;
37213819 default:
37223820 break;
37233821 }
@@ -3891,6 +3989,7 @@ static void gfx_v10_0_check_fw_write_wait(struct amdgpu_device *adev) · 167 unmodified lines
38913989 case CHIP_NAVI10:
38923990 case CHIP_NAVI12:
38933991 case CHIP_NAVI14:
3992+ case CHIP_CYAN_SKILLFISH:
38943993 if ((adev->gfx.me_fw_version >= 0x00000046) &&
38953994 (adev->gfx.me_feature_version >= 27) &&
38963995 (adev->gfx.pfp_fw_version >= 0x00000068) &&
@@ -4025,6 +4124,12 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) · 128 unmodified lines
40254124 case CHIP_YELLOW_CARP:
40264125 chip_name = "yellow_carp";
40274126 break;
4127+ case CHIP_CYAN_SKILLFISH:
4128+ if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2)
4129+ chip_name = "cyan_skillfish2";
4130+ else
4131+ chip_name = "cyan_skillfish";
4132+ break;
40284133 default:
40294134 BUG();
40304135 }
@@ -4516,6 +4621,7 @@ static void gfx_v10_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, · 485 unmodified lines
45164621 dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_IB_STS2);
45174622 dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_IB_DBG1);
45184623 dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_M0);
4624+ dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_MODE);
45194625 }
45204626
45214627 static void gfx_v10_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t simd,
@@ -4604,6 +4710,14 @@ static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev) · 82 unmodified lines
46044710 adev->gfx.config.gb_addr_config_fields.num_pkrs =
46054711 1 << REG_GET_FIELD(gb_addr_config, GB_ADDR_CONFIG, NUM_PKRS);
46064712 break;
4713+ case CHIP_CYAN_SKILLFISH:
4714+ adev->gfx.config.max_hw_contexts = 8;
4715+ adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
4716+ adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
4717+ adev->gfx.config.sc_hiz_tile_fifo_size = 0x30;
4718+ adev->gfx.config.sc_earlyz_tile_fifo_size = 0x4C0;
4719+ gb_addr_config = CYAN_SKILLFISH_GB_ADDR_CONFIG_GOLDEN;
4720+ break;
46074721 default:
46084722 BUG();
46094723 break;
@@ -4708,6 +4822,7 @@ static int gfx_v10_0_sw_init(void *handle) · 98 unmodified lines
47084822 case CHIP_NAVI10:
47094823 case CHIP_NAVI14:
47104824 case CHIP_NAVI12:
4825+ case CHIP_CYAN_SKILLFISH:
47114826 adev->gfx.me.num_me = 1;
47124827 adev->gfx.me.num_pipe_per_me = 1;
47134828 adev->gfx.me.num_queue_per_pipe = 1;
@@ -5319,7 +5434,8 @@ static int gfx_v10_0_rlc_resume(struct amdgpu_device *adev) · 605 unmodified lines
53195434 {
53205435 int r;
53215436
5322− if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
5437+ if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP &&
5438+ adev->psp.autoload_supported) {
53235439
53245440 r = gfx_v10_0_wait_for_rlc_autoload_complete(adev);
53255441 if (r)
@@ -5379,7 +5495,7 @@ static int gfx_v10_0_parse_rlc_toc(struct amdgpu_device *adev) · 53 unmodified lines
53795495 int ret;
53805496 RLC_TABLE_OF_CONTENT *rlc_toc;
53815497
5382− ret = amdgpu_bo_create_reserved(adev, adev->psp.toc_bin_size, PAGE_SIZE,
5498+ ret = amdgpu_bo_create_reserved(adev, adev->psp.toc.size_bytes, PAGE_SIZE,
53835499 AMDGPU_GEM_DOMAIN_GTT,
53845500 &adev->gfx.rlc.rlc_toc_bo,
53855501 &adev->gfx.rlc.rlc_toc_gpu_addr,
@@ -5390,7 +5506,7 @@ static int gfx_v10_0_parse_rlc_toc(struct amdgpu_device *adev) · 4 unmodified lines
53905506 }
53915507
53925508 /* Copy toc from psp sos fw to rlc toc buffer */
5393− memcpy(adev->gfx.rlc.rlc_toc_buf, adev->psp.toc_start_addr, adev->psp.toc_bin_size);
5509+ memcpy(adev->gfx.rlc.rlc_toc_buf, adev->psp.toc.start_addr, adev->psp.toc.size_bytes);
53945510
53955511 rlc_toc = (RLC_TABLE_OF_CONTENT *)adev->gfx.rlc.rlc_toc_buf;
53965512 while (rlc_toc && (rlc_toc->id > FIRMWARE_ID_INVALID) &&
@@ -7608,10 +7724,8 @@ static int gfx_v10_0_soft_reset(void *handle) · 2211 unmodified lines
76087724
76097725 static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev)
76107726 {
7611− uint64_t clock;
7727+ uint64_t clock, clock_lo, clock_hi, hi_check;
76127728
7613− amdgpu_gfx_off_ctrl(adev, false);
7614− mutex_lock(&adev->gfx.gpu_clock_mutex);
76157729 switch (adev->asic_type) {
76167730 case CHIP_VANGOGH:
76177731 case CHIP_YELLOW_CARP:
@@ -7619,12 +7733,21 @@ static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev) · 1 unmodified line
76197733 ((uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER_Vangogh) << 32ULL);
76207734 break;
76217735 default:
7622− clock = (uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER) |
7623− ((uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER) << 32ULL);
7736+ preempt_disable();
7737+ clock_hi = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER);
7738+ clock_lo = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER);
7739+ hi_check = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER);
7740+ /* The SMUIO TSC clock frequency is 100MHz, which sets 32-bit carry over
7741+ * roughly every 42 seconds.
7742+ */
7743+ if (hi_check != clock_hi) {
7744+ clock_lo = RREG32_SOC15_NO_KIQ(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER);
7745+ clock_hi = hi_check;
7746+ }
7747+ preempt_enable();
7748+ clock = clock_lo | (clock_hi << 32ULL);
76247749 break;
76257750 }
7626− mutex_unlock(&adev->gfx.gpu_clock_mutex);
7627− amdgpu_gfx_off_ctrl(adev, true);
76287751 return clock;
76297752 }
76307753
@@ -7665,6 +7788,7 @@ static int gfx_v10_0_early_init(void *handle) · 34 unmodified lines
76657788 case CHIP_NAVI10:
76667789 case CHIP_NAVI14:
76677790 case CHIP_NAVI12:
7791+ case CHIP_CYAN_SKILLFISH:
76687792 adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS_NV1X;
76697793 break;
76707794 case CHIP_SIENNA_CICHLID:
@@ -8261,8 +8385,8 @@ static const struct amdgpu_rlc_funcs gfx_v10_0_rlc_funcs_sriov = { · 590 unmodified lines
82618385 .reset = gfx_v10_0_rlc_reset,
82628386 .start = gfx_v10_0_rlc_start,
82638387 .update_spm_vmid = gfx_v10_0_update_spm_vmid,
8264− .rlcg_wreg = gfx_v10_rlcg_wreg,
8265− .rlcg_rreg = gfx_v10_rlcg_rreg,
8388+ .sriov_wreg = gfx_v10_sriov_wreg,
8389+ .sriov_rreg = gfx_v10_sriov_rreg,
82668390 .is_rlcg_access_range = gfx_v10_0_is_rlcg_access_range,
82678391 };
82688392
@@ -9425,6 +9549,7 @@ static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev) · 1156 unmodified lines
94259549 case CHIP_DIMGREY_CAVEFISH:
94269550 case CHIP_BEIGE_GOBY:
94279551 case CHIP_YELLOW_CARP:
9552+ case CHIP_CYAN_SKILLFISH:
94289553 adev->gfx.rlc.funcs = &gfx_v10_0_rlc_funcs;
94299554 break;
94309555 case CHIP_NAVI12:
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c+1−0
@@ -3027,6 +3027,7 @@ static void gfx_v6_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, u · 3026 unmodified lines
30273027 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_TMA_HI);
30283028 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_IB_DBG0);
30293029 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_M0);
3030+ dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_MODE);
30303031 }
30313032
30323033 static void gfx_v6_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t simd,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c+1−0
@@ -4198,6 +4198,7 @@ static void gfx_v7_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, u · 4197 unmodified lines
41984198 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_TMA_HI);
41994199 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_IB_DBG0);
42004200 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_M0);
4201+ dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_MODE);
42014202 }
42024203
42034204 static void gfx_v7_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t simd,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c+1−0
@@ -5279,6 +5279,7 @@ static void gfx_v8_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, u · 5278 unmodified lines
52795279 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_TMA_HI);
52805280 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_IB_DBG0);
52815281 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_M0);
5282+ dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_MODE);
52825283 }
52835284
52845285 static void gfx_v8_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t simd,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+3−2
@@ -787,7 +787,7 @@ static void gfx_v9_0_rlcg_w(struct amdgpu_device *adev, u32 offset, u32 v, u32 f · 786 unmodified lines
787787
788788 }
789789
790−static void gfx_v9_0_rlcg_wreg(struct amdgpu_device *adev, u32 offset,
790+static void gfx_v9_0_sriov_wreg(struct amdgpu_device *adev, u32 offset,
791791 u32 v, u32 acc_flags, u32 hwip)
792792 {
793793 if ((acc_flags & AMDGPU_REGS_RLC) &&
@@ -2090,6 +2090,7 @@ static void gfx_v9_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, u · 1296 unmodified lines
20902090 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_IB_STS);
20912091 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_IB_DBG0);
20922092 dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_M0);
2093+ dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_MODE);
20932094 }
20942095
20952096 static void gfx_v9_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t simd,
@@ -5150,7 +5151,7 @@ static const struct amdgpu_rlc_funcs gfx_v9_0_rlc_funcs = { · 3054 unmodified lines
51505151 .reset = gfx_v9_0_rlc_reset,
51515152 .start = gfx_v9_0_rlc_start,
51525153 .update_spm_vmid = gfx_v9_0_update_spm_vmid,
5153− .rlcg_wreg = gfx_v9_0_rlcg_wreg,
5154+ .sriov_wreg = gfx_v9_0_sriov_wreg,
51545155 .is_rlcg_access_range = gfx_v9_0_is_rlcg_access_range,
51555156 };
51565157
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c+3−3
@@ -85,7 +85,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde[] = { · 84 unmodified lines
8585 SOC15_REG_GOLDEN_VALUE(GC, 0, regTCI_CNTL_3, 0xff, 0x20),
8686 };
8787
88−/**
88+/*
8989 * This shader is used to clear VGPRS and LDS, and also write the input
9090 * pattern into the write back buffer, which will be used by driver to
9191 * check whether all SIMDs have been covered.
@@ -206,7 +206,7 @@ const struct soc15_reg_entry vgpr_init_regs_aldebaran[] = { · 114 unmodified lines
206206 { SOC15_REG_ENTRY(GC, 0, regCOMPUTE_STATIC_THREAD_MGMT_SE7), 0xffffffff },
207207 };
208208
209−/**
209+/*
210210 * The below shaders are used to clear SGPRS, and also write the input
211211 * pattern into the write back buffer. The first two dispatch should be
212212 * scheduled simultaneously which make sure that all SGPRS could be
@@ -302,7 +302,7 @@ const struct soc15_reg_entry sgpr96_init_regs_aldebaran[] = { · 89 unmodified lines
302302 { SOC15_REG_ENTRY(GC, 0, regCOMPUTE_STATIC_THREAD_MGMT_SE7), 0xffffffff },
303303 };
304304
305−/**
305+/*
306306 * This shader is used to clear the uninitiated sgprs after the above
307307 * two dispatches, because of hardware feature, dispath 0 couldn't clear
308308 * top hole sgprs. Therefore need 4 waves per SIMD to cover these sgprs
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_1.c+2−3
@@ -75,9 +75,8 @@ int gfxhub_v1_1_get_xgmi_info(struct amdgpu_device *adev) · 74 unmodified lines
7575 max_physical_node_id = 7;
7676 break;
7777 case CHIP_ALDEBARAN:
78− /* just using duplicates for Aldebaran support, revisit later */
79− max_num_physical_nodes = 8;
80− max_physical_node_id = 7;
78+ max_num_physical_nodes = 16;
79+ max_physical_node_id = 15;
8180 break;
8281 default:
8382 return -EINVAL;
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c+5−1
@@ -93,6 +93,7 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev, · 92 unmodified lines
9393 struct amdgpu_iv_entry *entry)
9494 {
9595 bool retry_fault = !!(entry->src_data[1] & 0x80);
96+ bool write_fault = !!(entry->src_data[1] & 0x20);
9697 struct amdgpu_vmhub *hub = &adev->vmhub[entry->vmid_src];
9798 struct amdgpu_task_info task_info;
9899 uint32_t status = 0;
@@ -121,7 +122,7 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev, · 22 unmodified lines
121122 /* Try to handle the recoverable page faults by filling page
122123 * tables
123124 */
124− if (amdgpu_vm_handle_fault(adev, entry->pasid, addr))
125+ if (amdgpu_vm_handle_fault(adev, entry->pasid, addr, write_fault))
125126 return 1;
126127 }
127128
@@ -810,6 +811,7 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev) · 682 unmodified lines
810811 case CHIP_DIMGREY_CAVEFISH:
811812 case CHIP_BEIGE_GOBY:
812813 case CHIP_YELLOW_CARP:
814+ case CHIP_CYAN_SKILLFISH:
813815 default:
814816 adev->gmc.gart_size = 512ULL << 20;
815817 break;
@@ -879,6 +881,7 @@ static int gmc_v10_0_sw_init(void *handle) · 63 unmodified lines
879881 case CHIP_DIMGREY_CAVEFISH:
880882 case CHIP_BEIGE_GOBY:
881883 case CHIP_YELLOW_CARP:
884+ case CHIP_CYAN_SKILLFISH:
882885 adev->num_vmhubs = 2;
883886 /*
884887 * To fulfill 4-level page support,
@@ -996,6 +999,7 @@ static void gmc_v10_0_init_golden_registers(struct amdgpu_device *adev) · 111 unmodified lines
996999 case CHIP_DIMGREY_CAVEFISH:
9971000 case CHIP_BEIGE_GOBY:
9981001 case CHIP_YELLOW_CARP:
1002+ case CHIP_CYAN_SKILLFISH:
9991003 break;
10001004 default:
10011005 break;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c+31−1
@@ -53,7 +53,9 @@ · 52 unmodified lines
5353 #include "mmhub_v1_7.h"
5454 #include "umc_v6_1.h"
5555 #include "umc_v6_0.h"
56+#include "umc_v6_7.h"
5657 #include "hdp_v4_0.h"
58+#include "mca_v3_0.h"
5759
5860 #include "ivsrcid/vmc/irqsrcs_vmc_1_0.h"
5961
@@ -505,6 +507,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev, · 445 unmodified lines
505507 struct amdgpu_iv_entry *entry)
506508 {
507509 bool retry_fault = !!(entry->src_data[1] & 0x80);
510+ bool write_fault = !!(entry->src_data[1] & 0x20);
508511 uint32_t status = 0, cid = 0, rw = 0;
509512 struct amdgpu_task_info task_info;
510513 struct amdgpu_vmhub *hub;
@@ -535,7 +538,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev, · 24 unmodified lines
535538 /* Try to handle the recoverable page faults by filling page
536539 * tables
537540 */
538− if (amdgpu_vm_handle_fault(adev, entry->pasid, addr))
541+ if (amdgpu_vm_handle_fault(adev, entry->pasid, addr, write_fault))
539542 return 1;
540543 }
541544
@@ -1168,6 +1171,18 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev) · 626 unmodified lines
11681171 adev->umc.channel_idx_tbl = &umc_v6_1_channel_idx_tbl[0][0];
11691172 adev->umc.ras_funcs = &umc_v6_1_ras_funcs;
11701173 break;
1174+ case CHIP_ALDEBARAN:
1175+ adev->umc.max_ras_err_cnt_per_query = UMC_V6_7_TOTAL_CHANNEL_NUM;
1176+ adev->umc.channel_inst_num = UMC_V6_7_CHANNEL_INSTANCE_NUM;
1177+ adev->umc.umc_inst_num = UMC_V6_7_UMC_INSTANCE_NUM;
1178+ adev->umc.channel_offs = UMC_V6_7_PER_CHANNEL_OFFSET;
1179+ if (!adev->gmc.xgmi.connected_to_cpu)
1180+ adev->umc.ras_funcs = &umc_v6_7_ras_funcs;
1181+ if (1 & adev->smuio.funcs->get_die_id(adev))
1182+ adev->umc.channel_idx_tbl = &umc_v6_7_channel_idx_tbl_first[0][0];
1183+ else
1184+ adev->umc.channel_idx_tbl = &umc_v6_7_channel_idx_tbl_second[0][0];
1185+ break;
11711186 default:
11721187 break;
11731188 }
@@ -1216,6 +1231,18 @@ static void gmc_v9_0_set_hdp_ras_funcs(struct amdgpu_device *adev) · 42 unmodified lines
12161231 adev->hdp.ras_funcs = &hdp_v4_0_ras_funcs;
12171232 }
12181233
1234+static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)
1235+{
1236+ switch (adev->asic_type) {
1237+ case CHIP_ALDEBARAN:
1238+ if (!adev->gmc.xgmi.connected_to_cpu)
1239+ adev->mca.funcs = &mca_v3_0_funcs;
1240+ break;
1241+ default:
1242+ break;
1243+ }
1244+}
1245+
12191246 static int gmc_v9_0_early_init(void *handle)
12201247 {
12211248 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1237,6 +1264,7 @@ static int gmc_v9_0_early_init(void *handle) · 15 unmodified lines
12371264 gmc_v9_0_set_mmhub_ras_funcs(adev);
12381265 gmc_v9_0_set_gfxhub_funcs(adev);
12391266 gmc_v9_0_set_hdp_ras_funcs(adev);
1267+ gmc_v9_0_set_mca_funcs(adev);
12401268
12411269 adev->gmc.shared_aperture_start = 0x2000000000000000ULL;
12421270 adev->gmc.shared_aperture_end =
@@ -1448,6 +1476,8 @@ static int gmc_v9_0_sw_init(void *handle) · 205 unmodified lines
14481476 adev->gfxhub.funcs->init(adev);
14491477
14501478 adev->mmhub.funcs->init(adev);
1479+ if (adev->mca.funcs)
1480+ adev->mca.funcs->init(adev);
14511481
14521482 spin_lock_init(&adev->gmc.invalidate_lock);
14531483
drivers/gpu/drm/amd/amdgpu/mca_v3_0.c+125−0
@@ -0,0 +1,125 @@
1+/*
2+ * Copyright 2021 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ */
23+#include "amdgpu_ras.h"
24+#include "amdgpu.h"
25+#include "amdgpu_mca.h"
26+
27+#define smnMCMP0_STATUST0 0x03830408
28+#define smnMCMP1_STATUST0 0x03b30408
29+#define smnMCMPIO_STATUST0 0x0c930408
30+
31+
32+static void mca_v3_0_mp0_query_ras_error_count(struct amdgpu_device *adev,
33+ void *ras_error_status)
34+{
35+ amdgpu_mca_query_ras_error_count(adev,
36+ smnMCMP0_STATUST0,
37+ ras_error_status);
38+}
39+
40+static int mca_v3_0_mp0_ras_late_init(struct amdgpu_device *adev)
41+{
42+ return amdgpu_mca_ras_late_init(adev, &adev->mca.mp0);
43+}
44+
45+static void mca_v3_0_mp0_ras_fini(struct amdgpu_device *adev)
46+{
47+ amdgpu_mca_ras_fini(adev, &adev->mca.mp0);
48+}
49+
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,
53+ .query_ras_error_count = mca_v3_0_mp0_query_ras_error_count,
54+ .query_ras_error_address = NULL,
55+ .ras_block = AMDGPU_RAS_BLOCK__MP0,
56+ .sysfs_name = "mp0_err_count",
57+};
58+
59+static void mca_v3_0_mp1_query_ras_error_count(struct amdgpu_device *adev,
60+ void *ras_error_status)
61+{
62+ amdgpu_mca_query_ras_error_count(adev,
63+ smnMCMP1_STATUST0,
64+ ras_error_status);
65+}
66+
67+static int mca_v3_0_mp1_ras_late_init(struct amdgpu_device *adev)
68+{
69+ return amdgpu_mca_ras_late_init(adev, &adev->mca.mp1);
70+}
71+
72+static void mca_v3_0_mp1_ras_fini(struct amdgpu_device *adev)
73+{
74+ amdgpu_mca_ras_fini(adev, &adev->mca.mp1);
75+}
76+
77+const struct amdgpu_mca_ras_funcs mca_v3_0_mp1_ras_funcs = {
78+ .ras_late_init = mca_v3_0_mp1_ras_late_init,
79+ .ras_fini = mca_v3_0_mp1_ras_fini,
80+ .query_ras_error_count = mca_v3_0_mp1_query_ras_error_count,
81+ .query_ras_error_address = NULL,
82+ .ras_block = AMDGPU_RAS_BLOCK__MP1,
83+ .sysfs_name = "mp1_err_count",
84+};
85+
86+static void mca_v3_0_mpio_query_ras_error_count(struct amdgpu_device *adev,
87+ void *ras_error_status)
88+{
89+ amdgpu_mca_query_ras_error_count(adev,
90+ smnMCMPIO_STATUST0,
91+ ras_error_status);
92+}
93+
94+static int mca_v3_0_mpio_ras_late_init(struct amdgpu_device *adev)
95+{
96+ return amdgpu_mca_ras_late_init(adev, &adev->mca.mpio);
97+}
98+
99+static void mca_v3_0_mpio_ras_fini(struct amdgpu_device *adev)
100+{
101+ amdgpu_mca_ras_fini(adev, &adev->mca.mpio);
102+}
103+
104+const struct amdgpu_mca_ras_funcs mca_v3_0_mpio_ras_funcs = {
105+ .ras_late_init = mca_v3_0_mpio_ras_late_init,
106+ .ras_fini = mca_v3_0_mpio_ras_fini,
107+ .query_ras_error_count = mca_v3_0_mpio_query_ras_error_count,
108+ .query_ras_error_address = NULL,
109+ .ras_block = AMDGPU_RAS_BLOCK__MPIO,
110+ .sysfs_name = "mpio_err_count",
111+};
112+
113+
114+static void mca_v3_0_init(struct amdgpu_device *adev)
115+{
116+ struct amdgpu_mca *mca = &adev->mca;
117+
118+ mca->mp0.ras_funcs = &mca_v3_0_mp0_ras_funcs;
119+ mca->mp1.ras_funcs = &mca_v3_0_mp1_ras_funcs;
120+ mca->mpio.ras_funcs = &mca_v3_0_mpio_ras_funcs;
121+}
122+
123+const struct amdgpu_mca_funcs mca_v3_0_funcs = {
124+ .init = mca_v3_0_init,
125+};
drivers/gpu/drm/amd/amdgpu/mca_v3_0.h+26−0
@@ -0,0 +1,26 @@
1+/*
2+ * Copyright (C) 2021 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included
12+ * in all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+ */
21+#ifndef __MCA_V3_0_H__
22+#define __MCA_V3_0_H__
23+
24+extern const struct amdgpu_mca_funcs mca_v3_0_funcs;
25+
26+#endif
drivers/gpu/drm/amd/amdgpu/mmsch_v1_0.h+1−3
@@ -24,9 +24,7 @@ · 23 unmodified lines
2424 #ifndef __MMSCH_V1_0_H__
2525 #define __MMSCH_V1_0_H__
2626
27−#define MMSCH_VERSION_MAJOR 1
28−#define MMSCH_VERSION_MINOR 0
29−#define MMSCH_VERSION (MMSCH_VERSION_MAJOR << 16 | MMSCH_VERSION_MINOR)
27+#define MMSCH_VERSION 0x1
3028
3129 enum mmsch_v1_0_command_type {
3230 MMSCH_COMMAND__DIRECT_REG_WRITE = 0,
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c+14−4
@@ -96,7 +96,11 @@ static int xgpu_nv_poll_ack(struct amdgpu_device *adev) · 95 unmodified lines
9696
9797 static int xgpu_nv_poll_msg(struct amdgpu_device *adev, enum idh_event event)
9898 {
99− int r, timeout = NV_MAILBOX_POLL_MSG_TIMEDOUT;
99+ int r;
100+ uint64_t timeout, now;
101+
102+ now = (uint64_t)ktime_to_ms(ktime_get());
103+ timeout = now + NV_MAILBOX_POLL_MSG_TIMEDOUT;
100104
101105 do {
102106 r = xgpu_nv_mailbox_rcv_msg(adev, event);
@@ -104,8 +108,8 @@ static int xgpu_nv_poll_msg(struct amdgpu_device *adev, enum idh_event event) · 1 unmodified line
104108 return 0;
105109
106110 msleep(10);
107− timeout -= 10;
108− } while (timeout > 1);
111+ now = (uint64_t)ktime_to_ms(ktime_get());
112+ } while (timeout > now);
109113
110114
111115 return -ETIME;
@@ -149,9 +153,10 @@ static void xgpu_nv_mailbox_trans_msg (struct amdgpu_device *adev, · 37 unmodified lines
149153 static int xgpu_nv_send_access_requests(struct amdgpu_device *adev,
150154 enum idh_request req)
151155 {
152− int r;
156+ int r, retry = 1;
153157 enum idh_event event = -1;
154158
159+send_request:
155160 xgpu_nv_mailbox_trans_msg(adev, req, 0, 0, 0);
156161
157162 switch (req) {
@@ -170,6 +175,9 @@ static int xgpu_nv_send_access_requests(struct amdgpu_device *adev, · 12 unmodified lines
170175 if (event != -1) {
171176 r = xgpu_nv_poll_msg(adev, event);
172177 if (r) {
178+ if (retry++ < 2)
179+ goto send_request;
180+
173181 if (req != IDH_REQ_GPU_INIT_DATA) {
174182 pr_err("Doesn't get msg:%d from pf, error=%d\n", event, r);
175183 return r;
@@ -279,6 +287,8 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work) · 103 unmodified lines
279287 amdgpu_virt_fini_data_exchange(adev);
280288 atomic_set(&adev->in_gpu_reset, 1);
281289
290+ xgpu_nv_mailbox_trans_msg(adev, IDH_READY_TO_RESET, 0, 0, 0);
291+
282292 do {
283293 if (xgpu_nv_mailbox_peek_msg(adev) == IDH_FLR_NOTIFICATION_CMPL)
284294 goto flr_done;
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h+2−1
@@ -37,7 +37,8 @@ enum idh_request { · 36 unmodified lines
3737 IDH_REQ_GPU_RESET_ACCESS,
3838 IDH_REQ_GPU_INIT_DATA,
3939
40− IDH_LOG_VF_ERROR = 200,
40+ IDH_LOG_VF_ERROR = 200,
41+ IDH_READY_TO_RESET = 201,
4142 };
4243
4344 enum idh_event {
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c+21−0
@@ -508,6 +508,26 @@ static void nbio_v2_3_apply_l1_link_width_reconfig_wa(struct amdgpu_device *adev · 507 unmodified lines
508508 WREG32_PCIE(smnPCIE_LC_LINK_WIDTH_CNTL, reg_data);
509509 }
510510
511+static void nbio_v2_3_clear_doorbell_interrupt(struct amdgpu_device *adev)
512+{
513+ uint32_t reg, reg_data;
514+
515+ if (adev->asic_type != CHIP_SIENNA_CICHLID)
516+ return;
517+
518+ reg = RREG32_SOC15(NBIO, 0, mmBIF_RB_CNTL);
519+
520+ /* Clear Interrupt Status
521+ */
522+ if ((reg & BIF_RB_CNTL__RB_ENABLE_MASK) == 0) {
523+ reg = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL);
524+ if (reg & BIF_DOORBELL_INT_CNTL__DOORBELL_INTERRUPT_STATUS_MASK) {
525+ reg_data = 1 << BIF_DOORBELL_INT_CNTL__DOORBELL_INTERRUPT_CLEAR__SHIFT;
526+ WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL, reg_data);
527+ }
528+ }
529+}
530+
511531 const struct amdgpu_nbio_funcs nbio_v2_3_funcs = {
512532 .get_hdp_flush_req_offset = nbio_v2_3_get_hdp_flush_req_offset,
513533 .get_hdp_flush_done_offset = nbio_v2_3_get_hdp_flush_done_offset,
@@ -531,4 +551,5 @@ const struct amdgpu_nbio_funcs nbio_v2_3_funcs = { · 17 unmodified lines
531551 .program_aspm = nbio_v2_3_program_aspm,
532552 .apply_lc_spc_mode_wa = nbio_v2_3_apply_lc_spc_mode_wa,
533553 .apply_l1_link_width_reconfig_wa = nbio_v2_3_apply_l1_link_width_reconfig_wa,
554+ .clear_doorbell_interrupt = nbio_v2_3_clear_doorbell_interrupt,
534555 };
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c+31−7
@@ -85,6 +85,11 @@ · 84 unmodified lines
8585 #define mmRCC_DEV0_EPF0_STRAP0_ALDE 0x0015
8686 #define mmRCC_DEV0_EPF0_STRAP0_ALDE_BASE_IDX 2
8787
88+#define mmBIF_DOORBELL_INT_CNTL_ALDE 0x3878
89+#define mmBIF_DOORBELL_INT_CNTL_ALDE_BASE_IDX 2
90+#define BIF_DOORBELL_INT_CNTL_ALDE__DOORBELL_INTERRUPT_DISABLE__SHIFT 0x18
91+#define BIF_DOORBELL_INT_CNTL_ALDE__DOORBELL_INTERRUPT_DISABLE_MASK 0x01000000L
92+
8893 static void nbio_v7_4_query_ras_error_count(struct amdgpu_device *adev,
8994 void *ras_error_status);
9095
@@ -346,14 +351,21 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device · 255 unmodified lines
346351 struct ras_err_data err_data = {0, 0, 0, NULL};
347352 struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
348353
349− bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL);
354+ if (adev->asic_type == CHIP_ALDEBARAN)
355+ bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL_ALDE);
356+ else
357+ bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL);
358+
350359 if (REG_GET_FIELD(bif_doorbell_intr_cntl,
351360 BIF_DOORBELL_INT_CNTL, RAS_CNTLR_INTERRUPT_STATUS)) {
352361 /* driver has to clear the interrupt status when bif ring is disabled */
353362 bif_doorbell_intr_cntl = REG_SET_FIELD(bif_doorbell_intr_cntl,
354363 BIF_DOORBELL_INT_CNTL,
355364 RAS_CNTLR_INTERRUPT_CLEAR, 1);
356− WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL, bif_doorbell_intr_cntl);
365+ if (adev->asic_type == CHIP_ALDEBARAN)
366+ WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL_ALDE, bif_doorbell_intr_cntl);
367+ else
368+ WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL, bif_doorbell_intr_cntl);
357369
358370 if (!ras->disable_ras_err_cnt_harvest) {
359371 /*
@@ -372,13 +384,13 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device · 12 unmodified lines
372384 "errors detected in %s block, "
373385 "no user action is needed.\n",
374386 obj->err_data.ce_count,
375− adev->nbio.ras_if->name);
387+ ras_block_str(adev->nbio.ras_if->block));
376388
377389 if (err_data.ue_count)
378390 dev_info(adev->dev, "%ld uncorrectable hardware "
379391 "errors detected in %s block\n",
380392 obj->err_data.ue_count,
381− adev->nbio.ras_if->name);
393+ ras_block_str(adev->nbio.ras_if->block));
382394 }
383395
384396 dev_info(adev->dev, "RAS controller interrupt triggered "
@@ -395,14 +407,22 @@ static void nbio_v7_4_handle_ras_err_event_athub_intr_no_bifring(struct amdgpu_d · 10 unmodified lines
395407 {
396408 uint32_t bif_doorbell_intr_cntl;
397409
398− bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL);
410+ if (adev->asic_type == CHIP_ALDEBARAN)
411+ bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL_ALDE);
412+ else
413+ bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL);
414+
399415 if (REG_GET_FIELD(bif_doorbell_intr_cntl,
400416 BIF_DOORBELL_INT_CNTL, RAS_ATHUB_ERR_EVENT_INTERRUPT_STATUS)) {
401417 /* driver has to clear the interrupt status when bif ring is disabled */
402418 bif_doorbell_intr_cntl = REG_SET_FIELD(bif_doorbell_intr_cntl,
403419 BIF_DOORBELL_INT_CNTL,
404420 RAS_ATHUB_ERR_EVENT_INTERRUPT_CLEAR, 1);
405− WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL, bif_doorbell_intr_cntl);
421+
422+ if (adev->asic_type == CHIP_ALDEBARAN)
423+ WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL_ALDE, bif_doorbell_intr_cntl);
424+ else
425+ WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL, bif_doorbell_intr_cntl);
406426
407427 amdgpu_ras_global_ras_isr(adev);
408428 }
@@ -572,7 +592,11 @@ static void nbio_v7_4_query_ras_error_count(struct amdgpu_device *adev, · 163 unmodified lines
572592 static void nbio_v7_4_enable_doorbell_interrupt(struct amdgpu_device *adev,
573593 bool enable)
574594 {
575− WREG32_FIELD15(NBIO, 0, BIF_DOORBELL_INT_CNTL,
595+ if (adev->asic_type == CHIP_ALDEBARAN)
596+ WREG32_FIELD15(NBIO, 0, BIF_DOORBELL_INT_CNTL_ALDE,
597+ DOORBELL_INTERRUPT_DISABLE, enable ? 0 : 1);
598+ else
599+ WREG32_FIELD15(NBIO, 0, BIF_DOORBELL_INT_CNTL,
576600 DOORBELL_INTERRUPT_DISABLE, enable ? 0 : 1);
577601 }
578602
drivers/gpu/drm/amd/amdgpu/nv.c+36−11
@@ -58,7 +58,7 @@ · 57 unmodified lines
5858 #include "jpeg_v2_0.h"
5959 #include "vcn_v3_0.h"
6060 #include "jpeg_v3_0.h"
61−#include "dce_virtual.h"
61+#include "amdgpu_vkms.h"
6262 #include "mes_v10_1.h"
6363 #include "mxgpu_nv.h"
6464 #include "smuio_v11_0.h"
@@ -666,6 +666,9 @@ legacy_init: · 601 unmodified lines
666666 case CHIP_YELLOW_CARP:
667667 yellow_carp_reg_base_init(adev);
668668 break;
669+ case CHIP_CYAN_SKILLFISH:
670+ cyan_skillfish_reg_base_init(adev);
671+ break;
669672 default:
670673 return -EINVAL;
671674 }
@@ -682,7 +685,10 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 10 unmodified lines
682685 {
683686 int r;
684687
685− if (adev->flags & AMD_IS_APU) {
688+ if (adev->asic_type == CHIP_CYAN_SKILLFISH) {
689+ adev->nbio.funcs = &nbio_v2_3_funcs;
690+ adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg;
691+ } else if (adev->flags & AMD_IS_APU) {
686692 adev->nbio.funcs = &nbio_v7_2_funcs;
687693 adev->nbio.hdp_flush_reg = &nbio_v7_2_hdp_flush_reg;
688694 } else {
@@ -715,7 +721,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 26 unmodified lines
715721 !amdgpu_sriov_vf(adev))
716722 amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
717723 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
718− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
724+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
719725 #if defined(CONFIG_DRM_AMD_DC)
720726 else if (amdgpu_device_has_dc_support(adev))
721727 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -743,7 +749,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 21 unmodified lines
743749 if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)
744750 amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
745751 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
746− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
752+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
747753 #if defined(CONFIG_DRM_AMD_DC)
748754 else if (amdgpu_device_has_dc_support(adev))
749755 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -773,7 +779,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 23 unmodified lines
773779 is_support_sw_smu(adev))
774780 amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
775781 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
776− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
782+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
777783 #if defined(CONFIG_DRM_AMD_DC)
778784 else if (amdgpu_device_has_dc_support(adev))
779785 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -796,7 +802,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 16 unmodified lines
796802 is_support_sw_smu(adev))
797803 amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
798804 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
799− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
805+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
800806 #if defined(CONFIG_DRM_AMD_DC)
801807 else if (amdgpu_device_has_dc_support(adev))
802808 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -817,7 +823,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 14 unmodified lines
817823 amdgpu_device_ip_block_add(adev, &psp_v11_0_ip_block);
818824 amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
819825 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
820− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
826+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
821827 #if defined(CONFIG_DRM_AMD_DC)
822828 else if (amdgpu_device_has_dc_support(adev))
823829 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -837,7 +843,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 13 unmodified lines
837843 is_support_sw_smu(adev))
838844 amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
839845 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
840− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
846+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
841847 #if defined(CONFIG_DRM_AMD_DC)
842848 else if (amdgpu_device_has_dc_support(adev))
843849 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -859,7 +865,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 15 unmodified lines
859865 amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block);
860866 amdgpu_device_ip_block_add(adev, &sdma_v5_2_ip_block);
861867 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
862− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
868+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
863869 #if defined(CONFIG_DRM_AMD_DC)
864870 else if (amdgpu_device_has_dc_support(adev))
865871 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -877,11 +883,11 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 11 unmodified lines
877883 amdgpu_device_ip_block_add(adev, &psp_v13_0_ip_block);
878884 amdgpu_device_ip_block_add(adev, &smu_v13_0_ip_block);
879885 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
880− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
886+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
881887 amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block);
882888 amdgpu_device_ip_block_add(adev, &sdma_v5_2_ip_block);
883889 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
884− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
890+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
885891 #if defined(CONFIG_DRM_AMD_DC)
886892 else if (amdgpu_device_has_dc_support(adev))
887893 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -889,6 +895,20 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) · 1 unmodified line
889895 amdgpu_device_ip_block_add(adev, &vcn_v3_0_ip_block);
890896 amdgpu_device_ip_block_add(adev, &jpeg_v3_0_ip_block);
891897 break;
898+ case CHIP_CYAN_SKILLFISH:
899+ amdgpu_device_ip_block_add(adev, &nv_common_ip_block);
900+ amdgpu_device_ip_block_add(adev, &gmc_v10_0_ip_block);
901+ amdgpu_device_ip_block_add(adev, &navi10_ih_ip_block);
902+ if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2) {
903+ if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP))
904+ amdgpu_device_ip_block_add(adev, &psp_v11_0_8_ip_block);
905+ amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
906+ }
907+ if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
908+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
909+ amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block);
910+ amdgpu_device_ip_block_add(adev, &sdma_v5_0_ip_block);
911+ break;
892912 default:
893913 return -EINVAL;
894914 }
@@ -1241,6 +1261,11 @@ static int nv_common_early_init(void *handle) · 346 unmodified lines
12411261 else
12421262 adev->external_rev_id = adev->rev_id + 0x01;
12431263 break;
1264+ case CHIP_CYAN_SKILLFISH:
1265+ adev->cg_flags = 0;
1266+ adev->pg_flags = 0;
1267+ adev->external_rev_id = adev->rev_id + 0x82;
1268+ break;
12441269 default:
12451270 /* FIXME: not supported yet */
12461271 return -EINVAL;
drivers/gpu/drm/amd/amdgpu/nv.h+1−0
@@ -38,5 +38,6 @@ void vangogh_reg_base_init(struct amdgpu_device *adev); · 37 unmodified lines
3838 int dimgrey_cavefish_reg_base_init(struct amdgpu_device *adev);
3939 int beige_goby_reg_base_init(struct amdgpu_device *adev);
4040 int yellow_carp_reg_base_init(struct amdgpu_device *adev);
41+int cyan_skillfish_reg_base_init(struct amdgpu_device *adev);
4142
4243 #endif
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c+20−20
@@ -84,29 +84,29 @@ static int psp_v10_0_init_microcode(struct psp_context *psp) · 83 unmodified lines
8484
8585 ta_hdr = (const struct ta_firmware_header_v1_0 *)
8686 adev->psp.ta_fw->data;
87− adev->psp.ta_hdcp_ucode_version =
88− le32_to_cpu(ta_hdr->ta_hdcp_ucode_version);
89− adev->psp.ta_hdcp_ucode_size =
90− le32_to_cpu(ta_hdr->ta_hdcp_size_bytes);
91− adev->psp.ta_hdcp_start_addr =
87+ adev->psp.hdcp.feature_version =
88+ le32_to_cpu(ta_hdr->hdcp.fw_version);
89+ adev->psp.hdcp.size_bytes =
90+ le32_to_cpu(ta_hdr->hdcp.size_bytes);
91+ adev->psp.hdcp.start_addr =
9292 (uint8_t *)ta_hdr +
9393 le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
9494
95− adev->psp.ta_dtm_ucode_version =
96− le32_to_cpu(ta_hdr->ta_dtm_ucode_version);
97− adev->psp.ta_dtm_ucode_size =
98− le32_to_cpu(ta_hdr->ta_dtm_size_bytes);
99− adev->psp.ta_dtm_start_addr =
100− (uint8_t *)adev->psp.ta_hdcp_start_addr +
101− le32_to_cpu(ta_hdr->ta_dtm_offset_bytes);
102−
103− adev->psp.ta_securedisplay_ucode_version =
104− le32_to_cpu(ta_hdr->ta_securedisplay_ucode_version);
105− adev->psp.ta_securedisplay_ucode_size =
106− le32_to_cpu(ta_hdr->ta_securedisplay_size_bytes);
107− adev->psp.ta_securedisplay_start_addr =
108− (uint8_t *)adev->psp.ta_hdcp_start_addr +
109− le32_to_cpu(ta_hdr->ta_securedisplay_offset_bytes);
95+ adev->psp.dtm.feature_version =
96+ le32_to_cpu(ta_hdr->dtm.fw_version);
97+ adev->psp.dtm.size_bytes =
98+ le32_to_cpu(ta_hdr->dtm.size_bytes);
99+ adev->psp.dtm.start_addr =
100+ (uint8_t *)adev->psp.hdcp.start_addr +
101+ le32_to_cpu(ta_hdr->dtm.offset_bytes);
102+
103+ adev->psp.securedisplay.feature_version =
104+ le32_to_cpu(ta_hdr->securedisplay.fw_version);
105+ adev->psp.securedisplay.size_bytes =
106+ le32_to_cpu(ta_hdr->securedisplay.size_bytes);
107+ adev->psp.securedisplay.start_addr =
108+ (uint8_t *)adev->psp.hdcp.start_addr +
109+ le32_to_cpu(ta_hdr->securedisplay.offset_bytes);
110110
111111 adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
112112 }
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c+31−46
@@ -80,6 +80,9 @@ MODULE_FIRMWARE("amdgpu/beige_goby_ta.bin"); · 79 unmodified lines
8080 /* For large FW files the time to complete can be very long */
8181 #define USBC_PD_POLLING_LIMIT_S 240
8282
83+/* Read USB-PD from LFB */
84+#define GFX_CMD_USB_PD_USE_LFB 0x480
85+
8386 static int psp_v11_0_init_microcode(struct psp_context *psp)
8487 {
8588 struct amdgpu_device *adev = psp->adev;
@@ -148,15 +151,15 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) · 62 unmodified lines
148151 goto out2;
149152
150153 ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
151− adev->psp.ta_xgmi_ucode_version = le32_to_cpu(ta_hdr->ta_xgmi_ucode_version);
152− adev->psp.ta_xgmi_ucode_size = le32_to_cpu(ta_hdr->ta_xgmi_size_bytes);
153− adev->psp.ta_xgmi_start_addr = (uint8_t *)ta_hdr +
154+ adev->psp.xgmi.feature_version = le32_to_cpu(ta_hdr->xgmi.fw_version);
155+ adev->psp.xgmi.size_bytes = le32_to_cpu(ta_hdr->xgmi.size_bytes);
156+ adev->psp.xgmi.start_addr = (uint8_t *)ta_hdr +
154157 le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
155158 adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
156− adev->psp.ta_ras_ucode_version = le32_to_cpu(ta_hdr->ta_ras_ucode_version);
157− adev->psp.ta_ras_ucode_size = le32_to_cpu(ta_hdr->ta_ras_size_bytes);
158− adev->psp.ta_ras_start_addr = (uint8_t *)adev->psp.ta_xgmi_start_addr +
159− le32_to_cpu(ta_hdr->ta_ras_offset_bytes);
159+ adev->psp.ras.feature_version = le32_to_cpu(ta_hdr->ras.fw_version);
160+ adev->psp.ras.size_bytes = le32_to_cpu(ta_hdr->ras.size_bytes);
161+ adev->psp.ras.start_addr = (uint8_t *)adev->psp.xgmi.start_addr +
162+ le32_to_cpu(ta_hdr->ras.offset_bytes);
160163 }
161164 break;
162165 case CHIP_NAVI10:
@@ -183,17 +186,17 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) · 20 unmodified lines
183186 goto out2;
184187
185188 ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
186− adev->psp.ta_hdcp_ucode_version = le32_to_cpu(ta_hdr->ta_hdcp_ucode_version);
187− adev->psp.ta_hdcp_ucode_size = le32_to_cpu(ta_hdr->ta_hdcp_size_bytes);
188− adev->psp.ta_hdcp_start_addr = (uint8_t *)ta_hdr +
189+ adev->psp.hdcp.feature_version = le32_to_cpu(ta_hdr->hdcp.fw_version);
190+ adev->psp.hdcp.size_bytes = le32_to_cpu(ta_hdr->hdcp.size_bytes);
191+ adev->psp.hdcp.start_addr = (uint8_t *)ta_hdr +
189192 le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
190193
191194 adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
192195
193− adev->psp.ta_dtm_ucode_version = le32_to_cpu(ta_hdr->ta_dtm_ucode_version);
194− adev->psp.ta_dtm_ucode_size = le32_to_cpu(ta_hdr->ta_dtm_size_bytes);
195− adev->psp.ta_dtm_start_addr = (uint8_t *)adev->psp.ta_hdcp_start_addr +
196− le32_to_cpu(ta_hdr->ta_dtm_offset_bytes);
196+ adev->psp.dtm.feature_version = le32_to_cpu(ta_hdr->dtm.fw_version);
197+ adev->psp.dtm.size_bytes = le32_to_cpu(ta_hdr->dtm.size_bytes);
198+ adev->psp.dtm.start_addr = (uint8_t *)adev->psp.hdcp.start_addr +
199+ le32_to_cpu(ta_hdr->dtm.offset_bytes);
197200 }
198201 break;
199202 case CHIP_SIENNA_CICHLID:
@@ -284,7 +287,7 @@ static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp) · 84 unmodified lines
284287 return ret;
285288
286289 /* Copy PSP KDB binary to memory */
287− psp_copy_fw(psp, psp->kdb_start_addr, psp->kdb_bin_size);
290+ psp_copy_fw(psp, psp->kdb.start_addr, psp->kdb.size_bytes);
288291
289292 /* Provide the PSP KDB to bootloader */
290293 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -315,7 +318,7 @@ static int psp_v11_0_bootloader_load_spl(struct psp_context *psp) · 24 unmodified lines
315318 return ret;
316319
317320 /* Copy PSP SPL binary to memory */
318− psp_copy_fw(psp, psp->spl_start_addr, psp->spl_bin_size);
321+ psp_copy_fw(psp, psp->spl.start_addr, psp->spl.size_bytes);
319322
320323 /* Provide the PSP SPL to bootloader */
321324 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -346,7 +349,7 @@ static int psp_v11_0_bootloader_load_sysdrv(struct psp_context *psp) · 24 unmodified lines
346349 return ret;
347350
348351 /* Copy PSP System Driver binary to memory */
349− psp_copy_fw(psp, psp->sys_start_addr, psp->sys_bin_size);
352+ psp_copy_fw(psp, psp->sys.start_addr, psp->sys.size_bytes);
350353
351354 /* Provide the sys driver to bootloader */
352355 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -380,7 +383,7 @@ static int psp_v11_0_bootloader_load_sos(struct psp_context *psp) · 27 unmodified lines
380383 return ret;
381384
382385 /* Copy Secure OS binary to PSP memory */
383− psp_copy_fw(psp, psp->sos_start_addr, psp->sos_bin_size);
386+ psp_copy_fw(psp, psp->sos.start_addr, psp->sos.size_bytes);
384387
385388 /* Provide the PSP secure OS to bootloader */
386389 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -753,44 +756,26 @@ static void psp_v11_0_ring_set_wptr(struct psp_context *psp, uint32_t value) · 366 unmodified lines
753756 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67, value);
754757 }
755758
756−static int psp_v11_0_load_usbc_pd_fw(struct psp_context *psp, dma_addr_t dma_addr)
759+static int psp_v11_0_load_usbc_pd_fw(struct psp_context *psp, uint64_t fw_pri_mc_addr)
757760 {
758761 struct amdgpu_device *adev = psp->adev;
759762 uint32_t reg_status;
760763 int ret, i = 0;
761764
762− /* Write lower 32-bit address of the PD Controller FW */
763− WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36, lower_32_bits(dma_addr));
764− ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
765− 0x80000000, 0x80000000, false);
766− if (ret)
767− return ret;
768−
769− /* Fireup interrupt so PSP can pick up the lower address */
770− WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35, 0x800000);
771− ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
772− 0x80000000, 0x80000000, false);
773− if (ret)
774− return ret;
775−
776− reg_status = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35);
777−
778− if ((reg_status & 0xFFFF) != 0) {
779− DRM_ERROR("Lower address load failed - MP0_SMN_C2PMSG_35.Bits [15:0] = %02x...\n",
780− reg_status & 0xFFFF);
781− return -EIO;
782− }
783−
784− /* Write upper 32-bit address of the PD Controller FW */
785− WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36, upper_32_bits(dma_addr));
765+ /*
766+ * LFB address which is aligned to 1MB address and has to be
767+ * right-shifted by 20 so that LFB address can be passed on a 32-bit C2P
768+ * register
769+ */
770+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36, (fw_pri_mc_addr >> 20));
786771
787772 ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
788773 0x80000000, 0x80000000, false);
789774 if (ret)
790775 return ret;
791776
792− /* Fireup interrupt so PSP can pick up the upper address */
793− WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35, 0x4000000);
777+ /* Fireup interrupt so PSP can pick up the address */
778+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35, (GFX_CMD_USB_PD_USE_LFB << 16));
794779
795780 /* FW load takes very long time */
796781 do {
@@ -806,7 +791,7 @@ static int psp_v11_0_load_usbc_pd_fw(struct psp_context *psp, dma_addr_t dma_add · 9 unmodified lines
806791 done:
807792
808793 if ((reg_status & 0xFFFF) != 0) {
809− DRM_ERROR("Upper address load failed - MP0_SMN_C2PMSG_35.Bits [15:0] = x%04x\n",
794+ DRM_ERROR("Address load failed - MP0_SMN_C2PMSG_35.Bits [15:0] = 0x%04x\n",
810795 reg_status & 0xFFFF);
811796 return -EIO;
812797 }
drivers/gpu/drm/amd/amdgpu/psp_v11_0_8.c+208−0
@@ -0,0 +1,208 @@
1+/*
2+ * Copyright 2021 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ */
23+#include "amdgpu.h"
24+#include "amdgpu_psp.h"
25+#include "amdgpu_ucode.h"
26+#include "soc15_common.h"
27+#include "psp_v11_0_8.h"
28+
29+#include "mp/mp_11_0_8_offset.h"
30+
31+static int psp_v11_0_8_ring_init(struct psp_context *psp,
32+ enum psp_ring_type ring_type)
33+{
34+ int ret = 0;
35+ struct psp_ring *ring;
36+ struct amdgpu_device *adev = psp->adev;
37+
38+ ring = &psp->km_ring;
39+
40+ ring->ring_type = ring_type;
41+
42+ /* allocate 4k Page of Local Frame Buffer memory for ring */
43+ ring->ring_size = 0x1000;
44+ ret = amdgpu_bo_create_kernel(adev, ring->ring_size, PAGE_SIZE,
45+ AMDGPU_GEM_DOMAIN_VRAM,
46+ &adev->firmware.rbuf,
47+ &ring->ring_mem_mc_addr,
48+ (void **)&ring->ring_mem);
49+ if (ret) {
50+ ring->ring_size = 0;
51+ return ret;
52+ }
53+
54+ return 0;
55+}
56+
57+static int psp_v11_0_8_ring_stop(struct psp_context *psp,
58+ enum psp_ring_type ring_type)
59+{
60+ int ret = 0;
61+ struct amdgpu_device *adev = psp->adev;
62+
63+ if (amdgpu_sriov_vf(adev)) {
64+ /* Write the ring destroy command*/
65+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
66+ GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
67+ /* there might be handshake issue with hardware which needs delay */
68+ mdelay(20);
69+ /* Wait for response flag (bit 31) */
70+ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
71+ 0x80000000, 0x80000000, false);
72+ } else {
73+ /* Write the ring destroy command*/
74+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
75+ GFX_CTRL_CMD_ID_DESTROY_RINGS);
76+ /* there might be handshake issue with hardware which needs delay */
77+ mdelay(20);
78+ /* Wait for response flag (bit 31) */
79+ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
80+ 0x80000000, 0x80000000, false);
81+ }
82+
83+ return ret;
84+}
85+
86+static int psp_v11_0_8_ring_create(struct psp_context *psp,
87+ enum psp_ring_type ring_type)
88+{
89+ int ret = 0;
90+ unsigned int psp_ring_reg = 0;
91+ struct psp_ring *ring = &psp->km_ring;
92+ struct amdgpu_device *adev = psp->adev;
93+
94+ if (amdgpu_sriov_vf(adev)) {
95+ ret = psp_v11_0_8_ring_stop(psp, ring_type);
96+ if (ret) {
97+ DRM_ERROR("psp_v11_0_8_ring_stop_sriov failed!\n");
98+ return ret;
99+ }
100+
101+ /* Write low address of the ring to C2PMSG_102 */
102+ psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr);
103+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_ring_reg);
104+ /* Write high address of the ring to C2PMSG_103 */
105+ psp_ring_reg = upper_32_bits(ring->ring_mem_mc_addr);
106+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_103, psp_ring_reg);
107+
108+ /* Write the ring initialization command to C2PMSG_101 */
109+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
110+ GFX_CTRL_CMD_ID_INIT_GPCOM_RING);
111+
112+ /* there might be handshake issue with hardware which needs delay */
113+ mdelay(20);
114+
115+ /* Wait for response flag (bit 31) in C2PMSG_101 */
116+ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
117+ 0x80000000, 0x8000FFFF, false);
118+
119+ } else {
120+ /* Wait for sOS ready for ring creation */
121+ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
122+ 0x80000000, 0x80000000, false);
123+ if (ret) {
124+ DRM_ERROR("Failed to wait for trust OS ready for ring creation\n");
125+ return ret;
126+ }
127+
128+ /* Write low address of the ring to C2PMSG_69 */
129+ psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr);
130+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_69, psp_ring_reg);
131+ /* Write high address of the ring to C2PMSG_70 */
132+ psp_ring_reg = upper_32_bits(ring->ring_mem_mc_addr);
133+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, psp_ring_reg);
134+ /* Write size of ring to C2PMSG_71 */
135+ psp_ring_reg = ring->ring_size;
136+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_71, psp_ring_reg);
137+ /* Write the ring initialization command to C2PMSG_64 */
138+ psp_ring_reg = ring_type;
139+ psp_ring_reg = psp_ring_reg << 16;
140+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg);
141+
142+ /* there might be handshake issue with hardware which needs delay */
143+ mdelay(20);
144+
145+ /* Wait for response flag (bit 31) in C2PMSG_64 */
146+ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
147+ 0x80000000, 0x8000FFFF, false);
148+ }
149+
150+ return ret;
151+}
152+
153+static int psp_v11_0_8_ring_destroy(struct psp_context *psp,
154+ enum psp_ring_type ring_type)
155+{
156+ int ret = 0;
157+ struct psp_ring *ring = &psp->km_ring;
158+ struct amdgpu_device *adev = psp->adev;
159+
160+ ret = psp_v11_0_8_ring_stop(psp, ring_type);
161+ if (ret)
162+ DRM_ERROR("Fail to stop psp ring\n");
163+
164+ amdgpu_bo_free_kernel(&adev->firmware.rbuf,
165+ &ring->ring_mem_mc_addr,
166+ (void **)&ring->ring_mem);
167+
168+ return ret;
169+}
170+
171+static uint32_t psp_v11_0_8_ring_get_wptr(struct psp_context *psp)
172+{
173+ uint32_t data;
174+ struct amdgpu_device *adev = psp->adev;
175+
176+ if (amdgpu_sriov_vf(adev))
177+ data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
178+ else
179+ data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
180+
181+ return data;
182+}
183+
184+static void psp_v11_0_8_ring_set_wptr(struct psp_context *psp, uint32_t value)
185+{
186+ struct amdgpu_device *adev = psp->adev;
187+
188+ if (amdgpu_sriov_vf(adev)) {
189+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value);
190+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
191+ GFX_CTRL_CMD_ID_CONSUME_CMD);
192+ } else
193+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67, value);
194+}
195+
196+static const struct psp_funcs psp_v11_0_8_funcs = {
197+ .ring_init = psp_v11_0_8_ring_init,
198+ .ring_create = psp_v11_0_8_ring_create,
199+ .ring_stop = psp_v11_0_8_ring_stop,
200+ .ring_destroy = psp_v11_0_8_ring_destroy,
201+ .ring_get_wptr = psp_v11_0_8_ring_get_wptr,
202+ .ring_set_wptr = psp_v11_0_8_ring_set_wptr,
203+};
204+
205+void psp_v11_0_8_set_psp_funcs(struct psp_context *psp)
206+{
207+ psp->funcs = &psp_v11_0_8_funcs;
208+}
drivers/gpu/drm/amd/amdgpu/psp_v11_0_8.hrenamed from drivers/gpu/drm/amd/amdgpu/dce_virtual.h+5−5
@@ -1,5 +1,5 @@
11 /*
2− * Copyright 2014 Advanced Micro Devices, Inc.
2+ * Copyright 2021 Advanced Micro Devices, Inc.
33 *
44 * Permission is hereby granted, free of charge, to any person obtaining a
55 * copy of this software and associated documentation files (the "Software"),
@@ -20,11 +20,11 @@ · 14 unmodified lines
2020 * OTHER DEALINGS IN THE SOFTWARE.
2121 *
2222 */
23+#ifndef __PSP_V11_0_8_H__
24+#define __PSP_V11_0_8_H__
2325
24−#ifndef __DCE_VIRTUAL_H__
25−#define __DCE_VIRTUAL_H__
26+#include "amdgpu_psp.h"
2627
27−extern const struct amdgpu_ip_block_version dce_virtual_ip_block;
28+void psp_v11_0_8_set_psp_funcs(struct psp_context *psp);
2829
2930 #endif
30−
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c+14−14
@@ -84,23 +84,23 @@ static int psp_v12_0_init_microcode(struct psp_context *psp) · 83 unmodified lines
8484
8585 ta_hdr = (const struct ta_firmware_header_v1_0 *)
8686 adev->psp.ta_fw->data;
87− adev->psp.ta_hdcp_ucode_version =
88− le32_to_cpu(ta_hdr->ta_hdcp_ucode_version);
89− adev->psp.ta_hdcp_ucode_size =
90− le32_to_cpu(ta_hdr->ta_hdcp_size_bytes);
91− adev->psp.ta_hdcp_start_addr =
87+ adev->psp.hdcp.feature_version =
88+ le32_to_cpu(ta_hdr->hdcp.fw_version);
89+ adev->psp.hdcp.size_bytes =
90+ le32_to_cpu(ta_hdr->hdcp.size_bytes);
91+ adev->psp.hdcp.start_addr =
9292 (uint8_t *)ta_hdr +
9393 le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
9494
9595 adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
9696
97− adev->psp.ta_dtm_ucode_version =
98− le32_to_cpu(ta_hdr->ta_dtm_ucode_version);
99− adev->psp.ta_dtm_ucode_size =
100− le32_to_cpu(ta_hdr->ta_dtm_size_bytes);
101− adev->psp.ta_dtm_start_addr =
102− (uint8_t *)adev->psp.ta_hdcp_start_addr +
103− le32_to_cpu(ta_hdr->ta_dtm_offset_bytes);
97+ adev->psp.dtm.feature_version =
98+ le32_to_cpu(ta_hdr->dtm.fw_version);
99+ adev->psp.dtm.size_bytes =
100+ le32_to_cpu(ta_hdr->dtm.size_bytes);
101+ adev->psp.dtm.start_addr =
102+ (uint8_t *)adev->psp.hdcp.start_addr +
103+ le32_to_cpu(ta_hdr->dtm.offset_bytes);
104104 }
105105
106106 return 0;
@@ -138,7 +138,7 @@ static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp) · 31 unmodified lines
138138 return ret;
139139
140140 /* Copy PSP System Driver binary to memory */
141− psp_copy_fw(psp, psp->sys_start_addr, psp->sys_bin_size);
141+ psp_copy_fw(psp, psp->sys.start_addr, psp->sys.size_bytes);
142142
143143 /* Provide the sys driver to bootloader */
144144 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -177,7 +177,7 @@ static int psp_v12_0_bootloader_load_sos(struct psp_context *psp) · 32 unmodified lines
177177 return ret;
178178
179179 /* Copy Secure OS binary to PSP memory */
180− psp_copy_fw(psp, psp->sos_start_addr, psp->sos_bin_size);
180+ psp_copy_fw(psp, psp->sos.start_addr, psp->sos.size_bytes);
181181
182182 /* Provide the PSP secure OS to bootloader */
183183 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c+93−33
@@ -35,6 +35,12 @@ MODULE_FIRMWARE("amdgpu/yellow_carp_asd.bin"); · 34 unmodified lines
3535 MODULE_FIRMWARE("amdgpu/yellow_carp_toc.bin");
3636 MODULE_FIRMWARE("amdgpu/yellow_carp_ta.bin");
3737
38+/* For large FW files the time to complete can be very long */
39+#define USBC_PD_POLLING_LIMIT_S 240
40+
41+/* Read USB-PD from LFB */
42+#define GFX_CMD_USB_PD_USE_LFB 0x480
43+
3844 static int psp_v13_0_init_microcode(struct psp_context *psp)
3945 {
4046 struct amdgpu_device *adev = psp->adev;
@@ -111,7 +117,9 @@ static int psp_v13_0_wait_for_bootloader(struct psp_context *psp) · 70 unmodified lines
111117 return ret;
112118 }
113119
114−static int psp_v13_0_bootloader_load_kdb(struct psp_context *psp)
120+static int psp_v13_0_bootloader_load_component(struct psp_context *psp,
121+ struct psp_bin_desc *bin_desc,
122+ enum psp_bootloader_cmd bl_cmd)
115123 {
116124 int ret;
117125 uint32_t psp_gfxdrv_command_reg = 0;
@@ -130,12 +138,12 @@ static int psp_v13_0_bootloader_load_kdb(struct psp_context *psp) · 12 unmodified lines
130138 memset(psp->fw_pri_buf, 0, PSP_1_MEG);
131139
132140 /* Copy PSP KDB binary to memory */
133− memcpy(psp->fw_pri_buf, psp->kdb_start_addr, psp->kdb_bin_size);
141+ memcpy(psp->fw_pri_buf, bin_desc->start_addr, bin_desc->size_bytes);
134142
135143 /* Provide the PSP KDB to bootloader */
136144 WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,
137145 (uint32_t)(psp->fw_pri_mc_addr >> 20));
138− psp_gfxdrv_command_reg = PSP_BL__LOAD_KEY_DATABASE;
146+ psp_gfxdrv_command_reg = bl_cmd;
139147 WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_35,
140148 psp_gfxdrv_command_reg);
141149
@@ -144,40 +152,29 @@ static int psp_v13_0_bootloader_load_kdb(struct psp_context *psp) · 2 unmodified lines
144152 return ret;
145153 }
146154
147−static int psp_v13_0_bootloader_load_sysdrv(struct psp_context *psp)
155+static int psp_v13_0_bootloader_load_kdb(struct psp_context *psp)
148156 {
149− int ret;
150− uint32_t psp_gfxdrv_command_reg = 0;
151− struct amdgpu_device *adev = psp->adev;
152−
153− /* Check sOS sign of life register to confirm sys driver and sOS
154− * are already been loaded.
155− */
156− if (psp_v13_0_is_sos_alive(psp))
157− return 0;
158−
159− ret = psp_v13_0_wait_for_bootloader(psp);
160− if (ret)
161− return ret;
162−
163− memset(psp->fw_pri_buf, 0, PSP_1_MEG);
164−
165− /* Copy PSP System Driver binary to memory */
166− memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size);
157+ return psp_v13_0_bootloader_load_component(psp, &psp->kdb, PSP_BL__LOAD_KEY_DATABASE);
158+}
167159
168− /* Provide the sys driver to bootloader */
169− WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,
170− (uint32_t)(psp->fw_pri_mc_addr >> 20));
171− psp_gfxdrv_command_reg = PSP_BL__LOAD_SYSDRV;
172− WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_35,
173− psp_gfxdrv_command_reg);
160+static int psp_v13_0_bootloader_load_sysdrv(struct psp_context *psp)
161+{
162+ return psp_v13_0_bootloader_load_component(psp, &psp->sys, PSP_BL__LOAD_SYSDRV);
163+}
174164
175− /* there might be handshake issue with hardware which needs delay */
176− mdelay(20);
165+static int psp_v13_0_bootloader_load_soc_drv(struct psp_context *psp)
166+{
167+ return psp_v13_0_bootloader_load_component(psp, &psp->soc_drv, PSP_BL__LOAD_SOCDRV);
168+}
177169
178− ret = psp_v13_0_wait_for_bootloader(psp);
170+static int psp_v13_0_bootloader_load_intf_drv(struct psp_context *psp)
171+{
172+ return psp_v13_0_bootloader_load_component(psp, &psp->intf_drv, PSP_BL__LOAD_INTFDRV);
173+}
179174
180− return ret;
175+static int psp_v13_0_bootloader_load_dbg_drv(struct psp_context *psp)
176+{
177+ return psp_v13_0_bootloader_load_component(psp, &psp->dbg_drv, PSP_BL__LOAD_DBGDRV);
181178 }
182179
183180 static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)
@@ -199,7 +196,7 @@ static int psp_v13_0_bootloader_load_sos(struct psp_context *psp) · 15 unmodified lines
199196 memset(psp->fw_pri_buf, 0, PSP_1_MEG);
200197
201198 /* Copy Secure OS binary to PSP memory */
202− memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size);
199+ memcpy(psp->fw_pri_buf, psp->sos.start_addr, psp->sos.size_bytes);
203200
204201 /* Provide the PSP secure OS to bootloader */
205202 WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,
@@ -382,10 +379,71 @@ static void psp_v13_0_ring_set_wptr(struct psp_context *psp, uint32_t value) · 176 unmodified lines
382379 WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_67, value);
383380 }
384381
382+static int psp_v13_0_load_usbc_pd_fw(struct psp_context *psp, uint64_t fw_pri_mc_addr)
383+{
384+ struct amdgpu_device *adev = psp->adev;
385+ uint32_t reg_status;
386+ int ret, i = 0;
387+
388+ /*
389+ * LFB address which is aligned to 1MB address and has to be
390+ * right-shifted by 20 so that LFB address can be passed on a 32-bit C2P
391+ * register
392+ */
393+ WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36, (fw_pri_mc_addr >> 20));
394+
395+ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_35),
396+ 0x80000000, 0x80000000, false);
397+ if (ret)
398+ return ret;
399+
400+ /* Fireup interrupt so PSP can pick up the address */
401+ WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_35, (GFX_CMD_USB_PD_USE_LFB << 16));
402+
403+ /* FW load takes very long time */
404+ do {
405+ msleep(1000);
406+ reg_status = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_35);
407+
408+ if (reg_status & 0x80000000)
409+ goto done;
410+
411+ } while (++i < USBC_PD_POLLING_LIMIT_S);
412+
413+ return -ETIME;
414+done:
415+
416+ if ((reg_status & 0xFFFF) != 0) {
417+ DRM_ERROR("Address load failed - MP0_SMN_C2PMSG_35.Bits [15:0] = %04x\n",
418+ reg_status & 0xFFFF);
419+ return -EIO;
420+ }
421+
422+ return 0;
423+}
424+
425+static int psp_v13_0_read_usbc_pd_fw(struct psp_context *psp, uint32_t *fw_ver)
426+{
427+ struct amdgpu_device *adev = psp->adev;
428+ int ret;
429+
430+ WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_35, C2PMSG_CMD_GFX_USB_PD_FW_VER);
431+
432+ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_35),
433+ 0x80000000, 0x80000000, false);
434+ if (!ret)
435+ *fw_ver = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36);
436+
437+ return ret;
438+}
439+
385440 static const struct psp_funcs psp_v13_0_funcs = {
386441 .init_microcode = psp_v13_0_init_microcode,
387442 .bootloader_load_kdb = psp_v13_0_bootloader_load_kdb,
388443 .bootloader_load_sysdrv = psp_v13_0_bootloader_load_sysdrv,
444+ .bootloader_load_soc_drv = psp_v13_0_bootloader_load_soc_drv,
445+ .bootloader_load_intf_drv = psp_v13_0_bootloader_load_intf_drv,
446+ .bootloader_load_dbg_drv = psp_v13_0_bootloader_load_dbg_drv,
389447 .bootloader_load_sos = psp_v13_0_bootloader_load_sos,
390448 .ring_init = psp_v13_0_ring_init,
391449 .ring_create = psp_v13_0_ring_create,
@@ -393,6 +451,8 @@ static const struct psp_funcs psp_v13_0_funcs = { · 1 unmodified line
393451 .ring_destroy = psp_v13_0_ring_destroy,
394452 .ring_get_wptr = psp_v13_0_ring_get_wptr,
395453 .ring_set_wptr = psp_v13_0_ring_set_wptr,
454+ .load_usbc_pd_fw = psp_v13_0_load_usbc_pd_fw,
455+ .read_usbc_pd_fw = psp_v13_0_read_usbc_pd_fw
396456 };
397457
398458 void psp_v13_0_set_psp_funcs(struct psp_context *psp)
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c+2−2
@@ -103,7 +103,7 @@ static int psp_v3_1_bootloader_load_sysdrv(struct psp_context *psp) · 102 unmodified lines
103103 return ret;
104104
105105 /* Copy PSP System Driver binary to memory */
106− psp_copy_fw(psp, psp->sys_start_addr, psp->sys_bin_size);
106+ psp_copy_fw(psp, psp->sys.start_addr, psp->sys.size_bytes);
107107
108108 /* Provide the sys driver to bootloader */
109109 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -142,7 +142,7 @@ static int psp_v3_1_bootloader_load_sos(struct psp_context *psp) · 32 unmodified lines
142142 return ret;
143143
144144 /* Copy Secure OS binary to PSP memory */
145− psp_copy_fw(psp, psp->sos_start_addr, psp->sos_bin_size);
145+ psp_copy_fw(psp, psp->sos.start_addr, psp->sos.size_bytes);
146146
147147 /* Provide the PSP secure OS to bootloader */
148148 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c+49−1
@@ -51,6 +51,12 @@ MODULE_FIRMWARE("amdgpu/navi14_sdma1.bin"); · 50 unmodified lines
5151 MODULE_FIRMWARE("amdgpu/navi12_sdma.bin");
5252 MODULE_FIRMWARE("amdgpu/navi12_sdma1.bin");
5353
54+MODULE_FIRMWARE("amdgpu/cyan_skillfish_sdma.bin");
55+MODULE_FIRMWARE("amdgpu/cyan_skillfish_sdma1.bin");
56+
57+MODULE_FIRMWARE("amdgpu/cyan_skillfish2_sdma.bin");
58+MODULE_FIRMWARE("amdgpu/cyan_skillfish2_sdma1.bin");
59+
5460 #define SDMA1_REG_OFFSET 0x600
5561 #define SDMA0_HYP_DEC_REG_START 0x5880
5662 #define SDMA0_HYP_DEC_REG_END 0x5893
@@ -130,6 +136,37 @@ static const struct soc15_reg_golden golden_settings_sdma_nv12[] = { · 73 unmodified lines
130136 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC3_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
131137 };
132138
139+static const struct soc15_reg_golden golden_settings_sdma_cyan_skillfish[] = {
140+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_CHICKEN_BITS, 0xffbf1f0f, 0x03ab0107),
141+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_GB_ADDR_CONFIG, 0x001877ff, 0x00000044),
142+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x001877ff, 0x00000044),
143+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_GFX_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
144+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_PAGE_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
145+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC0_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
146+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
147+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC2_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
148+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC3_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
149+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC4_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
150+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC5_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
151+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC6_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
152+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC7_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
153+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_UTCL1_PAGE, 0x007fffff, 0x004c5c00),
154+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_CHICKEN_BITS, 0xffbf1f0f, 0x03ab0107),
155+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_GB_ADDR_CONFIG, 0x001877ff, 0x00000044),
156+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x001877ff, 0x00000044),
157+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_GFX_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
158+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_PAGE_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
159+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC0_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
160+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC1_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
161+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC2_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
162+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC3_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
163+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC4_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
164+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC5_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
165+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC6_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
166+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC7_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
167+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_UTCL1_PAGE, 0x007fffff, 0x004c5c00)
168+};
169+
133170 static u32 sdma_v5_0_get_reg_offset(struct amdgpu_device *adev, u32 instance, u32 internal_offset)
134171 {
135172 u32 base;
@@ -180,6 +217,11 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev) · 44 unmodified lines
180217 golden_settings_sdma_nv12,
181218 (const u32)ARRAY_SIZE(golden_settings_sdma_nv12));
182219 break;
220+ case CHIP_CYAN_SKILLFISH:
221+ soc15_program_register_sequence(adev,
222+ golden_settings_sdma_cyan_skillfish,
223+ (const u32)ARRAY_SIZE(golden_settings_sdma_cyan_skillfish));
224+ break;
183225 default:
184226 break;
185227 }
@@ -200,7 +242,7 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev) · 14 unmodified lines
200242 static int sdma_v5_0_init_microcode(struct amdgpu_device *adev)
201243 {
202244 const char *chip_name;
203− char fw_name[30];
245+ char fw_name[40];
204246 int err = 0, i;
205247 struct amdgpu_firmware_info *info = NULL;
206248 const struct common_firmware_header *header = NULL;
@@ -221,6 +263,12 @@ static int sdma_v5_0_init_microcode(struct amdgpu_device *adev) · 14 unmodified lines
221263 case CHIP_NAVI12:
222264 chip_name = "navi12";
223265 break;
266+ case CHIP_CYAN_SKILLFISH:
267+ if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2)
268+ chip_name = "cyan_skillfish2";
269+ else
270+ chip_name = "cyan_skillfish";
271+ break;
224272 default:
225273 BUG();
226274 }
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c+0−17
@@ -87,21 +87,6 @@ static u32 sdma_v5_2_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3 · 86 unmodified lines
8787 return base + internal_offset;
8888 }
8989
90−static void sdma_v5_2_init_golden_registers(struct amdgpu_device *adev)
91−{
92− switch (adev->asic_type) {
93− case CHIP_SIENNA_CICHLID:
94− case CHIP_NAVY_FLOUNDER:
95− case CHIP_VANGOGH:
96− case CHIP_DIMGREY_CAVEFISH:
97− case CHIP_BEIGE_GOBY:
98− case CHIP_YELLOW_CARP:
99− break;
100− default:
101− break;
102− }
103−}
104−
10590 static int sdma_v5_2_init_inst_ctx(struct amdgpu_sdma_instance *sdma_inst)
10691 {
10792 int err = 0;
@@ -1345,8 +1330,6 @@ static int sdma_v5_2_hw_init(void *handle) · 1237 unmodified lines
13451330 int r;
13461331 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
13471332
1348− sdma_v5_2_init_golden_registers(adev);
1349−
13501333 r = sdma_v5_2_start(adev);
13511334
13521335 return r;
drivers/gpu/drm/amd/amdgpu/si.c+4−4
@@ -44,7 +44,7 @@ · 43 unmodified lines
4444 #include "dce_v6_0.h"
4545 #include "si.h"
4646 #include "uvd_v3_1.h"
47−#include "dce_virtual.h"
47+#include "amdgpu_vkms.h"
4848 #include "gca/gfx_6_0_d.h"
4949 #include "oss/oss_1_0_d.h"
5050 #include "oss/oss_1_0_sh_mask.h"
@@ -2759,7 +2759,7 @@ int si_set_ip_blocks(struct amdgpu_device *adev) · 2708 unmodified lines
27592759 amdgpu_device_ip_block_add(adev, &si_dma_ip_block);
27602760 amdgpu_device_ip_block_add(adev, &si_smu_ip_block);
27612761 if (adev->enable_virtual_display)
2762− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2762+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
27632763 #if defined(CONFIG_DRM_AMD_DC) && defined(CONFIG_DRM_AMD_DC_SI)
27642764 else if (amdgpu_device_has_dc_support(adev))
27652765 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2777,7 +2777,7 @@ int si_set_ip_blocks(struct amdgpu_device *adev) · 11 unmodified lines
27772777 amdgpu_device_ip_block_add(adev, &si_dma_ip_block);
27782778 amdgpu_device_ip_block_add(adev, &si_smu_ip_block);
27792779 if (adev->enable_virtual_display)
2780− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2780+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
27812781 #if defined(CONFIG_DRM_AMD_DC) && defined(CONFIG_DRM_AMD_DC_SI)
27822782 else if (amdgpu_device_has_dc_support(adev))
27832783 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2795,7 +2795,7 @@ int si_set_ip_blocks(struct amdgpu_device *adev) · 11 unmodified lines
27952795 amdgpu_device_ip_block_add(adev, &si_dma_ip_block);
27962796 amdgpu_device_ip_block_add(adev, &si_smu_ip_block);
27972797 if (adev->enable_virtual_display)
2798− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2798+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
27992799 break;
28002800 default:
28012801 BUG();
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c+186−138
@@ -41,9 +41,7 @@ · 40 unmodified lines
4141 #define I2C_SW_TIMEOUT 8
4242 #define I2C_ABORT 0x10
4343
44−/* I2C transaction flags */
45−#define I2C_NO_STOP 1
46−#define I2C_RESTART 2
44+#define I2C_X_RESTART BIT(31)
4745
4846 #define to_amdgpu_device(x) (container_of(x, struct amdgpu_device, pm.smu_i2c))
4947
@@ -56,12 +54,48 @@ static void smu_v11_0_i2c_set_clock_gating(struct i2c_adapter *control, bool en) · 6 unmodified lines
5654 WREG32_SOC15(SMUIO, 0, mmSMUIO_PWRMGT, reg);
5755 }
5856
57+/* The T_I2C_POLL_US is defined as follows:
58+ *
59+ * "Define a timer interval (t_i2c_poll) equal to 10 times the
60+ * signalling period for the highest I2C transfer speed used in the
61+ * system and supported by DW_apb_i2c. For instance, if the highest
62+ * I2C data transfer mode is 400 kb/s, then t_i2c_poll is 25 us." --
63+ * DesignWare DW_apb_i2c Databook, Version 1.21a, section 3.8.3.1,
64+ * page 56, with grammar and syntax corrections.
65+ *
66+ * Vcc for our device is at 1.8V which puts it at 400 kHz,
67+ * see Atmel AT24CM02 datasheet, section 8.3 DC Characteristics table, page 14.
68+ *
69+ * The procedure to disable the IP block is described in section
70+ * 3.8.3 Disabling DW_apb_i2c on page 56.
71+ */
72+#define I2C_SPEED_MODE_FAST 2
73+#define T_I2C_POLL_US 25
74+#define I2C_MAX_T_POLL_COUNT 1000
5975
60−static void smu_v11_0_i2c_enable(struct i2c_adapter *control, bool enable)
76+static int smu_v11_0_i2c_enable(struct i2c_adapter *control, bool enable)
6177 {
6278 struct amdgpu_device *adev = to_amdgpu_device(control);
6379
6480 WREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_ENABLE, enable ? 1 : 0);
81+
82+ if (!enable) {
83+ int ii;
84+
85+ for (ii = I2C_MAX_T_POLL_COUNT; ii > 0; ii--) {
86+ u32 en_stat = RREG32_SOC15(SMUIO,
87+ 0,
88+ mmCKSVII2C_IC_ENABLE_STATUS);
89+ if (REG_GET_FIELD(en_stat, CKSVII2C_IC_ENABLE_STATUS, IC_EN))
90+ udelay(T_I2C_POLL_US);
91+ else
92+ return I2C_OK;
93+ }
94+
95+ return I2C_ABORT;
96+ }
97+
98+ return I2C_OK;
6599 }
66100
67101 static void smu_v11_0_i2c_clear_status(struct i2c_adapter *control)
@@ -83,8 +117,13 @@ static void smu_v11_0_i2c_configure(struct i2c_adapter *control) · 15 unmodified lines
83117 reg = REG_SET_FIELD(reg, CKSVII2C_IC_CON, IC_RESTART_EN, 1);
84118 reg = REG_SET_FIELD(reg, CKSVII2C_IC_CON, IC_10BITADDR_MASTER, 0);
85119 reg = REG_SET_FIELD(reg, CKSVII2C_IC_CON, IC_10BITADDR_SLAVE, 0);
86− /* Standard mode */
87− reg = REG_SET_FIELD(reg, CKSVII2C_IC_CON, IC_MAX_SPEED_MODE, 2);
120+ /* The values of IC_MAX_SPEED_MODE are,
121+ * 1: standard mode, 0 - 100 Kb/s,
122+ * 2: fast mode, <= 400 Kb/s, or fast mode plus, <= 1000 Kb/s,
123+ * 3: high speed mode, <= 3.4 Mb/s.
124+ */
125+ reg = REG_SET_FIELD(reg, CKSVII2C_IC_CON, IC_MAX_SPEED_MODE,
126+ I2C_SPEED_MODE_FAST);
88127 reg = REG_SET_FIELD(reg, CKSVII2C_IC_CON, IC_MASTER_MODE, 1);
89128
90129 WREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_CON, reg);
@@ -113,13 +152,15 @@ static void smu_v11_0_i2c_set_clock(struct i2c_adapter *control) · 22 unmodified lines
113152 WREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_SDA_HOLD, 20);
114153 }
115154
116−static void smu_v11_0_i2c_set_address(struct i2c_adapter *control, uint8_t address)
155+static void smu_v11_0_i2c_set_address(struct i2c_adapter *control, u16 address)
117156 {
118157 struct amdgpu_device *adev = to_amdgpu_device(control);
119158
120− /* Convert fromr 8-bit to 7-bit address */
121− address >>= 1;
122− WREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_TAR, (address & 0xFF));
159+ /* The IC_TAR::IC_TAR field is 10-bits wide.
160+ * It takes a 7-bit or 10-bit addresses as an address,
161+ * i.e. no read/write bit--no wire format, just the address.
162+ */
163+ WREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_TAR, address & 0x3FF);
123164 }
124165
125166 static uint32_t smu_v11_0_i2c_poll_tx_status(struct i2c_adapter *control)
@@ -206,9 +247,6 @@ static uint32_t smu_v11_0_i2c_poll_rx_status(struct i2c_adapter *control) · 80 unmodified lines
206247 return ret;
207248 }
208249
209−
210−
211−
212250 /**
213251 * smu_v11_0_i2c_transmit - Send a block of data over the I2C bus to a slave device.
214252 *
@@ -221,17 +259,17 @@ static uint32_t smu_v11_0_i2c_poll_rx_status(struct i2c_adapter *control) · 6 unmodified lines
221259 * Returns 0 on success or error.
222260 */
223261 static uint32_t smu_v11_0_i2c_transmit(struct i2c_adapter *control,
224− uint8_t address, uint8_t *data,
225− uint32_t numbytes, uint32_t i2c_flag)
262+ u16 address, u8 *data,
263+ u32 numbytes, u32 i2c_flag)
226264 {
227265 struct amdgpu_device *adev = to_amdgpu_device(control);
228− uint32_t bytes_sent, reg, ret = 0;
266+ u32 bytes_sent, reg, ret = I2C_OK;
229267 unsigned long timeout_counter;
230268
231269 bytes_sent = 0;
232270
233271 DRM_DEBUG_DRIVER("I2C_Transmit(), address = %x, bytes = %d , data: ",
234− (uint16_t)address, numbytes);
272+ address, numbytes);
235273
236274 if (drm_debug_enabled(DRM_UT_DRIVER)) {
237275 print_hex_dump(KERN_INFO, "data: ", DUMP_PREFIX_NONE,
@@ -246,53 +284,49 @@ static uint32_t smu_v11_0_i2c_transmit(struct i2c_adapter *control, · 8 unmodified lines
246284 /* Clear status bits */
247285 smu_v11_0_i2c_clear_status(control);
248286
249−
250287 timeout_counter = jiffies + msecs_to_jiffies(20);
251288
252289 while (numbytes > 0) {
253290 reg = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_STATUS);
254− if (REG_GET_FIELD(reg, CKSVII2C_IC_STATUS, TFNF)) {
255− do {
256− reg = 0;
257− /*
258− * Prepare transaction, no need to set RESTART. I2C engine will send
259− * START as soon as it sees data in TXFIFO
260− */
261− if (bytes_sent == 0)
262− reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, RESTART,
263− (i2c_flag & I2C_RESTART) ? 1 : 0);
264− reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, DAT, data[bytes_sent]);
265−
266− /* determine if we need to send STOP bit or not */
267− if (numbytes == 1)
268− /* Final transaction, so send stop unless I2C_NO_STOP */
269− reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, STOP,
270− (i2c_flag & I2C_NO_STOP) ? 0 : 1);
271− /* Write */
272− reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, CMD, 0);
273− WREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_DATA_CMD, reg);
274−
275− /* Record that the bytes were transmitted */
276− bytes_sent++;
277− numbytes--;
278−
279− reg = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_STATUS);
280−
281− } while (numbytes && REG_GET_FIELD(reg, CKSVII2C_IC_STATUS, TFNF));
282− }
283−
284− /*
285− * We waited too long for the transmission FIFO to become not-full.
286− * Exit the loop with error.
287− */
288− if (time_after(jiffies, timeout_counter)) {
289− ret |= I2C_SW_TIMEOUT;
290− goto Err;
291+ if (!REG_GET_FIELD(reg, CKSVII2C_IC_STATUS, TFNF)) {
292+ /*
293+ * We waited for too long for the transmission
294+ * FIFO to become not-full. Exit the loop
295+ * with error.
296+ */
297+ if (time_after(jiffies, timeout_counter)) {
298+ ret |= I2C_SW_TIMEOUT;
299+ goto Err;
300+ }
301+ } else {
302+ reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, DAT,
303+ data[bytes_sent]);
304+
305+ /* Final message, final byte, must generate a
306+ * STOP to release the bus, i.e. don't hold
307+ * SCL low.
308+ */
309+ if (numbytes == 1 && i2c_flag & I2C_M_STOP)
310+ reg = REG_SET_FIELD(reg,
311+ CKSVII2C_IC_DATA_CMD,
312+ STOP, 1);
313+
314+ if (bytes_sent == 0 && i2c_flag & I2C_X_RESTART)
315+ reg = REG_SET_FIELD(reg,
316+ CKSVII2C_IC_DATA_CMD,
317+ RESTART, 1);
318+
319+ /* Write */
320+ reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, CMD, 0);
321+ WREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_DATA_CMD, reg);
322+
323+ /* Record that the bytes were transmitted */
324+ bytes_sent++;
325+ numbytes--;
291326 }
292327 }
293328
294329 ret = smu_v11_0_i2c_poll_tx_status(control);
295−
296330 Err:
297331 /* Any error, no point in proceeding */
298332 if (ret != I2C_OK) {
@@ -323,8 +357,8 @@ Err: · 24 unmodified lines
323357 * Returns 0 on success or error.
324358 */
325359 static uint32_t smu_v11_0_i2c_receive(struct i2c_adapter *control,
326− uint8_t address, uint8_t *data,
327− uint32_t numbytes, uint8_t i2c_flag)
360+ u16 address, u8 *data,
361+ u32 numbytes, u32 i2c_flag)
328362 {
329363 struct amdgpu_device *adev = to_amdgpu_device(control);
330364 uint32_t bytes_received, ret = I2C_OK;
@@ -342,23 +376,21 @@ static uint32_t smu_v11_0_i2c_receive(struct i2c_adapter *control, · 11 unmodified lines
342376
343377 smu_v11_0_i2c_clear_status(control);
344378
345−
346379 /* Prepare transaction */
347−
348− /* Each time we disable I2C, so this is not a restart */
349− if (bytes_received == 0)
350− reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, RESTART,
351− (i2c_flag & I2C_RESTART) ? 1 : 0);
352−
353380 reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, DAT, 0);
354381 /* Read */
355382 reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, CMD, 1);
356383
357− /* Transmitting last byte */
358− if (numbytes == 1)
359− /* Final transaction, so send stop if requested */
360− reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD, STOP,
361− (i2c_flag & I2C_NO_STOP) ? 0 : 1);
384+ /* Final message, final byte, must generate a STOP
385+ * to release the bus, i.e. don't hold SCL low.
386+ */
387+ if (numbytes == 1 && i2c_flag & I2C_M_STOP)
388+ reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD,
389+ STOP, 1);
390+
391+ if (bytes_received == 0 && i2c_flag & I2C_X_RESTART)
392+ reg = REG_SET_FIELD(reg, CKSVII2C_IC_DATA_CMD,
393+ RESTART, 1);
362394
363395 WREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_DATA_CMD, reg);
364396
@@ -413,7 +445,6 @@ static void smu_v11_0_i2c_abort(struct i2c_adapter *control) · 48 unmodified lines
413445 DRM_DEBUG_DRIVER("I2C_Abort() Done.");
414446 }
415447
416−
417448 static bool smu_v11_0_i2c_activity_done(struct i2c_adapter *control)
418449 {
419450 struct amdgpu_device *adev = to_amdgpu_device(control);
@@ -425,7 +456,6 @@ static bool smu_v11_0_i2c_activity_done(struct i2c_adapter *control) · 5 unmodified lines
425456 reg_ic_enable_status = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_ENABLE_STATUS);
426457 reg_ic_enable = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_ENABLE);
427458
428−
429459 if ((REG_GET_FIELD(reg_ic_enable, CKSVII2C_IC_ENABLE, ENABLE) == 0) &&
430460 (REG_GET_FIELD(reg_ic_enable_status, CKSVII2C_IC_ENABLE_STATUS, IC_EN) == 1)) {
431461 /*
@@ -455,6 +485,8 @@ static bool smu_v11_0_i2c_activity_done(struct i2c_adapter *control) · 23 unmodified lines
455485
456486 static void smu_v11_0_i2c_init(struct i2c_adapter *control)
457487 {
488+ int res;
489+
458490 /* Disable clock gating */
459491 smu_v11_0_i2c_set_clock_gating(control, false);
460492
@@ -462,7 +494,9 @@ static void smu_v11_0_i2c_init(struct i2c_adapter *control) · 1 unmodified line
462494 DRM_WARN("I2C busy !");
463495
464496 /* Disable I2C */
465− smu_v11_0_i2c_enable(control, false);
497+ res = smu_v11_0_i2c_enable(control, false);
498+ if (res != I2C_OK)
499+ smu_v11_0_i2c_abort(control);
466500
467501 /* Configure I2C to operate as master and in standard mode */
468502 smu_v11_0_i2c_configure(control);
@@ -475,21 +509,22 @@ static void smu_v11_0_i2c_init(struct i2c_adapter *control) · 6 unmodified lines
475509 static void smu_v11_0_i2c_fini(struct i2c_adapter *control)
476510 {
477511 struct amdgpu_device *adev = to_amdgpu_device(control);
478− uint32_t reg_ic_enable_status, reg_ic_enable;
512+ u32 status, enable, en_stat;
513+ int res;
479514
480− smu_v11_0_i2c_enable(control, false);
515+ res = smu_v11_0_i2c_enable(control, false);
516+ if (res != I2C_OK) {
517+ status = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_STATUS);
518+ enable = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_ENABLE);
519+ en_stat = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_ENABLE_STATUS);
481520
482− /* Double check if disabled, else force abort */
483− reg_ic_enable_status = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_ENABLE_STATUS);
484− reg_ic_enable = RREG32_SOC15(SMUIO, 0, mmCKSVII2C_IC_ENABLE);
485−
486− if ((REG_GET_FIELD(reg_ic_enable, CKSVII2C_IC_ENABLE, ENABLE) == 0) &&
487− (REG_GET_FIELD(reg_ic_enable_status,
488− CKSVII2C_IC_ENABLE_STATUS, IC_EN) == 1)) {
489− /*
490− * Nobody is using I2C engine, but engine remains active because
491− * someone missed to send STOP
521+ /* Nobody is using the I2C engine, yet it remains
522+ * active, possibly because someone missed to send
523+ * STOP.
492524 */
525+ DRM_DEBUG_DRIVER("Aborting from fini: status:0x%08x "
526+ "enable:0x%08x enable_stat:0x%08x",
527+ status, enable, en_stat);
493528 smu_v11_0_i2c_abort(control);
494529 }
495530
@@ -531,22 +566,12 @@ static bool smu_v11_0_i2c_bus_unlock(struct i2c_adapter *control) · 35 unmodified lines
531566 /***************************** I2C GLUE ****************************/
532567
533568 static uint32_t smu_v11_0_i2c_read_data(struct i2c_adapter *control,
534− uint8_t address,
535− uint8_t *data,
536− uint32_t numbytes)
569+ struct i2c_msg *msg, uint32_t i2c_flag)
537570 {
538− uint32_t ret = 0;
539−
540− /* First 2 bytes are dummy write to set EEPROM address */
541− ret = smu_v11_0_i2c_transmit(control, address, data, 2, I2C_NO_STOP);
542− if (ret != I2C_OK)
543− goto Fail;
571+ uint32_t ret;
544572
545− /* Now read data starting with that address */
546− ret = smu_v11_0_i2c_receive(control, address, data + 2, numbytes - 2,
547− I2C_RESTART);
573+ ret = smu_v11_0_i2c_receive(control, msg->addr, msg->buf, msg->len, i2c_flag);
548574
549−Fail:
550575 if (ret != I2C_OK)
551576 DRM_ERROR("ReadData() - I2C error occurred :%x", ret);
552577
@@ -554,28 +579,15 @@ Fail: · 1 unmodified line
554579 }
555580
556581 static uint32_t smu_v11_0_i2c_write_data(struct i2c_adapter *control,
557− uint8_t address,
558− uint8_t *data,
559− uint32_t numbytes)
582+ struct i2c_msg *msg, uint32_t i2c_flag)
560583 {
561584 uint32_t ret;
562585
563− ret = smu_v11_0_i2c_transmit(control, address, data, numbytes, 0);
586+ ret = smu_v11_0_i2c_transmit(control, msg->addr, msg->buf, msg->len, i2c_flag);
564587
565588 if (ret != I2C_OK)
566589 DRM_ERROR("WriteI2CData() - I2C error occurred :%x", ret);
567− else
568− /*
569− * According to EEPROM spec there is a MAX of 10 ms required for
570− * EEPROM to flush internal RX buffer after STOP was issued at the
571− * end of write transaction. During this time the EEPROM will not be
572− * responsive to any more commands - so wait a bit more.
573− *
574− * TODO Improve to wait for first ACK for slave address after
575− * internal write cycle done.
576− */
577− msleep(10);
578−
590+
579591 return ret;
580592
581593 }
@@ -584,12 +596,11 @@ static void lock_bus(struct i2c_adapter *i2c, unsigned int flags) · 2 unmodified lines
584596 {
585597 struct amdgpu_device *adev = to_amdgpu_device(i2c);
586598
587− if (!smu_v11_0_i2c_bus_lock(i2c)) {
599+ mutex_lock(&adev->pm.smu_i2c_mutex);
600+ if (!smu_v11_0_i2c_bus_lock(i2c))
588601 DRM_ERROR("Failed to lock the bus from SMU");
589− return;
590− }
591−
592− adev->pm.bus_locked = true;
602+ else
603+ adev->pm.bus_locked = true;
593604 }
594605
595606 static int trylock_bus(struct i2c_adapter *i2c, unsigned int flags)
@@ -602,12 +613,11 @@ static void unlock_bus(struct i2c_adapter *i2c, unsigned int flags) · 6 unmodified lines
602613 {
603614 struct amdgpu_device *adev = to_amdgpu_device(i2c);
604615
605− if (!smu_v11_0_i2c_bus_unlock(i2c)) {
616+ if (!smu_v11_0_i2c_bus_unlock(i2c))
606617 DRM_ERROR("Failed to unlock the bus from SMU");
607− return;
608− }
609−
610− adev->pm.bus_locked = false;
618+ else
619+ adev->pm.bus_locked = false;
620+ mutex_unlock(&adev->pm.smu_i2c_mutex);
611621 }
612622
613623 static const struct i2c_lock_operations smu_v11_0_i2c_i2c_lock_ops = {
@@ -617,27 +627,60 @@ static const struct i2c_lock_operations smu_v11_0_i2c_i2c_lock_ops = { · 3 unmodified lines
617627 };
618628
619629 static int smu_v11_0_i2c_xfer(struct i2c_adapter *i2c_adap,
620− struct i2c_msg *msgs, int num)
630+ struct i2c_msg *msg, int num)
621631 {
622632 int i, ret;
623− struct amdgpu_device *adev = to_amdgpu_device(i2c_adap);
624−
625− if (!adev->pm.bus_locked) {
626− DRM_ERROR("I2C bus unlocked, stopping transaction!");
627− return -EIO;
628− }
633+ u16 addr, dir;
629634
630635 smu_v11_0_i2c_init(i2c_adap);
631636
637+ /* From the client's point of view, this sequence of
638+ * messages-- the array i2c_msg *msg, is a single transaction
639+ * on the bus, starting with START and ending with STOP.
640+ *
641+ * The client is welcome to send any sequence of messages in
642+ * this array, as processing under this function here is
643+ * striving to be agnostic.
644+ *
645+ * Record the first address and direction we see. If either
646+ * changes for a subsequent message, generate ReSTART. The
647+ * DW_apb_i2c databook, v1.21a, specifies that ReSTART is
648+ * generated when the direction changes, with the default IP
649+ * block parameter settings, but it doesn't specify if ReSTART
650+ * is generated when the address changes (possibly...). We
651+ * don't rely on the default IP block parameter settings as
652+ * the block is shared and they may change.
653+ */
654+ if (num > 0) {
655+ addr = msg[0].addr;
656+ dir = msg[0].flags & I2C_M_RD;
657+ }
658+
632659 for (i = 0; i < num; i++) {
633− if (msgs[i].flags & I2C_M_RD)
660+ u32 i2c_flag = 0;
661+
662+ if (msg[i].addr != addr || (msg[i].flags ^ dir) & I2C_M_RD) {
663+ addr = msg[i].addr;
664+ dir = msg[i].flags & I2C_M_RD;
665+ i2c_flag |= I2C_X_RESTART;
666+ }
667+
668+ if (i == num - 1) {
669+ /* Set the STOP bit on the last message, so
670+ * that the IP block generates a STOP after
671+ * the last byte of the message.
672+ */
673+ i2c_flag |= I2C_M_STOP;
674+ }
675+
676+ if (msg[i].flags & I2C_M_RD)
634677 ret = smu_v11_0_i2c_read_data(i2c_adap,
635− (uint8_t)msgs[i].addr,
636− msgs[i].buf, msgs[i].len);
678+ msg + i,
679+ i2c_flag);
637680 else
638681 ret = smu_v11_0_i2c_write_data(i2c_adap,
639− (uint8_t)msgs[i].addr,
640− msgs[i].buf, msgs[i].len);
682+ msg + i,
683+ i2c_flag);
641684
642685 if (ret != I2C_OK) {
643686 num = -EIO;
@@ -654,23 +697,28 @@ static u32 smu_v11_0_i2c_func(struct i2c_adapter *adap) · 10 unmodified lines
654697 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
655698 }
656699
657−
658700 static const struct i2c_algorithm smu_v11_0_i2c_algo = {
659701 .master_xfer = smu_v11_0_i2c_xfer,
660702 .functionality = smu_v11_0_i2c_func,
661703 };
662704
705+static const struct i2c_adapter_quirks smu_v11_0_i2c_control_quirks = {
706+ .flags = I2C_AQ_NO_ZERO_LEN,
707+};
708+
663709 int smu_v11_0_i2c_control_init(struct i2c_adapter *control)
664710 {
665711 struct amdgpu_device *adev = to_amdgpu_device(control);
666712 int res;
667713
714+ mutex_init(&adev->pm.smu_i2c_mutex);
668715 control->owner = THIS_MODULE;
669− control->class = I2C_CLASS_SPD;
716+ control->class = I2C_CLASS_HWMON;
670717 control->dev.parent = &adev->pdev->dev;
671718 control->algo = &smu_v11_0_i2c_algo;
672719 snprintf(control->name, sizeof(control->name), "AMDGPU SMU");
673720 control->lock_ops = &smu_v11_0_i2c_i2c_lock_ops;
721+ control->quirks = &smu_v11_0_i2c_control_quirks;
674722
675723 res = i2c_add_adapter(control);
676724 if (res)
drivers/gpu/drm/amd/amdgpu/soc15.c+7−9
@@ -74,7 +74,7 @@ · 73 unmodified lines
7474 #include "smuio_v9_0.h"
7575 #include "smuio_v11_0.h"
7676 #include "smuio_v13_0.h"
77−#include "dce_virtual.h"
77+#include "amdgpu_vkms.h"
7878 #include "mxgpu_ai.h"
7979 #include "amdgpu_ras.h"
8080 #include "amdgpu_xgmi.h"
@@ -575,7 +575,7 @@ soc15_asic_reset_method(struct amdgpu_device *adev) · 494 unmodified lines
575575 baco_reset = amdgpu_dpm_is_baco_supported(adev);
576576 break;
577577 case CHIP_VEGA20:
578− if (adev->psp.sos_fw_version >= 0x80067)
578+ if (adev->psp.sos.fw_version >= 0x80067)
579579 baco_reset = amdgpu_dpm_is_baco_supported(adev);
580580
581581 /*
@@ -635,7 +635,7 @@ static bool soc15_supports_baco(struct amdgpu_device *adev) · 53 unmodified lines
635635 case CHIP_ARCTURUS:
636636 return amdgpu_dpm_is_baco_supported(adev);
637637 case CHIP_VEGA20:
638− if (adev->psp.sos_fw_version >= 0x80067)
638+ if (adev->psp.sos.fw_version >= 0x80067)
639639 return amdgpu_dpm_is_baco_supported(adev);
640640 return false;
641641 default:
@@ -843,7 +843,7 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 201 unmodified lines
843843 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
844844 }
845845 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
846− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
846+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
847847 #if defined(CONFIG_DRM_AMD_DC)
848848 else if (amdgpu_device_has_dc_support(adev))
849849 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -863,7 +863,7 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 13 unmodified lines
863863 amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block);
864864 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
865865 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
866− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
866+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
867867 #if defined(CONFIG_DRM_AMD_DC)
868868 else if (amdgpu_device_has_dc_support(adev))
869869 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -885,7 +885,7 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 15 unmodified lines
885885 }
886886
887887 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
888− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
888+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
889889 amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block);
890890 amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block);
891891 amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
@@ -909,7 +909,7 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 17 unmodified lines
909909 amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block);
910910 amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block);
911911 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
912− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
912+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
913913 #if defined(CONFIG_DRM_AMD_DC)
914914 else if (amdgpu_device_has_dc_support(adev))
915915 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -1353,8 +1353,6 @@ static int soc15_common_early_init(void *handle) · 437 unmodified lines
13531353 adev->asic_funcs = &vega20_asic_funcs;
13541354 adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
13551355 AMD_CG_SUPPORT_GFX_MGLS |
1356− AMD_CG_SUPPORT_GFX_CGCG |
1357− AMD_CG_SUPPORT_GFX_CGLS |
13581356 AMD_CG_SUPPORT_GFX_CP_LS |
13591357 AMD_CG_SUPPORT_HDP_LS |
13601358 AMD_CG_SUPPORT_SDMA_MGCG |
drivers/gpu/drm/amd/amdgpu/soc15_common.h+4−4
@@ -28,13 +28,13 @@ · 27 unmodified lines
2828 #define SOC15_REG_OFFSET(ip, inst, reg) (adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg)
2929
3030 #define __WREG32_SOC15_RLC__(reg, value, flag, hwip) \
31− ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->rlcg_wreg) ? \
32− adev->gfx.rlc.funcs->rlcg_wreg(adev, reg, value, flag, hwip) : \
31+ ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->sriov_wreg) ? \
32+ adev->gfx.rlc.funcs->sriov_wreg(adev, reg, value, flag, hwip) : \
3333 WREG32(reg, value))
3434
3535 #define __RREG32_SOC15_RLC__(reg, flag, hwip) \
36− ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->rlcg_rreg) ? \
37− adev->gfx.rlc.funcs->rlcg_rreg(adev, reg, flag, hwip) : \
36+ ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->sriov_rreg) ? \
37+ adev->gfx.rlc.funcs->sriov_rreg(adev, reg, flag, hwip) : \
3838 RREG32(reg))
3939
4040 #define WREG32_FIELD15(ip, idx, reg, field, val) \
drivers/gpu/drm/amd/amdgpu/ta_xgmi_if.h+15−2
@@ -33,7 +33,8 @@ enum ta_command_xgmi { · 32 unmodified lines
3333 TA_COMMAND_XGMI__GET_NODE_ID = 0x01,
3434 TA_COMMAND_XGMI__GET_HIVE_ID = 0x02,
3535 TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO = 0x03,
36− TA_COMMAND_XGMI__SET_TOPOLOGY_INFO = 0x04
36+ TA_COMMAND_XGMI__SET_TOPOLOGY_INFO = 0x04,
37+ TA_COMMAND_XGMI__GET_PEER_LINKS = 0x0B
3738 };
3839
3940 /* XGMI related enumerations */
@@ -75,6 +76,11 @@ struct ta_xgmi_node_info { · 35 unmodified lines
7576 enum ta_xgmi_assigned_sdma_engine sdma_engine;
7677 };
7778
79+struct ta_xgmi_peer_link_info {
80+ uint64_t node_id;
81+ uint8_t num_links;
82+};
83+
7884 struct ta_xgmi_cmd_initialize_output {
7985 uint32_t status;
8086 };
@@ -97,6 +103,11 @@ struct ta_xgmi_cmd_get_topology_info_output { · 16 unmodified lines
97103 struct ta_xgmi_node_info nodes[TA_XGMI__MAX_CONNECTED_NODES];
98104 };
99105
106+struct ta_xgmi_cmd_get_peer_link_info_output {
107+ uint32_t num_nodes;
108+ struct ta_xgmi_peer_link_info nodes[TA_XGMI__MAX_CONNECTED_NODES];
109+};
110+
100111 struct ta_xgmi_cmd_set_topology_info_input {
101112 uint32_t num_nodes;
102113 struct ta_xgmi_node_info nodes[TA_XGMI__MAX_CONNECTED_NODES];
@@ -115,6 +126,7 @@ union ta_xgmi_cmd_output { · 12 unmodified lines
115126 struct ta_xgmi_cmd_get_node_id_output get_node_id;
116127 struct ta_xgmi_cmd_get_hive_id_output get_hive_id;
117128 struct ta_xgmi_cmd_get_topology_info_output get_topology_info;
129+ struct ta_xgmi_cmd_get_peer_link_info_output get_link_info;
118130 };
119131 /**********************************************************/
120132
@@ -122,7 +134,8 @@ struct ta_xgmi_shared_memory { · 1 unmodified line
122134 uint32_t cmd_id;
123135 uint32_t resp_id;
124136 enum ta_xgmi_status xgmi_status;
125− uint32_t reserved;
137+ uint8_t flag_extend_link_record;
138+ uint8_t reserved0[3];
126139 union ta_xgmi_cmd_input xgmi_in_message;
127140 union ta_xgmi_cmd_output xgmi_out_message;
128141 };
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c+15−0
@@ -28,6 +28,21 @@ · 27 unmodified lines
2828 #include "umc/umc_6_7_0_offset.h"
2929 #include "umc/umc_6_7_0_sh_mask.h"
3030
31+const uint32_t
32+ umc_v6_7_channel_idx_tbl_second[UMC_V6_7_UMC_INSTANCE_NUM][UMC_V6_7_CHANNEL_INSTANCE_NUM] = {
33+ {28, 20, 24, 16, 12, 4, 8, 0},
34+ {6, 30, 2, 26, 22, 14, 18, 10},
35+ {19, 11, 15, 7, 3, 27, 31, 23},
36+ {9, 1, 5, 29, 25, 17, 21, 13}
37+};
38+const uint32_t
39+ umc_v6_7_channel_idx_tbl_first[UMC_V6_7_UMC_INSTANCE_NUM][UMC_V6_7_CHANNEL_INSTANCE_NUM] = {
40+ {19, 11, 15, 7, 3, 27, 31, 23},
41+ {9, 1, 5, 29, 25, 17, 21, 13},
42+ {28, 20, 24, 16, 12, 4, 8, 0},
43+ {6, 30, 2, 26, 22, 14, 18, 10},
44+};
45+
3146 static inline uint32_t get_umc_v6_7_reg_offset(struct amdgpu_device *adev,
3247 uint32_t umc_inst,
3348 uint32_t ch_inst)
drivers/gpu/drm/amd/amdgpu/umc_v6_7.h+15−0
@@ -23,6 +23,9 @@ · 22 unmodified lines
2323 #ifndef __UMC_V6_7_H__
2424 #define __UMC_V6_7_H__
2525
26+#include "soc15_common.h"
27+#include "amdgpu.h"
28+
2629 /* EccErrCnt max value */
2730 #define UMC_V6_7_CE_CNT_MAX 0xffff
2831 /* umc ce interrupt threshold */
@@ -32,6 +35,18 @@ · 3 unmodified lines
3235
3336 #define UMC_V6_7_INST_DIST 0x40000
3437
38+/* number of umc channel instance with memory map register access */
39+#define UMC_V6_7_UMC_INSTANCE_NUM 4
40+/* number of umc instance with memory map register access */
41+#define UMC_V6_7_CHANNEL_INSTANCE_NUM 8
42+/* total channel instances in one umc block */
43+#define UMC_V6_7_TOTAL_CHANNEL_NUM (UMC_V6_7_CHANNEL_INSTANCE_NUM * UMC_V6_7_UMC_INSTANCE_NUM)
44+/* UMC regiser per channel offset */
45+#define UMC_V6_7_PER_CHANNEL_OFFSET 0x400
3546 extern const struct amdgpu_umc_ras_funcs umc_v6_7_ras_funcs;
47+extern const uint32_t
48+ umc_v6_7_channel_idx_tbl_second[UMC_V6_7_UMC_INSTANCE_NUM][UMC_V6_7_CHANNEL_INSTANCE_NUM];
49+extern const uint32_t
50+ umc_v6_7_channel_idx_tbl_first[UMC_V6_7_UMC_INSTANCE_NUM][UMC_V6_7_CHANNEL_INSTANCE_NUM];
3651
3752 #endif
drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c+24−0
@@ -698,6 +698,30 @@ static int uvd_v3_1_hw_fini(void *handle) · 697 unmodified lines
698698 {
699699 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
700700
701+ /*
702+ * Proper cleanups before halting the HW engine:
703+ * - cancel the delayed idle work
704+ * - enable powergating
705+ * - enable clockgating
706+ * - disable dpm
707+ *
708+ * TODO: to align with the VCN implementation, move the
709+ * jobs for clockgating/powergating/dpm setting to
710+ * ->set_powergating_state().
711+ */
712+ cancel_delayed_work_sync(&adev->uvd.idle_work);
713+
714+ if (adev->pm.dpm_enabled) {
715+ amdgpu_dpm_enable_uvd(adev, false);
716+ } else {
717+ amdgpu_asic_set_uvd_clocks(adev, 0, 0);
718+ /* shutdown the UVD block */
719+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
720+ AMD_PG_STATE_GATE);
721+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
722+ AMD_CG_STATE_GATE);
723+ }
724+
701725 if (RREG32(mmUVD_STATUS) != 0)
702726 uvd_v3_1_stop(adev);
703727
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c+24−0
@@ -212,6 +212,30 @@ static int uvd_v4_2_hw_fini(void *handle) · 211 unmodified lines
212212 {
213213 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
214214
215+ /*
216+ * Proper cleanups before halting the HW engine:
217+ * - cancel the delayed idle work
218+ * - enable powergating
219+ * - enable clockgating
220+ * - disable dpm
221+ *
222+ * TODO: to align with the VCN implementation, move the
223+ * jobs for clockgating/powergating/dpm setting to
224+ * ->set_powergating_state().
225+ */
226+ cancel_delayed_work_sync(&adev->uvd.idle_work);
227+
228+ if (adev->pm.dpm_enabled) {
229+ amdgpu_dpm_enable_uvd(adev, false);
230+ } else {
231+ amdgpu_asic_set_uvd_clocks(adev, 0, 0);
232+ /* shutdown the UVD block */
233+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
234+ AMD_PG_STATE_GATE);
235+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
236+ AMD_CG_STATE_GATE);
237+ }
238+
215239 if (RREG32(mmUVD_STATUS) != 0)
216240 uvd_v4_2_stop(adev);
217241
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c+24−1
@@ -210,6 +210,30 @@ static int uvd_v5_0_hw_fini(void *handle) · 209 unmodified lines
210210 {
211211 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
212212
213+ /*
214+ * Proper cleanups before halting the HW engine:
215+ * - cancel the delayed idle work
216+ * - enable powergating
217+ * - enable clockgating
218+ * - disable dpm
219+ *
220+ * TODO: to align with the VCN implementation, move the
221+ * jobs for clockgating/powergating/dpm setting to
222+ * ->set_powergating_state().
223+ */
224+ cancel_delayed_work_sync(&adev->uvd.idle_work);
225+
226+ if (adev->pm.dpm_enabled) {
227+ amdgpu_dpm_enable_uvd(adev, false);
228+ } else {
229+ amdgpu_asic_set_uvd_clocks(adev, 0, 0);
230+ /* shutdown the UVD block */
231+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
232+ AMD_PG_STATE_GATE);
233+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
234+ AMD_CG_STATE_GATE);
235+ }
236+
213237 if (RREG32(mmUVD_STATUS) != 0)
214238 uvd_v5_0_stop(adev);
215239
@@ -224,7 +248,6 @@ static int uvd_v5_0_suspend(void *handle) · 8 unmodified lines
224248 r = uvd_v5_0_hw_fini(adev);
225249 if (r)
226250 return r;
227− uvd_v5_0_set_clockgating_state(adev, AMD_CG_STATE_GATE);
228251
229252 return amdgpu_uvd_suspend(adev);
230253 }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c+24−0
@@ -543,6 +543,30 @@ static int uvd_v6_0_hw_fini(void *handle) · 542 unmodified lines
543543 {
544544 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
545545
546+ /*
547+ * Proper cleanups before halting the HW engine:
548+ * - cancel the delayed idle work
549+ * - enable powergating
550+ * - enable clockgating
551+ * - disable dpm
552+ *
553+ * TODO: to align with the VCN implementation, move the
554+ * jobs for clockgating/powergating/dpm setting to
555+ * ->set_powergating_state().
556+ */
557+ cancel_delayed_work_sync(&adev->uvd.idle_work);
558+
559+ if (adev->pm.dpm_enabled) {
560+ amdgpu_dpm_enable_uvd(adev, false);
561+ } else {
562+ amdgpu_asic_set_uvd_clocks(adev, 0, 0);
563+ /* shutdown the UVD block */
564+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
565+ AMD_PG_STATE_GATE);
566+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
567+ AMD_CG_STATE_GATE);
568+ }
569+
546570 if (RREG32(mmUVD_STATUS) != 0)
547571 uvd_v6_0_stop(adev);
548572
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c+24−0
@@ -606,6 +606,30 @@ static int uvd_v7_0_hw_fini(void *handle) · 605 unmodified lines
606606 {
607607 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
608608
609+ /*
610+ * Proper cleanups before halting the HW engine:
611+ * - cancel the delayed idle work
612+ * - enable powergating
613+ * - enable clockgating
614+ * - disable dpm
615+ *
616+ * TODO: to align with the VCN implementation, move the
617+ * jobs for clockgating/powergating/dpm setting to
618+ * ->set_powergating_state().
619+ */
620+ cancel_delayed_work_sync(&adev->uvd.idle_work);
621+
622+ if (adev->pm.dpm_enabled) {
623+ amdgpu_dpm_enable_uvd(adev, false);
624+ } else {
625+ amdgpu_asic_set_uvd_clocks(adev, 0, 0);
626+ /* shutdown the UVD block */
627+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
628+ AMD_PG_STATE_GATE);
629+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
630+ AMD_CG_STATE_GATE);
631+ }
632+
609633 if (!amdgpu_sriov_vf(adev))
610634 uvd_v7_0_stop(adev);
611635 else {
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c+25−0
@@ -477,6 +477,31 @@ static int vce_v2_0_hw_init(void *handle) · 476 unmodified lines
477477
478478 static int vce_v2_0_hw_fini(void *handle)
479479 {
480+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
481+
482+ /*
483+ * Proper cleanups before halting the HW engine:
484+ * - cancel the delayed idle work
485+ * - enable powergating
486+ * - enable clockgating
487+ * - disable dpm
488+ *
489+ * TODO: to align with the VCN implementation, move the
490+ * jobs for clockgating/powergating/dpm setting to
491+ * ->set_powergating_state().
492+ */
493+ cancel_delayed_work_sync(&adev->vce.idle_work);
494+
495+ if (adev->pm.dpm_enabled) {
496+ amdgpu_dpm_enable_vce(adev, false);
497+ } else {
498+ amdgpu_asic_set_vce_clocks(adev, 0, 0);
499+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
500+ AMD_PG_STATE_GATE);
501+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
502+ AMD_CG_STATE_GATE);
503+ }
504+
480505 return 0;
481506 }
482507
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c+23−0
@@ -490,6 +490,29 @@ static int vce_v3_0_hw_fini(void *handle) · 489 unmodified lines
490490 int r;
491491 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
492492
493+ /*
494+ * Proper cleanups before halting the HW engine:
495+ * - cancel the delayed idle work
496+ * - enable powergating
497+ * - enable clockgating
498+ * - disable dpm
499+ *
500+ * TODO: to align with the VCN implementation, move the
501+ * jobs for clockgating/powergating/dpm setting to
502+ * ->set_powergating_state().
503+ */
504+ cancel_delayed_work_sync(&adev->vce.idle_work);
505+
506+ if (adev->pm.dpm_enabled) {
507+ amdgpu_dpm_enable_vce(adev, false);
508+ } else {
509+ amdgpu_asic_set_vce_clocks(adev, 0, 0);
510+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
511+ AMD_PG_STATE_GATE);
512+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
513+ AMD_CG_STATE_GATE);
514+ }
515+
493516 r = vce_v3_0_wait_for_idle(handle);
494517 if (r)
495518 return r;
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c+23−0
@@ -542,6 +542,29 @@ static int vce_v4_0_hw_fini(void *handle) · 541 unmodified lines
542542 {
543543 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
544544
545+ /*
546+ * Proper cleanups before halting the HW engine:
547+ * - cancel the delayed idle work
548+ * - enable powergating
549+ * - enable clockgating
550+ * - disable dpm
551+ *
552+ * TODO: to align with the VCN implementation, move the
553+ * jobs for clockgating/powergating/dpm setting to
554+ * ->set_powergating_state().
555+ */
556+ cancel_delayed_work_sync(&adev->vce.idle_work);
557+
558+ if (adev->pm.dpm_enabled) {
559+ amdgpu_dpm_enable_vce(adev, false);
560+ } else {
561+ amdgpu_asic_set_vce_clocks(adev, 0, 0);
562+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
563+ AMD_PG_STATE_GATE);
564+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
565+ AMD_CG_STATE_GATE);
566+ }
567+
545568 if (!amdgpu_sriov_vf(adev)) {
546569 /* vce_v4_0_wait_for_idle(handle); */
547570 vce_v4_0_stop(adev);
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c+1−1
@@ -119,7 +119,7 @@ static int vcn_v1_0_sw_init(void *handle) · 118 unmodified lines
119119 adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].fw = adev->vcn.fw;
120120 adev->firmware.fw_size +=
121121 ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);
122− DRM_INFO("PSP loading VCN firmware\n");
122+ dev_info(adev->dev, "Will use PSP to load VCN firmware\n");
123123 }
124124
125125 r = amdgpu_vcn_resume(adev);
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c+1−1
@@ -122,7 +122,7 @@ static int vcn_v2_0_sw_init(void *handle) · 121 unmodified lines
122122 adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].fw = adev->vcn.fw;
123123 adev->firmware.fw_size +=
124124 ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);
125− DRM_INFO("PSP loading VCN firmware\n");
125+ dev_info(adev->dev, "Will use PSP to load VCN firmware\n");
126126 }
127127
128128 r = amdgpu_vcn_resume(adev);
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c+1−1
@@ -152,7 +152,7 @@ static int vcn_v2_5_sw_init(void *handle) · 151 unmodified lines
152152 adev->firmware.fw_size +=
153153 ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);
154154 }
155− DRM_INFO("PSP loading VCN firmware\n");
155+ dev_info(adev->dev, "Will use PSP to load VCN firmware\n");
156156 }
157157
158158 r = amdgpu_vcn_resume(adev);
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c+21−14
@@ -90,9 +90,7 @@ static int vcn_v3_0_early_init(void *handle) · 89 unmodified lines
9090 int i;
9191
9292 if (amdgpu_sriov_vf(adev)) {
93− for (i = 0; i < VCN_INSTANCES_SIENNA_CICHLID; i++)
94− if (amdgpu_vcn_is_disabled_vcn(adev, VCN_DECODE_RING, i))
95− adev->vcn.num_vcn_inst++;
93+ adev->vcn.num_vcn_inst = VCN_INSTANCES_SIENNA_CICHLID;
9694 adev->vcn.harvest_config = 0;
9795 adev->vcn.num_enc_rings = 1;
9896
@@ -153,14 +151,13 @@ static int vcn_v3_0_sw_init(void *handle) · 54 unmodified lines
153151 adev->firmware.fw_size +=
154152 ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);
155153
156− if ((adev->vcn.num_vcn_inst == VCN_INSTANCES_SIENNA_CICHLID) ||
157− (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_SIENNA_CICHLID)) {
154+ if (adev->vcn.num_vcn_inst == VCN_INSTANCES_SIENNA_CICHLID) {
158155 adev->firmware.ucode[AMDGPU_UCODE_ID_VCN1].ucode_id = AMDGPU_UCODE_ID_VCN1;
159156 adev->firmware.ucode[AMDGPU_UCODE_ID_VCN1].fw = adev->vcn.fw;
160157 adev->firmware.fw_size +=
161158 ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);
162159 }
163− DRM_INFO("PSP loading VCN firmware\n");
160+ dev_info(adev->dev, "Will use PSP to load VCN firmware\n");
164161 }
165162
166163 r = amdgpu_vcn_resume(adev);
@@ -328,18 +325,28 @@ static int vcn_v3_0_hw_init(void *handle) · 161 unmodified lines
328325 continue;
329326
330327 ring = &adev->vcn.inst[i].ring_dec;
331− ring->wptr = 0;
332− ring->wptr_old = 0;
333− vcn_v3_0_dec_ring_set_wptr(ring);
334− ring->sched.ready = true;
335−
336− for (j = 0; j < adev->vcn.num_enc_rings; ++j) {
337− ring = &adev->vcn.inst[i].ring_enc[j];
328+ if (amdgpu_vcn_is_disabled_vcn(adev, VCN_DECODE_RING, i)) {
329+ ring->sched.ready = false;
330+ dev_info(adev->dev, "ring %s is disabled by hypervisor\n", ring->name);
331+ } else {
338332 ring->wptr = 0;
339333 ring->wptr_old = 0;
340− vcn_v3_0_enc_ring_set_wptr(ring);
334+ vcn_v3_0_dec_ring_set_wptr(ring);
341335 ring->sched.ready = true;
342336 }
337+
338+ for (j = 0; j < adev->vcn.num_enc_rings; ++j) {
339+ ring = &adev->vcn.inst[i].ring_enc[j];
340+ if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) {
341+ ring->sched.ready = false;
342+ dev_info(adev->dev, "ring %s is disabled by hypervisor\n", ring->name);
343+ } else {
344+ ring->wptr = 0;
345+ ring->wptr_old = 0;
346+ vcn_v3_0_enc_ring_set_wptr(ring);
347+ ring->sched.ready = true;
348+ }
349+ }
343350 }
344351 } else {
345352 for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
drivers/gpu/drm/amd/amdgpu/vi.c+15−8
@@ -77,7 +77,7 @@ · 76 unmodified lines
7777 #if defined(CONFIG_DRM_AMD_ACP)
7878 #include "amdgpu_acp.h"
7979 #endif
80−#include "dce_virtual.h"
80+#include "amdgpu_vkms.h"
8181 #include "mxgpu_vi.h"
8282 #include "amdgpu_dm.h"
8383
@@ -904,7 +904,14 @@ static bool vi_asic_supports_baco(struct amdgpu_device *adev) · 820 unmodified lines
904904 case CHIP_POLARIS11:
905905 case CHIP_POLARIS12:
906906 case CHIP_TOPAZ:
907− return amdgpu_dpm_is_baco_supported(adev);
907+ /* Disable BACO support for the specific polaris12 SKU temporarily */
908+ if ((adev->pdev->device == 0x699F) &&
909+ (adev->pdev->revision == 0xC7) &&
910+ (adev->pdev->subsystem_vendor == 0x1028) &&
911+ (adev->pdev->subsystem_device == 0x0039))
912+ return false;
913+ else
914+ return amdgpu_dpm_is_baco_supported(adev);
908915 default:
909916 return false;
910917 }
@@ -2102,7 +2109,7 @@ int vi_set_ip_blocks(struct amdgpu_device *adev) · 1191 unmodified lines
21022109 amdgpu_device_ip_block_add(adev, &sdma_v2_4_ip_block);
21032110 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
21042111 if (adev->enable_virtual_display)
2105− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2112+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
21062113 break;
21072114 case CHIP_FIJI:
21082115 amdgpu_device_ip_block_add(adev, &vi_common_ip_block);
@@ -2112,7 +2119,7 @@ int vi_set_ip_blocks(struct amdgpu_device *adev) · 3 unmodified lines
21122119 amdgpu_device_ip_block_add(adev, &sdma_v3_0_ip_block);
21132120 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
21142121 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
2115− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2122+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
21162123 #if defined(CONFIG_DRM_AMD_DC)
21172124 else if (amdgpu_device_has_dc_support(adev))
21182125 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2132,7 +2139,7 @@ int vi_set_ip_blocks(struct amdgpu_device *adev) · 13 unmodified lines
21322139 amdgpu_device_ip_block_add(adev, &sdma_v3_0_ip_block);
21332140 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
21342141 if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
2135− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2142+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
21362143 #if defined(CONFIG_DRM_AMD_DC)
21372144 else if (amdgpu_device_has_dc_support(adev))
21382145 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2155,7 +2162,7 @@ int vi_set_ip_blocks(struct amdgpu_device *adev) · 16 unmodified lines
21552162 amdgpu_device_ip_block_add(adev, &sdma_v3_1_ip_block);
21562163 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
21572164 if (adev->enable_virtual_display)
2158− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2165+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
21592166 #if defined(CONFIG_DRM_AMD_DC)
21602167 else if (amdgpu_device_has_dc_support(adev))
21612168 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2173,7 +2180,7 @@ int vi_set_ip_blocks(struct amdgpu_device *adev) · 11 unmodified lines
21732180 amdgpu_device_ip_block_add(adev, &sdma_v3_0_ip_block);
21742181 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
21752182 if (adev->enable_virtual_display)
2176− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2183+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
21772184 #if defined(CONFIG_DRM_AMD_DC)
21782185 else if (amdgpu_device_has_dc_support(adev))
21792186 amdgpu_device_ip_block_add(adev, &dm_ip_block);
@@ -2194,7 +2201,7 @@ int vi_set_ip_blocks(struct amdgpu_device *adev) · 14 unmodified lines
21942201 amdgpu_device_ip_block_add(adev, &sdma_v3_0_ip_block);
21952202 amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
21962203 if (adev->enable_virtual_display)
2197− amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
2204+ amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
21982205 #if defined(CONFIG_DRM_AMD_DC)
21992206 else if (amdgpu_device_has_dc_support(adev))
22002207 amdgpu_device_ip_block_add(adev, &dm_ip_block);
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c+35−12
@@ -1393,6 +1393,7 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep, · 1392 unmodified lines
13931393 long err = 0;
13941394 int i;
13951395 uint32_t *devices_arr = NULL;
1396+ bool table_freed = false;
13961397
13971398 dev = kfd_device_by_id(GET_GPU_ID(args->handle));
13981399 if (!dev)
@@ -1450,7 +1451,8 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep, · 51 unmodified lines
14501451 goto get_mem_obj_from_handle_failed;
14511452 }
14521453 err = amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
1453− peer->kgd, (struct kgd_mem *)mem, peer_pdd->drm_priv);
1454+ peer->kgd, (struct kgd_mem *)mem,
1455+ peer_pdd->drm_priv, &table_freed);
14541456 if (err) {
14551457 pr_err("Failed to map to gpu %d/%d\n",
14561458 i, args->n_devices);
@@ -1468,16 +1470,17 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep, · 11 unmodified lines
14681470 }
14691471
14701472 /* Flush TLBs after waiting for the page table updates to complete */
1471− for (i = 0; i < args->n_devices; i++) {
1472− peer = kfd_device_by_id(devices_arr[i]);
1473− if (WARN_ON_ONCE(!peer))
1474− continue;
1475− peer_pdd = kfd_get_process_device_data(peer, p);
1476− if (WARN_ON_ONCE(!peer_pdd))
1477− continue;
1478− kfd_flush_tlb(peer_pdd, TLB_FLUSH_LEGACY);
1473+ if (table_freed) {
1474+ for (i = 0; i < args->n_devices; i++) {
1475+ peer = kfd_device_by_id(devices_arr[i]);
1476+ if (WARN_ON_ONCE(!peer))
1477+ continue;
1478+ peer_pdd = kfd_get_process_device_data(peer, p);
1479+ if (WARN_ON_ONCE(!peer_pdd))
1480+ continue;
1481+ kfd_flush_tlb(peer_pdd, TLB_FLUSH_LEGACY);
1482+ }
14791483 }
1480−
14811484 kfree(devices_arr);
14821485
14831486 return err;
@@ -1565,10 +1568,29 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep, · 81 unmodified lines
15651568 }
15661569 args->n_success = i+1;
15671570 }
1568− kfree(devices_arr);
1569−
15701571 mutex_unlock(&p->mutex);
15711572
1573+ if (dev->device_info->asic_family == CHIP_ALDEBARAN) {
1574+ err = amdgpu_amdkfd_gpuvm_sync_memory(dev->kgd,
1575+ (struct kgd_mem *) mem, true);
1576+ if (err) {
1577+ pr_debug("Sync memory failed, wait interrupted by user signal\n");
1578+ goto sync_memory_failed;
1579+ }
1580+
1581+ /* Flush TLBs after waiting for the page table updates to complete */
1582+ for (i = 0; i < args->n_devices; i++) {
1583+ peer = kfd_device_by_id(devices_arr[i]);
1584+ if (WARN_ON_ONCE(!peer))
1585+ continue;
1586+ peer_pdd = kfd_get_process_device_data(peer, p);
1587+ if (WARN_ON_ONCE(!peer_pdd))
1588+ continue;
1589+ kfd_flush_tlb(peer_pdd, TLB_FLUSH_HEAVYWEIGHT);
1590+ }
1591+ }
1592+ kfree(devices_arr);
1593+
15721594 return 0;
15731595
15741596 bind_process_to_device_failed:
@@ -1576,6 +1598,7 @@ get_mem_obj_from_handle_failed: · 1 unmodified line
15761598 unmap_memory_from_gpu_failed:
15771599 mutex_unlock(&p->mutex);
15781600 copy_from_user_failed:
1601+sync_memory_failed:
15791602 kfree(devices_arr);
15801603 return err;
15811604 }
drivers/gpu/drm/amd/amdkfd/kfd_crat.c+17−0
@@ -1404,6 +1404,7 @@ static int kfd_fill_gpu_cache_info(struct kfd_dev *kdev, · 1403 unmodified lines
14041404 break;
14051405 case CHIP_NAVI10:
14061406 case CHIP_NAVI12:
1407+ case CHIP_CYAN_SKILLFISH:
14071408 pcache_info = navi10_cache_info;
14081409 num_of_cache_types = ARRAY_SIZE(navi10_cache_info);
14091410 break;
@@ -1989,8 +1990,19 @@ static int kfd_fill_gpu_direct_io_link_to_cpu(int *avail_size, · 579 unmodified lines
19891990 sub_type_hdr->flags |= CRAT_IOLINK_FLAGS_BI_DIRECTIONAL;
19901991 sub_type_hdr->io_interface_type = CRAT_IOLINK_TYPE_XGMI;
19911992 sub_type_hdr->num_hops_xgmi = 1;
1993+ if (adev->asic_type == CHIP_ALDEBARAN) {
1994+ sub_type_hdr->minimum_bandwidth_mbs =
1995+ amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(
1996+ kdev->kgd, NULL, true);
1997+ sub_type_hdr->maximum_bandwidth_mbs =
1998+ sub_type_hdr->minimum_bandwidth_mbs;
1999+ }
19922000 } else {
19932001 sub_type_hdr->io_interface_type = CRAT_IOLINK_TYPE_PCIEXPRESS;
2002+ sub_type_hdr->minimum_bandwidth_mbs =
2003+ amdgpu_amdkfd_get_pcie_bandwidth_mbytes(kdev->kgd, true);
2004+ sub_type_hdr->maximum_bandwidth_mbs =
2005+ amdgpu_amdkfd_get_pcie_bandwidth_mbytes(kdev->kgd, false);
19942006 }
19952007
19962008 sub_type_hdr->proximity_domain_from = proximity_domain;
@@ -2033,6 +2045,11 @@ static int kfd_fill_gpu_xgmi_link_to_gpu(int *avail_size, · 36 unmodified lines
20332045 sub_type_hdr->proximity_domain_to = proximity_domain_to;
20342046 sub_type_hdr->num_hops_xgmi =
20352047 amdgpu_amdkfd_get_xgmi_hops_count(kdev->kgd, peer_kdev->kgd);
2048+ sub_type_hdr->maximum_bandwidth_mbs =
2049+ amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(kdev->kgd, peer_kdev->kgd, false);
2050+ sub_type_hdr->minimum_bandwidth_mbs = sub_type_hdr->maximum_bandwidth_mbs ?
2051+ amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(kdev->kgd, NULL, true) : 0;
2052+
20362053 return 0;
20372054 }
20382055
drivers/gpu/drm/amd/amdkfd/kfd_device.c+51−8
@@ -84,12 +84,14 @@ static const struct kfd2kgd_calls *kfd2kgd_funcs[] = { · 83 unmodified lines
8484 [CHIP_DIMGREY_CAVEFISH] = &gfx_v10_3_kfd2kgd,
8585 [CHIP_BEIGE_GOBY] = &gfx_v10_3_kfd2kgd,
8686 [CHIP_YELLOW_CARP] = &gfx_v10_3_kfd2kgd,
87+ [CHIP_CYAN_SKILLFISH] = &gfx_v10_kfd2kgd,
8788 };
8889
8990 #ifdef KFD_SUPPORT_IOMMU_V2
9091 static const struct kfd_device_info kaveri_device_info = {
9192 .asic_family = CHIP_KAVERI,
9293 .asic_name = "kaveri",
94+ .gfx_target_version = 70000,
9395 .max_pasid_bits = 16,
9496 /* max num of queues for KV.TODO should be a dynamic value */
9597 .max_no_of_hqd = 24,
@@ -109,6 +111,7 @@ static const struct kfd_device_info kaveri_device_info = { · 13 unmodified lines
109111 static const struct kfd_device_info carrizo_device_info = {
110112 .asic_family = CHIP_CARRIZO,
111113 .asic_name = "carrizo",
114+ .gfx_target_version = 80001,
112115 .max_pasid_bits = 16,
113116 /* max num of queues for CZ.TODO should be a dynamic value */
114117 .max_no_of_hqd = 24,
@@ -129,6 +132,7 @@ static const struct kfd_device_info carrizo_device_info = { · 14 unmodified lines
129132 static const struct kfd_device_info raven_device_info = {
130133 .asic_family = CHIP_RAVEN,
131134 .asic_name = "raven",
135+ .gfx_target_version = 90002,
132136 .max_pasid_bits = 16,
133137 .max_no_of_hqd = 24,
134138 .doorbell_size = 8,
@@ -147,6 +151,7 @@ static const struct kfd_device_info raven_device_info = { · 12 unmodified lines
147151 static const struct kfd_device_info hawaii_device_info = {
148152 .asic_family = CHIP_HAWAII,
149153 .asic_name = "hawaii",
154+ .gfx_target_version = 70001,
150155 .max_pasid_bits = 16,
151156 /* max num of queues for KV.TODO should be a dynamic value */
152157 .max_no_of_hqd = 24,
@@ -166,6 +171,7 @@ static const struct kfd_device_info hawaii_device_info = { · 13 unmodified lines
166171 static const struct kfd_device_info tonga_device_info = {
167172 .asic_family = CHIP_TONGA,
168173 .asic_name = "tonga",
174+ .gfx_target_version = 80002,
169175 .max_pasid_bits = 16,
170176 .max_no_of_hqd = 24,
171177 .doorbell_size = 4,
@@ -184,6 +190,7 @@ static const struct kfd_device_info tonga_device_info = { · 12 unmodified lines
184190 static const struct kfd_device_info fiji_device_info = {
185191 .asic_family = CHIP_FIJI,
186192 .asic_name = "fiji",
193+ .gfx_target_version = 80003,
187194 .max_pasid_bits = 16,
188195 .max_no_of_hqd = 24,
189196 .doorbell_size = 4,
@@ -202,6 +209,7 @@ static const struct kfd_device_info fiji_device_info = { · 12 unmodified lines
202209 static const struct kfd_device_info fiji_vf_device_info = {
203210 .asic_family = CHIP_FIJI,
204211 .asic_name = "fiji",
212+ .gfx_target_version = 80003,
205213 .max_pasid_bits = 16,
206214 .max_no_of_hqd = 24,
207215 .doorbell_size = 4,
@@ -221,6 +229,7 @@ static const struct kfd_device_info fiji_vf_device_info = { · 13 unmodified lines
221229 static const struct kfd_device_info polaris10_device_info = {
222230 .asic_family = CHIP_POLARIS10,
223231 .asic_name = "polaris10",
232+ .gfx_target_version = 80003,
224233 .max_pasid_bits = 16,
225234 .max_no_of_hqd = 24,
226235 .doorbell_size = 4,
@@ -239,6 +248,7 @@ static const struct kfd_device_info polaris10_device_info = { · 12 unmodified lines
239248 static const struct kfd_device_info polaris10_vf_device_info = {
240249 .asic_family = CHIP_POLARIS10,
241250 .asic_name = "polaris10",
251+ .gfx_target_version = 80003,
242252 .max_pasid_bits = 16,
243253 .max_no_of_hqd = 24,
244254 .doorbell_size = 4,
@@ -257,6 +267,7 @@ static const struct kfd_device_info polaris10_vf_device_info = { · 12 unmodified lines
257267 static const struct kfd_device_info polaris11_device_info = {
258268 .asic_family = CHIP_POLARIS11,
259269 .asic_name = "polaris11",
270+ .gfx_target_version = 80003,
260271 .max_pasid_bits = 16,
261272 .max_no_of_hqd = 24,
262273 .doorbell_size = 4,
@@ -275,6 +286,7 @@ static const struct kfd_device_info polaris11_device_info = { · 12 unmodified lines
275286 static const struct kfd_device_info polaris12_device_info = {
276287 .asic_family = CHIP_POLARIS12,
277288 .asic_name = "polaris12",
289+ .gfx_target_version = 80003,
278290 .max_pasid_bits = 16,
279291 .max_no_of_hqd = 24,
280292 .doorbell_size = 4,
@@ -293,6 +305,7 @@ static const struct kfd_device_info polaris12_device_info = { · 12 unmodified lines
293305 static const struct kfd_device_info vegam_device_info = {
294306 .asic_family = CHIP_VEGAM,
295307 .asic_name = "vegam",
308+ .gfx_target_version = 80003,
296309 .max_pasid_bits = 16,
297310 .max_no_of_hqd = 24,
298311 .doorbell_size = 4,
@@ -311,6 +324,7 @@ static const struct kfd_device_info vegam_device_info = { · 12 unmodified lines
311324 static const struct kfd_device_info vega10_device_info = {
312325 .asic_family = CHIP_VEGA10,
313326 .asic_name = "vega10",
327+ .gfx_target_version = 90000,
314328 .max_pasid_bits = 16,
315329 .max_no_of_hqd = 24,
316330 .doorbell_size = 8,
@@ -329,6 +343,7 @@ static const struct kfd_device_info vega10_device_info = { · 12 unmodified lines
329343 static const struct kfd_device_info vega10_vf_device_info = {
330344 .asic_family = CHIP_VEGA10,
331345 .asic_name = "vega10",
346+ .gfx_target_version = 90000,
332347 .max_pasid_bits = 16,
333348 .max_no_of_hqd = 24,
334349 .doorbell_size = 8,
@@ -347,6 +362,7 @@ static const struct kfd_device_info vega10_vf_device_info = { · 12 unmodified lines
347362 static const struct kfd_device_info vega12_device_info = {
348363 .asic_family = CHIP_VEGA12,
349364 .asic_name = "vega12",
365+ .gfx_target_version = 90004,
350366 .max_pasid_bits = 16,
351367 .max_no_of_hqd = 24,
352368 .doorbell_size = 8,
@@ -365,6 +381,7 @@ static const struct kfd_device_info vega12_device_info = { · 12 unmodified lines
365381 static const struct kfd_device_info vega20_device_info = {
366382 .asic_family = CHIP_VEGA20,
367383 .asic_name = "vega20",
384+ .gfx_target_version = 90006,
368385 .max_pasid_bits = 16,
369386 .max_no_of_hqd = 24,
370387 .doorbell_size = 8,
@@ -383,6 +400,7 @@ static const struct kfd_device_info vega20_device_info = { · 12 unmodified lines
383400 static const struct kfd_device_info arcturus_device_info = {
384401 .asic_family = CHIP_ARCTURUS,
385402 .asic_name = "arcturus",
403+ .gfx_target_version = 90008,
386404 .max_pasid_bits = 16,
387405 .max_no_of_hqd = 24,
388406 .doorbell_size = 8,
@@ -401,6 +419,7 @@ static const struct kfd_device_info arcturus_device_info = { · 12 unmodified lines
401419 static const struct kfd_device_info aldebaran_device_info = {
402420 .asic_family = CHIP_ALDEBARAN,
403421 .asic_name = "aldebaran",
422+ .gfx_target_version = 90010,
404423 .max_pasid_bits = 16,
405424 .max_no_of_hqd = 24,
406425 .doorbell_size = 8,
@@ -419,6 +438,7 @@ static const struct kfd_device_info aldebaran_device_info = { · 12 unmodified lines
419438 static const struct kfd_device_info renoir_device_info = {
420439 .asic_family = CHIP_RENOIR,
421440 .asic_name = "renoir",
441+ .gfx_target_version = 90002,
422442 .max_pasid_bits = 16,
423443 .max_no_of_hqd = 24,
424444 .doorbell_size = 8,
@@ -437,6 +457,7 @@ static const struct kfd_device_info renoir_device_info = { · 12 unmodified lines
437457 static const struct kfd_device_info navi10_device_info = {
438458 .asic_family = CHIP_NAVI10,
439459 .asic_name = "navi10",
460+ .gfx_target_version = 100100,
440461 .max_pasid_bits = 16,
441462 .max_no_of_hqd = 24,
442463 .doorbell_size = 8,
@@ -455,6 +476,7 @@ static const struct kfd_device_info navi10_device_info = { · 12 unmodified lines
455476 static const struct kfd_device_info navi12_device_info = {
456477 .asic_family = CHIP_NAVI12,
457478 .asic_name = "navi12",
479+ .gfx_target_version = 100101,
458480 .max_pasid_bits = 16,
459481 .max_no_of_hqd = 24,
460482 .doorbell_size = 8,
@@ -473,6 +495,7 @@ static const struct kfd_device_info navi12_device_info = { · 12 unmodified lines
473495 static const struct kfd_device_info navi14_device_info = {
474496 .asic_family = CHIP_NAVI14,
475497 .asic_name = "navi14",
498+ .gfx_target_version = 100102,
476499 .max_pasid_bits = 16,
477500 .max_no_of_hqd = 24,
478501 .doorbell_size = 8,
@@ -491,6 +514,7 @@ static const struct kfd_device_info navi14_device_info = { · 12 unmodified lines
491514 static const struct kfd_device_info sienna_cichlid_device_info = {
492515 .asic_family = CHIP_SIENNA_CICHLID,
493516 .asic_name = "sienna_cichlid",
517+ .gfx_target_version = 100300,
494518 .max_pasid_bits = 16,
495519 .max_no_of_hqd = 24,
496520 .doorbell_size = 8,
@@ -509,6 +533,7 @@ static const struct kfd_device_info sienna_cichlid_device_info = { · 12 unmodified lines
509533 static const struct kfd_device_info navy_flounder_device_info = {
510534 .asic_family = CHIP_NAVY_FLOUNDER,
511535 .asic_name = "navy_flounder",
536+ .gfx_target_version = 100301,
512537 .max_pasid_bits = 16,
513538 .max_no_of_hqd = 24,
514539 .doorbell_size = 8,
@@ -527,6 +552,7 @@ static const struct kfd_device_info navy_flounder_device_info = { · 12 unmodified lines
527552 static const struct kfd_device_info vangogh_device_info = {
528553 .asic_family = CHIP_VANGOGH,
529554 .asic_name = "vangogh",
555+ .gfx_target_version = 100303,
530556 .max_pasid_bits = 16,
531557 .max_no_of_hqd = 24,
532558 .doorbell_size = 8,
@@ -545,6 +571,7 @@ static const struct kfd_device_info vangogh_device_info = { · 12 unmodified lines
545571 static const struct kfd_device_info dimgrey_cavefish_device_info = {
546572 .asic_family = CHIP_DIMGREY_CAVEFISH,
547573 .asic_name = "dimgrey_cavefish",
574+ .gfx_target_version = 100302,
548575 .max_pasid_bits = 16,
549576 .max_no_of_hqd = 24,
550577 .doorbell_size = 8,
@@ -563,6 +590,7 @@ static const struct kfd_device_info dimgrey_cavefish_device_info = { · 12 unmodified lines
563590 static const struct kfd_device_info beige_goby_device_info = {
564591 .asic_family = CHIP_BEIGE_GOBY,
565592 .asic_name = "beige_goby",
593+ .gfx_target_version = 100304,
566594 .max_pasid_bits = 16,
567595 .max_no_of_hqd = 24,
568596 .doorbell_size = 8,
@@ -581,6 +609,7 @@ static const struct kfd_device_info beige_goby_device_info = { · 12 unmodified lines
581609 static const struct kfd_device_info yellow_carp_device_info = {
582610 .asic_family = CHIP_YELLOW_CARP,
583611 .asic_name = "yellow_carp",
612+ .gfx_target_version = 100305,
584613 .max_pasid_bits = 16,
585614 .max_no_of_hqd = 24,
586615 .doorbell_size = 8,
@@ -596,6 +625,25 @@ static const struct kfd_device_info yellow_carp_device_info = { · 9 unmodified lines
596625 .num_sdma_queues_per_engine = 2,
597626 };
598627
628+static const struct kfd_device_info cyan_skillfish_device_info = {
629+ .asic_family = CHIP_CYAN_SKILLFISH,
630+ .asic_name = "cyan_skillfish",
631+ .gfx_target_version = 100103,
632+ .max_pasid_bits = 16,
633+ .max_no_of_hqd = 24,
634+ .doorbell_size = 8,
635+ .ih_ring_entry_size = 8 * sizeof(uint32_t),
636+ .event_interrupt_class = &event_interrupt_class_v9,
637+ .num_of_watch_points = 4,
638+ .mqd_size_aligned = MQD_SIZE_ALIGNED,
639+ .needs_iommu_device = false,
640+ .supports_cwsr = true,
641+ .needs_pci_atomics = true,
642+ .num_sdma_engines = 2,
643+ .num_xgmi_sdma_engines = 0,
644+ .num_sdma_queues_per_engine = 8,
645+};
646+
599647 /* For each entry, [0] is regular and [1] is virtualisation device. */
600648 static const struct kfd_device_info *kfd_supported_devices[][2] = {
601649 #ifdef KFD_SUPPORT_IOMMU_V2
@@ -625,6 +673,7 @@ static const struct kfd_device_info *kfd_supported_devices[][2] = { · 23 unmodified lines
625673 [CHIP_DIMGREY_CAVEFISH] = {&dimgrey_cavefish_device_info, &dimgrey_cavefish_device_info},
626674 [CHIP_BEIGE_GOBY] = {&beige_goby_device_info, &beige_goby_device_info},
627675 [CHIP_YELLOW_CARP] = {&yellow_carp_device_info, NULL},
676+ [CHIP_CYAN_SKILLFISH] = {&cyan_skillfish_device_info, NULL},
628677 };
629678
630679 static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
@@ -1369,7 +1418,7 @@ void kfd_dec_compute_active(struct kfd_dev *kfd) · 738 unmodified lines
13691418 WARN_ONCE(count < 0, "Compute profile ref. count error");
13701419 }
13711420
1372−void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint32_t throttle_bitmask)
1421+void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask)
13731422 {
13741423 if (kfd && kfd->init_complete)
13751424 kfd_smi_event_update_thermal_throttling(kfd, throttle_bitmask);
@@ -1382,18 +1431,12 @@ void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint32_t throttle_bitmask) · 6 unmodified lines
13821431 */
13831432 int kfd_debugfs_hang_hws(struct kfd_dev *dev)
13841433 {
1385− int r = 0;
1386−
13871434 if (dev->dqm->sched_policy != KFD_SCHED_POLICY_HWS) {
13881435 pr_err("HWS is not enabled");
13891436 return -EINVAL;
13901437 }
13911438
1392− r = pm_debugfs_hang_hws(&dev->dqm->packets);
1393− if (!r)
1394− r = dqm_debugfs_execute_queues(dev->dqm);
1395−
1396− return r;
1439+ return dqm_debugfs_hang_hws(dev->dqm);
13971440 }
13981441
13991442 #endif
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c+42−18
@@ -211,6 +211,15 @@ static void deallocate_doorbell(struct qcm_process_device *qpd, · 210 unmodified lines
211211 WARN_ON(!old);
212212 }
213213
214+static void program_trap_handler_settings(struct device_queue_manager *dqm,
215+ struct qcm_process_device *qpd)
216+{
217+ if (dqm->dev->kfd2kgd->program_trap_handler_settings)
218+ dqm->dev->kfd2kgd->program_trap_handler_settings(
219+ dqm->dev->kgd, qpd->vmid,
220+ qpd->tba_addr, qpd->tma_addr);
221+}
222+
214223 static int allocate_vmid(struct device_queue_manager *dqm,
215224 struct qcm_process_device *qpd,
216225 struct queue *q)
@@ -241,6 +250,10 @@ static int allocate_vmid(struct device_queue_manager *dqm, · 24 unmodified lines
241250
242251 program_sh_mem_settings(dqm, qpd);
243252
253+ if (dqm->dev->device_info->asic_family >= CHIP_VEGA10 &&
254+ dqm->dev->cwsr_enabled)
255+ program_trap_handler_settings(dqm, qpd);
256+
244257 /* qpd->page_table_base is set earlier when register_process()
245258 * is called, i.e. when the first queue is created.
246259 */
@@ -260,7 +273,7 @@ static int allocate_vmid(struct device_queue_manager *dqm, · 13 unmodified lines
260273 static int flush_texture_cache_nocpsch(struct kfd_dev *kdev,
261274 struct qcm_process_device *qpd)
262275 {
263− const struct packet_manager_funcs *pmf = qpd->dqm->packets.pmf;
276+ const struct packet_manager_funcs *pmf = qpd->dqm->packet_mgr.pmf;
264277 int ret;
265278
266279 if (!qpd->ib_kaddr)
@@ -582,7 +595,9 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) · 315 unmodified lines
582595 }
583596
584597 retval = mqd_mgr->destroy_mqd(mqd_mgr, q->mqd,
585− KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN,
598+ (dqm->dev->cwsr_enabled?
599+ KFD_PREEMPT_TYPE_WAVEFRONT_SAVE:
600+ KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN),
586601 KFD_UNMAP_LATENCY_MS, q->pipe, q->queue);
587602 if (retval) {
588603 pr_err("destroy mqd failed\n");
@@ -675,7 +690,9 @@ static int evict_process_queues_nocpsch(struct device_queue_manager *dqm, · 86 unmodified lines
675690 continue;
676691
677692 retval = mqd_mgr->destroy_mqd(mqd_mgr, q->mqd,
678− KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN,
693+ (dqm->dev->cwsr_enabled?
694+ KFD_PREEMPT_TYPE_WAVEFRONT_SAVE:
695+ KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN),
679696 KFD_UNMAP_LATENCY_MS, q->pipe, q->queue);
680697 if (retval && !ret)
681698 /* Return the first error, but keep going to
@@ -1000,7 +1017,7 @@ static int start_nocpsch(struct device_queue_manager *dqm) · 318 unmodified lines
10001017 init_interrupts(dqm);
10011018
10021019 if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
1003− return pm_init(&dqm->packets, dqm);
1020+ return pm_init(&dqm->packet_mgr, dqm);
10041021 dqm->sched_running = true;
10051022
10061023 return 0;
@@ -1009,7 +1026,7 @@ static int start_nocpsch(struct device_queue_manager *dqm) · 2 unmodified lines
10091026 static int stop_nocpsch(struct device_queue_manager *dqm)
10101027 {
10111028 if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
1012− pm_uninit(&dqm->packets, false);
1029+ pm_uninit(&dqm->packet_mgr, false);
10131030 dqm->sched_running = false;
10141031
10151032 return 0;
@@ -1124,7 +1141,7 @@ static int set_sched_resources(struct device_queue_manager *dqm) · 108 unmodified lines
11241141 "queue mask: 0x%8llX\n",
11251142 res.vmid_mask, res.queue_mask);
11261143
1127− return pm_send_set_resources(&dqm->packets, &res);
1144+ return pm_send_set_resources(&dqm->packet_mgr, &res);
11281145 }
11291146
11301147 static int initialize_cpsch(struct device_queue_manager *dqm)
@@ -1164,7 +1181,8 @@ static int start_cpsch(struct device_queue_manager *dqm) · 33 unmodified lines
11641181
11651182 retval = 0;
11661183
1167− retval = pm_init(&dqm->packets, dqm);
1184+ dqm_lock(dqm);
1185+ retval = pm_init(&dqm->packet_mgr, dqm);
11681186 if (retval)
11691187 goto fail_packet_manager_init;
11701188
@@ -1186,7 +1204,6 @@ static int start_cpsch(struct device_queue_manager *dqm) · 15 unmodified lines
11861204
11871205 init_interrupts(dqm);
11881206
1189− dqm_lock(dqm);
11901207 /* clear hang status when driver try to start the hw scheduler */
11911208 dqm->is_hws_hang = false;
11921209 dqm->is_resetting = false;
@@ -1197,8 +1214,9 @@ static int start_cpsch(struct device_queue_manager *dqm) · 4 unmodified lines
11971214 return 0;
11981215 fail_allocate_vidmem:
11991216 fail_set_sched_resources:
1200− pm_uninit(&dqm->packets, false);
1217+ pm_uninit(&dqm->packet_mgr, false);
12011218 fail_packet_manager_init:
1219+ dqm_unlock(dqm);
12021220 return retval;
12031221 }
12041222
@@ -1211,12 +1229,12 @@ static int stop_cpsch(struct device_queue_manager *dqm) · 6 unmodified lines
12111229 unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0);
12121230 hanging = dqm->is_hws_hang || dqm->is_resetting;
12131231 dqm->sched_running = false;
1214− dqm_unlock(dqm);
12151232
1216− pm_release_ib(&dqm->packets);
1233+ pm_release_ib(&dqm->packet_mgr);
12171234
12181235 kfd_gtt_sa_free(dqm->dev, dqm->fence_mem);
1219− pm_uninit(&dqm->packets, hanging);
1236+ pm_uninit(&dqm->packet_mgr, hanging);
1237+ dqm_unlock(dqm);
12201238
12211239 return 0;
12221240 }
@@ -1390,7 +1408,7 @@ static int map_queues_cpsch(struct device_queue_manager *dqm) · 167 unmodified lines
13901408 if (dqm->active_runlist)
13911409 return 0;
13921410
1393− retval = pm_send_runlist(&dqm->packets, &dqm->queues);
1411+ retval = pm_send_runlist(&dqm->packet_mgr, &dqm->queues);
13941412 pr_debug("%s sent runlist\n", __func__);
13951413 if (retval) {
13961414 pr_err("failed to execute runlist\n");
@@ -1416,13 +1434,13 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, · 19 unmodified lines
14161434 if (!dqm->active_runlist)
14171435 return retval;
14181436
1419− retval = pm_send_unmap_queue(&dqm->packets, KFD_QUEUE_TYPE_COMPUTE,
1437+ retval = pm_send_unmap_queue(&dqm->packet_mgr, KFD_QUEUE_TYPE_COMPUTE,
14201438 filter, filter_param, false, 0);
14211439 if (retval)
14221440 return retval;
14231441
14241442 *dqm->fence_addr = KFD_FENCE_INIT;
1425− pm_send_query_status(&dqm->packets, dqm->fence_gpu_addr,
1443+ pm_send_query_status(&dqm->packet_mgr, dqm->fence_gpu_addr,
14261444 KFD_FENCE_COMPLETED);
14271445 /* should be timed out */
14281446 retval = amdkfd_fence_wait_timeout(dqm->fence_addr, KFD_FENCE_COMPLETED,
@@ -1448,14 +1466,14 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, · 19 unmodified lines
14481466 * check those fields
14491467 */
14501468 mqd_mgr = dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ];
1451− if (mqd_mgr->read_doorbell_id(dqm->packets.priv_queue->queue->mqd)) {
1469+ if (mqd_mgr->read_doorbell_id(dqm->packet_mgr.priv_queue->queue->mqd)) {
14521470 pr_err("HIQ MQD's queue_doorbell_id0 is not 0, Queue preemption time out\n");
14531471 while (halt_if_hws_hang)
14541472 schedule();
14551473 return -ETIME;
14561474 }
14571475
1458− pm_release_ib(&dqm->packets);
1476+ pm_release_ib(&dqm->packet_mgr);
14591477 dqm->active_runlist = false;
14601478
14611479 return retval;
@@ -1946,6 +1964,7 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev) · 484 unmodified lines
19461964 case CHIP_DIMGREY_CAVEFISH:
19471965 case CHIP_BEIGE_GOBY:
19481966 case CHIP_YELLOW_CARP:
1967+ case CHIP_CYAN_SKILLFISH:
19491968 device_queue_manager_init_v10_navi10(&dqm->asic_ops);
19501969 break;
19511970 default:
@@ -2099,11 +2118,16 @@ int dqm_debugfs_hqds(struct seq_file *m, void *data) · 147 unmodified lines
20992118 return r;
21002119 }
21012120
2102−int dqm_debugfs_execute_queues(struct device_queue_manager *dqm)
2121+int dqm_debugfs_hang_hws(struct device_queue_manager *dqm)
21032122 {
21042123 int r = 0;
21052124
21062125 dqm_lock(dqm);
2126+ r = pm_debugfs_hang_hws(&dqm->packet_mgr);
2127+ if (r) {
2128+ dqm_unlock(dqm);
2129+ return r;
2130+ }
21072131 dqm->active_runlist = true;
21082132 r = execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0);
21092133 dqm_unlock(dqm);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h+1−1
@@ -169,7 +169,7 @@ struct device_queue_manager { · 168 unmodified lines
169169 struct device_queue_manager_asic_ops asic_ops;
170170
171171 struct mqd_manager *mqd_mgrs[KFD_MQD_TYPE_MAX];
172− struct packet_manager packets;
172+ struct packet_manager packet_mgr;
173173 struct kfd_dev *dev;
174174 struct mutex lock_hidden; /* use dqm_lock/unlock(dqm) */
175175 struct list_head queues;
drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c+1−0
@@ -422,6 +422,7 @@ int kfd_init_apertures(struct kfd_process *process) · 421 unmodified lines
422422 case CHIP_DIMGREY_CAVEFISH:
423423 case CHIP_BEIGE_GOBY:
424424 case CHIP_YELLOW_CARP:
425+ case CHIP_CYAN_SKILLFISH:
425426 kfd_init_apertures_v9(pdd, id);
426427 break;
427428 default:
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c+63−21
@@ -98,36 +98,78 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, · 97 unmodified lines
9898 uint32_t *se_mask)
9999 {
100100 struct kfd_cu_info cu_info;
101− uint32_t cu_per_se[KFD_MAX_NUM_SE] = {0};
102− int i, se, sh, cu = 0;
103−
101+ uint32_t cu_per_sh[KFD_MAX_NUM_SE][KFD_MAX_NUM_SH_PER_SE] = {0};
102+ int i, se, sh, cu;
104103 amdgpu_amdkfd_get_cu_info(mm->dev->kgd, &cu_info);
105104
106105 if (cu_mask_count > cu_info.cu_active_number)
107106 cu_mask_count = cu_info.cu_active_number;
108107
108+ /* Exceeding these bounds corrupts the stack and indicates a coding error.
109+ * Returning with no CU's enabled will hang the queue, which should be
110+ * attention grabbing.
111+ */
112+ if (cu_info.num_shader_engines > KFD_MAX_NUM_SE) {
113+ pr_err("Exceeded KFD_MAX_NUM_SE, chip reports %d\n", cu_info.num_shader_engines);
114+ return;
115+ }
116+ if (cu_info.num_shader_arrays_per_engine > KFD_MAX_NUM_SH_PER_SE) {
117+ pr_err("Exceeded KFD_MAX_NUM_SH, chip reports %d\n",
118+ cu_info.num_shader_arrays_per_engine * cu_info.num_shader_engines);
119+ return;
120+ }
121+ /* Count active CUs per SH.
122+ *
123+ * Some CUs in an SH may be disabled. HW expects disabled CUs to be
124+ * represented in the high bits of each SH's enable mask (the upper and lower
125+ * 16 bits of se_mask) and will take care of the actual distribution of
126+ * disabled CUs within each SH automatically.
127+ * Each half of se_mask must be filled only on bits 0-cu_per_sh[se][sh]-1.
128+ *
129+ * See note on Arcturus cu_bitmap layout in gfx_v9_0_get_cu_info.
130+ */
109131 for (se = 0; se < cu_info.num_shader_engines; se++)
110132 for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++)
111− cu_per_se[se] += hweight32(cu_info.cu_bitmap[se % 4][sh + (se / 4)]);
112−
113− /* Symmetrically map cu_mask to all SEs:
114− * cu_mask[0] bit0 -> se_mask[0] bit0;
115− * cu_mask[0] bit1 -> se_mask[1] bit0;
116− * ... (if # SE is 4)
117− * cu_mask[0] bit4 -> se_mask[0] bit1;
133+ cu_per_sh[se][sh] = hweight32(cu_info.cu_bitmap[se % 4][sh + (se / 4)]);
134+
135+ /* Symmetrically map cu_mask to all SEs & SHs:
136+ * se_mask programs up to 2 SH in the upper and lower 16 bits.
137+ *
138+ * Examples
139+ * Assuming 1 SH/SE, 4 SEs:
140+ * cu_mask[0] bit0 -> se_mask[0] bit0
141+ * cu_mask[0] bit1 -> se_mask[1] bit0
142+ * ...
143+ * cu_mask[0] bit4 -> se_mask[0] bit1
144+ * ...
145+ *
146+ * Assuming 2 SH/SE, 4 SEs
147+ * cu_mask[0] bit0 -> se_mask[0] bit0 (SE0,SH0,CU0)
148+ * cu_mask[0] bit1 -> se_mask[1] bit0 (SE1,SH0,CU0)
149+ * ...
150+ * cu_mask[0] bit4 -> se_mask[0] bit16 (SE0,SH1,CU0)
151+ * cu_mask[0] bit5 -> se_mask[1] bit16 (SE1,SH1,CU0)
152+ * ...
153+ * cu_mask[0] bit8 -> se_mask[0] bit1 (SE0,SH0,CU1)
118154 * ...
155+ *
156+ * First ensure all CUs are disabled, then enable user specified CUs.
119157 */
120− se = 0;
121− for (i = 0; i < cu_mask_count; i++) {
122− if (cu_mask[i / 32] & (1 << (i % 32)))
123− se_mask[se] |= 1 << cu;
124−
125− do {
126− se++;
127− if (se == cu_info.num_shader_engines) {
128− se = 0;
129− cu++;
158+ for (i = 0; i < cu_info.num_shader_engines; i++)
159+ se_mask[i] = 0;
160+
161+ i = 0;
162+ for (cu = 0; cu < 16; cu++) {
163+ for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) {
164+ for (se = 0; se < cu_info.num_shader_engines; se++) {
165+ if (cu_per_sh[se][sh] > cu) {
166+ if (cu_mask[i / 32] & (1 << (i % 32)))
167+ se_mask[se] |= 1 << (cu + sh * 16);
168+ i++;
169+ if (i == cu_mask_count)
170+ return;
171+ }
130172 }
131− } while (cu >= cu_per_se[se] && cu < 32);
173+ }
132174 }
133175 }
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include "kfd_priv.h"
2828
2929 #define KFD_MAX_NUM_SE 8
30+#define KFD_MAX_NUM_SH_PER_SE 2
3031
3132 /**
3233 * struct mqd_manager
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c+5−0
@@ -251,6 +251,7 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm) · 250 unmodified lines
251251 case CHIP_DIMGREY_CAVEFISH:
252252 case CHIP_BEIGE_GOBY:
253253 case CHIP_YELLOW_CARP:
254+ case CHIP_CYAN_SKILLFISH:
254255 pm->pmf = &kfd_v9_pm_funcs;
255256 break;
256257 case CHIP_ALDEBARAN:
@@ -278,6 +279,7 @@ void pm_uninit(struct packet_manager *pm, bool hanging) · 21 unmodified lines
278279 {
279280 mutex_destroy(&pm->lock);
280281 kernel_queue_uninit(pm->priv_queue, hanging);
282+ pm->priv_queue = NULL;
281283 }
282284
283285 int pm_send_set_resources(struct packet_manager *pm,
@@ -447,6 +449,9 @@ int pm_debugfs_hang_hws(struct packet_manager *pm) · 163 unmodified lines
447449 uint32_t *buffer, size;
448450 int r = 0;
449451
452+ if (!pm->priv_queue)
453+ return -EAGAIN;
454+
450455 size = pm->pmf->query_status_size;
451456 mutex_lock(&pm->lock);
452457 kq_acquire_packet_buffer(pm->priv_queue,
drivers/gpu/drm/amd/amdkfd/kfd_priv.h+2−1
@@ -196,6 +196,7 @@ struct kfd_event_interrupt_class { · 195 unmodified lines
196196 struct kfd_device_info {
197197 enum amd_asic_type asic_family;
198198 const char *asic_name;
199+ uint32_t gfx_target_version;
199200 const struct kfd_event_interrupt_class *event_interrupt_class;
200201 unsigned int max_pasid_bits;
201202 unsigned int max_no_of_hqd;
@@ -1194,7 +1195,7 @@ int pm_debugfs_runlist(struct seq_file *m, void *data); · 992 unmodified lines
11941195
11951196 int kfd_debugfs_hang_hws(struct kfd_dev *dev);
11961197 int pm_debugfs_hang_hws(struct packet_manager *pm);
1197−int dqm_debugfs_execute_queues(struct device_queue_manager *dqm);
1198+int dqm_debugfs_hang_hws(struct device_queue_manager *dqm);
11981199
11991200 #else
12001201
drivers/gpu/drm/amd/amdkfd/kfd_process.c+2−1
@@ -714,7 +714,8 @@ static int kfd_process_alloc_gpuvm(struct kfd_process_device *pdd, · 713 unmodified lines
714714 if (err)
715715 goto err_alloc_mem;
716716
717− err = amdgpu_amdkfd_gpuvm_map_memory_to_gpu(kdev->kgd, mem, pdd->drm_priv);
717+ err = amdgpu_amdkfd_gpuvm_map_memory_to_gpu(kdev->kgd, mem,
718+ pdd->drm_priv, NULL);
718719 if (err)
719720 goto err_map_mem;
720721
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c+5−5
@@ -205,23 +205,23 @@ void kfd_smi_event_update_gpu_reset(struct kfd_dev *dev, bool post_reset) · 204 unmodified lines
205205 }
206206
207207 void kfd_smi_event_update_thermal_throttling(struct kfd_dev *dev,
208− uint32_t throttle_bitmask)
208+ uint64_t throttle_bitmask)
209209 {
210210 struct amdgpu_device *adev = (struct amdgpu_device *)dev->kgd;
211211 /*
212212 * ThermalThrottle msg = throttle_bitmask(8):
213213 * thermal_interrupt_count(16):
214− * 1 byte event + 1 byte space + 8 byte throttle_bitmask +
214+ * 1 byte event + 1 byte space + 16 byte throttle_bitmask +
215215 * 1 byte : + 16 byte thermal_interupt_counter + 1 byte \n +
216− * 1 byte \0 = 29
216+ * 1 byte \0 = 37
217217 */
218− char fifo_in[29];
218+ char fifo_in[37];
219219 int len;
220220
221221 if (list_empty(&dev->smi_clients))
222222 return;
223223
224− len = snprintf(fifo_in, sizeof(fifo_in), "%x %x:%llx\n",
224+ len = snprintf(fifo_in, sizeof(fifo_in), "%x %llx:%llx\n",
225225 KFD_SMI_EVENT_THERMAL_THROTTLE, throttle_bitmask,
226226 atomic64_read(&adev->smu.throttle_int_counter));
227227
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.h+1−1
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 int kfd_smi_event_open(struct kfd_dev *dev, uint32_t *fd);
2727 void kfd_smi_event_update_vmfault(struct kfd_dev *dev, uint16_t pasid);
2828 void kfd_smi_event_update_thermal_throttling(struct kfd_dev *dev,
29− uint32_t throttle_bitmask);
29+ uint64_t throttle_bitmask);
3030 void kfd_smi_event_update_gpu_reset(struct kfd_dev *dev, bool post_reset);
3131
3232 #endif
drivers/gpu/drm/amd/amdkfd/kfd_svm.c+146−71
@@ -120,6 +120,7 @@ static void svm_range_remove_notifier(struct svm_range *prange) · 119 unmodified lines
120120
121121 static int
122122 svm_range_dma_map_dev(struct amdgpu_device *adev, struct svm_range *prange,
123+ unsigned long offset, unsigned long npages,
123124 unsigned long *hmm_pfns, uint32_t gpuidx)
124125 {
125126 enum dma_data_direction dir = DMA_BIDIRECTIONAL;
@@ -136,7 +137,8 @@ svm_range_dma_map_dev(struct amdgpu_device *adev, struct svm_range *prange, · 10 unmodified lines
136137 prange->dma_addr[gpuidx] = addr;
137138 }
138139
139− for (i = 0; i < prange->npages; i++) {
140+ addr += offset;
141+ for (i = 0; i < npages; i++) {
140142 if (WARN_ONCE(addr[i] && !dma_mapping_error(dev, addr[i]),
141143 "leaking dma mapping\n"))
142144 dma_unmap_page(dev, addr[i], PAGE_SIZE, dir);
@@ -167,6 +169,7 @@ svm_range_dma_map_dev(struct amdgpu_device *adev, struct svm_range *prange, · 24 unmodified lines
167169
168170 static int
169171 svm_range_dma_map(struct svm_range *prange, unsigned long *bitmap,
172+ unsigned long offset, unsigned long npages,
170173 unsigned long *hmm_pfns)
171174 {
172175 struct kfd_process *p;
@@ -187,7 +190,8 @@ svm_range_dma_map(struct svm_range *prange, unsigned long *bitmap, · 14 unmodified lines
187190 }
188191 adev = (struct amdgpu_device *)pdd->dev->kgd;
189192
190− r = svm_range_dma_map_dev(adev, prange, hmm_pfns, gpuidx);
193+ r = svm_range_dma_map_dev(adev, prange, offset, npages,
194+ hmm_pfns, gpuidx);
191195 if (r)
192196 break;
193197 }
@@ -1088,11 +1092,6 @@ svm_range_get_pte_flags(struct amdgpu_device *adev, struct svm_range *prange, · 894 unmodified lines
10881092 pte_flags |= snoop ? AMDGPU_PTE_SNOOPED : 0;
10891093
10901094 pte_flags |= amdgpu_gem_va_map_flags(adev, mapping_flags);
1091−
1092− pr_debug("svms 0x%p [0x%lx 0x%lx] vram %d PTE 0x%llx mapping 0x%x\n",
1093− prange->svms, prange->start, prange->last,
1094− (domain == SVM_RANGE_VRAM_DOMAIN) ? 1:0, pte_flags, mapping_flags);
1095−
10961095 return pte_flags;
10971096 }
10981097
@@ -1156,7 +1155,8 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start, · 57 unmodified lines
11561155
11571156 static int
11581157 svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm,
1159− struct svm_range *prange, dma_addr_t *dma_addr,
1158+ struct svm_range *prange, unsigned long offset,
1159+ unsigned long npages, bool readonly, dma_addr_t *dma_addr,
11601160 struct amdgpu_device *bo_adev, struct dma_fence **fence)
11611161 {
11621162 struct amdgpu_bo_va bo_va;
@@ -1167,14 +1167,15 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 4 unmodified lines
11671167 int r = 0;
11681168 int64_t i;
11691169
1170− pr_debug("svms 0x%p [0x%lx 0x%lx]\n", prange->svms, prange->start,
1171− prange->last);
1170+ last_start = prange->start + offset;
1171+
1172+ pr_debug("svms 0x%p [0x%lx 0x%lx] readonly %d\n", prange->svms,
1173+ last_start, last_start + npages - 1, readonly);
11721174
11731175 if (prange->svm_bo && prange->ttm_res)
11741176 bo_va.is_xgmi = amdgpu_xgmi_same_hive(adev, bo_adev);
11751177
1176− last_start = prange->start;
1177− for (i = 0; i < prange->npages; i++) {
1178+ for (i = offset; i < offset + npages; i++) {
11781179 last_domain = dma_addr[i] & SVM_RANGE_VRAM_DOMAIN;
11791180 dma_addr[i] &= ~SVM_RANGE_VRAM_DOMAIN;
11801181 if ((prange->start + i) < prange->last &&
@@ -1183,13 +1184,21 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 2 unmodified lines
11831184
11841185 pr_debug("Mapping range [0x%lx 0x%llx] on domain: %s\n",
11851186 last_start, prange->start + i, last_domain ? "GPU" : "CPU");
1187+
11861188 pte_flags = svm_range_get_pte_flags(adev, prange, last_domain);
1187− r = amdgpu_vm_bo_update_mapping(adev, bo_adev, vm, false, false, NULL,
1188− last_start,
1189+ if (readonly)
1190+ pte_flags &= ~AMDGPU_PTE_WRITEABLE;
1191+
1192+ pr_debug("svms 0x%p map [0x%lx 0x%llx] vram %d PTE 0x%llx\n",
1193+ prange->svms, last_start, prange->start + i,
1194+ (last_domain == SVM_RANGE_VRAM_DOMAIN) ? 1 : 0,
1195+ pte_flags);
1196+
1197+ r = amdgpu_vm_bo_update_mapping(adev, bo_adev, vm, false, false,
1198+ NULL, last_start,
11891199 prange->start + i, pte_flags,
11901200 last_start - prange->start,
1191− NULL,
1192− dma_addr,
1201+ NULL, dma_addr,
11931202 &vm->last_update,
11941203 &table_freed);
11951204 if (r) {
@@ -1220,8 +1229,10 @@ out: · 24 unmodified lines
12201229 return r;
12211230 }
12221231
1223−static int svm_range_map_to_gpus(struct svm_range *prange,
1224− unsigned long *bitmap, bool wait)
1232+static int
1233+svm_range_map_to_gpus(struct svm_range *prange, unsigned long offset,
1234+ unsigned long npages, bool readonly,
1235+ unsigned long *bitmap, bool wait)
12251236 {
12261237 struct kfd_process_device *pdd;
12271238 struct amdgpu_device *bo_adev;
@@ -1257,7 +1268,8 @@ static int svm_range_map_to_gpus(struct svm_range *prange, · 29 unmodified lines
12571268 }
12581269
12591270 r = svm_range_map_to_gpu(adev, drm_priv_to_vm(pdd->drm_priv),
1260− prange, prange->dma_addr[gpuidx],
1271+ prange, offset, npages, readonly,
1272+ prange->dma_addr[gpuidx],
12611273 bo_adev, wait ? &fence : NULL);
12621274 if (r)
12631275 break;
@@ -1390,7 +1402,7 @@ static int svm_range_validate_and_map(struct mm_struct *mm, · 126 unmodified lines
13901402 int32_t gpuidx, bool intr, bool wait)
13911403 {
13921404 struct svm_validate_context ctx;
1393− struct hmm_range *hmm_range;
1405+ unsigned long start, end, addr;
13941406 struct kfd_process *p;
13951407 void *owner;
13961408 int32_t idx;
@@ -1448,40 +1460,66 @@ static int svm_range_validate_and_map(struct mm_struct *mm, · 51 unmodified lines
14481460 break;
14491461 }
14501462 }
1451− r = amdgpu_hmm_range_get_pages(&prange->notifier, mm, NULL,
1452− prange->start << PAGE_SHIFT,
1453− prange->npages, &hmm_range,
1454− false, true, owner);
1455− if (r) {
1456− pr_debug("failed %d to get svm range pages\n", r);
1457− goto unreserve_out;
1458− }
14591463
1460− r = svm_range_dma_map(prange, ctx.bitmap,
1461− hmm_range->hmm_pfns);
1462− if (r) {
1463− pr_debug("failed %d to dma map range\n", r);
1464− goto unreserve_out;
1465− }
1464+ start = prange->start << PAGE_SHIFT;
1465+ end = (prange->last + 1) << PAGE_SHIFT;
1466+ for (addr = start; addr < end && !r; ) {
1467+ struct hmm_range *hmm_range;
1468+ struct vm_area_struct *vma;
1469+ unsigned long next;
1470+ unsigned long offset;
1471+ unsigned long npages;
1472+ bool readonly;
14661473
1467− prange->validated_once = true;
1474+ vma = find_vma(mm, addr);
1475+ if (!vma || addr < vma->vm_start) {
1476+ r = -EFAULT;
1477+ goto unreserve_out;
1478+ }
1479+ readonly = !(vma->vm_flags & VM_WRITE);
14681480
1469− svm_range_lock(prange);
1470− if (amdgpu_hmm_range_get_pages_done(hmm_range)) {
1471− pr_debug("hmm update the range, need validate again\n");
1472− r = -EAGAIN;
1473− goto unlock_out;
1474− }
1475− if (!list_empty(&prange->child_list)) {
1476− pr_debug("range split by unmap in parallel, validate again\n");
1477− r = -EAGAIN;
1478− goto unlock_out;
1479− }
1481+ next = min(vma->vm_end, end);
1482+ npages = (next - addr) >> PAGE_SHIFT;
1483+ r = amdgpu_hmm_range_get_pages(&prange->notifier, mm, NULL,
1484+ addr, npages, &hmm_range,
1485+ readonly, true, owner);
1486+ if (r) {
1487+ pr_debug("failed %d to get svm range pages\n", r);
1488+ goto unreserve_out;
1489+ }
14801490
1481− r = svm_range_map_to_gpus(prange, ctx.bitmap, wait);
1491+ offset = (addr - start) >> PAGE_SHIFT;
1492+ r = svm_range_dma_map(prange, ctx.bitmap, offset, npages,
1493+ hmm_range->hmm_pfns);
1494+ if (r) {
1495+ pr_debug("failed %d to dma map range\n", r);
1496+ goto unreserve_out;
1497+ }
1498+
1499+ svm_range_lock(prange);
1500+ if (amdgpu_hmm_range_get_pages_done(hmm_range)) {
1501+ pr_debug("hmm update the range, need validate again\n");
1502+ r = -EAGAIN;
1503+ goto unlock_out;
1504+ }
1505+ if (!list_empty(&prange->child_list)) {
1506+ pr_debug("range split by unmap in parallel, validate again\n");
1507+ r = -EAGAIN;
1508+ goto unlock_out;
1509+ }
1510+
1511+ r = svm_range_map_to_gpus(prange, offset, npages, readonly,
1512+ ctx.bitmap, wait);
14821513
14831514 unlock_out:
1484− svm_range_unlock(prange);
1515+ svm_range_unlock(prange);
1516+
1517+ addr = next;
1518+ }
1519+
1520+ if (addr == end)
1521+ prange->validated_once = true;
1522+
14851523 unreserve_out:
14861524 svm_range_unreserve_bos(&ctx);
14871525
@@ -2400,9 +2438,29 @@ svm_range_count_fault(struct amdgpu_device *adev, struct kfd_process *p, · 912 unmodified lines
24002438 WRITE_ONCE(pdd->faults, pdd->faults + 1);
24012439 }
24022440
2441+static bool
2442+svm_fault_allowed(struct mm_struct *mm, uint64_t addr, bool write_fault)
2443+{
2444+ unsigned long requested = VM_READ;
2445+ struct vm_area_struct *vma;
2446+
2447+ if (write_fault)
2448+ requested |= VM_WRITE;
2449+
2450+ vma = find_vma(mm, addr << PAGE_SHIFT);
2451+ if (!vma || (addr << PAGE_SHIFT) < vma->vm_start) {
2452+ pr_debug("address 0x%llx VMA is removed\n", addr);
2453+ return true;
2454+ }
2455+
2456+ pr_debug("requested 0x%lx, vma permission flags 0x%lx\n", requested,
2457+ vma->vm_flags);
2458+ return (vma->vm_flags & requested) == requested;
2459+}
2460+
24032461 int
24042462 svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
2405− uint64_t addr)
2463+ uint64_t addr, bool write_fault)
24062464 {
24072465 struct mm_struct *mm = NULL;
24082466 struct svm_range_list *svms;
@@ -2484,6 +2542,13 @@ retry_write_locked: · 75 unmodified lines
24842542 goto out_unlock_range;
24852543 }
24862544
2545+ if (!svm_fault_allowed(mm, addr, write_fault)) {
2546+ pr_debug("fault addr 0x%llx no %s permission\n", addr,
2547+ write_fault ? "write" : "read");
2548+ r = -EPERM;
2549+ goto out_unlock_range;
2550+ }
2551+
24872552 best_loc = svm_range_best_restore_location(prange, adev, &gpuidx);
24882553 if (best_loc == -1) {
24892554 pr_debug("svms %p failed get best restore loc [0x%lx 0x%lx]\n",
@@ -2675,22 +2740,26 @@ svm_range_add(struct kfd_process *p, uint64_t start, uint64_t size, · 185 unmodified lines
26752740 return 0;
26762741 }
26772742
2678−/* svm_range_best_prefetch_location - decide the best prefetch location
2743+/**
2744+ * svm_range_best_prefetch_location - decide the best prefetch location
26792745 * @prange: svm range structure
26802746 *
26812747 * For xnack off:
2682− * If range map to single GPU, the best acutal location is prefetch loc, which
2748+ * If range map to single GPU, the best prefetch location is prefetch_loc, which
26832749 * can be CPU or GPU.
26842750 *
2685− * If range map to multiple GPUs, only if mGPU connection on xgmi same hive,
2686− * the best actual location could be prefetch_loc GPU. If mGPU connection on
2687− * PCIe, the best actual location is always CPU, because GPU cannot access vram
2688− * of other GPUs, assuming PCIe small bar (large bar support is not upstream).
2751+ * If range is ACCESS or ACCESS_IN_PLACE by mGPUs, only if mGPU connection on
2752+ * XGMI same hive, the best prefetch location is prefetch_loc GPU, othervise
2753+ * the best prefetch location is always CPU, because GPU can not have coherent
2754+ * mapping VRAM of other GPUs even with large-BAR PCIe connection.
26892755 *
26902756 * For xnack on:
2691− * The best actual location is prefetch location. If mGPU connection on xgmi
2692− * same hive, range map to multiple GPUs. Otherwise, the range only map to
2693− * actual location GPU. Other GPU access vm fault will trigger migration.
2757+ * If range is not ACCESS_IN_PLACE by mGPUs, the best prefetch location is
2758+ * prefetch_loc, other GPU access will generate vm fault and trigger migration.
2759+ *
2760+ * If range is ACCESS_IN_PLACE by mGPUs, only if mGPU connection on XGMI same
2761+ * hive, the best prefetch location is prefetch_loc GPU, otherwise the best
2762+ * prefetch location is always CPU.
26942763 *
26952764 * Context: Process context
26962765 *
@@ -2710,11 +2779,6 @@ svm_range_best_prefetch_location(struct svm_range *prange) · 13 unmodified lines
27102779
27112780 p = container_of(prange->svms, struct kfd_process, svms);
27122781
2713− /* xnack on */
2714− if (p->xnack_enabled)
2715− goto out;
2716−
2717− /* xnack off */
27182782 if (!best_loc || best_loc == KFD_IOCTL_SVM_LOCATION_UNDEFINED)
27192783 goto out;
27202784
@@ -2724,8 +2788,12 @@ svm_range_best_prefetch_location(struct svm_range *prange) · 3 unmodified lines
27242788 best_loc = 0;
27252789 goto out;
27262790 }
2727− bitmap_or(bitmap, prange->bitmap_access, prange->bitmap_aip,
2728− MAX_GPU_INSTANCE);
2791+
2792+ if (p->xnack_enabled)
2793+ bitmap_copy(bitmap, prange->bitmap_aip, MAX_GPU_INSTANCE);
2794+ else
2795+ bitmap_or(bitmap, prange->bitmap_access, prange->bitmap_aip,
2796+ MAX_GPU_INSTANCE);
27292797
27302798 for_each_set_bit(gpuidx, bitmap, MAX_GPU_INSTANCE) {
27312799 pdd = kfd_process_device_from_gpuidx(p, gpuidx);
@@ -3019,7 +3087,8 @@ svm_range_get_attr(struct kfd_process *p, uint64_t start, uint64_t size, · 287 unmodified lines
30193087 struct svm_range *prange;
30203088 uint32_t prefetch_loc = KFD_IOCTL_SVM_LOCATION_UNDEFINED;
30213089 uint32_t location = KFD_IOCTL_SVM_LOCATION_UNDEFINED;
3022− uint32_t flags = 0xffffffff;
3090+ uint32_t flags_and = 0xffffffff;
3091+ uint32_t flags_or = 0;
30233092 int gpuidx;
30243093 uint32_t i;
30253094
@@ -3054,12 +3123,12 @@ svm_range_get_attr(struct kfd_process *p, uint64_t start, uint64_t size, · 28 unmodified lines
30543123 get_accessible = true;
30553124 break;
30563125 case KFD_IOCTL_SVM_ATTR_SET_FLAGS:
3126+ case KFD_IOCTL_SVM_ATTR_CLR_FLAGS:
30573127 get_flags = true;
30583128 break;
30593129 case KFD_IOCTL_SVM_ATTR_GRANULARITY:
30603130 get_granularity = true;
30613131 break;
3062− case KFD_IOCTL_SVM_ATTR_CLR_FLAGS:
30633132 case KFD_IOCTL_SVM_ATTR_ACCESS_IN_PLACE:
30643133 case KFD_IOCTL_SVM_ATTR_NO_ACCESS:
30653134 fallthrough;
@@ -3077,7 +3146,8 @@ svm_range_get_attr(struct kfd_process *p, uint64_t start, uint64_t size, · 11 unmodified lines
30773146 if (!node) {
30783147 pr_debug("range attrs not found return default values\n");
30793148 svm_range_set_default_attributes(&location, &prefetch_loc,
3080− &granularity, &flags);
3149+ &granularity, &flags_and);
3150+ flags_or = flags_and;
30813151 if (p->xnack_enabled)
30823152 bitmap_copy(bitmap_access, svms->bitmap_supported,
30833153 MAX_GPU_INSTANCE);
@@ -3123,8 +3193,10 @@ svm_range_get_attr(struct kfd_process *p, uint64_t start, uint64_t size, · 39 unmodified lines
31233193 bitmap_and(bitmap_aip, bitmap_aip,
31243194 prange->bitmap_aip, MAX_GPU_INSTANCE);
31253195 }
3126− if (get_flags)
3127− flags &= prange->flags;
3196+ if (get_flags) {
3197+ flags_and &= prange->flags;
3198+ flags_or |= prange->flags;
3199+ }
31283200
31293201 if (get_granularity && prange->granularity < granularity)
31303202 granularity = prange->granularity;
@@ -3158,7 +3230,10 @@ fill_values: · 27 unmodified lines
31583230 attrs[i].type = KFD_IOCTL_SVM_ATTR_NO_ACCESS;
31593231 break;
31603232 case KFD_IOCTL_SVM_ATTR_SET_FLAGS:
3161− attrs[i].value = flags;
3233+ attrs[i].value = flags_and;
3234+ break;
3235+ case KFD_IOCTL_SVM_ATTR_CLR_FLAGS:
3236+ attrs[i].value = ~flags_or;
31623237 break;
31633238 case KFD_IOCTL_SVM_ATTR_GRANULARITY:
31643239 attrs[i].value = (uint32_t)granularity;
drivers/gpu/drm/amd/amdkfd/kfd_svm.h+3−2
@@ -175,7 +175,7 @@ int svm_range_split_by_granularity(struct kfd_process *p, struct mm_struct *mm, · 174 unmodified lines
175175 unsigned long addr, struct svm_range *parent,
176176 struct svm_range *prange);
177177 int svm_range_restore_pages(struct amdgpu_device *adev,
178− unsigned int pasid, uint64_t addr);
178+ unsigned int pasid, uint64_t addr, bool write_fault);
179179 int svm_range_schedule_evict_svm_bo(struct amdgpu_amdkfd_fence *fence);
180180 void svm_range_add_list_work(struct svm_range_list *svms,
181181 struct svm_range *prange, struct mm_struct *mm,
@@ -209,7 +209,8 @@ static inline void svm_range_list_fini(struct kfd_process *p) · 27 unmodified lines
209209 }
210210
211211 static inline int svm_range_restore_pages(struct amdgpu_device *adev,
212− unsigned int pasid, uint64_t addr)
212+ unsigned int pasid, uint64_t addr,
213+ bool write_fault)
213214 {
214215 return -EFAULT;
215216 }
drivers/gpu/drm/amd/amdkfd/kfd_topology.c+5−1
@@ -478,6 +478,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, · 477 unmodified lines
478478 dev->node_props.simd_per_cu);
479479 sysfs_show_32bit_prop(buffer, offs, "max_slots_scratch_cu",
480480 dev->node_props.max_slots_scratch_cu);
481+ sysfs_show_32bit_prop(buffer, offs, "gfx_target_version",
482+ dev->node_props.gfx_target_version);
481483 sysfs_show_32bit_prop(buffer, offs, "vendor_id",
482484 dev->node_props.vendor_id);
483485 sysfs_show_32bit_prop(buffer, offs, "device_id",
@@ -1360,6 +1362,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) · 876 unmodified lines
13601362 dev->node_props.simd_arrays_per_engine =
13611363 cu_info.num_shader_arrays_per_engine;
13621364
1365+ dev->node_props.gfx_target_version = gpu->device_info->gfx_target_version;
13631366 dev->node_props.vendor_id = gpu->pdev->vendor;
13641367 dev->node_props.device_id = gpu->pdev->device;
13651368 dev->node_props.capability |=
@@ -1424,6 +1427,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) · 58 unmodified lines
14241427 case CHIP_DIMGREY_CAVEFISH:
14251428 case CHIP_BEIGE_GOBY:
14261429 case CHIP_YELLOW_CARP:
1430+ case CHIP_CYAN_SKILLFISH:
14271431 dev->node_props.capability |= ((HSA_CAP_DOORBELL_TYPE_2_0 <<
14281432 HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT) &
14291433 HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK);
@@ -1630,7 +1634,7 @@ int kfd_debugfs_rls_by_device(struct seq_file *m, void *data) · 200 unmodified lines
16301634 }
16311635
16321636 seq_printf(m, "Node %u, gpu_id %x:\n", i++, dev->gpu->id);
1633− r = pm_debugfs_runlist(m, &dev->gpu->dqm->packets);
1637+ r = pm_debugfs_runlist(m, &dev->gpu->dqm->packet_mgr);
16341638 if (r)
16351639 break;
16361640 }
drivers/gpu/drm/amd/amdkfd/kfd_topology.h+1−0
@@ -78,6 +78,7 @@ struct kfd_node_properties { · 77 unmodified lines
7878 uint32_t simd_per_cu;
7979 uint32_t max_slots_scratch_cu;
8080 uint32_t engine_id;
81+ uint32_t gfx_target_version;
8182 uint32_t vendor_id;
8283 uint32_t device_id;
8384 uint32_t location_id;
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile+4−0
@@ -27,6 +27,10 @@ · 26 unmodified lines
2727
2828 AMDGPUDM = amdgpu_dm.o amdgpu_dm_irq.o amdgpu_dm_mst_types.o amdgpu_dm_color.o
2929
30+ifdef CONFIG_DRM_AMD_DC_DCN
31+AMDGPUDM += dc_fpu.o
32+endif
33+
3034 ifneq ($(CONFIG_DRM_AMD_DC),)
3135 AMDGPUDM += amdgpu_dm_services.o amdgpu_dm_helpers.o amdgpu_dm_pp_smu.o amdgpu_dm_psr.o
3236 endif
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+245−127
@@ -618,6 +618,7 @@ static void dm_dcn_vertical_interrupt0_high_irq(void *interrupt_params) · 617 unmodified lines
618618 }
619619 #endif
620620
621+#define DMUB_TRACE_MAX_READ 64
621622 /**
622623 * dm_dmub_outbox1_low_irq() - Handles Outbox interrupt
623624 * @interrupt_params: used for determining the Outbox instance
@@ -625,7 +626,6 @@ static void dm_dcn_vertical_interrupt0_high_irq(void *interrupt_params) · 1 unmodified line
625626 * Handles the Outbox Interrupt
626627 * event handler.
627628 */
628−#define DMUB_TRACE_MAX_READ 64
629629 static void dm_dmub_outbox1_low_irq(void *interrupt_params)
630630 {
631631 struct dmub_notification notify;
@@ -1044,10 +1044,10 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_ · 412 unmodified lines
10441044 }
10451045 #endif
10461046 #if defined(CONFIG_DRM_AMD_DC_DCN)
1047−static void event_mall_stutter(struct work_struct *work)
1047+static void vblank_control_worker(struct work_struct *work)
10481048 {
1049−
1050− struct vblank_workqueue *vblank_work = container_of(work, struct vblank_workqueue, mall_work);
1049+ struct vblank_control_work *vblank_work =
1050+ container_of(work, struct vblank_control_work, work);
10511051 struct amdgpu_display_manager *dm = vblank_work->dm;
10521052
10531053 mutex_lock(&dm->dc_lock);
@@ -1061,27 +1061,25 @@ static void event_mall_stutter(struct work_struct *work) · 7 unmodified lines
10611061
10621062 DRM_DEBUG_KMS("Allow idle optimizations (MALL): %d\n", dm->active_vblank_irq_count == 0);
10631063
1064− mutex_unlock(&dm->dc_lock);
1065−}
1066−
1067−static struct vblank_workqueue *vblank_create_workqueue(struct amdgpu_device *adev, struct dc *dc)
1068−{
1069−
1070− int max_caps = dc->caps.max_links;
1071− struct vblank_workqueue *vblank_work;
1072− int i = 0;
1073−
1074− vblank_work = kcalloc(max_caps, sizeof(*vblank_work), GFP_KERNEL);
1075− if (ZERO_OR_NULL_PTR(vblank_work)) {
1076− kfree(vblank_work);
1077− return NULL;
1064+ /* Control PSR based on vblank requirements from OS */
1065+ if (vblank_work->stream && vblank_work->stream->link) {
1066+ if (vblank_work->enable) {
1067+ if (vblank_work->stream->link->psr_settings.psr_allow_active)
1068+ amdgpu_dm_psr_disable(vblank_work->stream);
1069+ } else if (vblank_work->stream->link->psr_settings.psr_feature_enabled &&
1070+ !vblank_work->stream->link->psr_settings.psr_allow_active &&
1071+ vblank_work->acrtc->dm_irq_params.allow_psr_entry) {
1072+ amdgpu_dm_psr_enable(vblank_work->stream);
1073+ }
10781074 }
10791075
1080− for (i = 0; i < max_caps; i++)
1081− INIT_WORK(&vblank_work[i].mall_work, event_mall_stutter);
1076+ mutex_unlock(&dm->dc_lock);
1077+
1078+ dc_stream_release(vblank_work->stream);
10821079
1083− return vblank_work;
1080+ kfree(vblank_work);
10841081 }
1082+
10851083 #endif
10861084 static int amdgpu_dm_init(struct amdgpu_device *adev)
10871085 {
@@ -1224,12 +1222,10 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) · 136 unmodified lines
12241222
12251223 #if defined(CONFIG_DRM_AMD_DC_DCN)
12261224 if (adev->dm.dc->caps.max_links > 0) {
1227− adev->dm.vblank_workqueue = vblank_create_workqueue(adev, adev->dm.dc);
1228−
1229− if (!adev->dm.vblank_workqueue)
1225+ adev->dm.vblank_control_workqueue =
1226+ create_singlethread_workqueue("dm_vblank_control_workqueue");
1227+ if (!adev->dm.vblank_control_workqueue)
12301228 DRM_ERROR("amdgpu: failed to initialize vblank_workqueue.\n");
1231− else
1232− DRM_DEBUG_DRIVER("amdgpu: vblank_workqueue init done %p.\n", adev->dm.vblank_workqueue);
12331229 }
12341230 #endif
12351231
@@ -1302,6 +1298,13 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) · 66 unmodified lines
13021298 {
13031299 int i;
13041300
1301+#if defined(CONFIG_DRM_AMD_DC_DCN)
1302+ if (adev->dm.vblank_control_workqueue) {
1303+ destroy_workqueue(adev->dm.vblank_control_workqueue);
1304+ adev->dm.vblank_control_workqueue = NULL;
1305+ }
1306+#endif
1307+
13051308 for (i = 0; i < adev->dm.display_indexes_num; i++) {
13061309 drm_encoder_cleanup(&adev->dm.mst_encoders[i].base);
13071310 }
@@ -1325,14 +1328,6 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) · 17 unmodified lines
13251328 dc_deinit_callbacks(adev->dm.dc);
13261329 #endif
13271330
1328−#if defined(CONFIG_DRM_AMD_DC_DCN)
1329− if (adev->dm.vblank_workqueue) {
1330− adev->dm.vblank_workqueue->dm = NULL;
1331− kfree(adev->dm.vblank_workqueue);
1332− adev->dm.vblank_workqueue = NULL;
1333− }
1334−#endif
1335−
13361331 dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
13371332
13381333 if (dc_enable_dmub_notifications(adev->dm.dc)) {
@@ -2412,6 +2407,7 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) · 1073 unmodified lines
24122407 static const u8 pre_computed_values[] = {
24132408 50, 51, 52, 53, 55, 56, 57, 58, 59, 61, 62, 63, 65, 66, 68, 69,
24142409 71, 72, 74, 75, 77, 79, 81, 82, 84, 86, 88, 90, 92, 94, 96, 98};
2410+ int i;
24152411
24162412 if (!aconnector || !aconnector->dc_link)
24172413 return;
@@ -2423,7 +2419,13 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) · 5 unmodified lines
24232419 conn_base = &aconnector->base;
24242420 adev = drm_to_adev(conn_base->dev);
24252421 dm = &adev->dm;
2426− caps = &dm->backlight_caps;
2422+ for (i = 0; i < dm->num_of_edps; i++) {
2423+ if (link == dm->backlight_link[i])
2424+ break;
2425+ }
2426+ if (i >= dm->num_of_edps)
2427+ return;
2428+ caps = &dm->backlight_caps[i];
24272429 caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;
24282430 caps->aux_support = false;
24292431 max_cll = conn_base->hdr_sink_metadata.hdmi_type1.max_cll;
@@ -3423,35 +3425,36 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) · 993 unmodified lines
34233425 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
34243426 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
34253427
3426−static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm)
3428+static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm,
3429+ int bl_idx)
34273430 {
34283431 #if defined(CONFIG_ACPI)
34293432 struct amdgpu_dm_backlight_caps caps;
34303433
34313434 memset(&caps, 0, sizeof(caps));
34323435
3433− if (dm->backlight_caps.caps_valid)
3436+ if (dm->backlight_caps[bl_idx].caps_valid)
34343437 return;
34353438
34363439 amdgpu_acpi_get_backlight_caps(&caps);
34373440 if (caps.caps_valid) {
3438− dm->backlight_caps.caps_valid = true;
3441+ dm->backlight_caps[bl_idx].caps_valid = true;
34393442 if (caps.aux_support)
34403443 return;
3441− dm->backlight_caps.min_input_signal = caps.min_input_signal;
3442− dm->backlight_caps.max_input_signal = caps.max_input_signal;
3444+ dm->backlight_caps[bl_idx].min_input_signal = caps.min_input_signal;
3445+ dm->backlight_caps[bl_idx].max_input_signal = caps.max_input_signal;
34433446 } else {
3444− dm->backlight_caps.min_input_signal =
3447+ dm->backlight_caps[bl_idx].min_input_signal =
34453448 AMDGPU_DM_DEFAULT_MIN_BACKLIGHT;
3446− dm->backlight_caps.max_input_signal =
3449+ dm->backlight_caps[bl_idx].max_input_signal =
34473450 AMDGPU_DM_DEFAULT_MAX_BACKLIGHT;
34483451 }
34493452 #else
3450− if (dm->backlight_caps.aux_support)
3453+ if (dm->backlight_caps[bl_idx].aux_support)
34513454 return;
34523455
3453− dm->backlight_caps.min_input_signal = AMDGPU_DM_DEFAULT_MIN_BACKLIGHT;
3454− dm->backlight_caps.max_input_signal = AMDGPU_DM_DEFAULT_MAX_BACKLIGHT;
3456+ dm->backlight_caps[bl_idx].min_input_signal = AMDGPU_DM_DEFAULT_MIN_BACKLIGHT;
3457+ dm->backlight_caps[bl_idx].max_input_signal = AMDGPU_DM_DEFAULT_MAX_BACKLIGHT;
34553458 #endif
34563459 }
34573460
@@ -3502,41 +3505,31 @@ static u32 convert_brightness_to_user(const struct amdgpu_dm_backlight_caps *cap · 44 unmodified lines
35023505 }
35033506
35043507 static int amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
3508+ int bl_idx,
35053509 u32 user_brightness)
35063510 {
35073511 struct amdgpu_dm_backlight_caps caps;
3508− struct dc_link *link[AMDGPU_DM_MAX_NUM_EDP];
3509− u32 brightness[AMDGPU_DM_MAX_NUM_EDP];
3512+ struct dc_link *link;
3513+ u32 brightness;
35103514 bool rc;
3511− int i;
35123515
3513− amdgpu_dm_update_backlight_caps(dm);
3514− caps = dm->backlight_caps;
3516+ amdgpu_dm_update_backlight_caps(dm, bl_idx);
3517+ caps = dm->backlight_caps[bl_idx];
35153518
3516− for (i = 0; i < dm->num_of_edps; i++) {
3517− dm->brightness[i] = user_brightness;
3518− brightness[i] = convert_brightness_from_user(&caps, dm->brightness[i]);
3519− link[i] = (struct dc_link *)dm->backlight_link[i];
3520− }
3519+ dm->brightness[bl_idx] = user_brightness;
3520+ brightness = convert_brightness_from_user(&caps, dm->brightness[bl_idx]);
3521+ link = (struct dc_link *)dm->backlight_link[bl_idx];
35213522
35223523 /* Change brightness based on AUX property */
35233524 if (caps.aux_support) {
3524− for (i = 0; i < dm->num_of_edps; i++) {
3525− rc = dc_link_set_backlight_level_nits(link[i], true, brightness[i],
3526− AUX_BL_DEFAULT_TRANSITION_TIME_MS);
3527− if (!rc) {
3528− DRM_DEBUG("DM: Failed to update backlight via AUX on eDP[%d]\n", i);
3529− break;
3530− }
3531− }
3525+ rc = dc_link_set_backlight_level_nits(link, true, brightness,
3526+ AUX_BL_DEFAULT_TRANSITION_TIME_MS);
3527+ if (!rc)
3528+ DRM_DEBUG("DM: Failed to update backlight via AUX on eDP[%d]\n", bl_idx);
35323529 } else {
3533− for (i = 0; i < dm->num_of_edps; i++) {
3534− rc = dc_link_set_backlight_level(dm->backlight_link[i], brightness[i], 0);
3535− if (!rc) {
3536− DRM_DEBUG("DM: Failed to update backlight on eDP[%d]\n", i);
3537− break;
3538− }
3539− }
3530+ rc = dc_link_set_backlight_level(link, brightness, 0);
3531+ if (!rc)
3532+ DRM_DEBUG("DM: Failed to update backlight on eDP[%d]\n", bl_idx);
35403533 }
35413534
35423535 return rc ? 0 : 1;
@@ -3545,33 +3538,41 @@ static int amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, · 2 unmodified lines
35453538 static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
35463539 {
35473540 struct amdgpu_display_manager *dm = bl_get_data(bd);
3541+ int i;
35483542
3549− amdgpu_dm_backlight_set_level(dm, bd->props.brightness);
3543+ for (i = 0; i < dm->num_of_edps; i++) {
3544+ if (bd == dm->backlight_dev[i])
3545+ break;
3546+ }
3547+ if (i >= AMDGPU_DM_MAX_NUM_EDP)
3548+ i = 0;
3549+ amdgpu_dm_backlight_set_level(dm, i, bd->props.brightness);
35503550
35513551 return 0;
35523552 }
35533553
3554−static u32 amdgpu_dm_backlight_get_level(struct amdgpu_display_manager *dm)
3554+static u32 amdgpu_dm_backlight_get_level(struct amdgpu_display_manager *dm,
3555+ int bl_idx)
35553556 {
35563557 struct amdgpu_dm_backlight_caps caps;
3558+ struct dc_link *link = (struct dc_link *)dm->backlight_link[bl_idx];
35573559
3558− amdgpu_dm_update_backlight_caps(dm);
3559− caps = dm->backlight_caps;
3560+ amdgpu_dm_update_backlight_caps(dm, bl_idx);
3561+ caps = dm->backlight_caps[bl_idx];
35603562
35613563 if (caps.aux_support) {
3562− struct dc_link *link = (struct dc_link *)dm->backlight_link[0];
35633564 u32 avg, peak;
35643565 bool rc;
35653566
35663567 rc = dc_link_get_backlight_level_nits(link, &avg, &peak);
35673568 if (!rc)
3568− return dm->brightness[0];
3569+ return dm->brightness[bl_idx];
35693570 return convert_brightness_to_user(&caps, avg);
35703571 } else {
3571− int ret = dc_link_get_backlight_level(dm->backlight_link[0]);
3572+ int ret = dc_link_get_backlight_level(link);
35723573
35733574 if (ret == DC_ERROR_UNEXPECTED)
3574− return dm->brightness[0];
3575+ return dm->brightness[bl_idx];
35753576 return convert_brightness_to_user(&caps, ret);
35763577 }
35773578 }
@@ -3579,8 +3580,15 @@ static u32 amdgpu_dm_backlight_get_level(struct amdgpu_display_manager *dm) · 1 unmodified line
35793580 static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
35803581 {
35813582 struct amdgpu_display_manager *dm = bl_get_data(bd);
3583+ int i;
35823584
3583− return amdgpu_dm_backlight_get_level(dm);
3585+ for (i = 0; i < dm->num_of_edps; i++) {
3586+ if (bd == dm->backlight_dev[i])
3587+ break;
3588+ }
3589+ if (i >= AMDGPU_DM_MAX_NUM_EDP)
3590+ i = 0;
3591+ return amdgpu_dm_backlight_get_level(dm, i);
35843592 }
35853593
35863594 static const struct backlight_ops amdgpu_dm_backlight_ops = {
@@ -3594,31 +3602,28 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm) · 7 unmodified lines
35943602 {
35953603 char bl_name[16];
35963604 struct backlight_properties props = { 0 };
3597− int i;
35983605
3599− amdgpu_dm_update_backlight_caps(dm);
3600− for (i = 0; i < dm->num_of_edps; i++)
3601− dm->brightness[i] = AMDGPU_MAX_BL_LEVEL;
3606+ amdgpu_dm_update_backlight_caps(dm, dm->num_of_edps);
3607+ dm->brightness[dm->num_of_edps] = AMDGPU_MAX_BL_LEVEL;
36023608
36033609 props.max_brightness = AMDGPU_MAX_BL_LEVEL;
36043610 props.brightness = AMDGPU_MAX_BL_LEVEL;
36053611 props.type = BACKLIGHT_RAW;
36063612
36073613 snprintf(bl_name, sizeof(bl_name), "amdgpu_bl%d",
3608− adev_to_drm(dm->adev)->primary->index);
3614+ adev_to_drm(dm->adev)->primary->index + dm->num_of_edps);
36093615
3610− dm->backlight_dev = backlight_device_register(bl_name,
3611− adev_to_drm(dm->adev)->dev,
3612− dm,
3613− &amdgpu_dm_backlight_ops,
3614− &props);
3616+ dm->backlight_dev[dm->num_of_edps] = backlight_device_register(bl_name,
3617+ adev_to_drm(dm->adev)->dev,
3618+ dm,
3619+ &amdgpu_dm_backlight_ops,
3620+ &props);
36153621
3616− if (IS_ERR(dm->backlight_dev))
3622+ if (IS_ERR(dm->backlight_dev[dm->num_of_edps]))
36173623 DRM_ERROR("DM: Backlight registration failed!\n");
36183624 else
36193625 DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name);
36203626 }
3621−
36223627 #endif
36233628
36243629 static int initialize_plane(struct amdgpu_display_manager *dm,
@@ -3675,10 +3680,10 @@ static void register_backlight_device(struct amdgpu_display_manager *dm, · 50 unmodified lines
36753680 * DM initialization because not having a backlight control
36763681 * is better then a black screen.
36773682 */
3678− if (!dm->backlight_dev)
3683+ if (!dm->backlight_dev[dm->num_of_edps])
36793684 amdgpu_dm_register_backlight_device(dm);
36803685
3681− if (dm->backlight_dev) {
3686+ if (dm->backlight_dev[dm->num_of_edps]) {
36823687 dm->backlight_link[dm->num_of_edps] = link;
36833688 dm->num_of_edps++;
36843689 }
@@ -4747,7 +4752,7 @@ fill_gfx9_plane_attributes_from_modifiers(struct amdgpu_device *adev, · 1062 unmodified lines
47474752 const bool force_disable_dcc)
47484753 {
47494754 const uint64_t modifier = afb->base.modifier;
4750− int ret;
4755+ int ret = 0;
47514756
47524757 fill_gfx9_tiling_info_from_modifier(adev, tiling_info, modifier);
47534758 tiling_info->gfx9.swizzle = modifier_gfx9_swizzle_mode(modifier);
@@ -4765,9 +4770,9 @@ fill_gfx9_plane_attributes_from_modifiers(struct amdgpu_device *adev, · 11 unmodified lines
47654770
47664771 ret = validate_dcc(adev, format, rotation, tiling_info, dcc, address, plane_size);
47674772 if (ret)
4768− return ret;
4773+ drm_dbg_kms(adev_to_drm(adev), "validate_dcc: returned error: %d\n", ret);
47694774
4770− return 0;
4775+ return ret;
47714776 }
47724777
47734778 static int
@@ -5994,7 +5999,7 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable) · 1220 unmodified lines
59945999 struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);
59956000 #if defined(CONFIG_DRM_AMD_DC_DCN)
59966001 struct amdgpu_display_manager *dm = &adev->dm;
5997− unsigned long flags;
6002+ struct vblank_control_work *work;
59986003 #endif
59996004 int rc = 0;
60006005
@@ -6019,12 +6024,21 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable) · 18 unmodified lines
60196024 return 0;
60206025
60216026 #if defined(CONFIG_DRM_AMD_DC_DCN)
6022− spin_lock_irqsave(&dm->vblank_lock, flags);
6023− dm->vblank_workqueue->dm = dm;
6024− dm->vblank_workqueue->otg_inst = acrtc->otg_inst;
6025− dm->vblank_workqueue->enable = enable;
6026− spin_unlock_irqrestore(&dm->vblank_lock, flags);
6027− schedule_work(&dm->vblank_workqueue->mall_work);
6027+ work = kzalloc(sizeof(*work), GFP_ATOMIC);
6028+ if (!work)
6029+ return -ENOMEM;
6030+
6031+ INIT_WORK(&work->work, vblank_control_worker);
6032+ work->dm = dm;
6033+ work->acrtc = acrtc;
6034+ work->enable = enable;
6035+
6036+ if (acrtc_state->stream) {
6037+ dc_stream_retain(acrtc_state->stream);
6038+ work->stream = acrtc_state->stream;
6039+ }
6040+
6041+ queue_work(dm->vblank_control_workqueue, &work->work);
60286042 #endif
60296043
60306044 return 0;
@@ -6198,6 +6212,7 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector) · 167 unmodified lines
61986212 const struct dc_link *link = aconnector->dc_link;
61996213 struct amdgpu_device *adev = drm_to_adev(connector->dev);
62006214 struct amdgpu_display_manager *dm = &adev->dm;
6215+ int i;
62016216
62026217 /*
62036218 * Call only if mst_mgr was iniitalized before since it's not done
@@ -6208,12 +6223,11 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector) · 4 unmodified lines
62086223
62096224 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
62106225 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
6211−
6212− if ((link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) &&
6213− link->type != dc_connection_none &&
6214− dm->backlight_dev) {
6215− backlight_device_unregister(dm->backlight_dev);
6216− dm->backlight_dev = NULL;
6226+ for (i = 0; i < dm->num_of_edps; i++) {
6227+ if ((link == dm->backlight_link[i]) && dm->backlight_dev[i]) {
6228+ backlight_device_unregister(dm->backlight_dev[i]);
6229+ dm->backlight_dev[i] = NULL;
6230+ }
62176231 }
62186232 #endif
62196233
@@ -7570,8 +7584,10 @@ static uint add_fs_modes(struct amdgpu_dm_connector *aconnector) · 1350 unmodified lines
75707584 * 60 - Commonly used
75717585 * 48,72,96 - Multiples of 24
75727586 */
7573− const uint32_t common_rates[] = { 23976, 24000, 25000, 29970, 30000,
7574− 48000, 50000, 60000, 72000, 96000 };
7587+ static const uint32_t common_rates[] = {
7588+ 23976, 24000, 25000, 29970, 30000,
7589+ 48000, 50000, 60000, 72000, 96000
7590+ };
75757591
75767592 /*
75777593 * Find mode with highest refresh rate with the same resolution
@@ -8627,6 +8643,14 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 1049 unmodified lines
86278643 /* Update the planes if changed or disable if we don't have any. */
86288644 if ((planes_count || acrtc_state->active_planes == 0) &&
86298645 acrtc_state->stream) {
8646+#if defined(CONFIG_DRM_AMD_DC_DCN)
8647+ /*
8648+ * If PSR or idle optimizations are enabled then flush out
8649+ * any pending work before hardware programming.
8650+ */
8651+ flush_workqueue(dm->vblank_control_workqueue);
8652+#endif
8653+
86308654 bundle->stream_update.stream = acrtc_state->stream;
86318655 if (new_pcrtc_state->mode_changed) {
86328656 bundle->stream_update.src = acrtc_state->stream->src;
@@ -8695,16 +8719,20 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 62 unmodified lines
86958719 acrtc_state->stream->link->psr_settings.psr_version != DC_PSR_VERSION_UNSUPPORTED &&
86968720 !acrtc_state->stream->link->psr_settings.psr_feature_enabled)
86978721 amdgpu_dm_link_setup_psr(acrtc_state->stream);
8698− else if ((acrtc_state->update_type == UPDATE_TYPE_FAST) &&
8699− acrtc_state->stream->link->psr_settings.psr_feature_enabled &&
8700− !acrtc_state->stream->link->psr_settings.psr_allow_active) {
8701− struct amdgpu_dm_connector *aconn = (struct amdgpu_dm_connector *)
8702− acrtc_state->stream->dm_stream_context;
8722+
8723+ /* Decrement skip count when PSR is enabled and we're doing fast updates. */
8724+ if (acrtc_state->update_type == UPDATE_TYPE_FAST &&
8725+ acrtc_state->stream->link->psr_settings.psr_feature_enabled) {
8726+ struct amdgpu_dm_connector *aconn =
8727+ (struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context;
87038728
87048729 if (aconn->psr_skip_count > 0)
87058730 aconn->psr_skip_count--;
8706− else
8707− amdgpu_dm_psr_enable(acrtc_state->stream);
8731+
8732+ /* Allow PSR when skip count is 0. */
8733+ acrtc_attach->dm_irq_params.allow_psr_entry = !aconn->psr_skip_count;
8734+ } else {
8735+ acrtc_attach->dm_irq_params.allow_psr_entry = false;
87088736 }
87098737
87108738 mutex_unlock(&dm->dc_lock);
@@ -8953,8 +8981,12 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 242 unmodified lines
89538981
89548982 if (dc_state) {
89558983 /* if there mode set or reset, disable eDP PSR */
8956− if (mode_set_reset_required)
8984+ if (mode_set_reset_required) {
8985+#if defined(CONFIG_DRM_AMD_DC_DCN)
8986+ flush_workqueue(dm->vblank_control_workqueue);
8987+#endif
89578988 amdgpu_dm_psr_disable_all(dm);
8989+ }
89588990
89598991 dm_enable_per_frame_crtc_master_sync(dc_state);
89608992 mutex_lock(&dm->dc_lock);
@@ -9191,8 +9223,11 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 230 unmodified lines
91919223 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || \
91929224 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
91939225 /* restore the backlight level */
9194− if (dm->backlight_dev && (amdgpu_dm_backlight_get_level(dm) != dm->brightness[0]))
9195− amdgpu_dm_backlight_set_level(dm, dm->brightness[0]);
9226+ for (i = 0; i < dm->num_of_edps; i++) {
9227+ if (dm->backlight_dev[i] &&
9228+ (amdgpu_dm_backlight_get_level(dm, i) != dm->brightness[i]))
9229+ amdgpu_dm_backlight_set_level(dm, i, dm->brightness[i]);
9230+ }
91969231 #endif
91979232 /*
91989233 * send vblank event on all events not handled in flip and
@@ -10554,13 +10589,68 @@ static bool is_dp_capable_without_timing_msa(struct dc *dc, · 1355 unmodified lines
1055410589 return capable;
1055510590 }
1055610591
10557−static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector,
10592+static bool dm_edid_parser_send_cea(struct amdgpu_display_manager *dm,
10593+ unsigned int offset,
10594+ unsigned int total_length,
10595+ uint8_t *data,
10596+ unsigned int length,
10597+ struct amdgpu_hdmi_vsdb_info *vsdb)
10598+{
10599+ bool res;
10600+ union dmub_rb_cmd cmd;
10601+ struct dmub_cmd_send_edid_cea *input;
10602+ struct dmub_cmd_edid_cea_output *output;
10603+
10604+ if (length > DMUB_EDID_CEA_DATA_CHUNK_BYTES)
10605+ return false;
10606+
10607+ memset(&cmd, 0, sizeof(cmd));
10608+
10609+ input = &cmd.edid_cea.data.input;
10610+
10611+ cmd.edid_cea.header.type = DMUB_CMD__EDID_CEA;
10612+ cmd.edid_cea.header.sub_type = 0;
10613+ cmd.edid_cea.header.payload_bytes =
10614+ sizeof(cmd.edid_cea) - sizeof(cmd.edid_cea.header);
10615+ input->offset = offset;
10616+ input->length = length;
10617+ input->total_length = total_length;
10618+ memcpy(input->payload, data, length);
10619+
10620+ res = dc_dmub_srv_cmd_with_reply_data(dm->dc->ctx->dmub_srv, &cmd);
10621+ if (!res) {
10622+ DRM_ERROR("EDID CEA parser failed\n");
10623+ return false;
10624+ }
10625+
10626+ output = &cmd.edid_cea.data.output;
10627+
10628+ if (output->type == DMUB_CMD__EDID_CEA_ACK) {
10629+ if (!output->ack.success) {
10630+ DRM_ERROR("EDID CEA ack failed at offset %d\n",
10631+ output->ack.offset);
10632+ }
10633+ } else if (output->type == DMUB_CMD__EDID_CEA_AMD_VSDB) {
10634+ if (!output->amd_vsdb.vsdb_found)
10635+ return false;
10636+
10637+ vsdb->freesync_supported = output->amd_vsdb.freesync_supported;
10638+ vsdb->amd_vsdb_version = output->amd_vsdb.amd_vsdb_version;
10639+ vsdb->min_refresh_rate_hz = output->amd_vsdb.min_frame_rate;
10640+ vsdb->max_refresh_rate_hz = output->amd_vsdb.max_frame_rate;
10641+ } else {
10642+ DRM_WARN("Unknown EDID CEA parser results\n");
10643+ return false;
10644+ }
10645+
10646+ return true;
10647+}
10648+
10649+static bool parse_edid_cea_dmcu(struct amdgpu_display_manager *dm,
1055810650 uint8_t *edid_ext, int len,
1055910651 struct amdgpu_hdmi_vsdb_info *vsdb_info)
1056010652 {
1056110653 int i;
10562− struct amdgpu_device *adev = drm_to_adev(aconnector->base.dev);
10563− struct dc *dc = adev->dm.dc;
1056410654
1056510655 /* send extension block to DMCU for parsing */
1056610656 for (i = 0; i < len; i += 8) {
@@ -10568,14 +10658,14 @@ static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector, · 1 unmodified line
1056810658 int offset;
1056910659
1057010660 /* send 8 bytes a time */
10571− if (!dc_edid_parser_send_cea(dc, i, len, &edid_ext[i], 8))
10661+ if (!dc_edid_parser_send_cea(dm->dc, i, len, &edid_ext[i], 8))
1057210662 return false;
1057310663
1057410664 if (i+8 == len) {
1057510665 /* EDID block sent completed, expect result */
1057610666 int version, min_rate, max_rate;
1057710667
10578− res = dc_edid_parser_recv_amd_vsdb(dc, &version, &min_rate, &max_rate);
10668+ res = dc_edid_parser_recv_amd_vsdb(dm->dc, &version, &min_rate, &max_rate);
1057910669 if (res) {
1058010670 /* amd vsdb found */
1058110671 vsdb_info->freesync_supported = 1;
@@ -10589,7 +10679,7 @@ static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector, · 7 unmodified lines
1058910679 }
1059010680
1059110681 /* check for ack*/
10592− res = dc_edid_parser_recv_cea_ack(dc, &offset);
10682+ res = dc_edid_parser_recv_cea_ack(dm->dc, &offset);
1059310683 if (!res)
1059410684 return false;
1059510685 }
@@ -10597,6 +10687,34 @@ static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector, · 1 unmodified line
1059710687 return false;
1059810688 }
1059910689
10690+static bool parse_edid_cea_dmub(struct amdgpu_display_manager *dm,
10691+ uint8_t *edid_ext, int len,
10692+ struct amdgpu_hdmi_vsdb_info *vsdb_info)
10693+{
10694+ int i;
10695+
10696+ /* send extension block to DMCU for parsing */
10697+ for (i = 0; i < len; i += 8) {
10698+ /* send 8 bytes a time */
10699+ if (!dm_edid_parser_send_cea(dm, i, len, &edid_ext[i], 8, vsdb_info))
10700+ return false;
10701+ }
10702+
10703+ return vsdb_info->freesync_supported;
10704+}
10705+
10706+static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector,
10707+ uint8_t *edid_ext, int len,
10708+ struct amdgpu_hdmi_vsdb_info *vsdb_info)
10709+{
10710+ struct amdgpu_device *adev = drm_to_adev(aconnector->base.dev);
10711+
10712+ if (adev->dm.dmub_srv)
10713+ return parse_edid_cea_dmub(&adev->dm, edid_ext, len, vsdb_info);
10714+ else
10715+ return parse_edid_cea_dmcu(&adev->dm, edid_ext, len, vsdb_info);
10716+}
10717+
1060010718 static int parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,
1060110719 struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info)
1060210720 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h+15−12
@@ -60,6 +60,7 @@ enum aux_return_code_type; · 59 unmodified lines
6060
6161 /* Forward declarations */
6262 struct amdgpu_device;
63+struct amdgpu_crtc;
6364 struct drm_device;
6465 struct dc;
6566 struct amdgpu_bo;
@@ -86,16 +87,18 @@ struct dm_compressor_info { · 20 unmodified lines
8687 };
8788
8889 /**
89− * struct vblank_workqueue - Works to be executed in a separate thread during vblank
90− * @mall_work: work for mall stutter
90+ * struct vblank_control_work - Work data for vblank control
91+ * @work: Kernel work data for the work event
9192 * @dm: amdgpu display manager device
92− * @otg_inst: otg instance of which vblank is being set
93− * @enable: true if enable vblank
93+ * @acrtc: amdgpu CRTC instance for which the event has occurred
94+ * @stream: DC stream for which the event has occurred
95+ * @enable: true if enabling vblank
9496 */
95−struct vblank_workqueue {
96− struct work_struct mall_work;
97+struct vblank_control_work {
98+ struct work_struct work;
9799 struct amdgpu_display_manager *dm;
98− int otg_inst;
100+ struct amdgpu_crtc *acrtc;
101+ struct dc_stream_state *stream;
99102 bool enable;
100103 };
101104
@@ -365,13 +368,13 @@ struct amdgpu_display_manager { · 263 unmodified lines
365368
366369 spinlock_t irq_handler_list_table_lock;
367370
368− struct backlight_device *backlight_dev;
371+ struct backlight_device *backlight_dev[AMDGPU_DM_MAX_NUM_EDP];
369372
370373 const struct dc_link *backlight_link[AMDGPU_DM_MAX_NUM_EDP];
371374
372375 uint8_t num_of_edps;
373376
374− struct amdgpu_dm_backlight_caps backlight_caps;
377+ struct amdgpu_dm_backlight_caps backlight_caps[AMDGPU_DM_MAX_NUM_EDP];
375378
376379 struct mod_freesync *freesync_module;
377380 #ifdef CONFIG_DRM_AMD_DC_HDCP
@@ -380,11 +383,11 @@ struct amdgpu_display_manager { · 2 unmodified lines
380383
381384 #if defined(CONFIG_DRM_AMD_DC_DCN)
382385 /**
383− * @vblank_workqueue:
386+ * @vblank_control_workqueue:
384387 *
385− * amdgpu workqueue during vblank
388+ * Deferred work for vblank control events.
386389 */
387− struct vblank_workqueue *vblank_workqueue;
390+ struct workqueue_struct *vblank_control_workqueue;
388391 #endif
389392
390393 struct drm_atomic_state *cached_state;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c+9−9
@@ -197,29 +197,29 @@ static ssize_t dp_link_settings_read(struct file *f, char __user *buf, · 196 unmodified lines
197197
198198 rd_buf_ptr = rd_buf;
199199
200− str_len = strlen("Current: %d %d %d ");
201− snprintf(rd_buf_ptr, str_len, "Current: %d %d %d ",
200+ str_len = strlen("Current: %d 0x%x %d ");
201+ snprintf(rd_buf_ptr, str_len, "Current: %d 0x%x %d ",
202202 link->cur_link_settings.lane_count,
203203 link->cur_link_settings.link_rate,
204204 link->cur_link_settings.link_spread);
205205 rd_buf_ptr += str_len;
206206
207− str_len = strlen("Verified: %d %d %d ");
208− snprintf(rd_buf_ptr, str_len, "Verified: %d %d %d ",
207+ str_len = strlen("Verified: %d 0x%x %d ");
208+ snprintf(rd_buf_ptr, str_len, "Verified: %d 0x%x %d ",
209209 link->verified_link_cap.lane_count,
210210 link->verified_link_cap.link_rate,
211211 link->verified_link_cap.link_spread);
212212 rd_buf_ptr += str_len;
213213
214− str_len = strlen("Reported: %d %d %d ");
215− snprintf(rd_buf_ptr, str_len, "Reported: %d %d %d ",
214+ str_len = strlen("Reported: %d 0x%x %d ");
215+ snprintf(rd_buf_ptr, str_len, "Reported: %d 0x%x %d ",
216216 link->reported_link_cap.lane_count,
217217 link->reported_link_cap.link_rate,
218218 link->reported_link_cap.link_spread);
219219 rd_buf_ptr += str_len;
220220
221− str_len = strlen("Preferred: %d %d %d ");
222− snprintf(rd_buf_ptr, str_len, "Preferred: %d %d %d\n",
221+ str_len = strlen("Preferred: %d 0x%x %d ");
222+ snprintf(rd_buf_ptr, str_len, "Preferred: %d 0x%x %d\n",
223223 link->preferred_link_setting.lane_count,
224224 link->preferred_link_setting.link_rate,
225225 link->preferred_link_setting.link_spread);
@@ -377,7 +377,7 @@ static ssize_t dp_phy_settings_read(struct file *f, char __user *buf, · 151 unmodified lines
377377 if (!rd_buf)
378378 return -EINVAL;
379379
380− snprintf(rd_buf, rd_buf_size, " %d %d %d ",
380+ snprintf(rd_buf, rd_buf_size, " %d %d %d\n",
381381 link->cur_lane_setting.VOLTAGE_SWING,
382382 link->cur_lane_setting.PRE_EMPHASIS,
383383 link->cur_lane_setting.POST_CURSOR2);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c+7−9
@@ -79,12 +79,12 @@ static uint8_t *psp_get_srm(struct psp_context *psp, uint32_t *srm_version, uint · 78 unmodified lines
7979
8080 struct ta_hdcp_shared_memory *hdcp_cmd;
8181
82− if (!psp->hdcp_context.hdcp_initialized) {
82+ if (!psp->hdcp_context.context.initialized) {
8383 DRM_WARN("Failed to get hdcp srm. HDCP TA is not initialized.");
8484 return NULL;
8585 }
8686
87− hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
87+ hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
8888 memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
8989
9090 hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP_GET_SRM;
@@ -105,12 +105,12 @@ static int psp_set_srm(struct psp_context *psp, uint8_t *srm, uint32_t srm_size, · 14 unmodified lines
105105
106106 struct ta_hdcp_shared_memory *hdcp_cmd;
107107
108− if (!psp->hdcp_context.hdcp_initialized) {
108+ if (!psp->hdcp_context.context.initialized) {
109109 DRM_WARN("Failed to get hdcp srm. HDCP TA is not initialized.");
110110 return -EINVAL;
111111 }
112112
113− hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
113+ hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
114114 memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
115115
116116 memcpy(hdcp_cmd->in_msg.hdcp_set_srm.srm_buf, srm, srm_size);
@@ -414,12 +414,12 @@ static bool enable_assr(void *handle, struct dc_link *link) · 297 unmodified lines
414414 struct ta_dtm_shared_memory *dtm_cmd;
415415 bool res = true;
416416
417− if (!psp->dtm_context.dtm_initialized) {
417+ if (!psp->dtm_context.context.initialized) {
418418 DRM_INFO("Failed to enable ASSR, DTM TA is not initialized.");
419419 return false;
420420 }
421421
422− dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;
422+ dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.context.mem_context.shared_buf;
423423
424424 mutex_lock(&psp->dtm_context.mutex);
425425 memset(dtm_cmd, 0, sizeof(struct ta_dtm_shared_memory));
@@ -655,10 +655,8 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, struct · 229 unmodified lines
655655 INIT_DELAYED_WORK(&hdcp_work[i].property_validate_dwork, event_property_validate);
656656
657657 hdcp_work[i].hdcp.config.psp.handle = &adev->psp;
658− if (dc->ctx->dce_version == DCN_VERSION_3_1) {
658+ if (dc->ctx->dce_version == DCN_VERSION_3_1)
659659 hdcp_work[i].hdcp.config.psp.caps.dtm_v3_supported = 1;
660− hdcp_work[i].hdcp.config.psp.caps.opm_state_query_supported = false;
661− }
662660 hdcp_work[i].hdcp.config.ddc.handle = dc_get_link_at_index(dc, i);
663661 hdcp_work[i].hdcp.config.ddc.funcs.write_i2c = lp_write_i2c;
664662 hdcp_work[i].hdcp.config.ddc.funcs.read_i2c = lp_read_i2c;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq_params.h+1−0
@@ -33,6 +33,7 @@ struct dm_irq_params { · 32 unmodified lines
3333 struct mod_vrr_params vrr_params;
3434 struct dc_stream_state *stream;
3535 int active_planes;
36+ bool allow_psr_entry;
3637 struct mod_freesync_config freesync_config;
3738
3839 #ifdef CONFIG_DEBUG_FS
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c+23−0
@@ -213,6 +213,29 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) · 212 unmodified lines
213213 drm_connector_update_edid_property(
214214 &aconnector->base,
215215 NULL);
216+
217+ DRM_DEBUG_KMS("Can't get EDID of %s. Add default remote sink.", connector->name);
218+ if (!aconnector->dc_sink) {
219+ struct dc_sink *dc_sink;
220+ struct dc_sink_init_data init_params = {
221+ .link = aconnector->dc_link,
222+ .sink_signal = SIGNAL_TYPE_DISPLAY_PORT_MST };
223+
224+ dc_sink = dc_link_add_remote_sink(
225+ aconnector->dc_link,
226+ NULL,
227+ 0,
228+ &init_params);
229+
230+ if (!dc_sink) {
231+ DRM_ERROR("Unable to add a remote sink\n");
232+ return 0;
233+ }
234+
235+ dc_sink->priv = aconnector;
236+ aconnector->dc_sink = dc_sink;
237+ }
238+
216239 return ret;
217240 }
218241
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h+24−0
@@ -637,6 +637,30 @@ TRACE_EVENT(amdgpu_refresh_rate_track, · 636 unmodified lines
637637 __entry->refresh_rate_ns)
638638 );
639639
640+TRACE_EVENT(dcn_fpu,
641+ TP_PROTO(bool begin, const char *function, const int line, const int recursion_depth),
642+ TP_ARGS(begin, function, line, recursion_depth),
643+
644+ TP_STRUCT__entry(
645+ __field(bool, begin)
646+ __field(const char *, function)
647+ __field(int, line)
648+ __field(int, recursion_depth)
649+ ),
650+ TP_fast_assign(
651+ __entry->begin = begin;
652+ __entry->function = function;
653+ __entry->line = line;
654+ __entry->recursion_depth = recursion_depth;
655+ ),
656+ TP_printk("%s: recursion_depth: %d: %s()+%d:",
657+ __entry->begin ? "begin" : "end",
658+ __entry->recursion_depth,
659+ __entry->function,
660+ __entry->line
661+ )
662+);
663+
640664 #endif /* _AMDGPU_DM_TRACE_H_ */
641665
642666 #undef TRACE_INCLUDE_PATH
drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c+144−0
@@ -0,0 +1,144 @@
1+// SPDX-License-Identifier: MIT
2+/*
3+ * Copyright 2021 Advanced Micro Devices, 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: AMD
24+ *
25+ */
26+
27+#include "dc_trace.h"
28+
29+#if defined(CONFIG_X86)
30+#include <asm/fpu/api.h>
31+#elif defined(CONFIG_PPC64)
32+#include <asm/switch_to.h>
33+#include <asm/cputable.h>
34+#endif
35+
36+/**
37+ * DOC: DC FPU manipulation overview
38+ *
39+ * DC core uses FPU operations in multiple parts of the code, which requires a
40+ * more specialized way to manage these areas' entrance. To fulfill this
41+ * requirement, we created some wrapper functions that encapsulate
42+ * kernel_fpu_begin/end to better fit our need in the display component. In
43+ * summary, in this file, you can find functions related to FPU operation
44+ * management.
45+ */
46+
47+static DEFINE_PER_CPU(int, fpu_recursion_depth);
48+
49+/**
50+ * dc_assert_fp_enabled - Check if FPU protection is enabled
51+ *
52+ * This function tells if the code is already under FPU protection or not. A
53+ * function that works as an API for a set of FPU operations can use this
54+ * function for checking if the caller invoked it after DC_FP_START(). For
55+ * example, take a look at dcn2x.c file.
56+ */
57+inline void dc_assert_fp_enabled(void)
58+{
59+ int *pcpu, depth = 0;
60+
61+ pcpu = get_cpu_ptr(&fpu_recursion_depth);
62+ depth = *pcpu;
63+ put_cpu_ptr(&fpu_recursion_depth);
64+
65+ ASSERT(depth > 1);
66+}
67+
68+/**
69+ * dc_fpu_begin - Enables FPU protection
70+ * @function_name: A string containing the function name for debug purposes
71+ * (usually __func__)
72+ *
73+ * @line: A line number where DC_FP_START was invoked for debug purpose
74+ * (usually __LINE__)
75+ *
76+ * This function is responsible for managing the use of kernel_fpu_begin() with
77+ * the advantage of providing an event trace for debugging.
78+ *
79+ * Note: Do not call this function directly; always use DC_FP_START().
80+ */
81+void dc_fpu_begin(const char *function_name, const int line)
82+{
83+ int *pcpu;
84+
85+ pcpu = get_cpu_ptr(&fpu_recursion_depth);
86+ *pcpu += 1;
87+
88+ if (*pcpu == 1) {
89+#if defined(CONFIG_X86)
90+ kernel_fpu_begin();
91+#elif defined(CONFIG_PPC64)
92+ if (cpu_has_feature(CPU_FTR_VSX_COMP)) {
93+ preempt_disable();
94+ enable_kernel_vsx();
95+ } else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) {
96+ preempt_disable();
97+ enable_kernel_altivec();
98+ } else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) {
99+ preempt_disable();
100+ enable_kernel_fp();
101+ }
102+#endif
103+ }
104+
105+ TRACE_DCN_FPU(true, function_name, line, *pcpu);
106+ put_cpu_ptr(&fpu_recursion_depth);
107+}
108+
109+/**
110+ * dc_fpu_end - Disable FPU protection
111+ * @function_name: A string containing the function name for debug purposes
112+ * @line: A-line number where DC_FP_END was invoked for debug purpose
113+ *
114+ * This function is responsible for managing the use of kernel_fpu_end() with
115+ * the advantage of providing an event trace for debugging.
116+ *
117+ * Note: Do not call this function directly; always use DC_FP_END().
118+ */
119+void dc_fpu_end(const char *function_name, const int line)
120+{
121+ int *pcpu;
122+
123+ pcpu = get_cpu_ptr(&fpu_recursion_depth);
124+ *pcpu -= 1;
125+ if (*pcpu <= 0) {
126+#if defined(CONFIG_X86)
127+ kernel_fpu_end();
128+#elif defined(CONFIG_PPC64)
129+ if (cpu_has_feature(CPU_FTR_VSX_COMP)) {
130+ disable_kernel_vsx();
131+ preempt_enable();
132+ } else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) {
133+ disable_kernel_altivec();
134+ preempt_enable();
135+ } else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) {
136+ disable_kernel_fp();
137+ preempt_enable();
138+ }
139+#endif
140+ }
141+
142+ TRACE_DCN_FPU(false, function_name, line, *pcpu);
143+ put_cpu_ptr(&fpu_recursion_depth);
144+}
drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h+34−0
@@ -0,0 +1,34 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright 2021 Advanced Micro Devices, 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: AMD
24+ *
25+ */
26+
27+#ifndef __DC_FPU_H__
28+#define __DC_FPU_H__
29+
30+void dc_assert_fp_enabled(void);
31+void dc_fpu_begin(const char *function_name, const int line);
32+void dc_fpu_end(const char *function_name, const int line);
33+
34+#endif /* __DC_FPU_H__ */
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c+6−6
@@ -264,9 +264,9 @@ static void rv1_update_clocks(struct clk_mgr *clk_mgr_base, · 263 unmodified lines
264264 if (pp_smu->set_hard_min_fclk_by_freq &&
265265 pp_smu->set_hard_min_dcfclk_by_freq &&
266266 pp_smu->set_min_deep_sleep_dcfclk) {
267− pp_smu->set_hard_min_fclk_by_freq(&pp_smu->pp_smu, new_clocks->fclk_khz / 1000);
268− pp_smu->set_hard_min_dcfclk_by_freq(&pp_smu->pp_smu, new_clocks->dcfclk_khz / 1000);
269− pp_smu->set_min_deep_sleep_dcfclk(&pp_smu->pp_smu, (new_clocks->dcfclk_deep_sleep_khz + 999) / 1000);
267+ pp_smu->set_hard_min_fclk_by_freq(&pp_smu->pp_smu, khz_to_mhz_ceil(new_clocks->fclk_khz));
268+ pp_smu->set_hard_min_dcfclk_by_freq(&pp_smu->pp_smu, khz_to_mhz_ceil(new_clocks->dcfclk_khz));
269+ pp_smu->set_min_deep_sleep_dcfclk(&pp_smu->pp_smu, khz_to_mhz_ceil(new_clocks->dcfclk_deep_sleep_khz));
270270 }
271271 }
272272
@@ -284,9 +284,9 @@ static void rv1_update_clocks(struct clk_mgr *clk_mgr_base, · 11 unmodified lines
284284 if (pp_smu->set_hard_min_fclk_by_freq &&
285285 pp_smu->set_hard_min_dcfclk_by_freq &&
286286 pp_smu->set_min_deep_sleep_dcfclk) {
287− pp_smu->set_hard_min_fclk_by_freq(&pp_smu->pp_smu, new_clocks->fclk_khz / 1000);
288− pp_smu->set_hard_min_dcfclk_by_freq(&pp_smu->pp_smu, new_clocks->dcfclk_khz / 1000);
289− pp_smu->set_min_deep_sleep_dcfclk(&pp_smu->pp_smu, (new_clocks->dcfclk_deep_sleep_khz + 999) / 1000);
287+ pp_smu->set_hard_min_fclk_by_freq(&pp_smu->pp_smu, khz_to_mhz_ceil(new_clocks->fclk_khz));
288+ pp_smu->set_hard_min_dcfclk_by_freq(&pp_smu->pp_smu, khz_to_mhz_ceil(new_clocks->dcfclk_khz));
289+ pp_smu->set_min_deep_sleep_dcfclk(&pp_smu->pp_smu, khz_to_mhz_ceil(new_clocks->dcfclk_deep_sleep_khz));
290290 }
291291 }
292292 }
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c+2−2
@@ -130,7 +130,7 @@ int rv1_vbios_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_di · 129 unmodified lines
130130 actual_dispclk_set_mhz = rv1_vbios_smu_send_msg_with_param(
131131 clk_mgr,
132132 VBIOSSMC_MSG_SetDispclkFreq,
133− requested_dispclk_khz / 1000);
133+ khz_to_mhz_ceil(requested_dispclk_khz));
134134
135135 if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) {
136136 if (dmcu && dmcu->funcs->is_dmcu_initialized(dmcu)) {
@@ -150,7 +150,7 @@ int rv1_vbios_smu_set_dprefclk(struct clk_mgr_internal *clk_mgr) · 13 unmodified lines
150150 actual_dprefclk_set_mhz = rv1_vbios_smu_send_msg_with_param(
151151 clk_mgr,
152152 VBIOSSMC_MSG_SetDprefclkFreq,
153− clk_mgr->base.dprefclk_khz / 1000);
153+ khz_to_mhz_ceil(clk_mgr->base.dprefclk_khz));
154154
155155 /* TODO: add code for programing DP DTO, currently this is down by command table */
156156
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c+6−6
@@ -253,20 +253,20 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base, · 252 unmodified lines
253253 if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base->clks.dcfclk_khz)) {
254254 clk_mgr_base->clks.dcfclk_khz = new_clocks->dcfclk_khz;
255255 if (pp_smu && pp_smu->set_hard_min_dcfclk_by_freq)
256− pp_smu->set_hard_min_dcfclk_by_freq(&pp_smu->pp_smu, clk_mgr_base->clks.dcfclk_khz / 1000);
256+ pp_smu->set_hard_min_dcfclk_by_freq(&pp_smu->pp_smu, khz_to_mhz_ceil(clk_mgr_base->clks.dcfclk_khz));
257257 }
258258
259259 if (should_set_clock(safe_to_lower,
260260 new_clocks->dcfclk_deep_sleep_khz, clk_mgr_base->clks.dcfclk_deep_sleep_khz)) {
261261 clk_mgr_base->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz;
262262 if (pp_smu && pp_smu->set_min_deep_sleep_dcfclk)
263− pp_smu->set_min_deep_sleep_dcfclk(&pp_smu->pp_smu, clk_mgr_base->clks.dcfclk_deep_sleep_khz / 1000);
263+ pp_smu->set_min_deep_sleep_dcfclk(&pp_smu->pp_smu, khz_to_mhz_ceil(clk_mgr_base->clks.dcfclk_deep_sleep_khz));
264264 }
265265
266266 if (should_set_clock(safe_to_lower, new_clocks->socclk_khz, clk_mgr_base->clks.socclk_khz)) {
267267 clk_mgr_base->clks.socclk_khz = new_clocks->socclk_khz;
268268 if (pp_smu && pp_smu->set_hard_min_socclk_by_freq)
269− pp_smu->set_hard_min_socclk_by_freq(&pp_smu->pp_smu, clk_mgr_base->clks.socclk_khz / 1000);
269+ pp_smu->set_hard_min_socclk_by_freq(&pp_smu->pp_smu, khz_to_mhz_ceil(clk_mgr_base->clks.socclk_khz));
270270 }
271271
272272 total_plane_count = clk_mgr_helper_get_active_plane_cnt(dc, context);
@@ -281,7 +281,7 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base, · 8 unmodified lines
281281 if (should_set_clock(safe_to_lower, new_clocks->dramclk_khz, clk_mgr_base->clks.dramclk_khz)) {
282282 clk_mgr_base->clks.dramclk_khz = new_clocks->dramclk_khz;
283283 if (pp_smu && pp_smu->set_hard_min_uclk_by_freq)
284− pp_smu->set_hard_min_uclk_by_freq(&pp_smu->pp_smu, clk_mgr_base->clks.dramclk_khz / 1000);
284+ pp_smu->set_hard_min_uclk_by_freq(&pp_smu->pp_smu, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz));
285285 }
286286
287287 if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {
@@ -306,7 +306,7 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base, · 18 unmodified lines
306306
307307 clk_mgr_base->clks.disp_dpp_voltage_level_khz = new_clocks->disp_dpp_voltage_level_khz;
308308 if (pp_smu && pp_smu->set_voltage_by_freq)
309− pp_smu->set_voltage_by_freq(&pp_smu->pp_smu, PP_SMU_NV_DISPCLK, clk_mgr_base->clks.disp_dpp_voltage_level_khz / 1000);
309+ pp_smu->set_voltage_by_freq(&pp_smu->pp_smu, PP_SMU_NV_DISPCLK, khz_to_mhz_ceil(clk_mgr_base->clks.disp_dpp_voltage_level_khz));
310310 }
311311
312312 if (dc->config.forced_clocks == false || (force_reset && safe_to_lower)) {
@@ -502,7 +502,7 @@ static void dcn2_notify_link_rate_change(struct clk_mgr *clk_mgr_base, struct dc · 189 unmodified lines
502502
503503 if (max_phyclk_req != clk_mgr_base->clks.phyclk_khz) {
504504 clk_mgr_base->clks.phyclk_khz = max_phyclk_req;
505− pp_smu->set_voltage_by_freq(&pp_smu->pp_smu, PP_SMU_NV_PHYCLK, clk_mgr_base->clks.phyclk_khz / 1000);
505+ pp_smu->set_voltage_by_freq(&pp_smu->pp_smu, PP_SMU_NV_PHYCLK, khz_to_mhz_ceil(clk_mgr_base->clks.phyclk_khz));
506506 }
507507 }
508508
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c+8−8
@@ -126,7 +126,7 @@ int rn_vbios_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_dis · 125 unmodified lines
126126 actual_dispclk_set_mhz = rn_vbios_smu_send_msg_with_param(
127127 clk_mgr,
128128 VBIOSSMC_MSG_SetDispclkFreq,
129− requested_dispclk_khz / 1000);
129+ khz_to_mhz_ceil(requested_dispclk_khz));
130130
131131 if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) {
132132 if (dmcu && dmcu->funcs->is_dmcu_initialized(dmcu)) {
@@ -138,7 +138,7 @@ int rn_vbios_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_dis · 5 unmodified lines
138138
139139 // pmfw always set clock more than or equal requested clock
140140 if (!IS_DIAG_DC(dc->ctx->dce_environment))
141− ASSERT(actual_dispclk_set_mhz >= requested_dispclk_khz / 1000);
141+ ASSERT(actual_dispclk_set_mhz >= khz_to_mhz_ceil(requested_dispclk_khz));
142142
143143 return actual_dispclk_set_mhz * 1000;
144144 }
@@ -150,7 +150,7 @@ int rn_vbios_smu_set_dprefclk(struct clk_mgr_internal *clk_mgr) · 5 unmodified lines
150150 actual_dprefclk_set_mhz = rn_vbios_smu_send_msg_with_param(
151151 clk_mgr,
152152 VBIOSSMC_MSG_SetDprefclkFreq,
153− clk_mgr->base.dprefclk_khz / 1000);
153+ khz_to_mhz_ceil(clk_mgr->base.dprefclk_khz));
154154
155155 /* TODO: add code for programing DP DTO, currently this is down by command table */
156156
@@ -167,7 +167,7 @@ int rn_vbios_smu_set_hard_min_dcfclk(struct clk_mgr_internal *clk_mgr, int reque · 10 unmodified lines
167167 actual_dcfclk_set_mhz = rn_vbios_smu_send_msg_with_param(
168168 clk_mgr,
169169 VBIOSSMC_MSG_SetHardMinDcfclkByFreq,
170− requested_dcfclk_khz / 1000);
170+ khz_to_mhz_ceil(requested_dcfclk_khz));
171171
172172 return actual_dcfclk_set_mhz * 1000;
173173 }
@@ -182,7 +182,7 @@ int rn_vbios_smu_set_min_deep_sleep_dcfclk(struct clk_mgr_internal *clk_mgr, int · 8 unmodified lines
182182 actual_min_ds_dcfclk_mhz = rn_vbios_smu_send_msg_with_param(
183183 clk_mgr,
184184 VBIOSSMC_MSG_SetMinDeepSleepDcfclk,
185− requested_min_ds_dcfclk_khz / 1000);
185+ khz_to_mhz_ceil(requested_min_ds_dcfclk_khz));
186186
187187 return actual_min_ds_dcfclk_mhz * 1000;
188188 }
@@ -192,7 +192,7 @@ void rn_vbios_smu_set_phyclk(struct clk_mgr_internal *clk_mgr, int requested_phy · 3 unmodified lines
192192 rn_vbios_smu_send_msg_with_param(
193193 clk_mgr,
194194 VBIOSSMC_MSG_SetPhyclkVoltageByFreq,
195− requested_phyclk_khz / 1000);
195+ khz_to_mhz_ceil(requested_phyclk_khz));
196196 }
197197
198198 int rn_vbios_smu_set_dppclk(struct clk_mgr_internal *clk_mgr, int requested_dpp_khz)
@@ -203,10 +203,10 @@ int rn_vbios_smu_set_dppclk(struct clk_mgr_internal *clk_mgr, int requested_dpp_ · 4 unmodified lines
203203 actual_dppclk_set_mhz = rn_vbios_smu_send_msg_with_param(
204204 clk_mgr,
205205 VBIOSSMC_MSG_SetDppclkFreq,
206− requested_dpp_khz / 1000);
206+ khz_to_mhz_ceil(requested_dpp_khz));
207207
208208 if (!IS_DIAG_DC(dc->ctx->dce_environment))
209− ASSERT(actual_dppclk_set_mhz >= requested_dpp_khz / 1000);
209+ ASSERT(actual_dppclk_set_mhz >= khz_to_mhz_ceil(requested_dpp_khz));
210210
211211 return actual_dppclk_set_mhz * 1000;
212212 }
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c+15−10
@@ -284,12 +284,12 @@ static void dcn3_update_clocks(struct clk_mgr *clk_mgr_base, · 283 unmodified lines
284284
285285 if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base->clks.dcfclk_khz)) {
286286 clk_mgr_base->clks.dcfclk_khz = new_clocks->dcfclk_khz;
287− dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_DCEFCLK, clk_mgr_base->clks.dcfclk_khz / 1000);
287+ dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_DCEFCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dcfclk_khz));
288288 }
289289
290290 if (should_set_clock(safe_to_lower, new_clocks->dcfclk_deep_sleep_khz, clk_mgr_base->clks.dcfclk_deep_sleep_khz)) {
291291 clk_mgr_base->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz;
292− dcn30_smu_set_min_deep_sleep_dcef_clk(clk_mgr, clk_mgr_base->clks.dcfclk_deep_sleep_khz / 1000);
292+ dcn30_smu_set_min_deep_sleep_dcef_clk(clk_mgr, khz_to_mhz_ceil(clk_mgr_base->clks.dcfclk_deep_sleep_khz));
293293 }
294294
295295 if (should_set_clock(safe_to_lower, new_clocks->socclk_khz, clk_mgr_base->clks.socclk_khz))
@@ -317,20 +317,20 @@ static void dcn3_update_clocks(struct clk_mgr *clk_mgr_base, · 21 unmodified lines
317317 /* set UCLK to requested value if P-State switching is supported, or to re-enable P-State switching */
318318 if (clk_mgr_base->clks.p_state_change_support &&
319319 (update_uclk || !clk_mgr_base->clks.prev_p_state_change_support))
320− dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, clk_mgr_base->clks.dramclk_khz / 1000);
320+ dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz));
321321
322322 if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr_base->clks.dppclk_khz)) {
323323 if (clk_mgr_base->clks.dppclk_khz > new_clocks->dppclk_khz)
324324 dpp_clock_lowered = true;
325325
326326 clk_mgr_base->clks.dppclk_khz = new_clocks->dppclk_khz;
327− dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_PIXCLK, clk_mgr_base->clks.dppclk_khz / 1000);
327+ dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_PIXCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dppclk_khz));
328328 update_dppclk = true;
329329 }
330330
331331 if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
332332 clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
333− dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_DISPCLK, clk_mgr_base->clks.dispclk_khz / 1000);
333+ dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_DISPCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dispclk_khz));
334334 update_dispclk = true;
335335 }
336336
@@ -396,12 +396,17 @@ static void dcn3_set_hard_min_memclk(struct clk_mgr *clk_mgr_base, bool current_ · 59 unmodified lines
396396 if (!clk_mgr->smu_present)
397397 return;
398398
399− if (current_mode)
400− dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK,
401− clk_mgr_base->clks.dramclk_khz / 1000);
402− else
399+ if (current_mode) {
400+ if (clk_mgr_base->clks.p_state_change_support)
401+ dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK,
402+ khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz));
403+ else
404+ dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK,
405+ clk_mgr_base->bw_params->clk_table.entries[clk_mgr_base->bw_params->clk_table.num_entries - 1].memclk_mhz);
406+ } else {
403407 dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK,
404408 clk_mgr_base->bw_params->clk_table.entries[0].memclk_mhz);
409+ }
405410 }
406411
407412 /* Set max memclk to highest DPM value */
@@ -489,7 +494,7 @@ static void dcn30_notify_link_rate_change(struct clk_mgr *clk_mgr_base, struct d · 81 unmodified lines
489494
490495 if (max_phyclk_req != clk_mgr_base->clks.phyclk_khz) {
491496 clk_mgr_base->clks.phyclk_khz = max_phyclk_req;
492− dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_PHYCLK, clk_mgr_base->clks.phyclk_khz / 1000);
497+ dcn30_smu_set_hard_min_by_freq(clk_mgr, PPCLK_PHYCLK, khz_to_mhz_ceil(clk_mgr_base->clks.phyclk_khz));
493498 }
494499 }
495500
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c+5−5
@@ -133,7 +133,7 @@ int dcn301_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_dispc · 132 unmodified lines
133133 actual_dispclk_set_mhz = dcn301_smu_send_msg_with_param(
134134 clk_mgr,
135135 VBIOSSMC_MSG_SetDispclkFreq,
136− requested_dispclk_khz / 1000);
136+ khz_to_mhz_ceil(requested_dispclk_khz));
137137
138138 return actual_dispclk_set_mhz * 1000;
139139 }
@@ -147,7 +147,7 @@ int dcn301_smu_set_dprefclk(struct clk_mgr_internal *clk_mgr) · 7 unmodified lines
147147 actual_dprefclk_set_mhz = dcn301_smu_send_msg_with_param(
148148 clk_mgr,
149149 VBIOSSMC_MSG_SetDprefclkFreq,
150− clk_mgr->base.dprefclk_khz / 1000);
150+ khz_to_mhz_ceil(clk_mgr->base.dprefclk_khz));
151151
152152 /* TODO: add code for programing DP DTO, currently this is down by command table */
153153
@@ -163,7 +163,7 @@ int dcn301_smu_set_hard_min_dcfclk(struct clk_mgr_internal *clk_mgr, int request · 9 unmodified lines
163163 actual_dcfclk_set_mhz = dcn301_smu_send_msg_with_param(
164164 clk_mgr,
165165 VBIOSSMC_MSG_SetHardMinDcfclkByFreq,
166− requested_dcfclk_khz / 1000);
166+ khz_to_mhz_ceil(requested_dcfclk_khz));
167167
168168 return actual_dcfclk_set_mhz * 1000;
169169 }
@@ -177,7 +177,7 @@ int dcn301_smu_set_min_deep_sleep_dcfclk(struct clk_mgr_internal *clk_mgr, int r · 7 unmodified lines
177177 actual_min_ds_dcfclk_mhz = dcn301_smu_send_msg_with_param(
178178 clk_mgr,
179179 VBIOSSMC_MSG_SetMinDeepSleepDcfclk,
180− requested_min_ds_dcfclk_khz / 1000);
180+ khz_to_mhz_ceil(requested_min_ds_dcfclk_khz));
181181
182182 return actual_min_ds_dcfclk_mhz * 1000;
183183 }
@@ -191,7 +191,7 @@ int dcn301_smu_set_dppclk(struct clk_mgr_internal *clk_mgr, int requested_dpp_kh · 7 unmodified lines
191191 actual_dppclk_set_mhz = dcn301_smu_send_msg_with_param(
192192 clk_mgr,
193193 VBIOSSMC_MSG_SetDppclkFreq,
194− requested_dpp_khz / 1000);
194+ khz_to_mhz_ceil(requested_dpp_khz));
195195
196196 return actual_dppclk_set_mhz * 1000;
197197 }
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c+1−1
@@ -114,7 +114,7 @@ void vg_update_clocks(struct clk_mgr *clk_mgr_base, · 113 unmodified lines
114114
115115 display_count = vg_get_active_display_cnt_wa(dc, context);
116116 /* if we can go lower, go lower */
117− if (display_count == 0) {
117+ if (display_count == 0 && !IS_DIAG_DC(dc->ctx->dce_environment)) {
118118 union display_idle_optimization_u idle_info = { 0 };
119119
120120 idle_info.idle_info.df_request_disabled = 1;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c+5−5
@@ -147,7 +147,7 @@ int dcn31_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_dispcl · 146 unmodified lines
147147 actual_dispclk_set_mhz = dcn31_smu_send_msg_with_param(
148148 clk_mgr,
149149 VBIOSSMC_MSG_SetDispclkFreq,
150− (requested_dispclk_khz + 999) / 1000);
150+ khz_to_mhz_ceil(requested_dispclk_khz));
151151
152152 return actual_dispclk_set_mhz * 1000;
153153 }
@@ -162,7 +162,7 @@ int dcn31_smu_set_dprefclk(struct clk_mgr_internal *clk_mgr) · 8 unmodified lines
162162 actual_dprefclk_set_mhz = dcn31_smu_send_msg_with_param(
163163 clk_mgr,
164164 VBIOSSMC_MSG_SetDprefclkFreq,
165− (clk_mgr->base.dprefclk_khz + 999) / 1000);
165+ khz_to_mhz_ceil(clk_mgr->base.dprefclk_khz));
166166
167167 /* TODO: add code for programing DP DTO, currently this is down by command table */
168168
@@ -182,7 +182,7 @@ int dcn31_smu_set_hard_min_dcfclk(struct clk_mgr_internal *clk_mgr, int requeste · 13 unmodified lines
182182 actual_dcfclk_set_mhz = dcn31_smu_send_msg_with_param(
183183 clk_mgr,
184184 VBIOSSMC_MSG_SetHardMinDcfclkByFreq,
185− (requested_dcfclk_khz + 999) / 1000);
185+ khz_to_mhz_ceil(requested_dcfclk_khz));
186186
187187 return actual_dcfclk_set_mhz * 1000;
188188 }
@@ -200,7 +200,7 @@ int dcn31_smu_set_min_deep_sleep_dcfclk(struct clk_mgr_internal *clk_mgr, int re · 11 unmodified lines
200200 actual_min_ds_dcfclk_mhz = dcn31_smu_send_msg_with_param(
201201 clk_mgr,
202202 VBIOSSMC_MSG_SetMinDeepSleepDcfclk,
203− (requested_min_ds_dcfclk_khz + 999) / 1000);
203+ khz_to_mhz_ceil(requested_min_ds_dcfclk_khz));
204204
205205 return actual_min_ds_dcfclk_mhz * 1000;
206206 }
@@ -215,7 +215,7 @@ int dcn31_smu_set_dppclk(struct clk_mgr_internal *clk_mgr, int requested_dpp_khz · 8 unmodified lines
215215 actual_dppclk_set_mhz = dcn31_smu_send_msg_with_param(
216216 clk_mgr,
217217 VBIOSSMC_MSG_SetDppclkFreq,
218− (requested_dpp_khz + 999) / 1000);
218+ khz_to_mhz_ceil(requested_dpp_khz));
219219
220220 return actual_dppclk_set_mhz * 1000;
221221 }
drivers/gpu/drm/amd/display/dc/core/dc.c+41−21
@@ -1481,6 +1481,22 @@ bool dc_validate_seamless_boot_timing(const struct dc *dc, · 1480 unmodified lines
14811481 return true;
14821482 }
14831483
1484+static inline bool should_update_pipe_for_stream(
1485+ struct dc_state *context,
1486+ struct pipe_ctx *pipe_ctx,
1487+ struct dc_stream_state *stream)
1488+{
1489+ return (pipe_ctx->stream && pipe_ctx->stream == stream);
1490+}
1491+
1492+static inline bool should_update_pipe_for_plane(
1493+ struct dc_state *context,
1494+ struct pipe_ctx *pipe_ctx,
1495+ struct dc_plane_state *plane_state)
1496+{
1497+ return (pipe_ctx->plane_state == plane_state);
1498+}
1499+
14841500 void dc_enable_stereo(
14851501 struct dc *dc,
14861502 struct dc_state *context,
@@ -1491,12 +1507,15 @@ void dc_enable_stereo( · 4 unmodified lines
14911507 struct pipe_ctx *pipe;
14921508
14931509 for (i = 0; i < MAX_PIPES; i++) {
1494− if (context != NULL)
1510+ if (context != NULL) {
14951511 pipe = &context->res_ctx.pipe_ctx[i];
1496− else
1512+ } else {
1513+ context = dc->current_state;
14971514 pipe = &dc->current_state->res_ctx.pipe_ctx[i];
1498− for (j = 0 ; pipe && j < stream_count; j++) {
1499− if (streams[j] && streams[j] == pipe->stream &&
1515+ }
1516+
1517+ for (j = 0; pipe && j < stream_count; j++) {
1518+ if (should_update_pipe_for_stream(context, pipe, streams[j]) &&
15001519 dc->hwss.setup_stereo)
15011520 dc->hwss.setup_stereo(pipe, dc);
15021521 }
@@ -2629,6 +2648,7 @@ static void commit_planes_for_stream(struct dc *dc, · 1126 unmodified lines
26292648 {
26302649 int i, j;
26312650 struct pipe_ctx *top_pipe_to_program = NULL;
2651+ bool should_lock_all_pipes = (update_type != UPDATE_TYPE_FAST);
26322652
26332653 #if defined(CONFIG_DRM_AMD_DC_DCN)
26342654 dc_z10_restore(dc);
@@ -2700,7 +2720,7 @@ static void commit_planes_for_stream(struct dc *dc, · 65 unmodified lines
27002720 top_pipe_to_program->stream_res.tg);
27012721 }
27022722
2703− if ((update_type != UPDATE_TYPE_FAST) && dc->hwss.interdependent_update_lock)
2723+ if (should_lock_all_pipes && dc->hwss.interdependent_update_lock)
27042724 dc->hwss.interdependent_update_lock(dc, context, true);
27052725 else
27062726 /* Lock the top pipe while updating plane addrs, since freesync requires
@@ -2723,7 +2743,7 @@ static void commit_planes_for_stream(struct dc *dc, · 16 unmodified lines
27232743 if (dc->hwss.program_front_end_for_ctx)
27242744 dc->hwss.program_front_end_for_ctx(dc, context);
27252745
2726− if ((update_type != UPDATE_TYPE_FAST) && dc->hwss.interdependent_update_lock)
2746+ if (should_lock_all_pipes && dc->hwss.interdependent_update_lock)
27272747 dc->hwss.interdependent_update_lock(dc, context, false);
27282748 else
27292749 dc->hwss.pipe_control_lock(dc, top_pipe_to_program, false);
@@ -2739,14 +2759,14 @@ static void commit_planes_for_stream(struct dc *dc, · 9 unmodified lines
27392759 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
27402760 if (!pipe_ctx->plane_state)
27412761 continue;
2742− if (pipe_ctx->plane_state != plane_state)
2762+ if (should_update_pipe_for_plane(context, pipe_ctx, plane_state))
27432763 continue;
2744− plane_state->triplebuffer_flips = false;
2764+ pipe_ctx->plane_state->triplebuffer_flips = false;
27452765 if (update_type == UPDATE_TYPE_FAST &&
27462766 dc->hwss.program_triplebuffer != NULL &&
2747− !plane_state->flip_immediate && dc->debug.enable_tri_buf) {
2767+ !pipe_ctx->plane_state->flip_immediate && dc->debug.enable_tri_buf) {
27482768 /*triple buffer for VUpdate only*/
2749− plane_state->triplebuffer_flips = true;
2769+ pipe_ctx->plane_state->triplebuffer_flips = true;
27502770 }
27512771 }
27522772 if (update_type == UPDATE_TYPE_FULL) {
@@ -2762,8 +2782,7 @@ static void commit_planes_for_stream(struct dc *dc, · 9 unmodified lines
27622782
27632783 if (!pipe_ctx->top_pipe &&
27642784 !pipe_ctx->prev_odm_pipe &&
2765− pipe_ctx->stream &&
2766− pipe_ctx->stream == stream) {
2785+ should_update_pipe_for_stream(context, pipe_ctx, stream)) {
27672786 struct dc_stream_status *stream_status = NULL;
27682787
27692788 if (!pipe_ctx->plane_state)
@@ -2816,15 +2835,15 @@ static void commit_planes_for_stream(struct dc *dc, · 46 unmodified lines
28162835 for (j = 0; j < dc->res_pool->pipe_count; j++) {
28172836 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
28182837
2819− if (pipe_ctx->stream != stream)
2838+ if (!should_update_pipe_for_stream(context, pipe_ctx, stream))
28202839 continue;
28212840
2822− if (pipe_ctx->plane_state != plane_state)
2841+ if (!should_update_pipe_for_plane(context, pipe_ctx, plane_state))
28232842 continue;
28242843
28252844 // GSL has to be used for flip immediate
28262845 dc->hwss.set_flip_control_gsl(pipe_ctx,
2827− plane_state->flip_immediate);
2846+ pipe_ctx->plane_state->flip_immediate);
28282847 }
28292848 }
28302849
@@ -2835,25 +2854,26 @@ static void commit_planes_for_stream(struct dc *dc, · 4 unmodified lines
28352854 for (j = 0; j < dc->res_pool->pipe_count; j++) {
28362855 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
28372856
2838− if (pipe_ctx->stream != stream)
2857+ if (!should_update_pipe_for_stream(context, pipe_ctx, stream))
28392858 continue;
28402859
2841− if (pipe_ctx->plane_state != plane_state)
2860+ if (!should_update_pipe_for_plane(context, pipe_ctx, plane_state))
28422861 continue;
2862+
28432863 /*program triple buffer after lock based on flip type*/
28442864 if (dc->hwss.program_triplebuffer != NULL && dc->debug.enable_tri_buf) {
28452865 /*only enable triplebuffer for fast_update*/
28462866 dc->hwss.program_triplebuffer(
2847− dc, pipe_ctx, plane_state->triplebuffer_flips);
2867+ dc, pipe_ctx, pipe_ctx->plane_state->triplebuffer_flips);
28482868 }
2849− if (srf_updates[i].flip_addr)
2869+ if (pipe_ctx->plane_state->update_flags.bits.addr_update)
28502870 dc->hwss.update_plane_addr(dc, pipe_ctx);
28512871 }
28522872 }
28532873
28542874 }
28552875
2856− if ((update_type != UPDATE_TYPE_FAST) && dc->hwss.interdependent_update_lock)
2876+ if (should_lock_all_pipes && dc->hwss.interdependent_update_lock)
28572877 dc->hwss.interdependent_update_lock(dc, context, false);
28582878 else
28592879 dc->hwss.pipe_control_lock(dc, top_pipe_to_program, false);
@@ -2897,7 +2917,7 @@ static void commit_planes_for_stream(struct dc *dc, · 37 unmodified lines
28972917 continue;
28982918
28992919 if (pipe_ctx->bottom_pipe || pipe_ctx->next_odm_pipe ||
2900− !pipe_ctx->stream || pipe_ctx->stream != stream ||
2920+ !pipe_ctx->stream || !should_update_pipe_for_stream(context, pipe_ctx, stream) ||
29012921 !pipe_ctx->plane_state->update_flags.bits.addr_update ||
29022922 pipe_ctx->plane_state->skip_manual_trigger)
29032923 continue;
drivers/gpu/drm/amd/display/dc/core/dc_link.c+63−55
@@ -541,6 +541,7 @@ static void link_disconnect_sink(struct dc_link *link) · 540 unmodified lines
541541 }
542542
543543 link->dpcd_sink_count = 0;
544+ //link->dpcd_caps.dpcd_rev.raw = 0;
544545 }
545546
546547 static void link_disconnect_remap(struct dc_sink *prev_sink, struct dc_link *link)
@@ -742,6 +743,7 @@ static bool detect_dp(struct dc_link *link, · 195 unmodified lines
742743 sink_caps,
743744 audio_support);
744745 link->dpcd_caps.dongle_type = sink_caps->dongle_type;
746+ link->dpcd_caps.dpcd_rev.raw = 0;
745747 }
746748
747749 return true;
@@ -1663,6 +1665,12 @@ struct dc_link *link_create(const struct link_init_data *init_params) · 915 unmodified lines
16631665 if (false == dc_link_construct(link, init_params))
16641666 goto construct_fail;
16651667
1668+ /*
1669+ * Must use preferred_link_setting, not reported_link_cap or verified_link_cap,
1670+ * since struct preferred_link_setting won't be reset after S3.
1671+ */
1672+ link->preferred_link_setting.dpcd_source_device_specific_field_support = true;
1673+
16661674 return link;
16671675
16681676 construct_fail:
@@ -3509,61 +3517,6 @@ void dc_link_enable_hpd_filter(struct dc_link *link, bool enable) · 1840 unmodified lines
35093517 }
35103518 }
35113519
3512−uint32_t dc_bandwidth_in_kbps_from_timing(
3513− const struct dc_crtc_timing *timing)
3514−{
3515− uint32_t bits_per_channel = 0;
3516− uint32_t kbps;
3517−
3518−#if defined(CONFIG_DRM_AMD_DC_DCN)
3519− if (timing->flags.DSC)
3520− return dc_dsc_stream_bandwidth_in_kbps(timing,
3521− timing->dsc_cfg.bits_per_pixel,
3522− timing->dsc_cfg.num_slices_h,
3523− timing->dsc_cfg.is_dp);
3524−#endif
3525−
3526− switch (timing->display_color_depth) {
3527− case COLOR_DEPTH_666:
3528− bits_per_channel = 6;
3529− break;
3530− case COLOR_DEPTH_888:
3531− bits_per_channel = 8;
3532− break;
3533− case COLOR_DEPTH_101010:
3534− bits_per_channel = 10;
3535− break;
3536− case COLOR_DEPTH_121212:
3537− bits_per_channel = 12;
3538− break;
3539− case COLOR_DEPTH_141414:
3540− bits_per_channel = 14;
3541− break;
3542− case COLOR_DEPTH_161616:
3543− bits_per_channel = 16;
3544− break;
3545− default:
3546− ASSERT(bits_per_channel != 0);
3547− bits_per_channel = 8;
3548− break;
3549− }
3550−
3551− kbps = timing->pix_clk_100hz / 10;
3552− kbps *= bits_per_channel;
3553−
3554− if (timing->flags.Y_ONLY != 1) {
3555− /*Only YOnly make reduce bandwidth by 1/3 compares to RGB*/
3556− kbps *= 3;
3557− if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420)
3558− kbps /= 2;
3559− else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR422)
3560− kbps = kbps * 2 / 3;
3561− }
3562−
3563− return kbps;
3564−
3565−}
3566−
35673520 void dc_link_set_drive_settings(struct dc *dc,
35683521 struct link_training_settings *lt_settings,
35693522 const struct dc_link *link)
@@ -3769,3 +3722,58 @@ bool dc_link_should_enable_fec(const struct dc_link *link) · 199 unmodified lines
37693722
37703723 return ret;
37713724 }
3725+
3726+uint32_t dc_bandwidth_in_kbps_from_timing(
3727+ const struct dc_crtc_timing *timing)
3728+{
3729+ uint32_t bits_per_channel = 0;
3730+ uint32_t kbps;
3731+
3732+#if defined(CONFIG_DRM_AMD_DC_DCN)
3733+ if (timing->flags.DSC)
3734+ return dc_dsc_stream_bandwidth_in_kbps(timing,
3735+ timing->dsc_cfg.bits_per_pixel,
3736+ timing->dsc_cfg.num_slices_h,
3737+ timing->dsc_cfg.is_dp);
3738+#endif
3739+
3740+ switch (timing->display_color_depth) {
3741+ case COLOR_DEPTH_666:
3742+ bits_per_channel = 6;
3743+ break;
3744+ case COLOR_DEPTH_888:
3745+ bits_per_channel = 8;
3746+ break;
3747+ case COLOR_DEPTH_101010:
3748+ bits_per_channel = 10;
3749+ break;
3750+ case COLOR_DEPTH_121212:
3751+ bits_per_channel = 12;
3752+ break;
3753+ case COLOR_DEPTH_141414:
3754+ bits_per_channel = 14;
3755+ break;
3756+ case COLOR_DEPTH_161616:
3757+ bits_per_channel = 16;
3758+ break;
3759+ default:
3760+ ASSERT(bits_per_channel != 0);
3761+ bits_per_channel = 8;
3762+ break;
3763+ }
3764+
3765+ kbps = timing->pix_clk_100hz / 10;
3766+ kbps *= bits_per_channel;
3767+
3768+ if (timing->flags.Y_ONLY != 1) {
3769+ /*Only YOnly make reduce bandwidth by 1/3 compares to RGB*/
3770+ kbps *= 3;
3771+ if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420)
3772+ kbps /= 2;
3773+ else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR422)
3774+ kbps = kbps * 2 / 3;
3775+ }
3776+
3777+ return kbps;
3778+
3779+}
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+64−63
@@ -1241,29 +1241,15 @@ enum link_training_result dp_check_link_loss_status( · 1240 unmodified lines
12411241 static inline void decide_8b_10b_training_settings(
12421242 struct dc_link *link,
12431243 const struct dc_link_settings *link_setting,
1244− const struct dc_link_training_overrides *overrides,
12451244 struct link_training_settings *lt_settings)
12461245 {
1247− uint32_t lane;
1248−
12491246 memset(lt_settings, '\0', sizeof(struct link_training_settings));
12501247
12511248 /* Initialize link settings */
12521249 lt_settings->link_settings.use_link_rate_set = link_setting->use_link_rate_set;
12531250 lt_settings->link_settings.link_rate_set = link_setting->link_rate_set;
1254−
1255− if (link->preferred_link_setting.link_rate != LINK_RATE_UNKNOWN)
1256− lt_settings->link_settings.link_rate = link->preferred_link_setting.link_rate;
1257− else
1258− lt_settings->link_settings.link_rate = link_setting->link_rate;
1259−
1260− if (link->preferred_link_setting.lane_count != LANE_COUNT_UNKNOWN)
1261− lt_settings->link_settings.lane_count = link->preferred_link_setting.lane_count;
1262− else
1263− lt_settings->link_settings.lane_count = link_setting->lane_count;
1264−
1265− /*@todo[vdevulap] move SS to LS, should not be handled by displaypath*/
1266−
1251+ lt_settings->link_settings.link_rate = link_setting->link_rate;
1252+ lt_settings->link_settings.lane_count = link_setting->lane_count;
12671253 /* TODO hard coded to SS for now
12681254 * lt_settings.link_settings.link_spread =
12691255 * dal_display_path_is_ss_supported(
@@ -1271,30 +1257,52 @@ static inline void decide_8b_10b_training_settings( · 1 unmodified line
12711257 * LINK_SPREAD_05_DOWNSPREAD_30KHZ :
12721258 * LINK_SPREAD_DISABLED;
12731259 */
1274− /* Initialize link spread */
1275− if (link->dp_ss_off)
1276− lt_settings->link_settings.link_spread = LINK_SPREAD_DISABLED;
1277− else if (overrides->downspread != NULL)
1278− lt_settings->link_settings.link_spread
1279− = *overrides->downspread
1280− ? LINK_SPREAD_05_DOWNSPREAD_30KHZ
1281− : LINK_SPREAD_DISABLED;
1282− else
1283− lt_settings->link_settings.link_spread = LINK_SPREAD_05_DOWNSPREAD_30KHZ;
1284−
1260+ lt_settings->link_settings.link_spread = link->dp_ss_off ?
1261+ LINK_SPREAD_DISABLED : LINK_SPREAD_05_DOWNSPREAD_30KHZ;
12851262 lt_settings->lttpr_mode = link->lttpr_mode;
1263+ lt_settings->cr_pattern_time = get_cr_training_aux_rd_interval(link, link_setting);
1264+ lt_settings->eq_pattern_time = get_eq_training_aux_rd_interval(link, link_setting);
1265+ lt_settings->pattern_for_cr = decide_cr_training_pattern(link_setting);
1266+ lt_settings->pattern_for_eq = decide_eq_training_pattern(link, link_setting);
1267+ lt_settings->enhanced_framing = 1;
1268+ lt_settings->should_set_fec_ready = true;
1269+}
1270+
1271+void dp_decide_training_settings(
1272+ struct dc_link *link,
1273+ const struct dc_link_settings *link_settings,
1274+ struct link_training_settings *lt_settings)
1275+{
1276+ if (dp_get_link_encoding_format(link_settings) == DP_8b_10b_ENCODING)
1277+ decide_8b_10b_training_settings(link, link_settings, lt_settings);
1278+}
1279+
1280+static void override_training_settings(
1281+ struct dc_link *link,
1282+ const struct dc_link_training_overrides *overrides,
1283+ struct link_training_settings *lt_settings)
1284+{
1285+ uint32_t lane;
1286+
1287+ /* Override link settings */
1288+ if (link->preferred_link_setting.link_rate != LINK_RATE_UNKNOWN)
1289+ lt_settings->link_settings.link_rate = link->preferred_link_setting.link_rate;
1290+ if (link->preferred_link_setting.lane_count != LANE_COUNT_UNKNOWN)
1291+ lt_settings->link_settings.lane_count = link->preferred_link_setting.lane_count;
1292+
1293+ /* Override link spread */
1294+ if (!link->dp_ss_off && overrides->downspread != NULL)
1295+ lt_settings->link_settings.link_spread = *overrides->downspread ?
1296+ LINK_SPREAD_05_DOWNSPREAD_30KHZ
1297+ : LINK_SPREAD_DISABLED;
12861298
1287− /* Initialize lane settings overrides */
1299+ /* Override lane settings */
12881300 if (overrides->voltage_swing != NULL)
12891301 lt_settings->voltage_swing = overrides->voltage_swing;
1290−
12911302 if (overrides->pre_emphasis != NULL)
12921303 lt_settings->pre_emphasis = overrides->pre_emphasis;
1293−
12941304 if (overrides->post_cursor2 != NULL)
12951305 lt_settings->post_cursor2 = overrides->post_cursor2;
1296−
1297− /* Initialize lane settings (VS/PE/PC2) */
12981306 for (lane = 0; lane < LANE_COUNT_DP_MAX; lane++) {
12991307 lt_settings->lane_settings[lane].VOLTAGE_SWING =
13001308 lt_settings->voltage_swing != NULL ?
@@ -1313,45 +1321,22 @@ static inline void decide_8b_10b_training_settings( · 12 unmodified lines
13131321 /* Initialize training timings */
13141322 if (overrides->cr_pattern_time != NULL)
13151323 lt_settings->cr_pattern_time = *overrides->cr_pattern_time;
1316− else
1317− lt_settings->cr_pattern_time = get_cr_training_aux_rd_interval(link, link_setting);
13181324
13191325 if (overrides->eq_pattern_time != NULL)
13201326 lt_settings->eq_pattern_time = *overrides->eq_pattern_time;
1321− else
1322− lt_settings->eq_pattern_time = get_eq_training_aux_rd_interval(link, link_setting);
13231327
13241328 if (overrides->pattern_for_cr != NULL)
13251329 lt_settings->pattern_for_cr = *overrides->pattern_for_cr;
1326− else
1327− lt_settings->pattern_for_cr = decide_cr_training_pattern(link_setting);
13281330 if (overrides->pattern_for_eq != NULL)
13291331 lt_settings->pattern_for_eq = *overrides->pattern_for_eq;
1330− else
1331− lt_settings->pattern_for_eq = decide_eq_training_pattern(link, link_setting);
13321332
13331333 if (overrides->enhanced_framing != NULL)
13341334 lt_settings->enhanced_framing = *overrides->enhanced_framing;
1335− else
1336− lt_settings->enhanced_framing = 1;
13371335
13381336 if (link->preferred_training_settings.fec_enable != NULL)
13391337 lt_settings->should_set_fec_ready = *link->preferred_training_settings.fec_enable;
1340− else
1341− lt_settings->should_set_fec_ready = true;
1342−}
1343−
1344−void dp_decide_training_settings(
1345− struct dc_link *link,
1346− const struct dc_link_settings *link_settings,
1347− const struct dc_link_training_overrides *overrides,
1348− struct link_training_settings *lt_settings)
1349−{
1350− if (dp_get_link_encoding_format(link_settings) == DP_8b_10b_ENCODING)
1351− decide_8b_10b_training_settings(link, link_settings, overrides, lt_settings);
13521338 }
13531339
1354−
13551340 uint8_t dp_convert_to_count(uint8_t lttpr_repeater_count)
13561341 {
13571342 switch (lttpr_repeater_count) {
@@ -1581,6 +1566,9 @@ bool dc_link_dp_perform_link_training_skip_aux( · 223 unmodified lines
15811566 dp_decide_training_settings(
15821567 link,
15831568 link_setting,
1569+ &lt_settings);
1570+ override_training_settings(
1571+ link,
15841572 &link->preferred_training_settings,
15851573 &lt_settings);
15861574
@@ -1727,6 +1715,9 @@ enum link_training_result dc_link_dp_perform_link_training( · 140 unmodified lines
17271715 dp_decide_training_settings(
17281716 link,
17291717 link_settings,
1718+ &lt_settings);
1719+ override_training_settings(
1720+ link,
17301721 &link->preferred_training_settings,
17311722 &lt_settings);
17321723
@@ -1939,11 +1930,13 @@ enum link_training_result dc_link_dp_sync_lt_attempt( · 206 unmodified lines
19391930 bool fec_enable = false;
19401931
19411932 dp_decide_training_settings(
1942− link,
1943− link_settings,
1944− lt_overrides,
1945− &lt_settings);
1946−
1933+ link,
1934+ link_settings,
1935+ &lt_settings);
1936+ override_training_settings(
1937+ link,
1938+ lt_overrides,
1939+ &lt_settings);
19471940 /* Setup MST Mode */
19481941 if (lt_overrides->mst_enable)
19491942 set_dp_mst_mode(link, *lt_overrides->mst_enable);
@@ -4776,10 +4769,18 @@ void dpcd_set_source_specific_data(struct dc_link *link) · 2826 unmodified lines
47764769
47774770 uint8_t hblank_size = (uint8_t)link->dc->caps.min_horizontal_blanking_period;
47784771
4779− result_write_min_hblank = core_link_write_dpcd(link,
4780− DP_SOURCE_MINIMUM_HBLANK_SUPPORTED, (uint8_t *)(&hblank_size),
4781− sizeof(hblank_size));
4772+ if (link->preferred_link_setting.dpcd_source_device_specific_field_support) {
4773+ result_write_min_hblank = core_link_write_dpcd(link,
4774+ DP_SOURCE_MINIMUM_HBLANK_SUPPORTED, (uint8_t *)(&hblank_size),
4775+ sizeof(hblank_size));
4776+
4777+ if (result_write_min_hblank == DC_ERROR_UNEXPECTED)
4778+ link->preferred_link_setting.dpcd_source_device_specific_field_support = false;
4779+ } else {
4780+ DC_LOG_DC("Sink device does not support 00340h DPCD write. Skipping on purpose.\n");
4781+ }
47824782 }
4783+
47834784 DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
47844785 WPP_BIT_FLAG_DC_DETECTION_DP_CAPS,
47854786 "result=%u link_index=%u enum dce_version=%d DPCD=0x%04X min_hblank=%u branch_dev_id=0x%x branch_dev_name='%c%c%c%c%c%c'",
drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c+25−0
@@ -1,3 +1,28 @@
1+/*
2+ * Copyright 2021 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ * Authors: AMD
23+ *
24+ */
25+
126 #include <inc/core_status.h>
227 #include <dc_link.h>
328 #include <inc/link_hwss.h>
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c+1−1
@@ -305,7 +305,7 @@ struct link_encoder *link_enc_cfg_get_next_avail_link_enc( · 304 unmodified lines
305305 const struct dc_state *state)
306306 {
307307 struct link_encoder *link_enc = NULL;
308− enum engine_id eng_id = ENGINE_ID_UNKNOWN;
308+ enum engine_id eng_id;
309309
310310 eng_id = find_first_avail_link_enc(dc->ctx, state);
311311 if (eng_id != ENGINE_ID_UNKNOWN)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c+6−1
@@ -1030,7 +1030,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) · 1029 unmodified lines
10301030
10311031 /* Timing borders are part of vactive that we are also supposed to skip in addition
10321032 * to any stream dst offset. Since dm logic assumes dst is in addressable
1033− * space we need to add the the left and top borders to dst offsets temporarily.
1033+ * space we need to add the left and top borders to dst offsets temporarily.
10341034 * TODO: fix in DM, stream dst is supposed to be in vactive
10351035 */
10361036 pipe_ctx->stream->dst.x += timing->h_border_left;
@@ -1051,6 +1051,11 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) · 14 unmodified lines
10511051 /* depends on scaling ratios and recout, does not calculate offset yet */
10521052 calculate_viewport_size(pipe_ctx);
10531053
1054+ /* Stopgap for validation of ODM + MPO on one side of screen case */
1055+ if (pipe_ctx->plane_res.scl_data.viewport.height < 1 ||
1056+ pipe_ctx->plane_res.scl_data.viewport.width < 1)
1057+ return false;
1058+
10541059 /*
10551060 * LB calculations depend on vp size, h/v_active and scaling ratios
10561061 * Setting line buffer pixel depth to 24bpp yields banding
drivers/gpu/drm/amd/display/dc/core/dc_stat.c+24−0
@@ -62,3 +62,27 @@ void dc_stat_get_dmub_notification(const struct dc *dc, struct dmub_notification · 61 unmodified lines
6262 status = dmub_srv_stat_get_notification(dmub, notify);
6363 ASSERT(status == DMUB_STATUS_OK);
6464 }
65+
66+/**
67+ *****************************************************************************
68+ * Function: dc_stat_get_dmub_dataout
69+ *
70+ * @brief
71+ * Calls dmub layer to retrieve dmub gpint dataout
72+ *
73+ * @param
74+ * [in] dc: dc structure
75+ * [in] dataout: dmub gpint dataout
76+ *
77+ * @return
78+ * None
79+ *****************************************************************************
80+ */
81+void dc_stat_get_dmub_dataout(const struct dc *dc, uint32_t *dataout)
82+{
83+ struct dmub_srv *dmub = dc->ctx->dmub_srv->dmub;
84+ enum dmub_status status;
85+
86+ status = dmub_srv_get_gpint_dataout(dmub, dataout);
87+ ASSERT(status == DMUB_STATUS_OK);
88+}
drivers/gpu/drm/amd/display/dc/core/dc_stream.c+68−41
@@ -221,6 +221,9 @@ struct dc_stream_status *dc_stream_get_status_from_state( · 220 unmodified lines
221221 {
222222 uint8_t i;
223223
224+ if (state == NULL)
225+ return NULL;
226+
224227 for (i = 0; i < state->stream_count; i++) {
225228 if (stream == state->streams[i])
226229 return &state->stream_status[i];
@@ -243,6 +246,40 @@ struct dc_stream_status *dc_stream_get_status( · 16 unmodified lines
243246 return dc_stream_get_status_from_state(dc->current_state, stream);
244247 }
245248
249+static void program_cursor_attributes(
250+ struct dc *dc,
251+ struct dc_stream_state *stream,
252+ const struct dc_cursor_attributes *attributes)
253+{
254+ int i;
255+ struct resource_context *res_ctx;
256+ struct pipe_ctx *pipe_to_program = NULL;
257+
258+ if (!stream)
259+ return;
260+
261+ res_ctx = &dc->current_state->res_ctx;
262+
263+ for (i = 0; i < MAX_PIPES; i++) {
264+ struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
265+
266+ if (pipe_ctx->stream != stream)
267+ continue;
268+
269+ if (!pipe_to_program) {
270+ pipe_to_program = pipe_ctx;
271+ dc->hwss.cursor_lock(dc, pipe_to_program, true);
272+ }
273+
274+ dc->hwss.set_cursor_attribute(pipe_ctx);
275+ if (dc->hwss.set_cursor_sdr_white_level)
276+ dc->hwss.set_cursor_sdr_white_level(pipe_ctx);
277+ }
278+
279+ if (pipe_to_program)
280+ dc->hwss.cursor_lock(dc, pipe_to_program, false);
281+}
282+
246283 #ifndef TRIM_FSFT
247284 /*
248285 * dc_optimize_timing_for_fsft() - dc to optimize timing
@@ -267,10 +304,7 @@ bool dc_stream_set_cursor_attributes( · 18 unmodified lines
267304 struct dc_stream_state *stream,
268305 const struct dc_cursor_attributes *attributes)
269306 {
270− int i;
271307 struct dc *dc;
272− struct resource_context *res_ctx;
273− struct pipe_ctx *pipe_to_program = NULL;
274308 #if defined(CONFIG_DRM_AMD_DC_DCN)
275309 bool reset_idle_optimizations = false;
276310 #endif
@@ -290,7 +324,6 @@ bool dc_stream_set_cursor_attributes( · 13 unmodified lines
290324 }
291325
292326 dc = stream->ctx->dc;
293− res_ctx = &dc->current_state->res_ctx;
294327 stream->cursor_attributes = *attributes;
295328
296329 #if defined(CONFIG_DRM_AMD_DC_DCN)
@@ -302,11 +335,39 @@ bool dc_stream_set_cursor_attributes( · 5 unmodified lines
302335 }
303336
304337 #endif
338+ program_cursor_attributes(dc, stream, attributes);
339+
340+#if defined(CONFIG_DRM_AMD_DC_DCN)
341+ /* re-enable idle optimizations if necessary */
342+ if (reset_idle_optimizations)
343+ dc_allow_idle_optimizations(dc, true);
344+
345+#endif
346+ return true;
347+}
348+
349+static void program_cursor_position(
350+ struct dc *dc,
351+ struct dc_stream_state *stream,
352+ const struct dc_cursor_position *position)
353+{
354+ int i;
355+ struct resource_context *res_ctx;
356+ struct pipe_ctx *pipe_to_program = NULL;
357+
358+ if (!stream)
359+ return;
360+
361+ res_ctx = &dc->current_state->res_ctx;
305362
306363 for (i = 0; i < MAX_PIPES; i++) {
307364 struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
308365
309− if (pipe_ctx->stream != stream)
366+ if (pipe_ctx->stream != stream ||
367+ (!pipe_ctx->plane_res.mi && !pipe_ctx->plane_res.hubp) ||
368+ !pipe_ctx->plane_state ||
369+ (!pipe_ctx->plane_res.xfm && !pipe_ctx->plane_res.dpp) ||
370+ (!pipe_ctx->plane_res.ipp && !pipe_ctx->plane_res.dpp))
310371 continue;
311372
312373 if (!pipe_to_program) {
@@ -314,31 +375,18 @@ bool dc_stream_set_cursor_attributes( · 1 unmodified line
314375 dc->hwss.cursor_lock(dc, pipe_to_program, true);
315376 }
316377
317− dc->hwss.set_cursor_attribute(pipe_ctx);
318− if (dc->hwss.set_cursor_sdr_white_level)
319− dc->hwss.set_cursor_sdr_white_level(pipe_ctx);
378+ dc->hwss.set_cursor_position(pipe_ctx);
320379 }
321380
322381 if (pipe_to_program)
323382 dc->hwss.cursor_lock(dc, pipe_to_program, false);
324−
325−#if defined(CONFIG_DRM_AMD_DC_DCN)
326− /* re-enable idle optimizations if necessary */
327− if (reset_idle_optimizations)
328− dc_allow_idle_optimizations(dc, true);
329−
330−#endif
331− return true;
332383 }
333384
334385 bool dc_stream_set_cursor_position(
335386 struct dc_stream_state *stream,
336387 const struct dc_cursor_position *position)
337388 {
338− int i;
339389 struct dc *dc;
340− struct resource_context *res_ctx;
341− struct pipe_ctx *pipe_to_program = NULL;
342390 #if defined(CONFIG_DRM_AMD_DC_DCN)
343391 bool reset_idle_optimizations = false;
344392 #endif
@@ -354,7 +402,6 @@ bool dc_stream_set_cursor_position( · 9 unmodified lines
354402 }
355403
356404 dc = stream->ctx->dc;
357− res_ctx = &dc->current_state->res_ctx;
358405 #if defined(CONFIG_DRM_AMD_DC_DCN)
359406 dc_z10_restore(dc);
360407
@@ -367,27 +414,7 @@ bool dc_stream_set_cursor_position( · 6 unmodified lines
367414 #endif
368415 stream->cursor_position = *position;
369416
370− for (i = 0; i < MAX_PIPES; i++) {
371− struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
372−
373− if (pipe_ctx->stream != stream ||
374− (!pipe_ctx->plane_res.mi && !pipe_ctx->plane_res.hubp) ||
375− !pipe_ctx->plane_state ||
376− (!pipe_ctx->plane_res.xfm && !pipe_ctx->plane_res.dpp) ||
377− (!pipe_ctx->plane_res.ipp && !pipe_ctx->plane_res.dpp))
378− continue;
379−
380− if (!pipe_to_program) {
381− pipe_to_program = pipe_ctx;
382− dc->hwss.cursor_lock(dc, pipe_to_program, true);
383− }
384−
385− dc->hwss.set_cursor_position(pipe_ctx);
386− }
387−
388− if (pipe_to_program)
389− dc->hwss.cursor_lock(dc, pipe_to_program, false);
390−
417+ program_cursor_position(dc, stream, position);
391418 #if defined(CONFIG_DRM_AMD_DC_DCN)
392419 /* re-enable idle optimizations if necessary */
393420 if (reset_idle_optimizations)
drivers/gpu/drm/amd/display/dc/dc.h+60−60
@@ -45,7 +45,7 @@ · 44 unmodified lines
4545 /* forward declaration */
4646 struct aux_payload;
4747
48−#define DC_VER "3.2.141"
48+#define DC_VER "3.2.149"
4949
5050 #define MAX_SURFACES 3
5151 #define MAX_PLANES 6
@@ -460,7 +460,65 @@ union mem_low_power_enable_options { · 408 unmodified lines
460460 uint32_t u32All;
461461 };
462462
463+struct dc_debug_data {
464+ uint32_t ltFailCount;
465+ uint32_t i2cErrorCount;
466+ uint32_t auxErrorCount;
467+};
468+
469+struct dc_phy_addr_space_config {
470+ struct {
471+ uint64_t start_addr;
472+ uint64_t end_addr;
473+ uint64_t fb_top;
474+ uint64_t fb_offset;
475+ uint64_t fb_base;
476+ uint64_t agp_top;
477+ uint64_t agp_bot;
478+ uint64_t agp_base;
479+ } system_aperture;
480+
481+ struct {
482+ uint64_t page_table_start_addr;
483+ uint64_t page_table_end_addr;
484+ uint64_t page_table_base_addr;
485+ bool base_addr_is_mc_addr;
486+ } gart_config;
487+
488+ bool valid;
489+ bool is_hvm_enabled;
490+ uint64_t page_table_default_page_addr;
491+};
492+
493+struct dc_virtual_addr_space_config {
494+ uint64_t page_table_base_addr;
495+ uint64_t page_table_start_addr;
496+ uint64_t page_table_end_addr;
497+ uint32_t page_table_block_size_in_bytes;
498+ uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid
499+};
500+
501+struct dc_bounding_box_overrides {
502+ int sr_exit_time_ns;
503+ int sr_enter_plus_exit_time_ns;
504+ int urgent_latency_ns;
505+ int percent_of_ideal_drambw;
506+ int dram_clock_change_latency_ns;
507+ int dummy_clock_change_latency_ns;
508+ /* This forces a hard min on the DCFCLK we use
509+ * for DML. Unlike the debug option for forcing
510+ * DCFCLK, this override affects watermark calculations
511+ */
512+ int min_dcfclk_mhz;
513+};
514+
515+struct dc_state;
516+struct resource_pool;
517+struct dce_hwseq;
518+
463519 struct dc_debug_options {
520+ bool native422_support;
521+ bool disable_dsc;
464522 enum visual_confirm visual_confirm;
465523 bool sanity_checks;
466524 bool max_disp_clk;
@@ -486,7 +544,6 @@ struct dc_debug_options { · 19 unmodified lines
486544 bool disable_dsc_power_gate;
487545 int dsc_min_slice_height_override;
488546 int dsc_bpp_increment_div;
489− bool native422_support;
490547 bool disable_pplib_wm_range;
491548 enum wm_report_mode pplib_wm_report_mode;
492549 unsigned int min_disp_clk_khz;
@@ -556,7 +613,6 @@ struct dc_debug_options { · 63 unmodified lines
556613 bool validate_dml_output;
557614 bool enable_dmcub_surface_flip;
558615 bool usbc_combo_phy_reset_wa;
559− bool disable_dsc;
560616 bool enable_dram_clock_change_one_display_vactive;
561617 union mem_low_power_enable_options enable_mem_low_power;
562618 bool force_vblank_alignment;
@@ -574,69 +630,13 @@ struct dc_debug_options { · 11 unmodified lines
574630 #endif
575631 };
576632
577−struct dc_debug_data {
578− uint32_t ltFailCount;
579− uint32_t i2cErrorCount;
580− uint32_t auxErrorCount;
581−};
582−
583−struct dc_phy_addr_space_config {
584− struct {
585− uint64_t start_addr;
586− uint64_t end_addr;
587− uint64_t fb_top;
588− uint64_t fb_offset;
589− uint64_t fb_base;
590− uint64_t agp_top;
591− uint64_t agp_bot;
592− uint64_t agp_base;
593− } system_aperture;
594−
595− struct {
596− uint64_t page_table_start_addr;
597− uint64_t page_table_end_addr;
598− uint64_t page_table_base_addr;
599−#if defined(CONFIG_DRM_AMD_DC_DCN)
600− bool base_addr_is_mc_addr;
601−#endif
602− } gart_config;
603−
604− bool valid;
605− bool is_hvm_enabled;
606− uint64_t page_table_default_page_addr;
607−};
608−
609−struct dc_virtual_addr_space_config {
610− uint64_t page_table_base_addr;
611− uint64_t page_table_start_addr;
612− uint64_t page_table_end_addr;
613− uint32_t page_table_block_size_in_bytes;
614− uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid
615−};
616−
617−struct dc_bounding_box_overrides {
618− int sr_exit_time_ns;
619− int sr_enter_plus_exit_time_ns;
620− int urgent_latency_ns;
621− int percent_of_ideal_drambw;
622− int dram_clock_change_latency_ns;
623− int dummy_clock_change_latency_ns;
624− /* This forces a hard min on the DCFCLK we use
625− * for DML. Unlike the debug option for forcing
626− * DCFCLK, this override affects watermark calculations
627− */
628− int min_dcfclk_mhz;
629−};
630−
631−struct resource_pool;
632−struct dce_hwseq;
633633 struct gpu_info_soc_bounding_box_v1_0;
634634 struct dc {
635+ struct dc_debug_options debug;
635636 struct dc_versions versions;
636637 struct dc_caps caps;
637638 struct dc_cap_funcs cap_funcs;
638639 struct dc_config config;
639− struct dc_debug_options debug;
640640 struct dc_bounding_box_overrides bb_overrides;
641641 struct dc_bug_wa work_arounds;
642642 struct dc_context *ctx;
drivers/gpu/drm/amd/display/dc/dc_dp_types.h+1−0
@@ -109,6 +109,7 @@ struct dc_link_settings { · 108 unmodified lines
109109 enum dc_link_spread link_spread;
110110 bool use_link_rate_set;
111111 uint8_t link_rate_set;
112+ bool dpcd_source_device_specific_field_support;
112113 };
113114
114115 struct dc_lane_settings {
drivers/gpu/drm/amd/display/dc/dc_stat.h+1−0
@@ -38,5 +38,6 @@ · 37 unmodified lines
3838 #include "dmub/dmub_srv.h"
3939
4040 void dc_stat_get_dmub_notification(const struct dc *dc, struct dmub_notification *notify);
41+void dc_stat_get_dmub_dataout(const struct dc *dc, uint32_t *dataout);
4142
4243 #endif /* _DC_STAT_H_ */
drivers/gpu/drm/amd/display/dc/dc_trace.h+3−0
@@ -37,3 +37,6 @@ · 36 unmodified lines
3737
3838 #define TRACE_DCN_CLOCK_STATE(dcn_clocks) \
3939 trace_amdgpu_dm_dc_clocks_state(dcn_clocks)
40+
41+#define TRACE_DCN_FPU(begin, function, line, ref_count) \
42+ trace_dcn_fpu(begin, function, line, ref_count)
drivers/gpu/drm/amd/display/dc/dc_types.h+41−42
@@ -75,18 +75,6 @@ enum dce_environment { · 74 unmodified lines
7575 #define IS_DIAG_DC(dce_environment) \
7676 (IS_FPGA_MAXIMUS_DC(dce_environment) || (dce_environment == DCE_ENV_DIAG))
7777
78−struct hw_asic_id {
79− uint32_t chip_id;
80− uint32_t chip_family;
81− uint32_t pci_revision_id;
82− uint32_t hw_internal_rev;
83− uint32_t vram_type;
84− uint32_t vram_width;
85− uint32_t feature_flags;
86− uint32_t fake_paths_num;
87− void *atombios_base_address;
88−};
89−
9078 struct dc_perf_trace {
9179 unsigned long read_count;
9280 unsigned long write_count;
@@ -94,36 +82,7 @@ struct dc_perf_trace { · 1 unmodified line
9482 unsigned long last_entry_write;
9583 };
9684
97−struct dc_context {
98− struct dc *dc;
99−
100− void *driver_context; /* e.g. amdgpu_device */
101− struct dc_perf_trace *perf_trace;
102− void *cgs_device;
103−
104− enum dce_environment dce_environment;
105− struct hw_asic_id asic_id;
106−
107− /* todo: below should probably move to dc. to facilitate removal
108− * of AS we will store these here
109− */
110− enum dce_version dce_version;
111− struct dc_bios *dc_bios;
112− bool created_bios;
113− struct gpio_service *gpio_service;
114− uint32_t dc_sink_id_count;
115− uint32_t dc_stream_id_count;
116− uint32_t dc_edp_id_count;
117− uint64_t fbc_gpu_addr;
118− struct dc_dmub_srv *dmub_srv;
119−
120−#ifdef CONFIG_DRM_AMD_DC_HDCP
121− struct cp_psp cp_psp;
122−#endif
123−};
124−
125−
126−#define DC_MAX_EDID_BUFFER_SIZE 1280
85+#define DC_MAX_EDID_BUFFER_SIZE 2048
12786 #define DC_EDID_BLOCK_SIZE 128
12887 #define MAX_SURFACE_NUM 4
12988 #define NUM_PIXEL_FORMATS 10
@@ -836,6 +795,46 @@ struct dc_clock_config { · 706 unmodified lines
836795 uint32_t current_clock_khz;/*current clock in use*/
837796 };
838797
798+struct hw_asic_id {
799+ uint32_t chip_id;
800+ uint32_t chip_family;
801+ uint32_t pci_revision_id;
802+ uint32_t hw_internal_rev;
803+ uint32_t vram_type;
804+ uint32_t vram_width;
805+ uint32_t feature_flags;
806+ uint32_t fake_paths_num;
807+ void *atombios_base_address;
808+};
809+
810+struct dc_context {
811+ struct dc *dc;
812+
813+ void *driver_context; /* e.g. amdgpu_device */
814+ struct dc_perf_trace *perf_trace;
815+ void *cgs_device;
816+
817+ enum dce_environment dce_environment;
818+ struct hw_asic_id asic_id;
819+
820+ /* todo: below should probably move to dc. to facilitate removal
821+ * of AS we will store these here
822+ */
823+ enum dce_version dce_version;
824+ struct dc_bios *dc_bios;
825+ bool created_bios;
826+ struct gpio_service *gpio_service;
827+ uint32_t dc_sink_id_count;
828+ uint32_t dc_stream_id_count;
829+ uint32_t dc_edp_id_count;
830+ uint64_t fbc_gpu_addr;
831+ struct dc_dmub_srv *dmub_srv;
832+#ifdef CONFIG_DRM_AMD_DC_HDCP
833+ struct cp_psp cp_psp;
834+#endif
835+
836+};
837+
839838 /* DSC DPCD capabilities */
840839 union dsc_slice_caps1 {
841840 struct {
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c+191−9
@@ -42,6 +42,11 @@ · 41 unmodified lines
4242 #define DC_LOGGER \
4343 engine->ctx->logger
4444
45+#define DC_TRACE_LEVEL_MESSAGE(...) /* do nothing */
46+#define IS_DC_I2CAUX_LOGGING_ENABLED() (false)
47+#define LOG_FLAG_Error_I2cAux LOG_ERROR
48+#define LOG_FLAG_I2cAux_DceAux LOG_I2C_AUX
49+
4550 #include "reg_helper.h"
4651
4752 #undef FN
@@ -71,6 +76,8 @@ enum { · 23 unmodified lines
7176 #define DEFAULT_AUX_ENGINE_MULT 0
7277 #define DEFAULT_AUX_ENGINE_LENGTH 69
7378
79+#define DC_TRACE_LEVEL_MESSAGE(...) /* do nothing */
80+
7481 static void release_engine(
7582 struct dce_aux *engine)
7683 {
@@ -621,6 +628,58 @@ int dce_aux_transfer_dmub_raw(struct ddc_service *ddc, · 544 unmodified lines
621628 #define AUX_MAX_INVALID_REPLY_RETRIES 2
622629 #define AUX_MAX_TIMEOUT_RETRIES 3
623630
631+static void dce_aux_log_payload(const char *payload_name,
632+ unsigned char *payload, uint32_t length, uint32_t max_length_to_log)
633+{
634+ if (!IS_DC_I2CAUX_LOGGING_ENABLED())
635+ return;
636+
637+ if (payload && length) {
638+ char hex_str[128] = {0};
639+ char *hex_str_ptr = &hex_str[0];
640+ uint32_t hex_str_remaining = sizeof(hex_str);
641+ unsigned char *payload_ptr = payload;
642+ unsigned char *payload_max_to_log_ptr = payload_ptr + min(max_length_to_log, length);
643+ unsigned int count;
644+ char *padding = "";
645+
646+ while (payload_ptr < payload_max_to_log_ptr) {
647+ count = snprintf_count(hex_str_ptr, hex_str_remaining, "%s%02X", padding, *payload_ptr);
648+ padding = " ";
649+ hex_str_remaining -= count;
650+ hex_str_ptr += count;
651+ payload_ptr++;
652+ }
653+
654+ count = snprintf_count(hex_str_ptr, hex_str_remaining, " ");
655+ hex_str_remaining -= count;
656+ hex_str_ptr += count;
657+
658+ payload_ptr = payload;
659+ while (payload_ptr < payload_max_to_log_ptr) {
660+ count = snprintf_count(hex_str_ptr, hex_str_remaining, "%c",
661+ *payload_ptr >= ' ' ? *payload_ptr : '.');
662+ hex_str_remaining -= count;
663+ hex_str_ptr += count;
664+ payload_ptr++;
665+ }
666+
667+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_VERBOSE,
668+ LOG_FLAG_I2cAux_DceAux,
669+ "dce_aux_log_payload: %s: length=%u: data: %s%s",
670+ payload_name,
671+ length,
672+ hex_str,
673+ (length > max_length_to_log ? " (...)" : " "));
674+ } else {
675+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_VERBOSE,
676+ LOG_FLAG_I2cAux_DceAux,
677+ "dce_aux_log_payload: %s: length=%u: data: <empty payload>",
678+ payload_name,
679+ length);
680+ }
681+}
682+
624683 bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
625684 struct aux_payload *payload)
626685 {
@@ -646,7 +705,34 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · 19 unmodified lines
646705 }
647706
648707 for (i = 0; i < AUX_MAX_RETRIES; i++) {
708+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
709+ LOG_FLAG_I2cAux_DceAux,
710+ "dce_aux_transfer_with_retries: link_index=%u: START: retry %d of %d: address=0x%04x length=%u write=%d mot=%d",
711+ ddc && ddc->link ? ddc->link->link_index : UINT_MAX,
712+ i + 1,
713+ (int)AUX_MAX_RETRIES,
714+ payload->address,
715+ payload->length,
716+ (unsigned int) payload->write,
717+ (unsigned int) payload->mot);
718+ if (payload->write)
719+ dce_aux_log_payload(" write", payload->data, payload->length, 16);
649720 ret = dce_aux_transfer_raw(ddc, payload, &operation_result);
721+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
722+ LOG_FLAG_I2cAux_DceAux,
723+ "dce_aux_transfer_with_retries: link_index=%u: END: retry %d of %d: address=0x%04x length=%u write=%d mot=%d: ret=%d operation_result=%d payload->reply=%u",
724+ ddc && ddc->link ? ddc->link->link_index : UINT_MAX,
725+ i + 1,
726+ (int)AUX_MAX_RETRIES,
727+ payload->address,
728+ payload->length,
729+ (unsigned int) payload->write,
730+ (unsigned int) payload->mot,
731+ ret,
732+ (int)operation_result,
733+ (unsigned int) *payload->reply);
734+ if (!payload->write)
735+ dce_aux_log_payload(" read", payload->data, ret > 0 ? ret : 0, 16);
650736
651737 switch (operation_result) {
652738 case AUX_RET_SUCCESS:
@@ -655,30 +741,64 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · 2 unmodified lines
655741
656742 switch (*payload->reply) {
657743 case AUX_TRANSACTION_REPLY_AUX_ACK:
744+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
745+ LOG_FLAG_I2cAux_DceAux,
746+ "dce_aux_transfer_with_retries: AUX_RET_SUCCESS: AUX_TRANSACTION_REPLY_AUX_ACK");
658747 if (!payload->write && payload->length != ret) {
659− if (++aux_ack_retries >= AUX_MAX_RETRIES)
748+ if (++aux_ack_retries >= AUX_MAX_RETRIES) {
749+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_ERROR,
750+ LOG_FLAG_Error_I2cAux,
751+ "dce_aux_transfer_with_retries: FAILURE: aux_ack_retries=%d >= AUX_MAX_RETRIES=%d",
752+ aux_defer_retries,
753+ AUX_MAX_RETRIES);
660754 goto fail;
661− else
755+ } else {
662756 udelay(300);
757+ }
663758 } else
664759 return true;
665760 break;
666761
667762 case AUX_TRANSACTION_REPLY_AUX_DEFER:
763+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
764+ LOG_FLAG_I2cAux_DceAux,
765+ "dce_aux_transfer_with_retries: AUX_RET_SUCCESS: AUX_TRANSACTION_REPLY_AUX_DEFER");
766+
668767 /* polling_timeout_period is in us */
669768 defer_time_in_ms += aux110->polling_timeout_period / 1000;
670769 ++aux_defer_retries;
671770 fallthrough;
672771 case AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:
772+ if (*payload->reply == AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER)
773+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
774+ LOG_FLAG_I2cAux_DceAux,
775+ "dce_aux_transfer_with_retries: AUX_RET_SUCCESS: AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER");
776+
673777 retry_on_defer = true;
674778 fallthrough;
675779 case AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK:
780+ if (*payload->reply == AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK)
781+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
782+ LOG_FLAG_I2cAux_DceAux,
783+ "dce_aux_transfer_with_retries: AUX_RET_SUCCESS: AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK");
784+
676785 if (aux_defer_retries >= AUX_MIN_DEFER_RETRIES
677786 && defer_time_in_ms >= AUX_MAX_DEFER_TIMEOUT_MS) {
787+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_ERROR,
788+ LOG_FLAG_Error_I2cAux,
789+ "dce_aux_transfer_with_retries: FAILURE: aux_defer_retries=%d >= AUX_MIN_DEFER_RETRIES=%d && defer_time_in_ms=%d >= AUX_MAX_DEFER_TIMEOUT_MS=%d",
790+ aux_defer_retries,
791+ AUX_MIN_DEFER_RETRIES,
792+ defer_time_in_ms,
793+ AUX_MAX_DEFER_TIMEOUT_MS);
678794 goto fail;
679795 } else {
680796 if ((*payload->reply == AUX_TRANSACTION_REPLY_AUX_DEFER) ||
681797 (*payload->reply == AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER)) {
798+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
799+ LOG_FLAG_I2cAux_DceAux,
800+ "dce_aux_transfer_with_retries: payload->defer_delay=%u",
801+ payload->defer_delay);
682802 if (payload->defer_delay > 1) {
683803 msleep(payload->defer_delay);
684804 defer_time_in_ms += payload->defer_delay;
@@ -691,37 +811,86 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · 6 unmodified lines
691811 break;
692812
693813 case AUX_TRANSACTION_REPLY_I2C_DEFER:
814+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
815+ LOG_FLAG_I2cAux_DceAux,
816+ "dce_aux_transfer_with_retries: AUX_RET_SUCCESS: AUX_TRANSACTION_REPLY_I2C_DEFER");
817+
694818 aux_defer_retries = 0;
695− if (++aux_i2c_defer_retries >= AUX_MAX_I2C_DEFER_RETRIES)
819+ if (++aux_i2c_defer_retries >= AUX_MAX_I2C_DEFER_RETRIES) {
820+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_ERROR,
821+ LOG_FLAG_Error_I2cAux,
822+ "dce_aux_transfer_with_retries: FAILURE: aux_i2c_defer_retries=%d >= AUX_MAX_I2C_DEFER_RETRIES=%d",
823+ aux_i2c_defer_retries,
824+ AUX_MAX_I2C_DEFER_RETRIES);
696825 goto fail;
826+ }
697827 break;
698828
699829 case AUX_TRANSACTION_REPLY_AUX_NACK:
830+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
831+ LOG_FLAG_I2cAux_DceAux,
832+ "dce_aux_transfer_with_retries: AUX_RET_SUCCESS: AUX_TRANSACTION_REPLY_AUX_NACK");
833+ goto fail;
834+
700835 case AUX_TRANSACTION_REPLY_HPD_DISCON:
836+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
837+ LOG_FLAG_I2cAux_DceAux,
838+ "dce_aux_transfer_with_retries: AUX_RET_SUCCESS: AUX_TRANSACTION_REPLY_HPD_DISCON");
839+ goto fail;
840+
701841 default:
842+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_ERROR,
843+ LOG_FLAG_Error_I2cAux,
844+ "dce_aux_transfer_with_retries: AUX_RET_SUCCESS: FAILURE: AUX_TRANSACTION_REPLY_* unknown, default case.");
702845 goto fail;
703846 }
704847 break;
705848
706849 case AUX_RET_ERROR_INVALID_REPLY:
707− if (++aux_invalid_reply_retries >= AUX_MAX_INVALID_REPLY_RETRIES)
850+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
851+ LOG_FLAG_I2cAux_DceAux,
852+ "dce_aux_transfer_with_retries: AUX_RET_ERROR_INVALID_REPLY");
853+ if (++aux_invalid_reply_retries >= AUX_MAX_INVALID_REPLY_RETRIES) {
854+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_ERROR,
855+ LOG_FLAG_Error_I2cAux,
856+ "dce_aux_transfer_with_retries: FAILURE: aux_invalid_reply_retries=%d >= AUX_MAX_INVALID_REPLY_RETRIES=%d",
857+ aux_invalid_reply_retries,
858+ AUX_MAX_INVALID_REPLY_RETRIES);
708859 goto fail;
709− else
860+ } else
710861 udelay(400);
711862 break;
712863
713864 case AUX_RET_ERROR_TIMEOUT:
865+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
866+ LOG_FLAG_I2cAux_DceAux,
867+ "dce_aux_transfer_with_retries: AUX_RET_ERROR_TIMEOUT");
714868 // Check whether a DEFER had occurred before the timeout.
715869 // If so, treat timeout as a DEFER.
716870 if (retry_on_defer) {
717− if (++aux_defer_retries >= AUX_MIN_DEFER_RETRIES)
871+ if (++aux_defer_retries >= AUX_MIN_DEFER_RETRIES) {
872+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_ERROR,
873+ LOG_FLAG_Error_I2cAux,
874+ "dce_aux_transfer_with_retries: FAILURE: aux_defer_retries=%d >= AUX_MIN_DEFER_RETRIES=%d",
875+ aux_defer_retries,
876+ AUX_MIN_DEFER_RETRIES);
718877 goto fail;
719− else if (payload->defer_delay > 0)
878+ } else if (payload->defer_delay > 0) {
879+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
880+ LOG_FLAG_I2cAux_DceAux,
881+ "dce_aux_transfer_with_retries: payload->defer_delay=%u",
882+ payload->defer_delay);
720883 msleep(payload->defer_delay);
884+ }
721885 } else {
722− if (++aux_timeout_retries >= AUX_MAX_TIMEOUT_RETRIES)
886+ if (++aux_timeout_retries >= AUX_MAX_TIMEOUT_RETRIES) {
887+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_ERROR,
888+ LOG_FLAG_Error_I2cAux,
889+ "dce_aux_transfer_with_retries: FAILURE: aux_timeout_retries=%d >= AUX_MAX_TIMEOUT_RETRIES=%d",
890+ aux_timeout_retries,
891+ AUX_MAX_TIMEOUT_RETRIES);
723892 goto fail;
724− else {
893+ } else {
725894 /*
726895 * DP 1.4, 2.8.2: AUX Transaction Response/Reply Timeouts
727896 * According to the DP spec there should be 3 retries total
@@ -736,12 +905,25 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · 8 unmodified lines
736905 case AUX_RET_ERROR_ENGINE_ACQUIRE:
737906 case AUX_RET_ERROR_UNKNOWN:
738907 default:
908+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
909+ LOG_FLAG_I2cAux_DceAux,
910+ "dce_aux_transfer_with_retries: Failure: operation_result=%d",
911+ (int)operation_result);
739912 goto fail;
740913 }
741914 }
742915
743916 fail:
917+ DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_ERROR,

12 more lines aren’t shown here.

drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c+16−5

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h+18−1

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c+29−0

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h+4−0

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+31−22

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c+6−0

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

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.h+2−0

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

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

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.c+21−0

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.h+21−12

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c+17−0

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+8−6

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

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

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

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h+0−2

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

drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c+1−0

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

drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.h+13−1

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

drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c+1−1

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

drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c+4−1

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

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c+64−26

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

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubbub.c+1−0

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

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubbub.h+13−1

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

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c+22−15

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

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c+3−5

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

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

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

drivers/gpu/drm/amd/display/dc/dcn301/dcn301_hubbub.c+1−0

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.c+30−3

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.h+14−1

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

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c+4−18

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

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

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

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

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

drivers/gpu/drm/amd/display/dc/dml/Makefile+4−0

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

drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c+1−1

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

drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c+1−1

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

drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c+6−5

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

drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c+1−1

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

drivers/gpu/drm/amd/display/dc/dml/dcn2x/dcn2x.c+102−0

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

drivers/gpu/drm/amd/display/dc/dml/dcn2x/dcn2x.h+34−0

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

drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c+15−10

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

drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c+1−1

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

drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c+8−7

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

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

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

drivers/gpu/drm/amd/display/dc/dml/display_mode_enums.h+3−1

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

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

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

drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c+9−7

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

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

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

drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c+2−2

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

drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c+228−165

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

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

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

drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h+5−0

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

drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h+11−0

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

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

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

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

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

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

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

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

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

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

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

drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h+36−23

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

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

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

drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h+8−2

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

drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c+17−0

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c+64−11

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h+8−2

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c+0−6

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_transition.c+4−4

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c+0−3

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_transition.c+2−2

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c+74−0

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.h+0−72

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

drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c+49−60

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

drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h+10−3

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

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

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

drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_2_sh_mask.h+4−0

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

drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_2_offset.h+4−0

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

drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_2_sh_mask.h+54−0

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

drivers/gpu/drm/amd/include/asic_reg/mp/mp_11_0_8_offset.h+352−0

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

drivers/gpu/drm/amd/include/asic_reg/thm/thm_11_0_2_offset.h+6−0

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

drivers/gpu/drm/amd/include/asic_reg/thm/thm_11_0_2_sh_mask.h+3−0

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

drivers/gpu/drm/amd/include/asic_reg/umc/umc_8_7_0_sh_mask.h+100−79

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

drivers/gpu/drm/amd/include/cyan_skillfish_ip_offset.h+714−0

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

drivers/gpu/drm/amd/include/kgd_kfd_interface.h+3−0

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

drivers/gpu/drm/amd/include/kgd_pp_interface.h+2−2

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

drivers/gpu/drm/amd/pm/amdgpu_pm.c+26−22

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

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h+5−4

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

drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h+27−6

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

drivers/gpu/drm/amd/pm/inc/hwmgr.h+3−3

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

drivers/gpu/drm/amd/pm/inc/smu11_driver_if_cyan_skillfish.h+95−0

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

drivers/gpu/drm/amd/pm/inc/smu11_driver_if_sienna_cichlid.h+63−2

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

drivers/gpu/drm/amd/pm/inc/smu_types.h+1−1

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

drivers/gpu/drm/amd/pm/inc/smu_v11_0.h+14−2

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

drivers/gpu/drm/amd/pm/inc/smu_v11_8_pmfw.h+152−0

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

drivers/gpu/drm/amd/pm/inc/smu_v11_8_ppsmc.h+70−0

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

drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c+8−8

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c+12−12

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c+23−23

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c+8−13

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.h+2−2

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c+4−3

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c+22−22

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c+8−10

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.h+2−2

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c+7−7

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c+40−40

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_thermal.c+16−14

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

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_thermal.h+2−2

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

drivers/gpu/drm/amd/pm/powerplay/si_dpm.c+8−11

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

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c+62−37

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

drivers/gpu/drm/amd/pm/swsmu/smu11/Makefile+1−0

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

drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c+237−209

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

drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.c+76−0

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

drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.hrenamed from include/drm/drm_irq.h+8−11

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

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c+203−59

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

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c+269−292

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

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c+127−8

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

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c+23−23

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

drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c+10−10

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

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c+95−194

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

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c+70−32

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

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c+7−7

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

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c+243−49

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

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h+2−1

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

drivers/gpu/drm/arm/display/komeda/komeda_kms.c+0−5

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

drivers/gpu/drm/arm/hdlcd_drv.c+96−78

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

drivers/gpu/drm/arm/hdlcd_drv.h+1−0

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

drivers/gpu/drm/arm/malidp_drv.c+0−4

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

drivers/gpu/drm/armada/armada_drv.c+1−3

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

drivers/gpu/drm/armada/armada_overlay.c+0−2

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

drivers/gpu/drm/armada/armada_plane.c+0−29

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

drivers/gpu/drm/armada/armada_plane.h+0−2

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

drivers/gpu/drm/aspeed/aspeed_gfx_crtc.c+0−1

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

drivers/gpu/drm/ast/ast_drv.c+1−1

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

drivers/gpu/drm/ast/ast_drv.h+6−0

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

drivers/gpu/drm/ast/ast_main.c+5−0

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

drivers/gpu/drm/ast/ast_mode.c+39−15

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

drivers/gpu/drm/ast/ast_post.c+65−26

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

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c+47−33

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

drivers/gpu/drm/bochs/Kconfig+0−11

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

drivers/gpu/drm/bochs/Makefile+0−4

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

drivers/gpu/drm/bochs/bochs.h+0−98

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

drivers/gpu/drm/bochs/bochs_drv.c+0−205

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

drivers/gpu/drm/bochs/bochs_hw.c+0−323

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

drivers/gpu/drm/bochs/bochs_kms.c+0−178

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

drivers/gpu/drm/bochs/bochs_mm.c+0−24

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

drivers/gpu/drm/bridge/Kconfig+1−0

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

drivers/gpu/drm/bridge/adv7511/adv7533.c+1−1

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

drivers/gpu/drm/bridge/analogix/analogix_dp_core.c+1−8

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

drivers/gpu/drm/bridge/analogix/anx7625.c+26−10

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

drivers/gpu/drm/bridge/analogix/anx7625.h+3−1

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

drivers/gpu/drm/bridge/cdns-dsi.c+2−2

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

drivers/gpu/drm/bridge/ite-it66121.c+2−0

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

drivers/gpu/drm/bridge/lontium-lt8912b.c+1−1

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

drivers/gpu/drm/bridge/nwl-dsi.c+1−7

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

drivers/gpu/drm/bridge/synopsys/dw-hdmi.c+53−2

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

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c+44−24

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

drivers/gpu/drm/bridge/tc358768.c+2−2

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

drivers/gpu/drm/bridge/ti-sn65dsi83.c+113−87

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

drivers/gpu/drm/bridge/ti-sn65dsi86.c+414−346

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

drivers/gpu/drm/drm_aperture.c+13−8

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

drivers/gpu/drm/drm_atomic.c+2−2

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

drivers/gpu/drm/drm_atomic_helper.c+15−5

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

drivers/gpu/drm/drm_atomic_uapi.c+3−3

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

drivers/gpu/drm/drm_auth.c+70−26

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

drivers/gpu/drm/drm_bridge.c+11−1

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

drivers/gpu/drm/drm_bufs.c+1−1

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

drivers/gpu/drm/drm_cache.c+1−1

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

drivers/gpu/drm/drm_connector.c+4−1

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

drivers/gpu/drm/drm_crtc_internal.h+2−0

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

drivers/gpu/drm/drm_damage_helper.c+2−56

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

drivers/gpu/drm/drm_debugfs.c+2−1

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

drivers/gpu/drm/drm_debugfs_crc.c+4−4

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

drivers/gpu/drm/drm_dp_aux_bus.c+323−0

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

drivers/gpu/drm/drm_dp_helper.c+467−3

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

drivers/gpu/drm/drm_dp_mst_topology.c+6−4

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

drivers/gpu/drm/drm_drv.c+2−2

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

drivers/gpu/drm/drm_dsc.c+1−1

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

drivers/gpu/drm/drm_edid.c+2−2

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

drivers/gpu/drm/drm_fb_helper.c+1−1

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

drivers/gpu/drm/drm_file.c+4−3

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

drivers/gpu/drm/drm_format_helper.c+1−1

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

drivers/gpu/drm/drm_framebuffer.c+22−2

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

drivers/gpu/drm/drm_gem.c+5−33

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

drivers/gpu/drm/drm_gem_atomic_helper.c+59−38

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

drivers/gpu/drm/drm_gem_framebuffer_helper.c+191−8

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

drivers/gpu/drm/drm_gem_shmem_helper.c+3−3

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

drivers/gpu/drm/drm_gem_vram_helper.c+4−7

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

drivers/gpu/drm/drm_hdcp.c+1−1

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

drivers/gpu/drm/drm_ioctl.c+2−2

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

drivers/gpu/drm/drm_irq.c+9−95

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

drivers/gpu/drm/drm_lease.c+120−143

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

drivers/gpu/drm/drm_legacy_misc.c+1−2

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

drivers/gpu/drm/drm_mipi_dbi.c+61−14

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

drivers/gpu/drm/drm_mm.c+1−1

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

drivers/gpu/drm/drm_mode_object.c+1−1

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

drivers/gpu/drm/drm_modes.c+2−2

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

drivers/gpu/drm/drm_of.c+4−2

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

drivers/gpu/drm/drm_plane.c+105−1

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

drivers/gpu/drm/drm_plane_helper.c+1−1

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

drivers/gpu/drm/drm_prime.c+2−2

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

drivers/gpu/drm/drm_probe_helper.c+1−1

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

drivers/gpu/drm/drm_property.c+1−1

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

drivers/gpu/drm/drm_scdc_helper.c+1−1

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

drivers/gpu/drm/drm_simple_kms_helper.c+46−5

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

drivers/gpu/drm/drm_syncobj.c+4−4

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

drivers/gpu/drm/drm_vblank.c+18−9

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

drivers/gpu/drm/drm_vma_manager.c+1−1

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

drivers/gpu/drm/etnaviv/etnaviv_drv.c+2−12

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

drivers/gpu/drm/etnaviv/etnaviv_drv.h+0−3

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

drivers/gpu/drm/etnaviv/etnaviv_gem.c+5−13

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

drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c+0−13

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

drivers/gpu/drm/etnaviv/etnaviv_gpu.c+6−0

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

drivers/gpu/drm/etnaviv/etnaviv_hwdb.c+31−0

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

drivers/gpu/drm/etnaviv/etnaviv_sched.c+2−1

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

drivers/gpu/drm/exynos/exynos_dp.c+1−4

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

drivers/gpu/drm/exynos/exynos_drm_dma.c+2−0

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

drivers/gpu/drm/exynos/exynos_drm_drv.c+0−10

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

drivers/gpu/drm/exynos/exynos_drm_dsi.c+4−4

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

drivers/gpu/drm/exynos/exynos_drm_g2d.c+8−6

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

drivers/gpu/drm/exynos/exynos_hdmi.c+1−4

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

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c+46−32

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

drivers/gpu/drm/gma500/oaktrail_lvds.c+3−3

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

drivers/gpu/drm/gma500/power.c+1−0

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

drivers/gpu/drm/gma500/psb_drv.c+2−6

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

drivers/gpu/drm/gma500/psb_drv.h+0−5

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

drivers/gpu/drm/gma500/psb_irq.c+24−2

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

drivers/gpu/drm/gma500/psb_irq.h+2−2

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

drivers/gpu/drm/gud/gud_drv.c+41−20

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

drivers/gpu/drm/gud/gud_internal.h+2−0

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

drivers/gpu/drm/gud/gud_pipe.c+67−19

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

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c+1−2

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

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c+8−7

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

drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c+1−8

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

drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c+0−2

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

drivers/gpu/drm/hyperv/hyperv_drm_drv.c+2−2

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

drivers/gpu/drm/hyperv/hyperv_drm_modeset.c+2−2

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

drivers/gpu/drm/i810/i810_dma.c+1−2

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

drivers/gpu/drm/i915/Kconfig.debug+6−0

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

drivers/gpu/drm/i915/Makefile+11−4

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

drivers/gpu/drm/i915/display/i9xx_plane.c+1−1

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

drivers/gpu/drm/i915/display/icl_dsi.c+44−2

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

drivers/gpu/drm/i915/display/intel_acpi.c+19−0

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

drivers/gpu/drm/i915/display/intel_acpi.h+3−0

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

drivers/gpu/drm/i915/display/intel_atomic_plane.c+6−1

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

drivers/gpu/drm/i915/display/intel_atomic_plane.h+1−2

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

drivers/gpu/drm/i915/display/intel_audio.c+2−2

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

drivers/gpu/drm/i915/display/intel_bios.c+4−4

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

drivers/gpu/drm/i915/display/intel_bw.c+172−6

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

drivers/gpu/drm/i915/display/intel_cdclk.c+40−67

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

drivers/gpu/drm/i915/display/intel_color.c+2−3

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

drivers/gpu/drm/i915/display/intel_combo_phy.c+20−86

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

drivers/gpu/drm/i915/display/intel_crt.c+3−0

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

drivers/gpu/drm/i915/display/intel_crtc.c+5−5

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

drivers/gpu/drm/i915/display/intel_cursor.c+8−4

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

drivers/gpu/drm/i915/display/intel_ddi.c+275−355

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

drivers/gpu/drm/i915/display/intel_ddi.h+2−2

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

drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c+1331−1144

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

drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h+18−52

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

drivers/gpu/drm/i915/display/intel_display.c+267−118

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

drivers/gpu/drm/i915/display/intel_display.h+1−0

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

drivers/gpu/drm/i915/display/intel_display_debugfs.c+101−17

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

drivers/gpu/drm/i915/display/intel_display_power.c+255−313

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

drivers/gpu/drm/i915/display/intel_display_power.h+12−3

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

drivers/gpu/drm/i915/display/intel_display_types.h+31−3

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

drivers/gpu/drm/i915/display/intel_dmc.c+108−124

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

drivers/gpu/drm/i915/display/intel_dmc.h+18−5

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

drivers/gpu/drm/i915/display/intel_dp.c+29−36

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

drivers/gpu/drm/i915/display/intel_dp_aux.c+0−1

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

drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c+40−289

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

drivers/gpu/drm/i915/display/intel_dp_mst.c+24−19

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

drivers/gpu/drm/i915/display/intel_dpll.c+7−5

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

drivers/gpu/drm/i915/display/intel_dpll_mgr.c+134−497

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

drivers/gpu/drm/i915/display/intel_dpll_mgr.h+1−2

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

drivers/gpu/drm/i915/display/intel_fbc.c+107−112

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

drivers/gpu/drm/i915/display/intel_fbdev.c+57−39

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

drivers/gpu/drm/i915/display/intel_fdi.c+12−13

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

drivers/gpu/drm/i915/display/intel_gmbus.c+2−2

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

drivers/gpu/drm/i915/display/intel_hdmi.c+31−22

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

drivers/gpu/drm/i915/display/intel_lvds.c+2−2

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

drivers/gpu/drm/i915/display/intel_opregion.c+3−0

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

drivers/gpu/drm/i915/display/intel_psr.c+214−51

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

drivers/gpu/drm/i915/display/intel_quirks.c+34−0

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

drivers/gpu/drm/i915/display/intel_sdvo.c+2−2

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

drivers/gpu/drm/i915/display/intel_snps_phy.c+862−0

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

drivers/gpu/drm/i915/display/intel_snps_phy.h+35−0

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

drivers/gpu/drm/i915/display/intel_sprite.c+1−1

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

drivers/gpu/drm/i915/display/intel_tc.c+27−7

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

drivers/gpu/drm/i915/display/intel_tc.h+2−0

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

drivers/gpu/drm/i915/display/intel_tv.c+6−7

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

drivers/gpu/drm/i915/display/intel_vbt_defs.h+1−1

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

drivers/gpu/drm/i915/display/intel_vdsc.c+4−1

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

drivers/gpu/drm/i915/display/intel_vga.c+8−4

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

drivers/gpu/drm/i915/display/skl_scaler.c+24−25

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

drivers/gpu/drm/i915/display/skl_universal_plane.c+14−14

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

drivers/gpu/drm/i915/display/vlv_dsi.c+6−7

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

drivers/gpu/drm/i915/gem/i915_gem_clflush.c+1−3

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

drivers/gpu/drm/i915/gem/i915_gem_client_blt.c+0−355

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

drivers/gpu/drm/i915/gem/i915_gem_client_blt.h+0−21

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

drivers/gpu/drm/i915/gem/i915_gem_context.c+1302−1618

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

drivers/gpu/drm/i915/gem/i915_gem_context.h+6−0

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

drivers/gpu/drm/i915/gem/i915_gem_context_types.h+183−13

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

drivers/gpu/drm/i915/gem/i915_gem_create.c+93−95

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

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c+46−12

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

drivers/gpu/drm/i915/gem/i915_gem_domain.c+10−1

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

drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c+68−418

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

drivers/gpu/drm/i915/gem/i915_gem_internal.c+2−2

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

drivers/gpu/drm/i915/gem/i915_gem_lmem.c+74−86

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

drivers/gpu/drm/i915/gem/i915_gem_lmem.h+7−5

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

drivers/gpu/drm/i915/gem/i915_gem_mman.c+78−29

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

drivers/gpu/drm/i915/gem/i915_gem_object.c+289−61

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

drivers/gpu/drm/i915/gem/i915_gem_object.h+49−20

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

drivers/gpu/drm/i915/gem/i915_gem_object_blt.c+0−461

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

drivers/gpu/drm/i915/gem/i915_gem_object_blt.h+0−39

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

drivers/gpu/drm/i915/gem/i915_gem_object_types.h+241−14

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

drivers/gpu/drm/i915/gem/i915_gem_pages.c+34−20

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

drivers/gpu/drm/i915/gem/i915_gem_phys.c+1−1

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

drivers/gpu/drm/i915/gem/i915_gem_region.c+12−11

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

drivers/gpu/drm/i915/gem/i915_gem_region.h+1−0

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

drivers/gpu/drm/i915/gem/i915_gem_shmem.c+25−5

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

drivers/gpu/drm/i915/gem/i915_gem_stolen.c+2−2

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

drivers/gpu/drm/i915/gem/i915_gem_ttm.c+965−0

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

drivers/gpu/drm/i915/gem/i915_gem_ttm.h+49−0

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

drivers/gpu/drm/i915/gem/i915_gem_userptr.c+64−53

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

drivers/gpu/drm/i915/gem/i915_gem_wait.c+21−2

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

drivers/gpu/drm/i915/gem/selftests/huge_gem_object.c+2−2

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

drivers/gpu/drm/i915/gem/selftests/huge_pages.c+4−4

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

drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c+1−113

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

drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c+2−125

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

drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c+188−2

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

drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c+243−0

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

drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c+87−77

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

drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c+0−597

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

drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c+2−1

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

drivers/gpu/drm/i915/gem/selftests/mock_context.c+43−24

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

drivers/gpu/drm/i915/gem/selftests/mock_context.h+3−1

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

drivers/gpu/drm/i915/gt/debugfs_gt_pm.c+5−5

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

drivers/gpu/drm/i915/gt/gen8_engine_cs.c+9−8

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

drivers/gpu/drm/i915/gt/gen8_ppgtt.c+68−0

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

drivers/gpu/drm/i915/gt/intel_breadcrumbs.c+20−24

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

drivers/gpu/drm/i915/gt/intel_breadcrumbs.h+14−2

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

drivers/gpu/drm/i915/gt/intel_breadcrumbs_types.h+7−0

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

drivers/gpu/drm/i915/gt/intel_context.c+61−27

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

drivers/gpu/drm/i915/gt/intel_context.h+51−5

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

drivers/gpu/drm/i915/gt/intel_context_param.c+0−63

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

drivers/gpu/drm/i915/gt/intel_context_param.h+1−5

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

drivers/gpu/drm/i915/gt/intel_context_types.h+63−1

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

drivers/gpu/drm/i915/gt/intel_engine.h+68−19

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

drivers/gpu/drm/i915/gt/intel_engine_cs.c+261−159

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

drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c+59−15

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

drivers/gpu/drm/i915/gt/intel_engine_heartbeat.h+4−0

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

drivers/gpu/drm/i915/gt/intel_engine_pm.c+1−3

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

drivers/gpu/drm/i915/gt/intel_engine_types.h+26−67

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

drivers/gpu/drm/i915/gt/intel_engine_user.c+5−1

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

drivers/gpu/drm/i915/gt/intel_execlists_submission.c+345−259

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

drivers/gpu/drm/i915/gt/intel_execlists_submission.h+2−10

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

drivers/gpu/drm/i915/gt/intel_ggtt.c+3−3

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

drivers/gpu/drm/i915/gt/intel_gpu_commands.h+2−0

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

drivers/gpu/drm/i915/gt/intel_gt.c+194−3

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

drivers/gpu/drm/i915/gt/intel_gt.h+10−0

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

drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c+5−5

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

drivers/gpu/drm/i915/gt/intel_gt_irq.c+12−1

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

drivers/gpu/drm/i915/gt/intel_gt_pm.c+4−7

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

drivers/gpu/drm/i915/gt/intel_gt_requests.c+5−16

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

drivers/gpu/drm/i915/gt/intel_gt_requests.h+5−4

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

drivers/gpu/drm/i915/gt/intel_gt_types.h+37−0

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

drivers/gpu/drm/i915/gt/intel_gtt.c+16−4

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

drivers/gpu/drm/i915/gt/intel_gtt.h+7−11

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

drivers/gpu/drm/i915/gt/intel_lrc.c+69−48

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

drivers/gpu/drm/i915/gt/intel_lrc_reg.h+2−1

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

drivers/gpu/drm/i915/gt/intel_migrate.c+688−0

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

drivers/gpu/drm/i915/gt/intel_migrate.h+65−0

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

drivers/gpu/drm/i915/gt/intel_migrate_types.h+15−0

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

drivers/gpu/drm/i915/gt/intel_mocs.c+1−1

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

drivers/gpu/drm/i915/gt/intel_rc6.c+33−16

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

drivers/gpu/drm/i915/gt/intel_region_lmem.c+4−3

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

drivers/gpu/drm/i915/gt/intel_renderstate.h+1−0

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

drivers/gpu/drm/i915/gt/intel_reset.c+26−30

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

drivers/gpu/drm/i915/gt/intel_ring.h+1−0

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

drivers/gpu/drm/i915/gt/intel_ring_submission.c+64−6

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

drivers/gpu/drm/i915/gt/intel_rps.c+207−2

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

drivers/gpu/drm/i915/gt/intel_rps.h+10−0

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

drivers/gpu/drm/i915/gt/intel_sseu.c+42−84

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

drivers/gpu/drm/i915/gt/intel_sseu.h+8−2

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

drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c+4−4

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

drivers/gpu/drm/i915/gt/intel_workarounds.c+250−248

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

drivers/gpu/drm/i915/gt/intel_workarounds_types.h+1−0

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

drivers/gpu/drm/i915/gt/mock_engine.c+44−7

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

drivers/gpu/drm/i915/gt/selftest_context.c+10−0

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

drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c+22−0

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

drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.h+2−0

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

drivers/gpu/drm/i915/gt/selftest_engine_pm.c+2−2

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

drivers/gpu/drm/i915/gt/selftest_execlists.c+42−265

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

drivers/gpu/drm/i915/gt/selftest_hangcheck.c+253−77

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

drivers/gpu/drm/i915/gt/selftest_lrc.c+3−3

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

drivers/gpu/drm/i915/gt/selftest_migrate.c+669−0

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

drivers/gpu/drm/i915/gt/selftest_mocs.c+37−15

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

drivers/gpu/drm/i915/gt/selftest_reset.c+1−1

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

drivers/gpu/drm/i915/gt/selftest_slpc.c+311−0

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

drivers/gpu/drm/i915/gt/selftest_timeline.c+1−1

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

drivers/gpu/drm/i915/gt/selftest_workarounds.c+118−44

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

drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h+128−1

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

drivers/gpu/drm/i915/gt/uc/abi/guc_actions_slpc_abi.h+235−0

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

drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h+105−22

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

drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h+31−34

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

drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h+213−0

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

drivers/gpu/drm/i915/gt/uc/intel_guc.c+120−86

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

drivers/gpu/drm/i915/gt/uc/intel_guc.h+113−6

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

drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c+425−62

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

drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h+4−0

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

drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c+475−228

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

drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h+32−4

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

drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c+46−1

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

drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h+51−116

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

drivers/gpu/drm/i915/gt/uc/intel_guc_log.c+10−19

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

drivers/gpu/drm/i915/gt/uc/intel_guc_log.h+2−4

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

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c+80−0

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

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h+31−0

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

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c+626−0

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

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h+42−0

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

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_types.h+29−0

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

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+2604−291

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

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h+16−2

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

drivers/gpu/drm/i915/gt/uc/intel_uc.c+94−32

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

drivers/gpu/drm/i915/gt/uc/intel_uc.h+15−0

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

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c+14−13

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

drivers/gpu/drm/i915/gvt/gtt.c+1−1

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

drivers/gpu/drm/i915/gvt/scheduler.c+2−5

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

drivers/gpu/drm/i915/i915_active.c+11−26

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

drivers/gpu/drm/i915/i915_active.h+3−0

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

drivers/gpu/drm/i915/i915_buddy.c+421−0

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

drivers/gpu/drm/i915/i915_buddy.h+135−0

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

drivers/gpu/drm/i915/i915_cmd_parser.c+34−33

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

drivers/gpu/drm/i915/i915_debugfs.c+4−4

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

drivers/gpu/drm/i915/i915_debugfs_params.c+32−0

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

drivers/gpu/drm/i915/i915_drv.c+13−6

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

drivers/gpu/drm/i915/i915_drv.h+145−125

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

drivers/gpu/drm/i915/i915_gem.c+4−59

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

drivers/gpu/drm/i915/i915_gem.h+0−12

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

drivers/gpu/drm/i915/i915_gem_evict.c+1−0

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

drivers/gpu/drm/i915/i915_gem_ww.c+63−0

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

drivers/gpu/drm/i915/i915_gem_ww.h+50−0

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

drivers/gpu/drm/i915/i915_getparam.c+5−2

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

drivers/gpu/drm/i915/i915_globals.c+0−160

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

drivers/gpu/drm/i915/i915_globals.h+0−37

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

drivers/gpu/drm/i915/i915_gpu_error.c+22−5

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

drivers/gpu/drm/i915/i915_irq.c+111−67

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

drivers/gpu/drm/i915/i915_module.c+124−0

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

drivers/gpu/drm/i915/i915_pci.c+115−94

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

drivers/gpu/drm/i915/i915_pci.h+8−0

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

drivers/gpu/drm/i915/i915_perf.c+31−27

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

drivers/gpu/drm/i915/i915_perf.h+1−1

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

drivers/gpu/drm/i915/i915_pmu.c+4−2

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

drivers/gpu/drm/i915/i915_pmu.h+2−2

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

drivers/gpu/drm/i915/i915_reg.h+246−204

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

drivers/gpu/drm/i915/i915_request.c+129−170

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

drivers/gpu/drm/i915/i915_request.h+34−4

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

drivers/gpu/drm/i915/i915_scatterlist.c+80−0

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

drivers/gpu/drm/i915/i915_scatterlist.h+5−0

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

drivers/gpu/drm/i915/i915_scheduler.c+102−118

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

drivers/gpu/drm/i915/i915_scheduler.h+53−1

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

drivers/gpu/drm/i915/i915_scheduler_types.h+111−0

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

drivers/gpu/drm/i915/i915_sw_fence_work.c+1−4

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

drivers/gpu/drm/i915/i915_sw_fence_work.h+1−1

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

drivers/gpu/drm/i915/i915_sysfs.c+17−66

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

drivers/gpu/drm/i915/i915_trace.h+197−4

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

drivers/gpu/drm/i915/i915_ttm_buddy_manager.c+258−0

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

drivers/gpu/drm/i915/i915_ttm_buddy_manager.h+56−0

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

drivers/gpu/drm/i915/i915_vma.c+9−25

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

drivers/gpu/drm/i915/i915_vma.h+3−0

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

drivers/gpu/drm/i915/intel_device_info.c+21−13

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

drivers/gpu/drm/i915/intel_device_info.h+13−7

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

drivers/gpu/drm/i915/intel_dram.c+21−21

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

drivers/gpu/drm/i915/intel_memory_region.c+10−53

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

drivers/gpu/drm/i915/intel_memory_region.h+10−20

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

drivers/gpu/drm/i915/intel_pch.c+4−4

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

drivers/gpu/drm/i915/intel_pch.h+2−0

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

drivers/gpu/drm/i915/intel_pm.c+191−113

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

drivers/gpu/drm/i915/intel_region_ttm.c+58−92

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

drivers/gpu/drm/i915/intel_region_ttm.h+15−8

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

drivers/gpu/drm/i915/intel_sideband.c+9−4

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

drivers/gpu/drm/i915/intel_sideband.h+1−1

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

drivers/gpu/drm/i915/intel_step.c+130−19

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

drivers/gpu/drm/i915/intel_step.h+23−10

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

drivers/gpu/drm/i915/intel_uncore.c+370−54

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

drivers/gpu/drm/i915/intel_uncore.h+19−1

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

drivers/gpu/drm/i915/intel_wopcm.c+5−5

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

drivers/gpu/drm/i915/selftests/i915_buddy.c+787−0

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

drivers/gpu/drm/i915/selftests/i915_live_selftests.h+3−2

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

drivers/gpu/drm/i915/selftests/i915_mock_selftests.h+1−1

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

drivers/gpu/drm/i915/selftests/i915_perf_selftests.h+1−1

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

drivers/gpu/drm/i915/selftests/i915_request.c+2−2

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

drivers/gpu/drm/i915/selftests/i915_selftest.c+2−2

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

drivers/gpu/drm/i915/selftests/igt_flush_test.c+1−1

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

drivers/gpu/drm/i915/selftests/igt_live_test.c+1−1

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

drivers/gpu/drm/i915/selftests/igt_mmap.c+19−6

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

drivers/gpu/drm/i915/selftests/igt_mmap.h+7−5

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

drivers/gpu/drm/i915/selftests/intel_memory_region.c+195−62

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

drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c+88−0

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

drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h+33−0

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

drivers/gpu/drm/i915/selftests/intel_uncore.c+2−0

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

drivers/gpu/drm/i915/selftests/mock_gem_device.c+2−1

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

drivers/gpu/drm/i915/selftests/mock_gtt.c+0−1

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

drivers/gpu/drm/i915/selftests/mock_region.c+18−11

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

drivers/gpu/drm/imx/dcss/dcss-kms.c+1−7

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

drivers/gpu/drm/imx/dcss/dcss-plane.c+0−1

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

drivers/gpu/drm/imx/imx-drm-core.c+0−11

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

drivers/gpu/drm/imx/imx-ldb.c+1−3

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

drivers/gpu/drm/imx/ipuv3-plane.c+0−1

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

drivers/gpu/drm/imx/parallel-display.c+1−4

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

drivers/gpu/drm/ingenic/ingenic-drm-drv.c+6−35

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

drivers/gpu/drm/ingenic/ingenic-ipu.c+0−1

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

drivers/gpu/drm/kmb/kmb_drv.c+20−6

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

drivers/gpu/drm/kmb/kmb_dsi.c+0−1

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

drivers/gpu/drm/lima/lima_sched.c+2−1

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

drivers/gpu/drm/mcde/mcde_display.c+0−1

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

drivers/gpu/drm/mcde/mcde_dsi.c+2−9

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

drivers/gpu/drm/mediatek/Makefile+2−1

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

drivers/gpu/drm/mediatek/mtk_disp_aal.c+169−0

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

drivers/gpu/drm/mediatek/mtk_disp_drv.h+9−0

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

drivers/gpu/drm/mediatek/mtk_disp_rdma.c+3−3

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

drivers/gpu/drm/mediatek/mtk_dpi.c+1−3

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

drivers/gpu/drm/mediatek/mtk_drm_crtc.c+141−32

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

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c+4−40

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

drivers/gpu/drm/mediatek/mtk_drm_drv.c+46−19

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

drivers/gpu/drm/mediatek/mtk_drm_drv.h+1−0

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

drivers/gpu/drm/mediatek/mtk_drm_gem.c+12−32

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

drivers/gpu/drm/mediatek/mtk_drm_gem.h+0−3

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

drivers/gpu/drm/mediatek/mtk_drm_plane.c+0−1

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

drivers/gpu/drm/mediatek/mtk_dsi.c+2−2

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

drivers/gpu/drm/mediatek/mtk_hdmi.c+1−4

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

drivers/gpu/drm/meson/meson_drv.c+4−8

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

drivers/gpu/drm/meson/meson_overlay.c+0−1

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

drivers/gpu/drm/meson/meson_plane.c+0−1

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

drivers/gpu/drm/mga/mga_dma.c+1−1

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

drivers/gpu/drm/mga/mga_drv.h+0−1

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

drivers/gpu/drm/mgag200/Makefile+1−1

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

drivers/gpu/drm/mgag200/mgag200_drv.c+31−33

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

drivers/gpu/drm/mgag200/mgag200_drv.h+62−15

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

drivers/gpu/drm/mgag200/mgag200_mode.c+78−719

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

drivers/gpu/drm/mgag200/mgag200_pll.c+992−0

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

drivers/gpu/drm/mgag200/mgag200_reg.h+4−5

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

drivers/gpu/drm/msm/Kconfig+4−3

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

drivers/gpu/drm/msm/Makefile+1−0

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

drivers/gpu/drm/msm/adreno/a5xx_debugfs.c+2−2

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

drivers/gpu/drm/msm/adreno/a5xx_gpu.c+27−8

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

drivers/gpu/drm/msm/adreno/a5xx_power.c+1−1

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

drivers/gpu/drm/msm/adreno/a5xx_preempt.c+3−4

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

drivers/gpu/drm/msm/adreno/a6xx_gmu.c+14−10

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

drivers/gpu/drm/msm/adreno/a6xx_gmu.h+1−0

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

drivers/gpu/drm/msm/adreno/a6xx_gpu.c+86−51

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

drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c+2−2

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

drivers/gpu/drm/msm/adreno/a6xx_hfi.c+33−1

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

drivers/gpu/drm/msm/adreno/adreno_device.c+34−6

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

drivers/gpu/drm/msm/adreno/adreno_gpu.c+3−3

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

drivers/gpu/drm/msm/adreno/adreno_gpu.h+19−3

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

drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c+30−13

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

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c+5−7

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

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c+5−0

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

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c+6−4

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

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c+57−45

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

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c+7−3

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

drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c+41−44

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

drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c+1−1

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

drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c+3−8

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

drivers/gpu/drm/msm/disp/msm_disp_snapshot.h+0−1

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

drivers/gpu/drm/msm/dp/dp_aux.c+3−0

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

drivers/gpu/drm/msm/dp/dp_catalog.c+6−2

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

drivers/gpu/drm/msm/dp/dp_ctrl.c+89−50

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

drivers/gpu/drm/msm/dp/dp_display.c+44−32

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

drivers/gpu/drm/msm/dp/dp_link.c+18−32

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

drivers/gpu/drm/msm/dp/dp_panel.c+7−2

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

drivers/gpu/drm/msm/dp/dp_power.c+3−0

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

drivers/gpu/drm/msm/dsi/dsi.c+10−5

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

drivers/gpu/drm/msm/dsi/dsi.h+10−8

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

drivers/gpu/drm/msm/dsi/dsi.xml.h+74−0

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

drivers/gpu/drm/msm/dsi/dsi_cfg.c+24−9

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

drivers/gpu/drm/msm/dsi/dsi_cfg.h+2−1

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

drivers/gpu/drm/msm/dsi/dsi_host.c+122−47

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

drivers/gpu/drm/msm/dsi/dsi_manager.c+74−72

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

drivers/gpu/drm/msm/dsi/phy/dsi_phy.c+69−14

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

drivers/gpu/drm/msm/dsi/phy/dsi_phy.h+5−0

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

drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c+1−1

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

drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c+4−4

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

drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c+146−44

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

drivers/gpu/drm/msm/msm_drv.c+99−59

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

drivers/gpu/drm/msm/msm_drv.h+15−3

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

drivers/gpu/drm/msm/msm_fbdev.c+3−11

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

drivers/gpu/drm/msm/msm_fence.c+9−44

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

drivers/gpu/drm/msm/msm_fence.h+37−7

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

drivers/gpu/drm/msm/msm_gem.c+22−112

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

drivers/gpu/drm/msm/msm_gem.h+28−22

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

drivers/gpu/drm/msm/msm_gem_prime.c+0−11

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

drivers/gpu/drm/msm/msm_gem_submit.c+210−140

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

drivers/gpu/drm/msm/msm_gpu.c+50−170

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

drivers/gpu/drm/msm/msm_gpu.h+132−7

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

drivers/gpu/drm/msm/msm_gpu_devfreq.c+203−0

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

drivers/gpu/drm/msm/msm_kms.h+1−4

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

drivers/gpu/drm/msm/msm_rd.c+5−1

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

drivers/gpu/drm/msm/msm_ringbuffer.c+66−3

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

drivers/gpu/drm/msm/msm_ringbuffer.h+12−0

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

drivers/gpu/drm/msm/msm_submitqueue.c+40−13

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

drivers/gpu/drm/mxsfb/mxsfb_drv.c+53−31

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

drivers/gpu/drm/mxsfb/mxsfb_drv.h+3−0

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

drivers/gpu/drm/mxsfb/mxsfb_kms.c+64−10

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

drivers/gpu/drm/mxsfb/mxsfb_regs.h+9−0

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

drivers/gpu/drm/nouveau/dispnv50/disp.c+33−1

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

drivers/gpu/drm/nouveau/nouveau_backlight.c+149−17

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

drivers/gpu/drm/nouveau/nouveau_connector.h+8−1

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

drivers/gpu/drm/nouveau/nouveau_drm.c+1−4

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

drivers/gpu/drm/nouveau/nouveau_encoder.h+1−0

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

drivers/gpu/drm/nouveau/nouveau_fence.c+1−1

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

drivers/gpu/drm/nouveau/nouveau_vga.c+4−4

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

drivers/gpu/drm/omapdrm/omap_drv.c+1−5

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

drivers/gpu/drm/omapdrm/omap_drv.h+2−0

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

drivers/gpu/drm/omapdrm/omap_irq.c+3−10

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

drivers/gpu/drm/omapdrm/omap_plane.c+3−0

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

drivers/gpu/drm/panel/Kconfig+54−0

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

drivers/gpu/drm/panel/Makefile+5−0

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

drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c+1−1

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

drivers/gpu/drm/panel/panel-dsi-cm.c+1−1

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

drivers/gpu/drm/panel/panel-elida-kd35t133.c+1−1

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

drivers/gpu/drm/panel/panel-ilitek-ili9341.c+792−0

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

drivers/gpu/drm/panel/panel-innolux-ej030na.c+289−0

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

drivers/gpu/drm/panel/panel-khadas-ts050.c+1−1

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

drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c+1−1

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

drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c+1−1

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

drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c+1−1

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

drivers/gpu/drm/panel/panel-samsung-atna33xc20.c+366−0

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

drivers/gpu/drm/panel/panel-samsung-db7430.c+347−0

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

drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c+1−1

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

drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c+6−4

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

drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c+31−52

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

drivers/gpu/drm/panel/panel-samsung-s6e63m0.c+9−32

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

drivers/gpu/drm/panel/panel-samsung-s6e63m0.h+30−3

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

drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c+2−2

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

drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c+1−1

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

drivers/gpu/drm/panel/panel-simple.c+343−14

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

drivers/gpu/drm/panel/panel-sony-acx424akp.c+26−56

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

drivers/gpu/drm/panel/panel-widechips-ws2401.c+441−0

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

drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c+1−1

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

drivers/gpu/drm/panfrost/panfrost_devfreq.c+2−1

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

drivers/gpu/drm/panfrost/panfrost_device.c+94−48

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

drivers/gpu/drm/panfrost/panfrost_device.h+94−5

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

drivers/gpu/drm/panfrost/panfrost_drv.c+27−64

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

drivers/gpu/drm/panfrost/panfrost_gem.c+9−11

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

drivers/gpu/drm/panfrost/panfrost_gpu.c+1−1

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

drivers/gpu/drm/panfrost/panfrost_job.c+472−223

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

drivers/gpu/drm/panfrost/panfrost_job.h+3−5

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

drivers/gpu/drm/panfrost/panfrost_mmu.c+145−58

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

drivers/gpu/drm/panfrost/panfrost_mmu.h+3−2

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

drivers/gpu/drm/panfrost/panfrost_regs.h+0−3

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

drivers/gpu/drm/pl111/pl111_display.c+0−2

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

drivers/gpu/drm/pl111/pl111_drv.c+0−1

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

drivers/gpu/drm/qxl/qxl_drv.c+1−3

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

drivers/gpu/drm/qxl/qxl_drv.h+0−3

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

drivers/gpu/drm/qxl/qxl_irq.c+5−4

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

drivers/gpu/drm/qxl/qxl_prime.c+0−6

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

drivers/gpu/drm/r128/r128_cce.c+1−2

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

drivers/gpu/drm/radeon/atombios.h+2−2

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

drivers/gpu/drm/radeon/evergreen.c+7−1

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

drivers/gpu/drm/radeon/r100.c+9−0

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

drivers/gpu/drm/radeon/r300_reg.h+1−1

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

drivers/gpu/drm/radeon/radeon_device.c+10−9

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

drivers/gpu/drm/radeon/radeon_drv.c+1−5

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

drivers/gpu/drm/radeon/radeon_fb.c+3−5

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

drivers/gpu/drm/radeon/radeon_fence.c+2−2

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

drivers/gpu/drm/radeon/radeon_irq_kms.c+45−15

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

drivers/gpu/drm/radeon/radeon_kms.h+0−4

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

drivers/gpu/drm/radeon/radeon_vm.c+1−1

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

drivers/gpu/drm/radeon/rs600.c+7−1

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

drivers/gpu/drm/radeon/rv770.c+7−1

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

drivers/gpu/drm/rcar-du/rcar_du_drv.c+9−4

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

drivers/gpu/drm/rcar-du/rcar_du_encoder.c+21−5

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

drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c+1−0

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

drivers/gpu/drm/rcar-du/rcar_lvds.c+14−112

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

drivers/gpu/drm/rockchip/Kconfig+2−0

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

drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c+349−0

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

drivers/gpu/drm/rockchip/rockchip_drm_drv.c+1−7

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

drivers/gpu/drm/rockchip/rockchip_drm_vop.c+0−1

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

drivers/gpu/drm/rockchip/rockchip_lvds.c+1−4

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

drivers/gpu/drm/rockchip/rockchip_rgb.c+1−4

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

drivers/gpu/drm/scheduler/sched_main.c+13−8

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

drivers/gpu/drm/selftests/test-drm_damage_helper.c+71−216

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

drivers/gpu/drm/shmobile/shmob_drm_drv.c+9−5

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

drivers/gpu/drm/shmobile/shmob_drm_drv.h+1−0

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

drivers/gpu/drm/sti/sti_compositor.c+0−2

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

drivers/gpu/drm/sti/sti_dvo.c+1−3

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

drivers/gpu/drm/stm/dw_mipi_dsi-stm.c+13−4

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

drivers/gpu/drm/stm/ltdc.c+5−7

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

drivers/gpu/drm/sun4i/sun4i_drv.c+1−3

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

drivers/gpu/drm/sun4i/sun4i_layer.c+0−1

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

drivers/gpu/drm/sun4i/sun4i_lvds.c+1−3

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

drivers/gpu/drm/sun4i/sun4i_rgb.c+1−3

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

drivers/gpu/drm/sun4i/sun8i_ui_layer.c+0−1

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

drivers/gpu/drm/sun4i/sun8i_vi_layer.c+0−1

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

drivers/gpu/drm/tegra/Kconfig+1−0

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

drivers/gpu/drm/tegra/Makefile+3−0

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

drivers/gpu/drm/tegra/dc.c+356−2

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

drivers/gpu/drm/tegra/dc.h+17−0

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

drivers/gpu/drm/tegra/drm.c+63−44

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

drivers/gpu/drm/tegra/drm.h+12−0

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

drivers/gpu/drm/tegra/firewall.c+254−0

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

drivers/gpu/drm/tegra/gem.c+13−0

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

drivers/gpu/drm/tegra/gem.h+2−0

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

drivers/gpu/drm/tegra/plane.c+117−0

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

drivers/gpu/drm/tegra/plane.h+16−0

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

drivers/gpu/drm/tegra/rgb.c+1−4

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

drivers/gpu/drm/tegra/submit.c+625−0

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

drivers/gpu/drm/tegra/submit.h+21−0

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

drivers/gpu/drm/tegra/uapi.c+338−0

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

drivers/gpu/drm/tegra/uapi.h+58−0

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

drivers/gpu/drm/tegra/vic.c+51−61

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

drivers/gpu/drm/tidss/tidss_drv.c+5−10

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

drivers/gpu/drm/tidss/tidss_drv.h+2−0

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

drivers/gpu/drm/tidss/tidss_irq.c+24−6

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

drivers/gpu/drm/tidss/tidss_irq.h+1−3

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

drivers/gpu/drm/tidss/tidss_kms.c+1−3

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

drivers/gpu/drm/tidss/tidss_plane.c+0−1

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

drivers/gpu/drm/tilcdc/tilcdc_drv.c+40−11

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

drivers/gpu/drm/tilcdc/tilcdc_drv.h+3−0

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

drivers/gpu/drm/tilcdc/tilcdc_external.c+1−3

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

drivers/gpu/drm/tiny/Kconfig+15−2

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

drivers/gpu/drm/tiny/Makefile+1−0

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

drivers/gpu/drm/tiny/bochs.c+733−0

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

drivers/gpu/drm/tiny/cirrus.c+3−3

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

drivers/gpu/drm/tiny/gm12u320.c+7−16

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

drivers/gpu/drm/tiny/hx8357d.c+0−1

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

drivers/gpu/drm/tiny/ili9225.c+0−1

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

drivers/gpu/drm/tiny/ili9341.c+0−1

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

drivers/gpu/drm/tiny/ili9486.c+0−1

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

drivers/gpu/drm/tiny/mi0283qt.c+0−1

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

drivers/gpu/drm/tiny/repaper.c+4−15

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

drivers/gpu/drm/tiny/simpledrm.c+2−2

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

drivers/gpu/drm/tiny/st7586.c+6−13

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

drivers/gpu/drm/tiny/st7735r.c+0−1

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

drivers/gpu/drm/ttm/ttm_bo.c+37−29

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

drivers/gpu/drm/tve200/tve200_display.c+0−1

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

drivers/gpu/drm/udl/udl_modeset.c+10−23

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

drivers/gpu/drm/v3d/Makefile+1−0

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

drivers/gpu/drm/v3d/v3d_drv.c+8−0

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

drivers/gpu/drm/v3d/v3d_drv.h+63−0

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

drivers/gpu/drm/v3d/v3d_gem.c+31−0

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

drivers/gpu/drm/v3d/v3d_perfmon.c+213−0

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

drivers/gpu/drm/v3d/v3d_regs.h+2−0

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

drivers/gpu/drm/v3d/v3d_sched.c+21−5

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

drivers/gpu/drm/vboxvideo/vbox_drv.c+1−2

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

drivers/gpu/drm/vboxvideo/vbox_drv.h+0−1

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

drivers/gpu/drm/vboxvideo/vbox_irq.c+11−5

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

drivers/gpu/drm/vboxvideo/vbox_mode.c+2−3

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

drivers/gpu/drm/vc4/Kconfig+1−0

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

drivers/gpu/drm/vc4/vc4_drv.c+1−5

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

drivers/gpu/drm/vc4/vc4_drv.h+5−3

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

drivers/gpu/drm/vc4/vc4_dsi.c+1−3

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

drivers/gpu/drm/vc4/vc4_hdmi.c+232−218

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

drivers/gpu/drm/vc4/vc4_hdmi.h+1−4

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

drivers/gpu/drm/vc4/vc4_irq.c+38−10

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

drivers/gpu/drm/vc4/vc4_kms.c+0−1

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

drivers/gpu/drm/vc4/vc4_regs.h+30−0

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

drivers/gpu/drm/vc4/vc4_v3d.c+10−7

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

drivers/gpu/drm/via/via_mm.c+1−2

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

drivers/gpu/drm/virtio/virtgpu_drv.c+1−1

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

drivers/gpu/drm/virtio/virtgpu_drv.h+3−1

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

drivers/gpu/drm/virtio/virtgpu_plane.c+51−13

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

drivers/gpu/drm/virtio/virtgpu_prime.c+2−0

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

drivers/gpu/drm/virtio/virtgpu_vq.c+5−2

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

drivers/gpu/drm/vkms/vkms_composer.c+13−15

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

drivers/gpu/drm/vkms/vkms_drv.c+29−3

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

drivers/gpu/drm/vkms/vkms_drv.h+10−3

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

drivers/gpu/drm/vkms/vkms_plane.c+12−45

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

drivers/gpu/drm/vkms/vkms_writeback.c+16−12

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

drivers/gpu/drm/vmwgfx/Kconfig+8−0

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

drivers/gpu/drm/vmwgfx/Makefile+1−1

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

drivers/gpu/drm/vmwgfx/device_include/includeCheck.h+0−3

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

drivers/gpu/drm/vmwgfx/device_include/svga3d_caps.h+0−111

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

drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h+1459−2221

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

drivers/gpu/drm/vmwgfx/device_include/svga3d_devcaps.h+327−466

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

drivers/gpu/drm/vmwgfx/device_include/svga3d_dx.h+1580−1923

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

drivers/gpu/drm/vmwgfx/device_include/svga3d_limits.h+28−73

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

drivers/gpu/drm/vmwgfx/device_include/svga3d_reg.h+5−10

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

drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h+1513−1619

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

drivers/gpu/drm/vmwgfx/device_include/svga3d_types.h+1288−1732

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

drivers/gpu/drm/vmwgfx/device_include/svga_escape.h+17−51

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

drivers/gpu/drm/vmwgfx/device_include/svga_overlay.h+60−143

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

drivers/gpu/drm/vmwgfx/device_include/svga_reg.h+720−2127

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

drivers/gpu/drm/vmwgfx/device_include/svga_types.h+0−51

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

drivers/gpu/drm/vmwgfx/device_include/vm_basic_types.h+127−3

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

drivers/gpu/drm/vmwgfx/device_include/vmware_pack_begin.h+0−2

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

drivers/gpu/drm/vmwgfx/device_include/vmware_pack_end.h+0−2

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

drivers/gpu/drm/vmwgfx/ttm_memory.c+2−0

This diff is large: its 11 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmw_surface_cache.h+539−0

This diff is large: its 540 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_binding.c+10−14

This diff is large: its 98 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_bo.c+2−3

This diff is large: its 26 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c+4−5

This diff is large: its 30 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c+5−5

This diff is large: its 38 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c+4−3

This diff is large: its 21 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_context.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_devcaps.c+142−0

This diff is large: its 143 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_devcaps.h+50−0

This diff is large: its 51 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_drv.c+256−201

This diff is large: its 730 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_drv.h+37−13

This diff is large: its 138 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c+14−3

This diff is large: its 65 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c+34−2

This diff is large: its 43 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c+12−99

This diff is large: its 164 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_irq.c+5−19

This diff is large: its 55 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c+14−4

This diff is large: its 60 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c+1−4

This diff is large: its 19 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_mksstat.h+144−0

This diff is large: its 145 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_mob.c+23−22

This diff is large: its 104 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_msg.c+577−2

This diff is large: its 629 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_resource.c+7−4

This diff is large: its 39 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c+0−4

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_shader.c+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_so.c+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c+3−4

This diff is large: its 26 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_surface.c+42−42

This diff is large: its 262 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c+0−35

This diff is large: its 51 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_validation.c+2−2

This diff is large: its 16 lines aren’t shown here.

drivers/gpu/drm/xen/xen_drm_front_kms.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/gpu/drm/xlnx/Kconfig+2−0

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/xlnx/zynqmp_disp.c+159−161

This diff is large: its 763 lines aren’t shown here.

drivers/gpu/drm/xlnx/zynqmp_dp.c+12−10

This diff is large: its 71 lines aren’t shown here.

drivers/gpu/drm/xlnx/zynqmp_dpsub.c+0−2

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/zte/zx_drm_drv.c+0−6

This diff is large: its 13 lines aren’t shown here.

drivers/gpu/host1x/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/gpu/host1x/cdma.c+52−6

This diff is large: its 96 lines aren’t shown here.

drivers/gpu/host1x/fence.c+168−0

This diff is large: its 169 lines aren’t shown here.

drivers/gpu/host1x/fence.h+13−0

This diff is large: its 14 lines aren’t shown here.

drivers/gpu/host1x/hw/channel_hw.c+66−21

This diff is large: its 130 lines aren’t shown here.

drivers/gpu/host1x/hw/debug_hw.c+17−15

This diff is large: its 71 lines aren’t shown here.

drivers/gpu/host1x/hw/debug_hw_1x01.c+6−2

This diff is large: its 27 lines aren’t shown here.

drivers/gpu/host1x/hw/debug_hw_1x06.c+15−1

This diff is large: its 34 lines aren’t shown here.

drivers/gpu/host1x/hw/hw_host1x02_uclass.h+12−0

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/host1x/hw/hw_host1x04_uclass.h+12−0

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/host1x/hw/hw_host1x05_uclass.h+12−0

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/host1x/hw/hw_host1x06_uclass.h+12−0

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/host1x/hw/hw_host1x07_uclass.h+12−0

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/host1x/intr.c+9−0

This diff is large: its 29 lines aren’t shown here.

drivers/gpu/host1x/intr.h+2−0

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/host1x/job.c+71−27

This diff is large: its 234 lines aren’t shown here.

drivers/gpu/host1x/job.h+16−0

This diff is large: its 23 lines aren’t shown here.

drivers/gpu/host1x/syncpt.c+2−0

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/host1x/syncpt.h+12−0

This diff is large: its 24 lines aren’t shown here.

drivers/gpu/vga/vgaarb.c+23−44

This diff is large: its 151 lines aren’t shown here.

drivers/vfio/pci/vfio_pci.c+5−6

This diff is large: its 35 lines aren’t shown here.

drivers/video/fbdev/arcfb.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/video/fbdev/asiliantfb.c+3−0

This diff is large: its 10 lines aren’t shown here.

drivers/video/fbdev/core/fbmem.c+3−3

This diff is large: its 27 lines aren’t shown here.

drivers/video/fbdev/ep93xx-fb.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/video/fbdev/kyro/fbdev.c+8−0

This diff is large: its 22 lines aren’t shown here.

drivers/video/fbdev/neofb.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/video/fbdev/omap2/omapfb/dss/apply.c+1−3

This diff is large: its 18 lines aren’t shown here.

drivers/video/fbdev/riva/fbdev.c+3−0

This diff is large: its 10 lines aren’t shown here.

drivers/video/fbdev/ssd1307fb.c+104−47

This diff is large: its 232 lines aren’t shown here.

include/drm/amd_asic_type.h+9−8

This diff is large: its 24 lines aren’t shown here.

include/drm/bridge/dw_hdmi.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/drm/drm_aperture.h+9−5

This diff is large: its 40 lines aren’t shown here.

include/drm/drm_auth.h+57−11

This diff is large: its 95 lines aren’t shown here.

include/drm/drm_bridge.h+23−3

This diff is large: its 61 lines aren’t shown here.

include/drm/drm_connector.h+10−0

This diff is large: its 24 lines aren’t shown here.

include/drm/drm_damage_helper.h+0−18

This diff is large: its 30 lines aren’t shown here.

include/drm/drm_device.h+4−14

This diff is large: its 32 lines aren’t shown here.

include/drm/drm_dp_aux_bus.h+57−0

This diff is large: its 58 lines aren’t shown here.

include/drm/drm_dp_helper.h+142−33

This diff is large: its 222 lines aren’t shown here.

include/drm/drm_drv.h+4−40

This diff is large: its 65 lines aren’t shown here.

include/drm/drm_edid.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/drm/drm_file.h+19−3

This diff is large: its 35 lines aren’t shown here.

include/drm/drm_fourcc.h+9−4

This diff is large: its 48 lines aren’t shown here.

include/drm/drm_framebuffer.h+4−4

This diff is large: its 41 lines aren’t shown here.

include/drm/drm_gem.h+0−2

This diff is large: its 9 lines aren’t shown here.

include/drm/drm_gem_atomic_helper.h+16−1

This diff is large: its 38 lines aren’t shown here.

include/drm/drm_gem_framebuffer_helper.h+13−0

This diff is large: its 27 lines aren’t shown here.

include/drm/drm_gem_vram_helper.h+12−4

This diff is large: its 30 lines aren’t shown here.

include/drm/drm_legacy.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/drm/drm_mipi_dbi.h+6−1

This diff is large: its 14 lines aren’t shown here.

include/drm/drm_mipi_dsi.h+9−4

This diff is large: its 32 lines aren’t shown here.

include/drm/drm_modeset_helper_vtables.h+5−2

This diff is large: its 14 lines aren’t shown here.

include/drm/drm_panel.h+4−4

This diff is large: its 22 lines aren’t shown here.

include/drm/drm_plane.h+8−31

This diff is large: its 54 lines aren’t shown here.

include/drm/drm_print.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/drm/drm_property.h+8−1

This diff is large: its 23 lines aren’t shown here.

include/drm/drm_rect.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/drm/drm_simple_kms_helper.h+32−2

This diff is large: its 48 lines aren’t shown here.

include/drm/drm_vma_manager.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/drm/gpu_scheduler.h+36−1

This diff is large: its 65 lines aren’t shown here.

include/drm/ttm/ttm_placement.h+5−2

This diff is large: its 14 lines aren’t shown here.

include/dt-bindings/phy/phy.h+2−0

This diff is large: its 8 lines aren’t shown here.

include/linux/dma-buf.h+143−27

This diff is large: its 251 lines aren’t shown here.

include/linux/dma-fence-chain.h+46−6

This diff is large: its 79 lines aren’t shown here.

include/linux/fb.h+2−1

This diff is large: its 17 lines aren’t shown here.

include/linux/host1x.h+24−3

This diff is large: its 63 lines aren’t shown here.

include/linux/lockdep.h+21−20

This diff is large: its 60 lines aren’t shown here.

include/linux/sysfb.hrenamed from arch/x86/include/asm/sysfb.h+16−16

This diff is large: its 61 lines aren’t shown here.

include/linux/vgaarb.h+42−76

This diff is large: its 141 lines aren’t shown here.

include/uapi/drm/drm.h+12−2

This diff is large: its 28 lines aren’t shown here.

include/uapi/drm/drm_fourcc.h+106−3

This diff is large: its 123 lines aren’t shown here.

include/uapi/drm/drm_mode.h+88−4

This diff is large: its 128 lines aren’t shown here.

include/uapi/drm/i915_drm.h+417−81

This diff is large: its 623 lines aren’t shown here.

include/uapi/drm/msm_drm.h+13−1

This diff is large: its 32 lines aren’t shown here.

include/uapi/drm/tegra_drm.h+402−23

This diff is large: its 450 lines aren’t shown here.

include/uapi/drm/v3d_drm.h+136−0

This diff is large: its 171 lines aren’t shown here.

include/uapi/drm/vmwgfx_drm.h+41−0

This diff is large: its 55 lines aren’t shown here.

include/uapi/linux/dma-buf.h+49−1

This diff is large: its 58 lines aren’t shown here.

include/uapi/linux/kfd_ioctl.h+9−7

This diff is large: its 38 lines aren’t shown here.