History

Merge tag 'amd-drm-next-6.18-2025-09-26' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-6.18-2025-09-26: amdgpu: - Misc fixes - Misc cleanups - SMU 13.x fixes - MES fix - VCN 5.0.1 reset fixes - DCN 3.2 watermark fixes - AVI infoframe fixes - PSR fix - Brightness fixes - DCN 3.1.4 fixes - DCN 3.1+ DTM fixes - DCN powergating fixes - DMUB fixes - DCN/SMU cleanup - DCN stutter fixes - DCN 3.5 fixes - GAMMA_LUT fixes - Add UserQ documentation - GC 9.4 reset fixes - Enforce isolation cleanups - UserQ fixes - DC/non-DC common modes cleanup - DCE6-10 fixes amdkfd: - Fix a race in sw_fini - Switch partition fix Signed-off-by: Dave Airlie <airlied@redhat.com>

Dave Airlie committed 1 year ago

Commit b2ec5ca2 parents 62bea0e df2ba5779 files · +1195 −392Browse files

Unified · Split

79 files
  1. Documentation/gpu/amdgpu/index.rst +1 −0
  2. Documentation/gpu/amdgpu/userq.rst +203 −0
  3. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c +2 −2
  4. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c +2 −2
  5. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c +2 −2
  6. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c +2 −2
  7. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +7 −3
  8. drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h +0 −1
  9. drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +19 −22
  10. drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 −25
  11. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 −1
  12. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 −2
  13. drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +1 −10
  14. drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.h +1 −1
  15. drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +40 −26
  16. drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h +5 −6
  17. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 −4
  18. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +2 −3
  19. drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2 −0
  20. drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +1 −1
  21. drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 −1
  22. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 −13
  23. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 −1
  24. drivers/gpu/drm/amd/amdgpu/atom.c +4 −3
  25. drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +12 −0
  26. drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +6 −0
  27. drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +5 −0
  28. drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c +65 −13
  29. drivers/gpu/drm/amd/amdkfd/kfd_device.c +19 −1
  30. drivers/gpu/drm/amd/amdkfd/kfd_priv.h +2 −0
  31. drivers/gpu/drm/amd/amdkfd/kfd_process.c +4 −0
  32. drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 −1
  33. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +51 −4
  34. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +2 −0
  35. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +64 −24
  36. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +6 −2
  37. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +8 −4
  38. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +1 −1
  39. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c +2 −2
  40. drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +3 −0
  41. drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c +5 −0
  42. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr_smu_msg.c +1 −1
  43. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c +137 −5
  44. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.h +5 −0
  45. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr_smu_msg.c +3 −2
  46. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c +119 −2
  47. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c +13 −13
  48. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c +126 −4
  49. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.h +9 −1
  50. drivers/gpu/drm/amd/display/dc/core/dc.c +7 −5
  51. drivers/gpu/drm/amd/display/dc/core/dc_resource.c +6 −0
  52. drivers/gpu/drm/amd/display/dc/dc.h +2 −3
  53. drivers/gpu/drm/amd/display/dc/dc_stream.h +3 −0
  54. drivers/gpu/drm/amd/display/dc/dc_types.h +1 −0
  55. drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +21 −3
  56. drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c +1 −0
  57. drivers/gpu/drm/amd/display/dc/dm_services.h +6 −5
  58. drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn3.c +11 −10
  59. drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c +33 −5
  60. drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +1 −1
  61. drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +8 −9
  62. drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +6 −8
  63. drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +14 −0
  64. drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c +21 −4
  65. drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.h +9 −0
  66. drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c +3 −66
  67. drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c +3 −57
  68. drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c +1 −0
  69. drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +1 −0
  70. drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.h +2 −1
  71. drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +5 −1
  72. drivers/gpu/drm/amd/include/mes_v11_api_def.h +2 −1
  73. drivers/gpu/drm/amd/include/mes_v12_api_def.h +2 −1
  74. drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_12_ppsmc.h +2 −1
  75. drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0_0_pptable.h +0 −0
  76. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c +1 −0
  77. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +3 −0
  78. drivers/gpu/drm/amd/ras/rascore/Makefile +0 −0
  79. drivers/gpu/drm/amd/ras/rascore/ras_core_status.h +37 −0
Documentation/gpu/amdgpu/index.rst+1−0
@@ -12,6 +12,7 @@ Next (GCN), Radeon DNA (RDNA), and Compute DNA (CDNA) architectures. · 11 unmodified lines
1212 module-parameters
1313 gc/index
1414 display/index
15+ userq
1516 flashing
1617 xgmi
1718 ras
Documentation/gpu/amdgpu/userq.rst+203−0
@@ -0,0 +1,203 @@
1+==================
2+ User Mode Queues
3+==================
4+
5+Introduction
6+============
7+
8+Similar to the KFD, GPU engine queues move into userspace. The idea is to let
9+user processes manage their submissions to the GPU engines directly, bypassing
10+IOCTL calls to the driver to submit work. This reduces overhead and also allows
11+the GPU to submit work to itself. Applications can set up work graphs of jobs
12+across multiple GPU engines without needing trips through the CPU.
13+
14+UMDs directly interface with firmware via per application shared memory areas.
15+The main vehicle for this is queue. A queue is a ring buffer with a read
16+pointer (rptr) and a write pointer (wptr). The UMD writes IP specific packets
17+into the queue and the firmware processes those packets, kicking off work on the
18+GPU engines. The CPU in the application (or another queue or device) updates
19+the wptr to tell the firmware how far into the ring buffer to process packets
20+and the rtpr provides feedback to the UMD on how far the firmware has progressed
21+in executing those packets. When the wptr and the rptr are equal, the queue is
22+idle.
23+
24+Theory of Operation
25+===================
26+
27+The various engines on modern AMD GPUs support multiple queues per engine with a
28+scheduling firmware which handles dynamically scheduling user queues on the
29+available hardware queue slots. When the number of user queues outnumbers the
30+available hardware queue slots, the scheduling firmware dynamically maps and
31+unmaps queues based on priority and time quanta. The state of each user queue
32+is managed in the kernel driver in an MQD (Memory Queue Descriptor). This is a
33+buffer in GPU accessible memory that stores the state of a user queue. The
34+scheduling firmware uses the MQD to load the queue state into an HQD (Hardware
35+Queue Descriptor) when a user queue is mapped. Each user queue requires a
36+number of additional buffers which represent the ring buffer and any metadata
37+needed by the engine for runtime operation. On most engines this consists of
38+the ring buffer itself, a rptr buffer (where the firmware will shadow the rptr
39+to userspace), a wptr buffer (where the application will write the wptr for the
40+firmware to fetch it), and a doorbell. A doorbell is a piece of one of the
41+device's MMIO BARs which can be mapped to specific user queues. When the
42+application writes to the doorbell, it will signal the firmware to take some
43+action. Writing to the doorbell wakes the firmware and causes it to fetch the
44+wptr and start processing the packets in the queue. Each 4K page of the doorbell
45+BAR supports specific offset ranges for specific engines. The doorbell of a
46+queue must be mapped into the aperture aligned to the IP used by the queue
47+(e.g., GFX, VCN, SDMA, etc.). These doorbell apertures are set up via NBIO
48+registers. Doorbells are 32 bit or 64 bit (depending on the engine) chunks of
49+the doorbell BAR. A 4K doorbell page provides 512 64-bit doorbells for up to
50+512 user queues. A subset of each page is reserved for each IP type supported
51+on the device. The user can query the doorbell ranges for each IP via the INFO
52+IOCTL. See the IOCTL Interfaces section for more information.
53+
54+When an application wants to create a user queue, it allocates the necessary
55+buffers for the queue (ring buffer, wptr and rptr, context save areas, etc.).
56+These can be separate buffers or all part of one larger buffer. The application
57+would map the buffer(s) into its GPUVM and use the GPU virtual addresses of for
58+the areas of memory they want to use for the user queue. They would also
59+allocate a doorbell page for the doorbells used by the user queues. The
60+application would then populate the MQD in the USERQ IOCTL structure with the
61+GPU virtual addresses and doorbell index they want to use. The user can also
62+specify the attributes for the user queue (priority, whether the queue is secure
63+for protected content, etc.). The application would then call the USERQ
64+CREATE IOCTL to create the queue using the specified MQD details in the IOCTL.
65+The kernel driver then validates the MQD provided by the application and
66+translates the MQD into the engine specific MQD format for the IP. The IP
67+specific MQD would be allocated and the queue would be added to the run list
68+maintained by the scheduling firmware. Once the queue has been created, the
69+application can write packets directly into the queue, update the wptr, and
70+write to the doorbell offset to kick off work in the user queue.
71+
72+When the application is done with the user queue, it would call the USERQ
73+FREE IOCTL to destroy it. The kernel driver would preempt the queue and
74+remove it from the scheduling firmware's run list. Then the IP specific MQD
75+would be freed and the user queue state would be cleaned up.
76+
77+Some engines may require the aggregated doorbell too if the engine does not
78+support doorbells from unmapped queues. The aggregated doorbell is a special
79+page of doorbell space which wakes the scheduler. In cases where the engine may
80+be oversubscribed, some queues may not be mapped. If the doorbell is rung when
81+the queue is not mapped, the engine firmware may miss the request. Some
82+scheduling firmware may work around this by polling wptr shadows when the
83+hardware is oversubscribed, other engines may support doorbell updates from
84+unmapped queues. In the event that one of these options is not available, the
85+kernel driver will map a page of aggregated doorbell space into each GPUVM
86+space. The UMD will then update the doorbell and wptr as normal and then write
87+to the aggregated doorbell as well.
88+
89+Special Packets
90+---------------
91+
92+In order to support legacy implicit synchronization, as well as mixed user and
93+kernel queues, we need a synchronization mechanism that is secure. Because
94+kernel queues or memory management tasks depend on kernel fences, we need a way
95+for user queues to update memory that the kernel can use for a fence, that can't
96+be messed with by a bad actor. To support this, we've added a protected fence
97+packet. This packet works by writing a monotonically increasing value to
98+a memory location that only privileged clients have write access to. User
99+queues only have read access. When this packet is executed, the memory location
100+is updated and other queues (kernel or user) can see the results. The
101+user application would submit this packet in their command stream. The actual
102+packet format varies from IP to IP (GFX/Compute, SDMA, VCN, etc.), but the
103+behavior is the same. The packet submission is handled in userspace. The
104+kernel driver sets up the privileged memory used for each user queue when it
105+sets the queues up when the application creates them.
106+
107+
108+Memory Management
109+=================
110+
111+It is assumed that all buffers mapped into the GPUVM space for the process are
112+valid when engines on the GPU are running. The kernel driver will only allow
113+user queues to run when all buffers are mapped. If there is a memory event that
114+requires buffer migration, the kernel driver will preempt the user queues,
115+migrate buffers to where they need to be, update the GPUVM page tables and
116+invaldidate the TLB, and then resume the user queues.
117+
118+Interaction with Kernel Queues
119+==============================
120+
121+Depending on the IP and the scheduling firmware, you can enable kernel queues
122+and user queues at the same time, however, you are limited by the HQD slots.
123+Kernel queues are always mapped so any work that goes into kernel queues will
124+take priority. This limits the available HQD slots for user queues.
125+
126+Not all IPs will support user queues on all GPUs. As such, UMDs will need to
127+support both user queues and kernel queues depending on the IP. For example, a
128+GPU may support user queues for GFX, compute, and SDMA, but not for VCN, JPEG,
129+and VPE. UMDs need to support both. The kernel driver provides a way to
130+determine if user queues and kernel queues are supported on a per IP basis.
131+UMDs can query this information via the INFO IOCTL and determine whether to use
132+kernel queues or user queues for each IP.
133+
134+Queue Resets
135+============
136+
137+For most engines, queues can be reset individually. GFX, compute, and SDMA
138+queues can be reset individually. When a hung queue is detected, it can be
139+reset either via the scheduling firmware or MMIO. Since there are no kernel
140+fences for most user queues, they will usually only be detected when some other
141+event happens; e.g., a memory event which requires migration of buffers. When
142+the queues are preempted, if the queue is hung, the preemption will fail.
143+Driver will then look up the queues that failed to preempt and reset them and
144+record which queues are hung.
145+
146+On the UMD side, we will add a USERQ QUERY_STATUS IOCTL to query the queue
147+status. UMD will provide the queue id in the IOCTL and the kernel driver
148+will check if it has already recorded the queue as hung (e.g., due to failed
149+peemption) and report back the status.
150+
151+IOCTL Interfaces
152+================
153+
154+GPU virtual addresses used for queues and related data (rptrs, wptrs, context
155+save areas, etc.) should be validated by the kernel mode driver to prevent the
156+user from specifying invalid GPU virtual addresses. If the user provides
157+invalid GPU virtual addresses or doorbell indicies, the IOCTL should return an
158+error message. These buffers should also be tracked in the kernel driver so
159+that if the user attempts to unmap the buffer(s) from the GPUVM, the umap call
160+would return an error.
161+
162+INFO
163+----
164+There are several new INFO queries related to user queues in order to query the
165+size of user queue meta data needed for a user queue (e.g., context save areas
166+or shadow buffers), whether kernel or user queues or both are supported
167+for each IP type, and the offsets for each IP type in each doorbell page.
168+
169+USERQ
170+-----
171+The USERQ IOCTL is used for creating, freeing, and querying the status of user
172+queues. It supports 3 opcodes:
173+
174+1. CREATE - Create a user queue. The application provides an MQD-like structure
175+ that defines the type of queue and associated metadata and flags for that
176+ queue type. Returns the queue id.
177+2. FREE - Free a user queue.
178+3. QUERY_STATUS - Query that status of a queue. Used to check if the queue is
179+ healthy or not. E.g., if the queue has been reset. (WIP)
180+
181+USERQ_SIGNAL
182+------------
183+The USERQ_SIGNAL IOCTL is used to provide a list of sync objects to be signaled.
184+
185+USERQ_WAIT
186+----------
187+The USERQ_WAIT IOCTL is used to provide a list of sync object to be waited on.
188+
189+Kernel and User Queues
190+======================
191+
192+In order to properly validate and test performance, we have a driver option to
193+select what type of queues are enabled (kernel queues, user queues or both).
194+The user_queue driver parameter allows you to enable kernel queues only (0),
195+user queues and kernel queues (1), and user queues only (2). Enabling user
196+queues only will free up static queue assignments that would otherwise be used
197+by kernel queues for use by the scheduling firmware. Some kernel queues are
198+required for kernel driver operation and they will always be created. When the
199+kernel queues are not enabled, they are not registered with the drm scheduler
200+and the CS IOCTL will reject any incoming command submissions which target those
201+queue types. Kernel queues only mirrors the behavior on all existing GPUs.
202+Enabling both queues allows for backwards compatibility with old userspace while
203+still supporting user queues.
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c+2−2
@@ -352,7 +352,7 @@ static int kgd_hqd_dump(struct amdgpu_device *adev, · 351 unmodified lines
352352 (*dump)[i++][1] = RREG32_SOC15_IP(GC, addr); \
353353 } while (0)
354354
355− *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
355+ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL);
356356 if (*dump == NULL)
357357 return -ENOMEM;
358358
@@ -449,7 +449,7 @@ static int kgd_hqd_sdma_dump(struct amdgpu_device *adev, · 90 unmodified lines
449449 #undef HQD_N_REGS
450450 #define HQD_N_REGS (19+6+7+10)
451451
452− *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
452+ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL);
453453 if (*dump == NULL)
454454 return -ENOMEM;
455455
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c+2−2
@@ -338,7 +338,7 @@ static int hqd_dump_v10_3(struct amdgpu_device *adev, · 337 unmodified lines
338338 (*dump)[i++][1] = RREG32_SOC15_IP(GC, addr); \
339339 } while (0)
340340
341− *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
341+ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL);
342342 if (*dump == NULL)
343343 return -ENOMEM;
344344
@@ -435,7 +435,7 @@ static int hqd_sdma_dump_v10_3(struct amdgpu_device *adev, · 90 unmodified lines
435435 #undef HQD_N_REGS
436436 #define HQD_N_REGS (19+6+7+12)
437437
438− *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
438+ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL);
439439 if (*dump == NULL)
440440 return -ENOMEM;
441441
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c+2−2
@@ -323,7 +323,7 @@ static int hqd_dump_v11(struct amdgpu_device *adev, · 322 unmodified lines
323323 (*dump)[i++][1] = RREG32(addr); \
324324 } while (0)
325325
326− *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
326+ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL);
327327 if (*dump == NULL)
328328 return -ENOMEM;
329329
@@ -420,7 +420,7 @@ static int hqd_sdma_dump_v11(struct amdgpu_device *adev, · 90 unmodified lines
420420 #undef HQD_N_REGS
421421 #define HQD_N_REGS (7+11+1+12+12)
422422
423− *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
423+ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL);
424424 if (*dump == NULL)
425425 return -ENOMEM;
426426
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c+2−2
@@ -115,7 +115,7 @@ static int hqd_dump_v12(struct amdgpu_device *adev, · 114 unmodified lines
115115 (*dump)[i++][1] = RREG32(addr); \
116116 } while (0)
117117
118− *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
118+ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL);
119119 if (*dump == NULL)
120120 return -ENOMEM;
121121
@@ -146,7 +146,7 @@ static int hqd_sdma_dump_v12(struct amdgpu_device *adev, · 24 unmodified lines
146146 #undef HQD_N_REGS
147147 #define HQD_N_REGS (last_reg - first_reg + 1)
148148
149− *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
149+ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL);
150150 if (*dump == NULL)
151151 return -ENOMEM;
152152
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c+7−3
@@ -1089,7 +1089,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr, · 1088 unmodified lines
10891089 return 0;
10901090 }
10911091
1092− ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages, &range);
1092+ ret = amdgpu_ttm_tt_get_user_pages(bo, &range);
10931093 if (ret) {
10941094 if (ret == -EAGAIN)
10951095 pr_debug("Failed to get user pages, try again\n");
@@ -1103,6 +1103,9 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr, · 7 unmodified lines
11031103 pr_err("%s: Failed to reserve BO\n", __func__);
11041104 goto release_out;
11051105 }
1106+
1107+ amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, range);
1108+
11061109 amdgpu_bo_placement_from_domain(bo, mem->domain);
11071110 ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
11081111 if (ret)
@@ -2565,8 +2568,7 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info, · 1456 unmodified lines
25652568 }
25662569
25672570 /* Get updated user pages */
2568− ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages,
2569− &mem->range);
2571+ ret = amdgpu_ttm_tt_get_user_pages(bo, &mem->range);
25702572 if (ret) {
25712573 pr_debug("Failed %d to get user pages\n", ret);
25722574
@@ -2595,6 +2597,8 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info, · 22 unmodified lines
25952597 ret = 0;
25962598 }
25972599
2600+ amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, mem->range);
2601+
25982602 mutex_lock(&process_info->notifier_lock);
25992603
26002604 /* Mark the BO as valid unless it was invalidated
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h+0−1
@@ -38,7 +38,6 @@ struct amdgpu_bo_list_entry { · 37 unmodified lines
3838 struct amdgpu_bo *bo;
3939 struct amdgpu_bo_va *bo_va;
4040 uint32_t priority;
41− struct page **user_pages;
4241 struct hmm_range *range;
4342 bool user_invalidated;
4443 };
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c+19−22
@@ -398,30 +398,28 @@ static void amdgpu_connector_add_common_modes(struct drm_encoder *encoder, · 397 unmodified lines
398398 struct drm_display_mode *mode = NULL;
399399 struct drm_display_mode *native_mode = &amdgpu_encoder->native_mode;
400400 int i;
401− static const struct mode_size {
401+ int n;
402+ struct mode_size {
403+ char name[DRM_DISPLAY_MODE_LEN];
402404 int w;
403405 int h;
404− } common_modes[17] = {
405− { 640, 480},
406− { 720, 480},
407− { 800, 600},
408− { 848, 480},
409− {1024, 768},
410− {1152, 768},
411− {1280, 720},
412− {1280, 800},
413− {1280, 854},
414− {1280, 960},
415− {1280, 1024},
416− {1440, 900},
417− {1400, 1050},
418− {1680, 1050},
419− {1600, 1200},
420− {1920, 1080},
421− {1920, 1200}
406+ } common_modes[] = {
407+ { "640x480", 640, 480},
408+ { "800x600", 800, 600},
409+ { "1024x768", 1024, 768},
410+ { "1280x720", 1280, 720},
411+ { "1280x800", 1280, 800},
412+ {"1280x1024", 1280, 1024},
413+ { "1440x900", 1440, 900},
414+ {"1680x1050", 1680, 1050},
415+ {"1600x1200", 1600, 1200},
416+ {"1920x1080", 1920, 1080},
417+ {"1920x1200", 1920, 1200}
422418 };
423419
424− for (i = 0; i < 17; i++) {
420+ n = ARRAY_SIZE(common_modes);
421+
422+ for (i = 0; i < n; i++) {
425423 if (amdgpu_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) {
426424 if (common_modes[i].w > 1024 ||
427425 common_modes[i].h > 768)
@@ -434,12 +432,11 @@ static void amdgpu_connector_add_common_modes(struct drm_encoder *encoder, · 6 unmodified lines
434432 common_modes[i].h == native_mode->vdisplay))
435433 continue;
436434 }
437− if (common_modes[i].w < 320 || common_modes[i].h < 200)
438− continue;
439435
440436 mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false);
441437 if (!mode)
442438 return;
439+ strscpy(mode->name, common_modes[i].name, DRM_DISPLAY_MODE_LEN);
443440
444441 drm_mode_probed_add(connector, mode);
445442 }
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c+6−25
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/pagemap.h>
3030 #include <linux/sync_file.h>
3131 #include <linux/dma-buf.h>
32+#include <linux/hmm.h>
3233
3334 #include <drm/amdgpu_drm.h>
3435 #include <drm/drm_syncobj.h>
@@ -883,26 +884,13 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 848 unmodified lines
883884 amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) {
884885 bool userpage_invalidated = false;
885886 struct amdgpu_bo *bo = e->bo;
886− int i;
887−
888− e->user_pages = kvcalloc(bo->tbo.ttm->num_pages,
889− sizeof(struct page *),
890− GFP_KERNEL);
891− if (!e->user_pages) {
892− drm_err(adev_to_drm(p->adev), "kvmalloc_array failure\n");
893− r = -ENOMEM;
894− goto out_free_user_pages;
895− }
896887
897− r = amdgpu_ttm_tt_get_user_pages(bo, e->user_pages, &e->range);
898− if (r) {
899− kvfree(e->user_pages);
900− e->user_pages = NULL;
888+ r = amdgpu_ttm_tt_get_user_pages(bo, &e->range);
889+ if (r)
901890 goto out_free_user_pages;
902− }
903891
904892 for (i = 0; i < bo->tbo.ttm->num_pages; i++) {
905− if (bo->tbo.ttm->pages[i] != e->user_pages[i]) {
893+ if (bo->tbo.ttm->pages[i] != hmm_pfn_to_page(e->range->hmm_pfns[i])) {
906894 userpage_invalidated = true;
907895 break;
908896 }
@@ -946,7 +934,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 37 unmodified lines
946934 }
947935
948936 if (amdgpu_ttm_tt_is_userptr(e->bo->tbo.ttm) &&
949− e->user_invalidated && e->user_pages) {
937+ e->user_invalidated) {
950938 amdgpu_bo_placement_from_domain(e->bo,
951939 AMDGPU_GEM_DOMAIN_CPU);
952940 r = ttm_bo_validate(&e->bo->tbo, &e->bo->placement,
@@ -955,11 +943,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 2 unmodified lines
955943 goto out_free_user_pages;
956944
957945 amdgpu_ttm_tt_set_user_pages(e->bo->tbo.ttm,
958− e->user_pages);
946+ e->range);
959947 }
960−
961− kvfree(e->user_pages);
962− e->user_pages = NULL;
963948 }
964949
965950 amdgpu_cs_get_threshold_for_moves(p->adev, &p->bytes_moved_threshold,
@@ -1001,11 +986,7 @@ out_free_user_pages: · 35 unmodified lines
1001986 amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) {
1002987 struct amdgpu_bo *bo = e->bo;
1003988
1004− if (!e->user_pages)
1005− continue;
1006989 amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, e->range);
1007− kvfree(e->user_pages);
1008− e->user_pages = NULL;
1009990 e->range = NULL;
1010991 }
1011992 mutex_unlock(&p->bo_list->bo_list_mutex);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+1−1
@@ -960,7 +960,7 @@ module_param_named(tmz, amdgpu_tmz, int, 0444); · 959 unmodified lines
960960 */
961961 MODULE_PARM_DESC(
962962 freesync_video,
963− "Enable freesync modesetting optimization feature (0 = off (default), 1 = on)");
963+ "Adds additional modes via VRR for refresh changes without a full modeset (0 = off (default), 1 = on)");
964964 module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444);
965965
966966 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+3−2
@@ -572,8 +572,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, · 571 unmodified lines
572572 goto release_object;
573573
574574 if (args->flags & AMDGPU_GEM_USERPTR_VALIDATE) {
575− r = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages,
576− &range);
575+ r = amdgpu_ttm_tt_get_user_pages(bo, &range);
577576 if (r)
578577 goto release_object;
579578
@@ -581,6 +580,8 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, · 1 unmodified line
581580 if (r)
582581 goto user_pages_done;
583582
583+ amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, range);
584+
584585 amdgpu_bo_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_GTT);
585586 r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
586587 amdgpu_bo_unreserve(bo);
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c+1−10
@@ -167,13 +167,12 @@ void amdgpu_hmm_unregister(struct amdgpu_bo *bo) · 166 unmodified lines
167167
168168 int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
169169 uint64_t start, uint64_t npages, bool readonly,
170− void *owner, struct page **pages,
170+ void *owner,
171171 struct hmm_range **phmm_range)
172172 {
173173 struct hmm_range *hmm_range;
174174 unsigned long end;
175175 unsigned long timeout;
176− unsigned long i;
177176 unsigned long *pfns;
178177 int r = 0;
179178
@@ -222,14 +221,6 @@ retry: · 42 unmodified lines
222221 hmm_range->start = start;
223222 hmm_range->hmm_pfns = pfns;
224223
225− /*
226− * Due to default_flags, all pages are HMM_PFN_VALID or
227− * hmm_range_fault() fails. FIXME: The pages cannot be touched outside
228− * the notifier_lock, and mmu_interval_read_retry() must be done first.
229− */
230− for (i = 0; pages && i < npages; i++)
231− pages[i] = hmm_pfn_to_page(pfns[i]);
232−
233224 *phmm_range = hmm_range;
234225
235226 return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.h+1−1
@@ -33,7 +33,7 @@ · 32 unmodified lines
3333
3434 int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
3535 uint64_t start, uint64_t npages, bool readonly,
36− void *owner, struct page **pages,
36+ void *owner,
3737 struct hmm_range **phmm_range);
3838 bool amdgpu_hmm_range_get_pages_done(struct hmm_range *hmm_range);
3939
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c+40−26
@@ -275,13 +275,12 @@ static int amdgpu_vmid_grab_reserved(struct amdgpu_vm *vm, · 274 unmodified lines
275275 {
276276 struct amdgpu_device *adev = ring->adev;
277277 unsigned vmhub = ring->vm_hub;
278− struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];
279278 uint64_t fence_context = adev->fence_context + ring->idx;
280279 bool needs_flush = vm->use_cpu_for_update;
281280 uint64_t updates = amdgpu_vm_tlb_seq(vm);
282281 int r;
283282
284− *id = id_mgr->reserved;
283+ *id = vm->reserved_vmid[vmhub];
285284 if ((*id)->owner != vm->immediate.fence_context ||
286285 !amdgpu_vmid_compatible(*id, job) ||
287286 (*id)->flushed_updates < updates ||
@@ -474,40 +473,61 @@ bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub) · 186 unmodified lines
474473 return vm->reserved_vmid[vmhub];
475474 }
476475
477−int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev,
476+/*
477+ * amdgpu_vmid_alloc_reserved - reserve a specific VMID for this vm
478+ * @adev: amdgpu device structure
479+ * @vm: the VM to reserve an ID for
480+ * @vmhub: the VMHUB which should be used
481+ *
482+ * Mostly used to have a reserved VMID for debugging and SPM.
483+ *
484+ * Returns: 0 for success, -ENOENT if an ID is already reserved.
485+ */
486+int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm,
478487 unsigned vmhub)
479488 {
480489 struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];
490+ struct amdgpu_vmid *id;
491+ int r = 0;
481492
482493 mutex_lock(&id_mgr->lock);
483−
484− ++id_mgr->reserved_use_count;
485− if (!id_mgr->reserved) {
486− struct amdgpu_vmid *id;
487−
488− id = list_first_entry(&id_mgr->ids_lru, struct amdgpu_vmid,
489− list);
490− /* Remove from normal round robin handling */
491− list_del_init(&id->list);
492− id_mgr->reserved = id;
494+ if (vm->reserved_vmid[vmhub])
495+ goto unlock;
496+ if (id_mgr->reserved_vmid) {
497+ r = -ENOENT;
498+ goto unlock;
493499 }
494−
500+ /* Remove from normal round robin handling */
501+ id = list_first_entry(&id_mgr->ids_lru, struct amdgpu_vmid, list);
502+ list_del_init(&id->list);
503+ vm->reserved_vmid[vmhub] = id;
504+ id_mgr->reserved_vmid = true;
495505 mutex_unlock(&id_mgr->lock);
506+
496507 return 0;
508+unlock:
509+ mutex_unlock(&id_mgr->lock);
510+ return r;
497511 }
498512
499−void amdgpu_vmid_free_reserved(struct amdgpu_device *adev,
513+/*
514+ * amdgpu_vmid_free_reserved - free up a reserved VMID again
515+ * @adev: amdgpu device structure
516+ * @vm: the VM with the reserved ID
517+ * @vmhub: the VMHUB which should be used
518+ */
519+void amdgpu_vmid_free_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm,
500520 unsigned vmhub)
501521 {
502522 struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];
503523
504524 mutex_lock(&id_mgr->lock);
505− if (!--id_mgr->reserved_use_count) {
506− /* give the reserved ID back to normal round robin */
507− list_add(&id_mgr->reserved->list, &id_mgr->ids_lru);
508− id_mgr->reserved = NULL;
525+ if (vm->reserved_vmid[vmhub]) {
526+ list_add(&vm->reserved_vmid[vmhub]->list,
527+ &id_mgr->ids_lru);
528+ vm->reserved_vmid[vmhub] = NULL;
529+ id_mgr->reserved_vmid = false;
509530 }
510−
511531 mutex_unlock(&id_mgr->lock);
512532 }
513533
@@ -574,7 +594,6 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev) · 60 unmodified lines
574594
575595 mutex_init(&id_mgr->lock);
576596 INIT_LIST_HEAD(&id_mgr->ids_lru);
577− id_mgr->reserved_use_count = 0;
578597
579598 /* for GC <10, SDMA uses MMHUB so use first_kfd_vmid for both GC and MM */
580599 if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(10, 0, 0))
@@ -594,11 +613,6 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev) · 13 unmodified lines
594613 list_add_tail(&id_mgr->ids[j].list, &id_mgr->ids_lru);
595614 }
596615 }
597− /* alloc a default reserved vmid to enforce isolation */
598− for (i = 0; i < (adev->xcp_mgr ? adev->xcp_mgr->num_xcps : 1); i++) {
599− if (adev->enforce_isolation[i] != AMDGPU_ENFORCE_ISOLATION_DISABLE)
600− amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i));
601− }
602616 }
603617
604618 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h+5−6
@@ -67,8 +67,7 @@ struct amdgpu_vmid_mgr { · 66 unmodified lines
6767 unsigned num_ids;
6868 struct list_head ids_lru;
6969 struct amdgpu_vmid ids[AMDGPU_NUM_VMID];
70− struct amdgpu_vmid *reserved;
71− unsigned int reserved_use_count;
70+ bool reserved_vmid;
7271 };
7372
7473 int amdgpu_pasid_alloc(unsigned int bits);
@@ -79,10 +78,10 @@ void amdgpu_pasid_free_delayed(struct dma_resv *resv, · 4 unmodified lines
7978 bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev,
8079 struct amdgpu_vmid *id);
8180 bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub);
82−int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev,
83− unsigned vmhub);
84−void amdgpu_vmid_free_reserved(struct amdgpu_device *adev,
85− unsigned vmhub);
81+int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm,
82+ unsigned vmhub);
83+void amdgpu_vmid_free_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm,
84+ unsigned vmhub);
8685 int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
8786 struct amdgpu_job *job, struct dma_fence **fence);
8887 void amdgpu_vmid_reset(struct amdgpu_device *adev, unsigned vmhub,
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+4−4
@@ -708,7 +708,7 @@ struct amdgpu_ttm_tt { · 707 unmodified lines
708708 * Calling function must call amdgpu_ttm_tt_userptr_range_done() once and only
709709 * once afterwards to stop HMM tracking
710710 */
711−int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages,
711+int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo,
712712 struct hmm_range **range)
713713 {
714714 struct ttm_tt *ttm = bo->tbo.ttm;
@@ -745,7 +745,7 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages, · 30 unmodified lines
745745
746746 readonly = amdgpu_ttm_tt_is_readonly(ttm);
747747 r = amdgpu_hmm_range_get_pages(&bo->notifier, start, ttm->num_pages,
748− readonly, NULL, pages, range);
748+ readonly, NULL, range);
749749 out_unlock:
750750 mmap_read_unlock(mm);
751751 if (r)
@@ -797,12 +797,12 @@ bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm, · 45 unmodified lines
797797 * that backs user memory and will ultimately be mapped into the device
798798 * address space.
799799 */
800−void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages)
800+void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct hmm_range *range)
801801 {
802802 unsigned long i;
803803
804804 for (i = 0; i < ttm->num_pages; ++i)
805− ttm->pages[i] = pages ? pages[i] : NULL;
805+ ttm->pages[i] = range ? hmm_pfn_to_page(range->hmm_pfns[i]) : NULL;
806806 }
807807
808808 /*
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h+2−3
@@ -191,7 +191,7 @@ void amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo); · 190 unmodified lines
191191 uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type);
192192
193193 #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
194−int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages,
194+int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo,
195195 struct hmm_range **range);
196196 void amdgpu_ttm_tt_discard_user_pages(struct ttm_tt *ttm,
197197 struct hmm_range *range);
@@ -199,7 +199,6 @@ bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm, · 1 unmodified line
199199 struct hmm_range *range);
200200 #else
201201 static inline int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo,
202− struct page **pages,
203202 struct hmm_range **range)
204203 {
205204 return -EPERM;
@@ -215,7 +214,7 @@ static inline bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm, · 9 unmodified lines
215214 }
216215 #endif
217216
218−void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages);
217+void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct hmm_range *range);
219218 int amdgpu_ttm_tt_get_userptr(const struct ttm_buffer_object *tbo,
220219 uint64_t *user_addr);
221220 int amdgpu_ttm_tt_set_userptr(struct ttm_buffer_object *bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c+2−0
@@ -71,6 +71,7 @@ int amdgpu_userq_input_va_validate(struct amdgpu_vm *vm, u64 addr, · 70 unmodified lines
7171 return 0;
7272 }
7373
74+ r = -EINVAL;
7475 out_err:
7576 amdgpu_bo_unreserve(vm->root.bo);
7677 return r;
@@ -508,6 +509,7 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args) · 431 unmodified lines
508509 if (amdgpu_userq_input_va_validate(&fpriv->vm, args->in.queue_va, args->in.queue_size) ||
509510 amdgpu_userq_input_va_validate(&fpriv->vm, args->in.rptr_va, AMDGPU_GPU_PAGE_SIZE) ||
510511 amdgpu_userq_input_va_validate(&fpriv->vm, args->in.wptr_va, AMDGPU_GPU_PAGE_SIZE)) {
512+ r = -EINVAL;
511513 kfree(queue);
512514 goto unlock;
513515 }
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c+1−1
@@ -284,7 +284,7 @@ static int amdgpu_userq_fence_create(struct amdgpu_usermode_queue *userq, · 283 unmodified lines
284284
285285 /* Check if hardware has already processed the job */
286286 spin_lock_irqsave(&fence_drv->fence_list_lock, flags);
287− if (!dma_fence_is_signaled_locked(fence))
287+ if (!dma_fence_is_signaled(fence))
288288 list_add_tail(&userq_fence->link, &fence_drv->fences);
289289 else
290290 dma_fence_put(fence);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h+1−1
@@ -501,7 +501,7 @@ struct amdgpu_vcn5_fw_shared { · 500 unmodified lines
501501 struct amdgpu_fw_shared_rb_setup rb_setup;
502502 struct amdgpu_fw_shared_smu_interface_info smu_dpm_interface;
503503 struct amdgpu_fw_shared_drm_key_wa drm_key_wa;
504− uint8_t pad3[9];
504+ uint8_t pad3[404];
505505 };
506506
507507 #define VCN_BLOCK_ENCODE_DISABLE_MASK 0x80
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+4−13
@@ -2790,10 +2790,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 2789 unmodified lines
27902790 dma_fence_put(vm->last_update);
27912791
27922792 for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) {
2793− if (vm->reserved_vmid[i]) {
2794− amdgpu_vmid_free_reserved(adev, i);
2795− vm->reserved_vmid[i] = false;
2796− }
2793+ amdgpu_vmid_free_reserved(adev, vm, i);
27972794 }
27982795
27992796 ttm_lru_bulk_move_fini(&adev->mman.bdev, &vm->lru_bulk_move);
@@ -2889,6 +2886,7 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 89 unmodified lines
28892886 union drm_amdgpu_vm *args = data;
28902887 struct amdgpu_device *adev = drm_to_adev(dev);
28912888 struct amdgpu_fpriv *fpriv = filp->driver_priv;
2889+ struct amdgpu_vm *vm = &fpriv->vm;
28922890
28932891 /* No valid flags defined yet */
28942892 if (args->in.flags)
@@ -2897,17 +2895,10 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 2 unmodified lines
28972895 switch (args->in.op) {
28982896 case AMDGPU_VM_OP_RESERVE_VMID:
28992897 /* We only have requirement to reserve vmid from gfxhub */
2900− if (!fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)]) {
2901− amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(0));
2902− fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)] = true;
2903− }
2904−
2898+ amdgpu_vmid_alloc_reserved(adev, vm, AMDGPU_GFXHUB(0));
29052899 break;
29062900 case AMDGPU_VM_OP_UNRESERVE_VMID:
2907− if (fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)]) {
2908− amdgpu_vmid_free_reserved(adev, AMDGPU_GFXHUB(0));
2909− fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)] = false;
2910− }
2901+ amdgpu_vmid_free_reserved(adev, vm, AMDGPU_GFXHUB(0));
29112902 break;
29122903 default:
29132904 return -EINVAL;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h+1−1
@@ -415,7 +415,7 @@ struct amdgpu_vm { · 414 unmodified lines
415415 struct dma_fence *last_unlocked;
416416
417417 unsigned int pasid;
418− bool reserved_vmid[AMDGPU_MAX_VMHUBS];
418+ struct amdgpu_vmid *reserved_vmid[AMDGPU_MAX_VMHUBS];
419419
420420 /* Flag to indicate if VM tables are updated by CPU or GPU (SDMA) */
421421 bool use_cpu_for_update;
drivers/gpu/drm/amd/amdgpu/atom.c+4−3
@@ -1502,7 +1502,7 @@ static void atom_get_vbios_build(struct atom_context *ctx) · 1501 unmodified lines
15021502 {
15031503 unsigned char *atom_rom_hdr;
15041504 unsigned char *str;
1505− uint16_t base;
1505+ uint16_t base, len;
15061506
15071507 base = CU16(ATOM_ROM_TABLE_PTR);
15081508 atom_rom_hdr = CSTR(base);
@@ -1515,8 +1515,9 @@ static void atom_get_vbios_build(struct atom_context *ctx) · 6 unmodified lines
15151515 while (str < atom_rom_hdr && *str++)
15161516 ;
15171517
1518− if ((str + STRLEN_NORMAL) < atom_rom_hdr)
1519− strscpy(ctx->build_num, str, STRLEN_NORMAL);
1518+ len = min(atom_rom_hdr - str, STRLEN_NORMAL);
1519+ if (len)
1520+ strscpy(ctx->build_num, str, len);
15201521 }
15211522
15221523 struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c+12−0
@@ -3560,6 +3560,7 @@ static int gfx_v9_4_3_reset_kcq(struct amdgpu_ring *ring, · 3559 unmodified lines
35603560 struct amdgpu_device *adev = ring->adev;
35613561 struct amdgpu_kiq *kiq = &adev->gfx.kiq[ring->xcc_id];
35623562 struct amdgpu_ring *kiq_ring = &kiq->ring;
3563+ int reset_mode = AMDGPU_RESET_TYPE_PER_QUEUE;
35633564 unsigned long flags;
35643565 int r;
35653566
@@ -3597,6 +3598,7 @@ pipe_reset: · 31 unmodified lines
35973598 if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_PIPE))
35983599 return -EOPNOTSUPP;
35993600 r = gfx_v9_4_3_reset_hw_pipe(ring);
3601+ reset_mode = AMDGPU_RESET_TYPE_PER_PIPE;
36003602 dev_info(adev->dev, "ring: %s pipe reset :%s\n", ring->name,
36013603 r ? "failed" : "successfully");
36023604 if (r)
@@ -3619,10 +3621,20 @@ pipe_reset: · 16 unmodified lines
36193621 r = amdgpu_ring_test_ring(kiq_ring);
36203622 spin_unlock_irqrestore(&kiq->ring_lock, flags);
36213623 if (r) {
3624+ if (reset_mode == AMDGPU_RESET_TYPE_PER_QUEUE)
3625+ goto pipe_reset;
3626+
36223627 dev_err(adev->dev, "fail to remap queue\n");
36233628 return r;
36243629 }
36253630
3631+ if (reset_mode == AMDGPU_RESET_TYPE_PER_QUEUE) {
3632+ r = amdgpu_ring_test_ring(ring);
3633+ if (r)
3634+ goto pipe_reset;
3635+ }
3636+
3637+
36263638 return amdgpu_ring_reset_helper_end(ring, timedout_fence);
36273639 }
36283640
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c+6−0
@@ -713,6 +713,12 @@ static int mes_v11_0_set_hw_resources(struct amdgpu_mes *mes) · 712 unmodified lines
713713 mes_set_hw_res_pkt.enable_reg_active_poll = 1;
714714 mes_set_hw_res_pkt.enable_level_process_quantum_check = 1;
715715 mes_set_hw_res_pkt.oversubscription_timer = 50;
716+ if ((mes->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x7f)
717+ mes_set_hw_res_pkt.enable_lr_compute_wa = 1;
718+ else
719+ dev_info_once(mes->adev->dev,
720+ "MES FW version must be >= 0x7f to enable LR compute workaround.\n");
721+
716722 if (amdgpu_mes_log_enable) {
717723 mes_set_hw_res_pkt.enable_mes_event_int_logging = 1;
718724 mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr =
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c+5−0
@@ -769,6 +769,11 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes, int pipe) · 768 unmodified lines
769769 mes_set_hw_res_pkt.use_different_vmid_compute = 1;
770770 mes_set_hw_res_pkt.enable_reg_active_poll = 1;
771771 mes_set_hw_res_pkt.enable_level_process_quantum_check = 1;
772+ if ((mes->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x82)
773+ mes_set_hw_res_pkt.enable_lr_compute_wa = 1;
774+ else
775+ dev_info_once(adev->dev,
776+ "MES FW version must be >= 0x82 to enable LR compute workaround.\n");
772777
773778 /*
774779 * Keep oversubscribe timer for sdma . When we have unmapped doorbell
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c+65−13
@@ -113,6 +113,25 @@ static int vcn_v5_0_1_early_init(struct amdgpu_ip_block *ip_block) · 112 unmodified lines
113113 return 0;
114114 }
115115
116+static int vcn_v5_0_1_late_init(struct amdgpu_ip_block *ip_block)
117+{
118+ struct amdgpu_device *adev = ip_block->adev;
119+
120+ adev->vcn.supported_reset =
121+ amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]);
122+
123+ switch (amdgpu_ip_version(adev, MP0_HWIP, 0)) {
124+ case IP_VERSION(13, 0, 12):
125+ if ((adev->psp.sos.fw_version >= 0x00450025) && amdgpu_dpm_reset_vcn_is_supported(adev))
126+ adev->vcn.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
127+ break;
128+ default:
129+ break;
130+ }
131+
132+ return 0;
133+}
134+
116135 static void vcn_v5_0_1_fw_shared_init(struct amdgpu_device *adev, int inst_idx)
117136 {
118137 struct amdgpu_vcn5_fw_shared *fw_shared;
@@ -187,10 +206,6 @@ static int vcn_v5_0_1_sw_init(struct amdgpu_ip_block *ip_block) · 68 unmodified lines
187206 vcn_v5_0_1_fw_shared_init(adev, i);
188207 }
189208
190− /* TODO: Add queue reset mask when FW fully supports it */
191− adev->vcn.supported_reset =
192− amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]);
193−
194209 if (amdgpu_sriov_vf(adev)) {
195210 r = amdgpu_virt_alloc_mm_table(adev);
196211 if (r)
@@ -253,6 +268,23 @@ static int vcn_v5_0_1_sw_fini(struct amdgpu_ip_block *ip_block) · 56 unmodified lines
253268 return 0;
254269 }
255270
271+static int vcn_v5_0_1_hw_init_inst(struct amdgpu_device *adev, int i)
272+{
273+ struct amdgpu_ring *ring;
274+ int vcn_inst;
275+
276+ vcn_inst = GET_INST(VCN, i);
277+ ring = &adev->vcn.inst[i].ring_enc[0];
278+
279+ if (ring->use_doorbell)
280+ adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
281+ ((adev->doorbell_index.vcn.vcn_ring0_1 << 1) +
282+ 11 * vcn_inst),
283+ adev->vcn.inst[i].aid_id);
284+
285+ return 0;
286+}
287+
256288 /**
257289 * vcn_v5_0_1_hw_init - start and test VCN block
258290 *
@@ -264,7 +296,7 @@ static int vcn_v5_0_1_hw_init(struct amdgpu_ip_block *ip_block) · 5 unmodified lines
264296 {
265297 struct amdgpu_device *adev = ip_block->adev;
266298 struct amdgpu_ring *ring;
267− int i, r, vcn_inst;
299+ int i, r;
268300
269301 if (amdgpu_sriov_vf(adev)) {
270302 r = vcn_v5_0_1_start_sriov(adev);
@@ -282,14 +314,8 @@ static int vcn_v5_0_1_hw_init(struct amdgpu_ip_block *ip_block) · 11 unmodified lines
282314 if (RREG32_SOC15(VCN, GET_INST(VCN, 0), regVCN_RRMT_CNTL) & 0x100)
283315 adev->vcn.caps |= AMDGPU_VCN_CAPS(RRMT_ENABLED);
284316 for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
285− vcn_inst = GET_INST(VCN, i);
286317 ring = &adev->vcn.inst[i].ring_enc[0];
287−
288− if (ring->use_doorbell)
289− adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
290− ((adev->doorbell_index.vcn.vcn_ring0_1 << 1) +
291− 11 * vcn_inst),
292− adev->vcn.inst[i].aid_id);
318+ vcn_v5_0_1_hw_init_inst(adev, i);
293319
294320 /* Re-init fw_shared, if required */
295321 vcn_v5_0_1_fw_shared_init(adev, i);
@@ -1273,6 +1299,31 @@ static void vcn_v5_0_1_unified_ring_set_wptr(struct amdgpu_ring *ring) · 977 unmodified lines
12731299 }
12741300 }
12751301
1302+static int vcn_v5_0_1_ring_reset(struct amdgpu_ring *ring,
1303+ unsigned int vmid,
1304+ struct amdgpu_fence *timedout_fence)
1305+{
1306+ int r = 0;
1307+ int vcn_inst;
1308+ struct amdgpu_device *adev = ring->adev;
1309+ struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[ring->me];
1310+
1311+ amdgpu_ring_reset_helper_begin(ring, timedout_fence);
1312+
1313+ vcn_inst = GET_INST(VCN, ring->me);
1314+ r = amdgpu_dpm_reset_vcn(adev, 1 << vcn_inst);
1315+
1316+ if (r) {
1317+ DRM_DEV_ERROR(adev->dev, "VCN reset fail : %d\n", r);
1318+ return r;
1319+ }
1320+
1321+ vcn_v5_0_1_hw_init_inst(adev, ring->me);
1322+ vcn_v5_0_1_start_dpg_mode(vinst, vinst->indirect_sram);
1323+
1324+ return amdgpu_ring_reset_helper_end(ring, timedout_fence);
1325+}
1326+
12761327 static const struct amdgpu_ring_funcs vcn_v5_0_1_unified_ring_vm_funcs = {
12771328 .type = AMDGPU_RING_TYPE_VCN_ENC,
12781329 .align_mask = 0x3f,
@@ -1301,6 +1352,7 @@ static const struct amdgpu_ring_funcs vcn_v5_0_1_unified_ring_vm_funcs = { · 22 unmodified lines
13011352 .emit_wreg = vcn_v4_0_3_enc_ring_emit_wreg,
13021353 .emit_reg_wait = vcn_v4_0_3_enc_ring_emit_reg_wait,
13031354 .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
1355+ .reset = vcn_v5_0_1_ring_reset,
13041356 };
13051357
13061358 /**
@@ -1504,7 +1556,7 @@ static void vcn_v5_0_1_set_irq_funcs(struct amdgpu_device *adev) · 197 unmodified lines
15041556 static const struct amd_ip_funcs vcn_v5_0_1_ip_funcs = {
15051557 .name = "vcn_v5_0_1",
15061558 .early_init = vcn_v5_0_1_early_init,
1507− .late_init = NULL,
1559+ .late_init = vcn_v5_0_1_late_init,
15081560 .sw_init = vcn_v5_0_1_sw_init,
15091561 .sw_fini = vcn_v5_0_1_sw_fini,
15101562 .hw_init = vcn_v5_0_1_hw_init,
drivers/gpu/drm/amd/amdkfd/kfd_device.c+19−1
@@ -495,6 +495,7 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf) · 494 unmodified lines
495495 mutex_init(&kfd->doorbell_mutex);
496496
497497 ida_init(&kfd->doorbell_ida);
498+ atomic_set(&kfd->kfd_processes_count, 0);
498499
499500 return kfd;
500501 }
@@ -1133,7 +1134,15 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) · 632 unmodified lines
11331134 }
11341135
11351136 for (i = 0; i < kfd->num_nodes; i++) {
1136− node = kfd->nodes[i];
1137+ /* Race if another thread in b/w
1138+ * kfd_cleanup_nodes and kfree(kfd),
1139+ * when kfd->nodes[i] = NULL
1140+ */
1141+ if (kfd->nodes[i])
1142+ node = kfd->nodes[i];
1143+ else
1144+ return;
1145+
11371146 spin_lock_irqsave(&node->interrupt_lock, flags);
11381147
11391148 if (node->interrupts_active
@@ -1485,6 +1494,15 @@ int kgd2kfd_check_and_lock_kfd(struct kfd_dev *kfd) · 345 unmodified lines
14851494
14861495 mutex_lock(&kfd_processes_mutex);
14871496
1497+ /* kfd_processes_count is per kfd_dev, return -EBUSY without
1498+ * further check
1499+ */
1500+ if (!!atomic_read(&kfd->kfd_processes_count)) {
1501+ pr_debug("process_wq_release not finished\n");
1502+ r = -EBUSY;
1503+ goto out;
1504+ }
1505+
14881506 if (hash_empty(kfd_processes_table) && !kfd_is_locked(kfd))
14891507 goto out;
14901508
drivers/gpu/drm/amd/amdkfd/kfd_priv.h+2−0
@@ -382,6 +382,8 @@ struct kfd_dev { · 381 unmodified lines
382382
383383 /* for dynamic partitioning */
384384 int kfd_dev_lock;
385+
386+ atomic_t kfd_processes_count;
385387 };
386388
387389 enum kfd_mempool {
drivers/gpu/drm/amd/amdkfd/kfd_process.c+4−0
@@ -1088,6 +1088,8 @@ static void kfd_process_destroy_pdds(struct kfd_process *p) · 1087 unmodified lines
10881088 pdd->runtime_inuse = false;
10891089 }
10901090
1091+ atomic_dec(&pdd->dev->kfd->kfd_processes_count);
1092+
10911093 kfree(pdd);
10921094 p->pdds[i] = NULL;
10931095 }
@@ -1649,6 +1651,8 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_node *dev, · 555 unmodified lines
16491651 /* Init idr used for memory handle translation */
16501652 idr_init(&pdd->alloc_idr);
16511653
1654+ atomic_inc(&dev->kfd->kfd_processes_count);
1655+
16521656 return pdd;
16531657 }
16541658
drivers/gpu/drm/amd/amdkfd/kfd_svm.c+1−1
@@ -1738,7 +1738,7 @@ static int svm_range_validate_and_map(struct mm_struct *mm, · 1737 unmodified lines
17381738
17391739 WRITE_ONCE(p->svms.faulting_task, current);
17401740 r = amdgpu_hmm_range_get_pages(&prange->notifier, addr, npages,
1741− readonly, owner, NULL,
1741+ readonly, owner,
17421742 &hmm_range);
17431743 WRITE_ONCE(p->svms.faulting_task, NULL);
17441744 if (r)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+51−4
@@ -233,6 +233,7 @@ static int amdgpu_dm_encoder_init(struct drm_device *dev, · 232 unmodified lines
233233
234234 static int amdgpu_dm_connector_get_modes(struct drm_connector *connector);
235235
236+static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state);
236237 static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state);
237238
238239 static int amdgpu_dm_atomic_check(struct drm_device *dev,
@@ -417,8 +418,7 @@ static inline bool update_planes_and_stream_adapter(struct dc *dc, · 178 unmodified lines
417418 /*
418419 * Previous frame finished and HW is ready for optimization.
419420 */
420− if (update_type == UPDATE_TYPE_FAST)
421− dc_post_update_surfaces_to_stream(dc);
421+ dc_post_update_surfaces_to_stream(dc);
422422
423423 return dc_update_planes_and_stream(dc,
424424 array_of_surface_update,
@@ -3637,7 +3637,7 @@ static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { · 3212 unmodified lines
36373637
36383638 static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
36393639 .atomic_commit_tail = amdgpu_dm_atomic_commit_tail,
3640− .atomic_commit_setup = drm_dp_mst_atomic_setup_commit,
3640+ .atomic_commit_setup = amdgpu_dm_atomic_setup_commit,
36413641 };
36423642
36433643 static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
@@ -4829,6 +4829,16 @@ static void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *cap · 1185 unmodified lines
48294829 if (!caps->data_points)
48304830 return;
48314831
4832+ /*
4833+ * Handle the case where brightness is below the first data point
4834+ * Interpolate between (0,0) and (first_signal, first_lum)
4835+ */
4836+ if (brightness < caps->luminance_data[0].input_signal) {
4837+ lum = DIV_ROUND_CLOSEST(caps->luminance_data[0].luminance * brightness,
4838+ caps->luminance_data[0].input_signal);
4839+ goto scale;
4840+ }
4841+
48324842 left = 0;
48334843 right = caps->data_points - 1;
48344844 while (left <= right) {
@@ -8261,6 +8271,10 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder, · 3426 unmodified lines
82618271 {"1920x1200", 1920, 1200}
82628272 };
82638273
8274+ if ((connector->connector_type != DRM_MODE_CONNECTOR_eDP) &&
8275+ (connector->connector_type != DRM_MODE_CONNECTOR_LVDS))
8276+ return;
8277+
82648278 n = ARRAY_SIZE(common_modes);
82658279
82668280 for (i = 0; i < n; i++) {
@@ -10353,6 +10367,39 @@ static void amdgpu_dm_update_hdcp(struct drm_atomic_state *state) · 2086 unmodified lines
1035310367 }
1035410368 }
1035510369
10370+static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state)
10371+{
10372+ struct drm_crtc *crtc;
10373+ struct drm_crtc_state *old_crtc_state, *new_crtc_state;
10374+ struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
10375+ int i, ret;
10376+
10377+ ret = drm_dp_mst_atomic_setup_commit(state);
10378+ if (ret)
10379+ return ret;
10380+
10381+ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
10382+ dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
10383+ dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
10384+ /*
10385+ * Color management settings. We also update color properties
10386+ * when a modeset is needed, to ensure it gets reprogrammed.
10387+ */
10388+ if (dm_new_crtc_state->base.active && dm_new_crtc_state->stream &&
10389+ (dm_new_crtc_state->base.color_mgmt_changed ||
10390+ dm_old_crtc_state->regamma_tf != dm_new_crtc_state->regamma_tf ||
10391+ drm_atomic_crtc_needs_modeset(new_crtc_state))) {
10392+ ret = amdgpu_dm_update_crtc_color_mgmt(dm_new_crtc_state);
10393+ if (ret) {
10394+ drm_dbg_atomic(state->dev, "Failed to update color state\n");
10395+ return ret;
10396+ }
10397+ }
10398+ }
10399+
10400+ return 0;
10401+}
10402+
1035610403 /**
1035710404 * amdgpu_dm_atomic_commit_tail() - AMDgpu DM's commit tail implementation.
1035810405 * @state: The atomic state to commit
@@ -11167,7 +11214,7 @@ skip_modeset: · 808 unmodified lines
1116711214 if (dm_new_crtc_state->base.color_mgmt_changed ||
1116811215 dm_old_crtc_state->regamma_tf != dm_new_crtc_state->regamma_tf ||
1116911216 drm_atomic_crtc_needs_modeset(new_crtc_state)) {
11170− ret = amdgpu_dm_update_crtc_color_mgmt(dm_new_crtc_state);
11217+ ret = amdgpu_dm_check_crtc_color_mgmt(dm_new_crtc_state, true);
1117111218 if (ret)
1117211219 goto fail;
1117311220 }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h+2−0
@@ -1054,6 +1054,8 @@ void amdgpu_dm_init_color_mod(void); · 1053 unmodified lines
10541054 int amdgpu_dm_create_color_properties(struct amdgpu_device *adev);
10551055 int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state);
10561056 int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc);
1057+int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc,
1058+ bool check_only);
10571059 int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,
10581060 struct drm_plane_state *plane_state,
10591061 struct dc_plane_state *dc_plane_state);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+64−24
@@ -566,12 +566,11 @@ static int __set_output_tf(struct dc_transfer_func *func, · 565 unmodified lines
566566 return res ? 0 : -ENOMEM;
567567 }
568568
569−static int amdgpu_dm_set_atomic_regamma(struct dc_stream_state *stream,
569+static int amdgpu_dm_set_atomic_regamma(struct dc_transfer_func *out_tf,
570570 const struct drm_color_lut *regamma_lut,
571571 uint32_t regamma_size, bool has_rom,
572572 enum dc_transfer_func_predefined tf)
573573 {
574− struct dc_transfer_func *out_tf = &stream->out_transfer_func;
575574 int ret = 0;
576575
577576 if (regamma_size || tf != TRANSFER_FUNCTION_LINEAR) {
@@ -821,7 +820,7 @@ int amdgpu_dm_verify_lut3d_size(struct amdgpu_device *adev, · 243 unmodified lines
821820 struct dm_plane_state *dm_plane_state = to_dm_plane_state(plane_state);
822821 const struct drm_color_lut *shaper = NULL, *lut3d = NULL;
823822 uint32_t exp_size, size, dim_size = MAX_COLOR_3DLUT_SIZE;
824− bool has_3dlut = adev->dm.dc->caps.color.dpp.hw_3d_lut;
823+ bool has_3dlut = adev->dm.dc->caps.color.dpp.hw_3d_lut || adev->dm.dc->caps.color.mpc.preblend;
825824
826825 /* shaper LUT is only available if 3D LUT color caps */
827826 exp_size = has_3dlut ? MAX_COLOR_LUT_ENTRIES : 0;
@@ -885,33 +884,33 @@ int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state) · 57 unmodified lines
885884 }
886885
887886 /**
888− * amdgpu_dm_update_crtc_color_mgmt: Maps DRM color management to DC stream.
887+ * amdgpu_dm_check_crtc_color_mgmt: Check if DRM color props are programmable by DC.
889888 * @crtc: amdgpu_dm crtc state
889+ * @check_only: only check color state without update dc stream
890890 *
891− * With no plane level color management properties we're free to use any
892− * of the HW blocks as long as the CRTC CTM always comes before the
893− * CRTC RGM and after the CRTC DGM.
894− *
895− * - The CRTC RGM block will be placed in the RGM LUT block if it is non-linear.
896− * - The CRTC DGM block will be placed in the DGM LUT block if it is non-linear.
897− * - The CRTC CTM will be placed in the gamut remap block if it is non-linear.
891+ * This function just verifies CRTC LUT sizes, if there is enough space for
892+ * output transfer function and if its parameters can be calculated by AMD
893+ * color module. It also adjusts some settings for programming CRTC degamma at
894+ * plane stage, using plane DGM block.
898895 *
899896 * The RGM block is typically more fully featured and accurate across
900897 * all ASICs - DCE can't support a custom non-linear CRTC DGM.
901898 *
902899 * For supporting both plane level color management and CRTC level color
903− * management at once we have to either restrict the usage of CRTC properties
904− * or blend adjustments together.
900+ * management at once we have to either restrict the usage of some CRTC
901+ * properties or blend adjustments together.
905902 *
906903 * Returns:
907− * 0 on success. Error code if setup fails.
904+ * 0 on success. Error code if validation fails.
908905 */
909−int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
906+
907+int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc,
908+ bool check_only)
910909 {
911910 struct dc_stream_state *stream = crtc->stream;
912911 struct amdgpu_device *adev = drm_to_adev(crtc->base.state->dev);
913912 bool has_rom = adev->asic_type <= CHIP_RAVEN;
914− struct drm_color_ctm *ctm = NULL;
913+ struct dc_transfer_func *out_tf;
915914 const struct drm_color_lut *degamma_lut, *regamma_lut;
916915 uint32_t degamma_size, regamma_size;
917916 bool has_regamma, has_degamma;
@@ -940,6 +939,14 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) · 22 unmodified lines
940939 crtc->cm_has_degamma = false;
941940 crtc->cm_is_degamma_srgb = false;
942941
942+ if (check_only) {
943+ out_tf = kvzalloc(sizeof(*out_tf), GFP_KERNEL);
944+ if (!out_tf)
945+ return -ENOMEM;
946+ } else {
947+ out_tf = &stream->out_transfer_func;
948+ }
949+
943950 /* Setup regamma and degamma. */
944951 if (is_legacy) {
945952 /*
@@ -954,8 +961,8 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) · 8 unmodified lines
954961 * inverse color ramp in legacy userspace.
955962 */
956963 crtc->cm_is_degamma_srgb = true;
957− stream->out_transfer_func.type = TF_TYPE_DISTRIBUTED_POINTS;
958− stream->out_transfer_func.tf = TRANSFER_FUNCTION_SRGB;
964+ out_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
965+ out_tf->tf = TRANSFER_FUNCTION_SRGB;
959966 /*
960967 * Note: although we pass has_rom as parameter here, we never
961968 * actually use ROM because the color module only takes the ROM
@@ -963,16 +970,12 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) · 1 unmodified line
963970 *
964971 * See more in mod_color_calculate_regamma_params()
965972 */
966− r = __set_legacy_tf(&stream->out_transfer_func, regamma_lut,
973+ r = __set_legacy_tf(out_tf, regamma_lut,
967974 regamma_size, has_rom);
968− if (r)
969− return r;
970975 } else {
971976 regamma_size = has_regamma ? regamma_size : 0;
972− r = amdgpu_dm_set_atomic_regamma(stream, regamma_lut,
977+ r = amdgpu_dm_set_atomic_regamma(out_tf, regamma_lut,
973978 regamma_size, has_rom, tf);
974− if (r)
975− return r;
976979 }
977980
978981 /*
@@ -981,6 +984,43 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) · 2 unmodified lines
981984 * have to place the CTM in the OCSC in that case.
982985 */
983986 crtc->cm_has_degamma = has_degamma;
987+ if (check_only)
988+ kvfree(out_tf);
989+
990+ return r;
991+}
992+
993+/**
994+ * amdgpu_dm_update_crtc_color_mgmt: Maps DRM color management to DC stream.
995+ * @crtc: amdgpu_dm crtc state
996+ *
997+ * With no plane level color management properties we're free to use any
998+ * of the HW blocks as long as the CRTC CTM always comes before the
999+ * CRTC RGM and after the CRTC DGM.
1000+ *
1001+ * - The CRTC RGM block will be placed in the RGM LUT block if it is non-linear.
1002+ * - The CRTC DGM block will be placed in the DGM LUT block if it is non-linear.
1003+ * - The CRTC CTM will be placed in the gamut remap block if it is non-linear.
1004+ *
1005+ * The RGM block is typically more fully featured and accurate across
1006+ * all ASICs - DCE can't support a custom non-linear CRTC DGM.
1007+ *
1008+ * For supporting both plane level color management and CRTC level color
1009+ * management at once we have to either restrict the usage of CRTC properties
1010+ * or blend adjustments together.
1011+ *
1012+ * Returns:
1013+ * 0 on success. Error code if setup fails.
1014+ */
1015+int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
1016+{
1017+ struct dc_stream_state *stream = crtc->stream;
1018+ struct drm_color_ctm *ctm = NULL;
1019+ int ret;
1020+
1021+ ret = amdgpu_dm_check_crtc_color_mgmt(crtc, false);
1022+ if (ret)
1023+ return ret;
9841024
9851025 /* Setup CRTC CTM. */
9861026 if (crtc->base.ctm) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c+6−2
@@ -218,8 +218,10 @@ static void amdgpu_dm_idle_worker(struct work_struct *work) · 217 unmodified lines
218218 break;
219219 }
220220
221− if (idle_work->enable)
221+ if (idle_work->enable) {
222+ dc_post_update_surfaces_to_stream(idle_work->dm->dc);
222223 dc_allow_idle_optimizations(idle_work->dm->dc, true);
224+ }
223225 mutex_unlock(&idle_work->dm->dc_lock);
224226 }
225227 idle_work->dm->idle_workqueue->running = false;
@@ -273,8 +275,10 @@ static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work) · 47 unmodified lines
273275 vblank_work->acrtc->dm_irq_params.allow_sr_entry);
274276 }
275277
276− if (dm->active_vblank_irq_count == 0)
278+ if (dm->active_vblank_irq_count == 0) {
279+ dc_post_update_surfaces_to_stream(dm->dc);
277280 dc_allow_idle_optimizations(dm->dc, true);
281+ }
278282
279283 mutex_unlock(&dm->dc_lock);
280284
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c+8−4
@@ -768,14 +768,18 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, · 767 unmodified lines
768768 struct mod_hdcp_ddc_funcs *ddc_funcs = &config->ddc.funcs;
769769
770770 config->psp.handle = &adev->psp;
771− if (dc->ctx->dce_version == DCN_VERSION_3_1 ||
771+ if (dc->ctx->dce_version == DCN_VERSION_3_1 ||
772772 dc->ctx->dce_version == DCN_VERSION_3_14 ||
773773 dc->ctx->dce_version == DCN_VERSION_3_15 ||
774− dc->ctx->dce_version == DCN_VERSION_3_5 ||
774+ dc->ctx->dce_version == DCN_VERSION_3_16 ||
775+ dc->ctx->dce_version == DCN_VERSION_3_2 ||
776+ dc->ctx->dce_version == DCN_VERSION_3_21 ||
777+ dc->ctx->dce_version == DCN_VERSION_3_5 ||
775778 dc->ctx->dce_version == DCN_VERSION_3_51 ||
776− dc->ctx->dce_version == DCN_VERSION_3_6 ||
777− dc->ctx->dce_version == DCN_VERSION_3_16)
779+ dc->ctx->dce_version == DCN_VERSION_3_6 ||
780+ dc->ctx->dce_version == DCN_VERSION_4_01)
778781 config->psp.caps.dtm_v3_supported = 1;
782+
779783 config->ddc.handle = dc_get_link_at_index(dc, i);
780784
781785 ddc_funcs->write_i2c = lp_write_i2c;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c+1−1
@@ -1633,7 +1633,7 @@ dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, · 1632 unmodified lines
16331633 drm_object_attach_property(&plane->base,
16341634 dm->adev->mode_info.plane_ctm_property, 0);
16351635
1636− if (dpp_color_caps.hw_3d_lut) {
1636+ if (dpp_color_caps.hw_3d_lut || dm->dc->caps.color.mpc.preblend) {
16371637 drm_object_attach_property(&plane->base,
16381638 mode_info.plane_shaper_lut_property, 0);
16391639 drm_object_attach_property(&plane->base,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c+2−2
@@ -53,11 +53,11 @@ void dm_perf_trace_timestamp(const char *func_name, unsigned int line, struct dc · 52 unmodified lines
5353 func_name, line);
5454 }
5555
56−void dm_trace_smu_msg(uint32_t msg_id, uint32_t param_in, struct dc_context *ctx)
56+void dm_trace_smu_enter(uint32_t msg_id, uint32_t param_in, unsigned int delay, struct dc_context *ctx)
5757 {
5858 }
5959
60−void dm_trace_smu_delay(uint32_t delay, struct dc_context *ctx)
60+void dm_trace_smu_exit(bool success, uint32_t response, struct dc_context *ctx)
6161 {
6262 }
6363
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c+3−0
@@ -463,6 +463,9 @@ void dce_clk_mgr_construct( · 462 unmodified lines
463463 clk_mgr->max_clks_state = DM_PP_CLOCKS_STATE_NOMINAL;
464464 clk_mgr->cur_min_clks_state = DM_PP_CLOCKS_STATE_INVALID;
465465
466+ base->clks.max_supported_dispclk_khz =
467+ clk_mgr->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE].display_clk_khz;
468+
466469 dce_clock_read_integrated_info(clk_mgr);
467470 dce_clock_read_ss_info(clk_mgr);
468471 }
drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c+5−0
@@ -147,6 +147,8 @@ void dce60_clk_mgr_construct( · 146 unmodified lines
147147 struct dc_context *ctx,
148148 struct clk_mgr_internal *clk_mgr)
149149 {
150+ struct clk_mgr *base = &clk_mgr->base;
151+
150152 dce_clk_mgr_construct(ctx, clk_mgr);
151153
152154 memcpy(clk_mgr->max_clks_by_state,
@@ -157,5 +159,8 @@ void dce60_clk_mgr_construct( · 4 unmodified lines
157159 clk_mgr->clk_mgr_shift = &disp_clk_shift;
158160 clk_mgr->clk_mgr_mask = &disp_clk_mask;
159161 clk_mgr->base.funcs = &dce60_funcs;
162+
163+ base->clks.max_supported_dispclk_khz =
164+ clk_mgr->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE].display_clk_khz;
160165 }
161166
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr_smu_msg.c+1−1
@@ -69,7 +69,7 @@ static uint32_t dcn30_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, un · 68 unmodified lines
6969
7070 /* handle DALSMC_Result_CmdRejectedBusy? */
7171
72− TRACE_SMU_DELAY(delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
72+ TRACE_SMU_MSG_DELAY(0, 0, delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
7373
7474 return reg;
7575 }
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c+137−5
@@ -77,6 +77,7 @@ static const struct IP_BASE CLK_BASE = { { { { 0x00016C00, 0x02401800, 0, 0, 0, · 76 unmodified lines
7777 #undef DC_LOGGER
7878 #define DC_LOGGER \
7979 clk_mgr->base.base.ctx->logger
80+
8081 #define regCLK1_CLK_PLL_REQ 0x0237
8182 #define regCLK1_CLK_PLL_REQ_BASE_IDX 0
8283
@@ -87,8 +88,70 @@ static const struct IP_BASE CLK_BASE = { { { { 0x00016C00, 0x02401800, 0, 0, 0, · 4 unmodified lines
8788 #define CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L
8889 #define CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L
8990
91+#define regCLK1_CLK0_DFS_CNTL 0x0269
92+#define regCLK1_CLK0_DFS_CNTL_BASE_IDX 0
93+#define regCLK1_CLK1_DFS_CNTL 0x026c
94+#define regCLK1_CLK1_DFS_CNTL_BASE_IDX 0
95+#define regCLK1_CLK2_DFS_CNTL 0x026f
96+#define regCLK1_CLK2_DFS_CNTL_BASE_IDX 0
97+#define regCLK1_CLK3_DFS_CNTL 0x0272
98+#define regCLK1_CLK3_DFS_CNTL_BASE_IDX 0
99+#define regCLK1_CLK4_DFS_CNTL 0x0275
100+#define regCLK1_CLK4_DFS_CNTL_BASE_IDX 0
101+#define regCLK1_CLK5_DFS_CNTL 0x0278
102+#define regCLK1_CLK5_DFS_CNTL_BASE_IDX 0
103+
104+#define regCLK1_CLK0_CURRENT_CNT 0x02fb
105+#define regCLK1_CLK0_CURRENT_CNT_BASE_IDX 0
106+#define regCLK1_CLK1_CURRENT_CNT 0x02fc
107+#define regCLK1_CLK1_CURRENT_CNT_BASE_IDX 0
108+#define regCLK1_CLK2_CURRENT_CNT 0x02fd
109+#define regCLK1_CLK2_CURRENT_CNT_BASE_IDX 0
110+#define regCLK1_CLK3_CURRENT_CNT 0x02fe
111+#define regCLK1_CLK3_CURRENT_CNT_BASE_IDX 0
112+#define regCLK1_CLK4_CURRENT_CNT 0x02ff
113+#define regCLK1_CLK4_CURRENT_CNT_BASE_IDX 0
114+#define regCLK1_CLK5_CURRENT_CNT 0x0300
115+#define regCLK1_CLK5_CURRENT_CNT_BASE_IDX 0
116+
117+#define regCLK1_CLK0_BYPASS_CNTL 0x028a
118+#define regCLK1_CLK0_BYPASS_CNTL_BASE_IDX 0
119+#define regCLK1_CLK1_BYPASS_CNTL 0x0293
120+#define regCLK1_CLK1_BYPASS_CNTL_BASE_IDX 0
90121 #define regCLK1_CLK2_BYPASS_CNTL 0x029c
91122 #define regCLK1_CLK2_BYPASS_CNTL_BASE_IDX 0
123+#define regCLK1_CLK3_BYPASS_CNTL 0x02a5
124+#define regCLK1_CLK3_BYPASS_CNTL_BASE_IDX 0
125+#define regCLK1_CLK4_BYPASS_CNTL 0x02ae
126+#define regCLK1_CLK4_BYPASS_CNTL_BASE_IDX 0
127+#define regCLK1_CLK5_BYPASS_CNTL 0x02b7
128+#define regCLK1_CLK5_BYPASS_CNTL_BASE_IDX 0
129+
130+#define regCLK1_CLK0_DS_CNTL 0x0283
131+#define regCLK1_CLK0_DS_CNTL_BASE_IDX 0
132+#define regCLK1_CLK1_DS_CNTL 0x028c
133+#define regCLK1_CLK1_DS_CNTL_BASE_IDX 0
134+#define regCLK1_CLK2_DS_CNTL 0x0295
135+#define regCLK1_CLK2_DS_CNTL_BASE_IDX 0
136+#define regCLK1_CLK3_DS_CNTL 0x029e
137+#define regCLK1_CLK3_DS_CNTL_BASE_IDX 0
138+#define regCLK1_CLK4_DS_CNTL 0x02a7
139+#define regCLK1_CLK4_DS_CNTL_BASE_IDX 0
140+#define regCLK1_CLK5_DS_CNTL 0x02b0
141+#define regCLK1_CLK5_DS_CNTL_BASE_IDX 0
142+
143+#define regCLK1_CLK0_ALLOW_DS 0x0284
144+#define regCLK1_CLK0_ALLOW_DS_BASE_IDX 0
145+#define regCLK1_CLK1_ALLOW_DS 0x028d
146+#define regCLK1_CLK1_ALLOW_DS_BASE_IDX 0
147+#define regCLK1_CLK2_ALLOW_DS 0x0296
148+#define regCLK1_CLK2_ALLOW_DS_BASE_IDX 0
149+#define regCLK1_CLK3_ALLOW_DS 0x029f
150+#define regCLK1_CLK3_ALLOW_DS_BASE_IDX 0
151+#define regCLK1_CLK4_ALLOW_DS 0x02a8
152+#define regCLK1_CLK4_ALLOW_DS_BASE_IDX 0
153+#define regCLK1_CLK5_ALLOW_DS 0x02b1
154+#define regCLK1_CLK5_ALLOW_DS_BASE_IDX 0
92155
93156 #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL__SHIFT 0x0
94157 #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV__SHIFT 0x10
@@ -185,6 +248,8 @@ void dcn314_init_clocks(struct clk_mgr *clk_mgr) · 90 unmodified lines
185248 {
186249 struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr);
187250 uint32_t ref_dtbclk = clk_mgr->clks.ref_dtbclk_khz;
251+ struct clk_mgr_dcn314 *clk_mgr_dcn314 = TO_CLK_MGR_DCN314(clk_mgr_int);
252+ struct clk_log_info log_info = {0};
188253
189254 memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks));
190255 // Assumption is that boot state always supports pstate
@@ -200,6 +265,9 @@ void dcn314_init_clocks(struct clk_mgr *clk_mgr) · 9 unmodified lines
200265 dce_adjust_dp_ref_freq_for_ss(clk_mgr_int, clk_mgr->dprefclk_khz);
201266 else
202267 clk_mgr->dp_dto_source_clock_in_khz = clk_mgr->dprefclk_khz;
268+
269+ dcn314_dump_clk_registers(&clk_mgr->boot_snapshot, &clk_mgr_dcn314->base.base, &log_info);
270+ clk_mgr->clks.dispclk_khz = clk_mgr->boot_snapshot.dispclk * 1000;
203271 }
204272
205273 void dcn314_update_clocks(struct clk_mgr *clk_mgr_base,
@@ -218,6 +286,8 @@ void dcn314_update_clocks(struct clk_mgr *clk_mgr_base, · 12 unmodified lines
218286 if (dc->work_arounds.skip_clock_update)
219287 return;
220288
289+ display_count = dcn314_get_active_display_cnt_wa(dc, context);
290+
221291 /*
222292 * if it is safe to lower, but we are already in the lower state, we don't have to do anything
223293 * also if safe to lower is false, we just go in the higher state
@@ -236,7 +306,6 @@ void dcn314_update_clocks(struct clk_mgr *clk_mgr_base, · 12 unmodified lines
236306 }
237307 /* check that we're not already in lower */
238308 if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_LOW_POWER) {
239− display_count = dcn314_get_active_display_cnt_wa(dc, context);
240309 /* if we can go lower, go lower */
241310 if (display_count == 0) {
242311 union display_idle_optimization_u idle_info = { 0 };
@@ -293,11 +362,19 @@ void dcn314_update_clocks(struct clk_mgr *clk_mgr_base, · 50 unmodified lines
293362 update_dppclk = true;
294363 }
295364
296− if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
365+ if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz) &&
366+ (new_clocks->dispclk_khz > 0 || (safe_to_lower && display_count == 0))) {
367+ int requested_dispclk_khz = new_clocks->dispclk_khz;
368+
297369 dcn314_disable_otg_wa(clk_mgr_base, context, safe_to_lower, true);
298370
371+ /* Clamp the requested clock to PMFW based on their limit. */
372+ if (dc->debug.min_disp_clk_khz > 0 && requested_dispclk_khz < dc->debug.min_disp_clk_khz)
373+ requested_dispclk_khz = dc->debug.min_disp_clk_khz;
374+
375+ dcn314_smu_set_dispclk(clk_mgr, requested_dispclk_khz);
299376 clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
300− dcn314_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz);
377+
301378 dcn314_disable_otg_wa(clk_mgr_base, context, safe_to_lower, false);
302379
303380 update_dispclk = true;
@@ -385,10 +462,65 @@ bool dcn314_are_clock_states_equal(struct dc_clocks *a, · 81 unmodified lines
385462 return true;
386463 }
387464
388−static void dcn314_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass,
465+
466+static void dcn314_dump_clk_registers_internal(struct dcn35_clk_internal *internal, struct clk_mgr *clk_mgr_base)
467+{
468+ struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
469+
470+ // read dtbclk
471+ internal->CLK1_CLK4_CURRENT_CNT = REG_READ(CLK1_CLK4_CURRENT_CNT);
472+ internal->CLK1_CLK4_BYPASS_CNTL = REG_READ(CLK1_CLK4_BYPASS_CNTL);
473+
474+ // read dcfclk
475+ internal->CLK1_CLK3_CURRENT_CNT = REG_READ(CLK1_CLK3_CURRENT_CNT);
476+ internal->CLK1_CLK3_BYPASS_CNTL = REG_READ(CLK1_CLK3_BYPASS_CNTL);
477+
478+ // read dcf deep sleep divider
479+ internal->CLK1_CLK3_DS_CNTL = REG_READ(CLK1_CLK3_DS_CNTL);
480+ internal->CLK1_CLK3_ALLOW_DS = REG_READ(CLK1_CLK3_ALLOW_DS);
481+
482+ // read dppclk
483+ internal->CLK1_CLK1_CURRENT_CNT = REG_READ(CLK1_CLK1_CURRENT_CNT);
484+ internal->CLK1_CLK1_BYPASS_CNTL = REG_READ(CLK1_CLK1_BYPASS_CNTL);
485+
486+ // read dprefclk
487+ internal->CLK1_CLK2_CURRENT_CNT = REG_READ(CLK1_CLK2_CURRENT_CNT);
488+ internal->CLK1_CLK2_BYPASS_CNTL = REG_READ(CLK1_CLK2_BYPASS_CNTL);
489+
490+ // read dispclk
491+ internal->CLK1_CLK0_CURRENT_CNT = REG_READ(CLK1_CLK0_CURRENT_CNT);
492+ internal->CLK1_CLK0_BYPASS_CNTL = REG_READ(CLK1_CLK0_BYPASS_CNTL);
493+}
494+
495+void dcn314_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass,
389496 struct clk_mgr *clk_mgr_base, struct clk_log_info *log_info)
390497 {
391− return;
498+
499+ struct dcn35_clk_internal internal = {0};
500+
501+ dcn314_dump_clk_registers_internal(&internal, clk_mgr_base);
502+
503+ regs_and_bypass->dcfclk = internal.CLK1_CLK3_CURRENT_CNT / 10;
504+ regs_and_bypass->dcf_deep_sleep_divider = internal.CLK1_CLK3_DS_CNTL / 10;
505+ regs_and_bypass->dcf_deep_sleep_allow = internal.CLK1_CLK3_ALLOW_DS;
506+ regs_and_bypass->dprefclk = internal.CLK1_CLK2_CURRENT_CNT / 10;
507+ regs_and_bypass->dispclk = internal.CLK1_CLK0_CURRENT_CNT / 10;
508+ regs_and_bypass->dppclk = internal.CLK1_CLK1_CURRENT_CNT / 10;
509+ regs_and_bypass->dtbclk = internal.CLK1_CLK4_CURRENT_CNT / 10;
510+
511+ regs_and_bypass->dppclk_bypass = internal.CLK1_CLK1_BYPASS_CNTL & 0x0007;
512+ if (regs_and_bypass->dppclk_bypass < 0 || regs_and_bypass->dppclk_bypass > 4)
513+ regs_and_bypass->dppclk_bypass = 0;
514+ regs_and_bypass->dcfclk_bypass = internal.CLK1_CLK3_BYPASS_CNTL & 0x0007;
515+ if (regs_and_bypass->dcfclk_bypass < 0 || regs_and_bypass->dcfclk_bypass > 4)
516+ regs_and_bypass->dcfclk_bypass = 0;
517+ regs_and_bypass->dispclk_bypass = internal.CLK1_CLK0_BYPASS_CNTL & 0x0007;
518+ if (regs_and_bypass->dispclk_bypass < 0 || regs_and_bypass->dispclk_bypass > 4)
519+ regs_and_bypass->dispclk_bypass = 0;
520+ regs_and_bypass->dprefclk_bypass = internal.CLK1_CLK2_BYPASS_CNTL & 0x0007;
521+ if (regs_and_bypass->dprefclk_bypass < 0 || regs_and_bypass->dprefclk_bypass > 4)
522+ regs_and_bypass->dprefclk_bypass = 0;
523+
392524 }
393525
394526 static struct clk_bw_params dcn314_bw_params = {
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.h+5−0
@@ -65,4 +65,9 @@ void dcn314_clk_mgr_construct(struct dc_context *ctx, · 64 unmodified lines
6565
6666 void dcn314_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr_int);
6767
68+
69+void dcn314_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass,
70+ struct clk_mgr *clk_mgr_base, struct clk_log_info *log_info);
71+
72+
6873 #endif //__DCN314_CLK_MGR_H__
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr_smu_msg.c+3−2
@@ -63,7 +63,8 @@ static uint32_t dcn32_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, un · 62 unmodified lines
6363 udelay(delay_us);
6464 } while (max_retries--);
6565
66− TRACE_SMU_DELAY(delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
66+ TRACE_SMU_MSG_DELAY(0, 0, delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
67+
6768
6869 return reg;
6970 }
@@ -120,7 +121,7 @@ static uint32_t dcn32_smu_wait_for_response_delay(struct clk_mgr_internal *clk_m · 50 unmodified lines
120121 *total_delay_us += delay_us;
121122 } while (max_retries--);
122123
123− TRACE_SMU_DELAY(*total_delay_us, clk_mgr->base.ctx);
124+ TRACE_SMU_MSG_DELAY(0, 0, *total_delay_us, clk_mgr->base.ctx);
124125
125126 return reg;
126127 }
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c+119−2
@@ -587,9 +587,118 @@ bool dcn35_are_clock_states_equal(struct dc_clocks *a, · 586 unmodified lines
587587 return true;
588588 }
589589
590−static void dcn35_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass,
590+static void dcn35_save_clk_registers_internal(struct dcn35_clk_internal *internal, struct clk_mgr *clk_mgr_base)
591+{
592+ struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
593+
594+ // read dtbclk
595+ internal->CLK1_CLK4_CURRENT_CNT = REG_READ(CLK1_CLK4_CURRENT_CNT);
596+ internal->CLK1_CLK4_BYPASS_CNTL = REG_READ(CLK1_CLK4_BYPASS_CNTL);
597+
598+ // read dcfclk
599+ internal->CLK1_CLK3_CURRENT_CNT = REG_READ(CLK1_CLK3_CURRENT_CNT);
600+ internal->CLK1_CLK3_BYPASS_CNTL = REG_READ(CLK1_CLK3_BYPASS_CNTL);
601+
602+ // read dcf deep sleep divider
603+ internal->CLK1_CLK3_DS_CNTL = REG_READ(CLK1_CLK3_DS_CNTL);
604+ internal->CLK1_CLK3_ALLOW_DS = REG_READ(CLK1_CLK3_ALLOW_DS);
605+
606+ // read dppclk
607+ internal->CLK1_CLK1_CURRENT_CNT = REG_READ(CLK1_CLK1_CURRENT_CNT);
608+ internal->CLK1_CLK1_BYPASS_CNTL = REG_READ(CLK1_CLK1_BYPASS_CNTL);
609+
610+ // read dprefclk
611+ internal->CLK1_CLK2_CURRENT_CNT = REG_READ(CLK1_CLK2_CURRENT_CNT);
612+ internal->CLK1_CLK2_BYPASS_CNTL = REG_READ(CLK1_CLK2_BYPASS_CNTL);
613+
614+ // read dispclk
615+ internal->CLK1_CLK0_CURRENT_CNT = REG_READ(CLK1_CLK0_CURRENT_CNT);
616+ internal->CLK1_CLK0_BYPASS_CNTL = REG_READ(CLK1_CLK0_BYPASS_CNTL);
617+}
618+
619+static void dcn35_save_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass,
591620 struct clk_mgr_dcn35 *clk_mgr)
592621 {
622+ struct dcn35_clk_internal internal = {0};
623+ char *bypass_clks[5] = {"0x0 DFS", "0x1 REFCLK", "0x2 ERROR", "0x3 400 FCH", "0x4 600 FCH"};
624+
625+ dcn35_save_clk_registers_internal(&internal, &clk_mgr->base.base);
626+
627+ regs_and_bypass->dcfclk = internal.CLK1_CLK3_CURRENT_CNT / 10;
628+ regs_and_bypass->dcf_deep_sleep_divider = internal.CLK1_CLK3_DS_CNTL / 10;
629+ regs_and_bypass->dcf_deep_sleep_allow = internal.CLK1_CLK3_ALLOW_DS;
630+ regs_and_bypass->dprefclk = internal.CLK1_CLK2_CURRENT_CNT / 10;
631+ regs_and_bypass->dispclk = internal.CLK1_CLK0_CURRENT_CNT / 10;
632+ regs_and_bypass->dppclk = internal.CLK1_CLK1_CURRENT_CNT / 10;
633+ regs_and_bypass->dtbclk = internal.CLK1_CLK4_CURRENT_CNT / 10;
634+
635+ regs_and_bypass->dppclk_bypass = internal.CLK1_CLK1_BYPASS_CNTL & 0x0007;
636+ if (regs_and_bypass->dppclk_bypass < 0 || regs_and_bypass->dppclk_bypass > 4)
637+ regs_and_bypass->dppclk_bypass = 0;
638+ regs_and_bypass->dcfclk_bypass = internal.CLK1_CLK3_BYPASS_CNTL & 0x0007;
639+ if (regs_and_bypass->dcfclk_bypass < 0 || regs_and_bypass->dcfclk_bypass > 4)
640+ regs_and_bypass->dcfclk_bypass = 0;
641+ regs_and_bypass->dispclk_bypass = internal.CLK1_CLK0_BYPASS_CNTL & 0x0007;
642+ if (regs_and_bypass->dispclk_bypass < 0 || regs_and_bypass->dispclk_bypass > 4)
643+ regs_and_bypass->dispclk_bypass = 0;
644+ regs_and_bypass->dprefclk_bypass = internal.CLK1_CLK2_BYPASS_CNTL & 0x0007;
645+ if (regs_and_bypass->dprefclk_bypass < 0 || regs_and_bypass->dprefclk_bypass > 4)
646+ regs_and_bypass->dprefclk_bypass = 0;
647+
648+ if (clk_mgr->base.base.ctx->dc->debug.pstate_enabled) {
649+ DC_LOG_SMU("clk_type,clk_value,deepsleep_cntl,deepsleep_allow,bypass\n");
650+
651+ DC_LOG_SMU("dcfclk,%d,%d,%d,%s\n",
652+ regs_and_bypass->dcfclk,
653+ regs_and_bypass->dcf_deep_sleep_divider,
654+ regs_and_bypass->dcf_deep_sleep_allow,
655+ bypass_clks[(int) regs_and_bypass->dcfclk_bypass]);
656+
657+ DC_LOG_SMU("dprefclk,%d,N/A,N/A,%s\n",
658+ regs_and_bypass->dprefclk,
659+ bypass_clks[(int) regs_and_bypass->dprefclk_bypass]);
660+
661+ DC_LOG_SMU("dispclk,%d,N/A,N/A,%s\n",
662+ regs_and_bypass->dispclk,
663+ bypass_clks[(int) regs_and_bypass->dispclk_bypass]);
664+
665+ // REGISTER VALUES
666+ DC_LOG_SMU("reg_name,value,clk_type");
667+
668+ DC_LOG_SMU("CLK1_CLK3_CURRENT_CNT,%d,dcfclk",
669+ internal.CLK1_CLK3_CURRENT_CNT);
670+
671+ DC_LOG_SMU("CLK1_CLK4_CURRENT_CNT,%d,dtbclk",
672+ internal.CLK1_CLK4_CURRENT_CNT);
673+
674+ DC_LOG_SMU("CLK1_CLK3_DS_CNTL,%d,dcf_deep_sleep_divider",
675+ internal.CLK1_CLK3_DS_CNTL);
676+
677+ DC_LOG_SMU("CLK1_CLK3_ALLOW_DS,%d,dcf_deep_sleep_allow",
678+ internal.CLK1_CLK3_ALLOW_DS);
679+
680+ DC_LOG_SMU("CLK1_CLK2_CURRENT_CNT,%d,dprefclk",
681+ internal.CLK1_CLK2_CURRENT_CNT);
682+
683+ DC_LOG_SMU("CLK1_CLK0_CURRENT_CNT,%d,dispclk",
684+ internal.CLK1_CLK0_CURRENT_CNT);
685+
686+ DC_LOG_SMU("CLK1_CLK1_CURRENT_CNT,%d,dppclk",
687+ internal.CLK1_CLK1_CURRENT_CNT);
688+
689+ DC_LOG_SMU("CLK1_CLK3_BYPASS_CNTL,%d,dcfclk_bypass",
690+ internal.CLK1_CLK3_BYPASS_CNTL);
691+
692+ DC_LOG_SMU("CLK1_CLK2_BYPASS_CNTL,%d,dprefclk_bypass",
693+ internal.CLK1_CLK2_BYPASS_CNTL);
694+
695+ DC_LOG_SMU("CLK1_CLK0_BYPASS_CNTL,%d,dispclk_bypass",
696+ internal.CLK1_CLK0_BYPASS_CNTL);
697+
698+ DC_LOG_SMU("CLK1_CLK1_BYPASS_CNTL,%d,dppclk_bypass",
699+ internal.CLK1_CLK1_BYPASS_CNTL);
700+
701+ }
593702 }
594703
595704 static bool dcn35_is_spll_ssc_enabled(struct clk_mgr *clk_mgr_base)
@@ -623,6 +732,7 @@ static void init_clk_states(struct clk_mgr *clk_mgr) · 27 unmodified lines
623732 void dcn35_init_clocks(struct clk_mgr *clk_mgr)
624733 {
625734 struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr);
735+ struct clk_mgr_dcn35 *clk_mgr_dcn35 = TO_CLK_MGR_DCN35(clk_mgr_int);
626736
627737 init_clk_states(clk_mgr);
628738
@@ -633,6 +743,13 @@ void dcn35_init_clocks(struct clk_mgr *clk_mgr) · 4 unmodified lines
633743 else
634744 clk_mgr->dp_dto_source_clock_in_khz = clk_mgr->dprefclk_khz;
635745
746+ dcn35_save_clk_registers(&clk_mgr->boot_snapshot, clk_mgr_dcn35);
747+
748+ clk_mgr->clks.ref_dtbclk_khz = clk_mgr->boot_snapshot.dtbclk * 10;
749+ if (clk_mgr->boot_snapshot.dtbclk > 59000) {
750+ /*dtbclk enabled based on */
751+ clk_mgr->clks.dtbclk_en = true;
752+ }
636753 }
637754 static struct clk_bw_params dcn35_bw_params = {
638755 .vram_type = Ddr4MemType,
@@ -1323,7 +1440,7 @@ void dcn35_clk_mgr_construct( · 684 unmodified lines
13231440 dcn35_bw_params.wm_table = ddr5_wm_table;
13241441 }
13251442 /* Saved clocks configured at boot for debug purposes */
1326− dcn35_dump_clk_registers(&clk_mgr->base.base.boot_snapshot, clk_mgr);
1443+ dcn35_save_clk_registers(&clk_mgr->base.base.boot_snapshot, clk_mgr);
13271444
13281445 clk_mgr->base.base.dprefclk_khz = dcn35_smu_get_dprefclk(&clk_mgr->base);
13291446 clk_mgr->base.base.clks.ref_dtbclk_khz = 600000;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c+13−13
@@ -162,7 +162,7 @@ static void dcn401_init_single_clock(struct clk_mgr_internal *clk_mgr, PPCLK_e c · 161 unmodified lines
162162 unsigned int i;
163163 char *entry_i = (char *)entry_0;
164164
165− uint32_t ret = dcn30_smu_get_dpm_freq_by_index(clk_mgr, clk, 0xFF);
165+ uint32_t ret = dcn401_smu_get_dpm_freq_by_index(clk_mgr, clk, 0xFF);
166166
167167 if (ret & (1 << 31))
168168 /* fine-grained, only min and max */
@@ -174,7 +174,7 @@ static void dcn401_init_single_clock(struct clk_mgr_internal *clk_mgr, PPCLK_e c · 5 unmodified lines
174174
175175 /* if the initial message failed, num_levels will be 0 */
176176 for (i = 0; i < *num_levels && i < ARRAY_SIZE(clk_mgr->base.bw_params->clk_table.entries); i++) {
177− *((unsigned int *)entry_i) = (dcn30_smu_get_dpm_freq_by_index(clk_mgr, clk, i) & 0xFFFF);
177+ *((unsigned int *)entry_i) = (dcn401_smu_get_dpm_freq_by_index(clk_mgr, clk, i) & 0xFFFF);
178178 entry_i += sizeof(clk_mgr->base.bw_params->clk_table.entries[0]);
179179 }
180180 }
@@ -231,20 +231,20 @@ void dcn401_init_clocks(struct clk_mgr *clk_mgr_base) · 50 unmodified lines
231231 clk_mgr->smu_present = false;
232232 clk_mgr->dpm_present = false;
233233
234− if (!clk_mgr_base->force_smu_not_present && dcn30_smu_get_smu_version(clk_mgr, &clk_mgr->smu_ver))
234+ if (!clk_mgr_base->force_smu_not_present && dcn401_smu_get_smu_version(clk_mgr, &clk_mgr->smu_ver))
235235 clk_mgr->smu_present = true;
236236
237237 if (!clk_mgr->smu_present)
238238 return;
239239
240− dcn30_smu_check_driver_if_version(clk_mgr);
241− dcn30_smu_check_msg_header_version(clk_mgr);
240+ dcn401_smu_check_driver_if_version(clk_mgr);
241+ dcn401_smu_check_msg_header_version(clk_mgr);
242242
243243 /* DCFCLK */
244244 dcn401_init_single_clock(clk_mgr, PPCLK_DCFCLK,
245245 &clk_mgr_base->bw_params->clk_table.entries[0].dcfclk_mhz,
246246 &num_entries_per_clk->num_dcfclk_levels);
247− clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DCFCLK);
247+ clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DCFCLK);
248248 if (num_entries_per_clk->num_dcfclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz ==
249249 clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dcfclk_levels - 1].dcfclk_mhz)
250250 clk_mgr_base->bw_params->dc_mode_limit.dcfclk_mhz = 0;
@@ -253,7 +253,7 @@ void dcn401_init_clocks(struct clk_mgr *clk_mgr_base) · 2 unmodified lines
253253 dcn401_init_single_clock(clk_mgr, PPCLK_SOCCLK,
254254 &clk_mgr_base->bw_params->clk_table.entries[0].socclk_mhz,
255255 &num_entries_per_clk->num_socclk_levels);
256− clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_SOCCLK);
256+ clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_SOCCLK);
257257 if (num_entries_per_clk->num_socclk_levels && clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz ==
258258 clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_socclk_levels - 1].socclk_mhz)
259259 clk_mgr_base->bw_params->dc_mode_limit.socclk_mhz = 0;
@@ -263,7 +263,7 @@ void dcn401_init_clocks(struct clk_mgr *clk_mgr_base) · 3 unmodified lines
263263 dcn401_init_single_clock(clk_mgr, PPCLK_DTBCLK,
264264 &clk_mgr_base->bw_params->clk_table.entries[0].dtbclk_mhz,
265265 &num_entries_per_clk->num_dtbclk_levels);
266− clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DTBCLK);
266+ clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DTBCLK);
267267 if (num_entries_per_clk->num_dtbclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz ==
268268 clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dtbclk_levels - 1].dtbclk_mhz)
269269 clk_mgr_base->bw_params->dc_mode_limit.dtbclk_mhz = 0;
@@ -273,7 +273,7 @@ void dcn401_init_clocks(struct clk_mgr *clk_mgr_base) · 3 unmodified lines
273273 dcn401_init_single_clock(clk_mgr, PPCLK_DISPCLK,
274274 &clk_mgr_base->bw_params->clk_table.entries[0].dispclk_mhz,
275275 &num_entries_per_clk->num_dispclk_levels);
276− clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DISPCLK);
276+ clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_DISPCLK);
277277 if (num_entries_per_clk->num_dispclk_levels && clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz ==
278278 clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_dispclk_levels - 1].dispclk_mhz)
279279 clk_mgr_base->bw_params->dc_mode_limit.dispclk_mhz = 0;
@@ -1318,8 +1318,8 @@ static void dcn401_notify_wm_ranges(struct clk_mgr *clk_mgr_base) · 1038 unmodified lines
13181318 table->Watermarks.WatermarkRow[i].WmSetting = i;
13191319 table->Watermarks.WatermarkRow[i].Flags = clk_mgr->base.bw_params->wm_table.nv_entries[i].pmfw_breakdown.wm_type;
13201320 }
1321− dcn30_smu_set_dram_addr_high(clk_mgr, clk_mgr->wm_range_table_addr >> 32);
1322− dcn30_smu_set_dram_addr_low(clk_mgr, clk_mgr->wm_range_table_addr & 0xFFFFFFFF);
1321+ dcn401_smu_set_dram_addr_high(clk_mgr, clk_mgr->wm_range_table_addr >> 32);
1322+ dcn401_smu_set_dram_addr_low(clk_mgr, clk_mgr->wm_range_table_addr & 0xFFFFFFFF);
13231323 dcn401_smu_transfer_wm_table_dram_2_smu(clk_mgr);
13241324 }
13251325
@@ -1390,7 +1390,7 @@ static void dcn401_get_memclk_states_from_smu(struct clk_mgr *clk_mgr_base) · 64 unmodified lines
13901390 clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_memclk_levels - 1].memclk_mhz;
13911391 }
13921392
1393− clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_UCLK);
1393+ clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_UCLK);
13941394 if (num_entries_per_clk->num_memclk_levels && clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz ==
13951395 clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_memclk_levels - 1].memclk_mhz)
13961396 clk_mgr_base->bw_params->dc_mode_limit.memclk_mhz = 0;
@@ -1399,7 +1399,7 @@ static void dcn401_get_memclk_states_from_smu(struct clk_mgr *clk_mgr_base) · 2 unmodified lines
13991399 dcn401_init_single_clock(clk_mgr, PPCLK_FCLK,
14001400 &clk_mgr_base->bw_params->clk_table.entries[0].fclk_mhz,
14011401 &num_entries_per_clk->num_fclk_levels);
1402− clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_FCLK);
1402+ clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz = dcn401_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_FCLK);
14031403 if (num_entries_per_clk->num_fclk_levels && clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz ==
14041404 clk_mgr_base->bw_params->clk_table.entries[num_entries_per_clk->num_fclk_levels - 1].fclk_mhz)
14051405 clk_mgr_base->bw_params->dc_mode_limit.fclk_mhz = 0;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c+126−4
@@ -57,6 +57,8 @@ static bool dcn401_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, uin · 56 unmodified lines
5757 /* Wait for response register to be ready */
5858 dcn401_smu_wait_for_response(clk_mgr, 10, 200000);
5959
60+ TRACE_SMU_MSG_ENTER(msg_id, param_in, clk_mgr->base.ctx);
61+
6062 /* Clear response register */
6163 REG_WRITE(DAL_RESP_REG, 0);
6264
@@ -71,9 +73,11 @@ static bool dcn401_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, uin · 8 unmodified lines
7173 if (param_out)
7274 *param_out = REG_READ(DAL_ARG_REG);
7375
76+ TRACE_SMU_MSG_EXIT(true, param_out ? *param_out : 0, clk_mgr->base.ctx);
7477 return true;
7578 }
7679
80+ TRACE_SMU_MSG_EXIT(false, 0, clk_mgr->base.ctx);
7781 return false;
7882 }
7983
@@ -102,8 +106,6 @@ static uint32_t dcn401_smu_wait_for_response_delay(struct clk_mgr_internal *clk_ · 22 unmodified lines
102106 *total_delay_us += delay_us;
103107 } while (max_retries--);
104108
105− TRACE_SMU_DELAY(*total_delay_us, clk_mgr->base.ctx);
106−
107109 return reg;
108110 }
109111
@@ -115,6 +117,8 @@ static bool dcn401_smu_send_msg_with_param_delay(struct clk_mgr_internal *clk_mg · 5 unmodified lines
115117 /* Wait for response register to be ready */
116118 dcn401_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay1_us);
117119
120+ TRACE_SMU_MSG_ENTER(msg_id, param_in, clk_mgr->base.ctx);
121+
118122 /* Clear response register */
119123 REG_WRITE(DAL_RESP_REG, 0);
120124
@@ -124,18 +128,71 @@ static bool dcn401_smu_send_msg_with_param_delay(struct clk_mgr_internal *clk_mg · 3 unmodified lines
124128 /* Trigger the message transaction by writing the message ID */
125129 REG_WRITE(DAL_MSG_REG, msg_id);
126130
127− TRACE_SMU_MSG(msg_id, param_in, clk_mgr->base.ctx);
128−
129131 /* Wait for response */
130132 if (dcn401_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay2_us) == DALSMC_Result_OK) {
131133 if (param_out)
132134 *param_out = REG_READ(DAL_ARG_REG);
133135
134136 *total_delay_us = delay1_us + delay2_us;
137+ TRACE_SMU_MSG_EXIT(true, param_out ? *param_out : 0, clk_mgr->base.ctx);
135138 return true;
136139 }
137140
138141 *total_delay_us = delay1_us + 2000000;
142+ TRACE_SMU_MSG_EXIT(false, 0, clk_mgr->base.ctx);
143+ return false;
144+}
145+
146+bool dcn401_smu_get_smu_version(struct clk_mgr_internal *clk_mgr, unsigned int *version)
147+{
148+ smu_print("SMU Get SMU version\n");
149+
150+ if (dcn401_smu_send_msg_with_param(clk_mgr,
151+ DALSMC_MSG_GetSmuVersion, 0, version)) {
152+
153+ smu_print("SMU version: %d\n", *version);
154+
155+ return true;
156+ }
157+
158+ return false;
159+}
160+
161+/* Message output should match SMU11_DRIVER_IF_VERSION in smu11_driver_if.h */
162+bool dcn401_smu_check_driver_if_version(struct clk_mgr_internal *clk_mgr)
163+{
164+ uint32_t response = 0;
165+
166+ smu_print("SMU Check driver if version\n");
167+
168+ if (dcn401_smu_send_msg_with_param(clk_mgr,
169+ DALSMC_MSG_GetDriverIfVersion, 0, &response)) {
170+
171+ smu_print("SMU driver if version: %d\n", response);
172+
173+ if (response == SMU14_DRIVER_IF_VERSION)
174+ return true;
175+ }
176+
177+ return false;
178+}
179+
180+/* Message output should match DALSMC_VERSION in dalsmc.h */
181+bool dcn401_smu_check_msg_header_version(struct clk_mgr_internal *clk_mgr)
182+{
183+ uint32_t response = 0;
184+
185+ smu_print("SMU Check msg header version\n");
186+
187+ if (dcn401_smu_send_msg_with_param(clk_mgr,
188+ DALSMC_MSG_GetMsgHeaderVersion, 0, &response)) {
189+
190+ smu_print("SMU msg header version: %d\n", response);
191+
192+ if (response == DALSMC_VERSION)
193+ return true;
194+ }
195+
139196 return false;
140197 }
141198
@@ -163,6 +220,22 @@ void dcn401_smu_send_cab_for_uclk_message(struct clk_mgr_internal *clk_mgr, unsi · 21 unmodified lines
163220 smu_print("Numways for SubVP : %d\n", num_ways);
164221 }
165222
223+void dcn401_smu_set_dram_addr_high(struct clk_mgr_internal *clk_mgr, uint32_t addr_high)
224+{
225+ smu_print("SMU Set DRAM addr high: %d\n", addr_high);
226+
227+ dcn401_smu_send_msg_with_param(clk_mgr,
228+ DALSMC_MSG_SetDalDramAddrHigh, addr_high, NULL);
229+}
230+
231+void dcn401_smu_set_dram_addr_low(struct clk_mgr_internal *clk_mgr, uint32_t addr_low)
232+{
233+ smu_print("SMU Set DRAM addr low: %d\n", addr_low);
234+
235+ dcn401_smu_send_msg_with_param(clk_mgr,
236+ DALSMC_MSG_SetDalDramAddrLow, addr_low, NULL);
237+}
238+
166239 void dcn401_smu_transfer_wm_table_dram_2_smu(struct clk_mgr_internal *clk_mgr)
167240 {
168241 smu_print("SMU Transfer WM table DRAM 2 SMU\n");
@@ -348,3 +421,52 @@ unsigned int dcn401_smu_get_num_of_umc_channels(struct clk_mgr_internal *clk_mgr · 179 unmodified lines
348421
349422 return response;
350423 }
424+
425+/*
426+ * Frequency in MHz returned in lower 16 bits for valid DPM level
427+ *
428+ * Call with dpm_level = 0xFF to query features, return value will be:
429+ * Bits 7:0 - number of DPM levels
430+ * Bit 28 - 1 = auto DPM on
431+ * Bit 29 - 1 = sweep DPM on
432+ * Bit 30 - 1 = forced DPM on
433+ * Bit 31 - 0 = discrete, 1 = fine-grained
434+ *
435+ * With fine-grained DPM, only min and max frequencies will be reported
436+ *
437+ * Returns 0 on failure
438+ */
439+unsigned int dcn401_smu_get_dpm_freq_by_index(struct clk_mgr_internal *clk_mgr, uint32_t clk, uint8_t dpm_level)
440+{
441+ uint32_t response = 0;
442+
443+ /* bits 23:16 for clock type, lower 8 bits for DPM level */
444+ uint32_t param = (clk << 16) | dpm_level;
445+
446+ smu_print("SMU Get dpm freq by index: clk = %d, dpm_level = %d\n", clk, dpm_level);
447+
448+ dcn401_smu_send_msg_with_param(clk_mgr,
449+ DALSMC_MSG_GetDpmFreqByIndex, param, &response);
450+
451+ smu_print("SMU dpm freq: %d MHz\n", response);
452+
453+ return response;
454+}
455+
456+/* Returns the max DPM frequency in DC mode in MHz, 0 on failure */
457+unsigned int dcn401_smu_get_dc_mode_max_dpm_freq(struct clk_mgr_internal *clk_mgr, uint32_t clk)
458+{
459+ uint32_t response = 0;
460+
461+ /* bits 23:16 for clock type */
462+ uint32_t param = clk << 16;
463+
464+ smu_print("SMU Get DC mode max DPM freq: clk = %d\n", clk);
465+
466+ dcn401_smu_send_msg_with_param(clk_mgr,
467+ DALSMC_MSG_GetDcModeMaxDpmFreq, param, &response);
468+
469+ smu_print("SMU DC mode max DMP freq: %d MHz\n", response);
470+
471+ return response;
472+}
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.h+9−1
@@ -7,11 +7,17 @@ · 6 unmodified lines
77
88 #include "os_types.h"
99 #include "core_types.h"
10−#include "dcn32/dcn32_clk_mgr_smu_msg.h"
1110
11+struct clk_mgr_internal;
12+
13+bool dcn401_smu_get_smu_version(struct clk_mgr_internal *clk_mgr, unsigned int *version);
14+bool dcn401_smu_check_driver_if_version(struct clk_mgr_internal *clk_mgr);
15+bool dcn401_smu_check_msg_header_version(struct clk_mgr_internal *clk_mgr);
1216 void dcn401_smu_send_fclk_pstate_message(struct clk_mgr_internal *clk_mgr, bool support);
1317 void dcn401_smu_send_uclk_pstate_message(struct clk_mgr_internal *clk_mgr, bool support);
1418 void dcn401_smu_send_cab_for_uclk_message(struct clk_mgr_internal *clk_mgr, unsigned int num_ways);
19+void dcn401_smu_set_dram_addr_high(struct clk_mgr_internal *clk_mgr, uint32_t addr_high);
20+void dcn401_smu_set_dram_addr_low(struct clk_mgr_internal *clk_mgr, uint32_t addr_low);
1521 void dcn401_smu_transfer_wm_table_dram_2_smu(struct clk_mgr_internal *clk_mgr);
1622 void dcn401_smu_set_pme_workaround(struct clk_mgr_internal *clk_mgr);
1723 unsigned int dcn401_smu_set_hard_min_by_freq(struct clk_mgr_internal *clk_mgr, uint32_t clk, uint16_t freq_mhz);
@@ -29,5 +35,7 @@ bool dcn401_smu_set_subvp_uclk_fclk_hardmin(struct clk_mgr_internal *clk_mgr, · 11 unmodified lines
2935 void dcn401_smu_set_min_deep_sleep_dcef_clk(struct clk_mgr_internal *clk_mgr, uint32_t freq_mhz);
3036 void dcn401_smu_set_num_of_displays(struct clk_mgr_internal *clk_mgr, uint32_t num_displays);
3137 unsigned int dcn401_smu_get_num_of_umc_channels(struct clk_mgr_internal *clk_mgr);
38+unsigned int dcn401_smu_get_dc_mode_max_dpm_freq(struct clk_mgr_internal *clk_mgr, uint32_t clk);
39+unsigned int dcn401_smu_get_dpm_freq_by_index(struct clk_mgr_internal *clk_mgr, uint32_t clk, uint8_t dpm_level);
3240
3341 #endif /* __DCN401_CLK_MGR_SMU_MSG_H_ */
drivers/gpu/drm/amd/display/dc/core/dc.c+7−5
@@ -460,7 +460,7 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc, · 459 unmodified lines
460460 * avoid conflicting with firmware updates.
461461 */
462462 if (dc->ctx->dce_version > DCE_VERSION_MAX) {
463− if ((dc->optimized_required || dc->wm_optimized_required) &&
463+ if (dc->optimized_required &&
464464 (stream->adjust.v_total_max != adjust->v_total_max ||
465465 stream->adjust.v_total_min != adjust->v_total_min)) {
466466 stream->adjust.timing_adjust_pending = true;
@@ -2577,7 +2577,6 @@ void dc_post_update_surfaces_to_stream(struct dc *dc) · 2110 unmodified lines
25772577 }
25782578
25792579 dc->optimized_required = false;
2580− dc->wm_optimized_required = false;
25812580 }
25822581
25832582 bool dc_set_generic_gpio_for_stereo(bool enable,
@@ -3056,8 +3055,6 @@ enum surface_update_type dc_check_update_surfaces_for_stream( · 472 unmodified lines
30563055 } else if (memcmp(&dc->current_state->bw_ctx.bw.dcn.clk, &dc->clk_mgr->clks, offsetof(struct dc_clocks, prev_p_state_change_support)) != 0) {
30573056 dc->optimized_required = true;
30583057 }
3059−
3060− dc->optimized_required |= dc->wm_optimized_required;
30613058 }
30623059
30633060 return type;
@@ -3313,6 +3310,9 @@ static void copy_stream_update_to_stream(struct dc *dc, · 249 unmodified lines
33133310 if (update->adaptive_sync_infopacket)
33143311 stream->adaptive_sync_infopacket = *update->adaptive_sync_infopacket;
33153312
3313+ if (update->avi_infopacket)
3314+ stream->avi_infopacket = *update->avi_infopacket;
3315+
33163316 if (update->dither_option)
33173317 stream->dither_option = *update->dither_option;
33183318
@@ -3607,7 +3607,8 @@ static void commit_planes_do_stream_update(struct dc *dc, · 288 unmodified lines
36073607 stream_update->vsp_infopacket ||
36083608 stream_update->hfvsif_infopacket ||
36093609 stream_update->adaptive_sync_infopacket ||
3610− stream_update->vtem_infopacket) {
3610+ stream_update->vtem_infopacket ||
3611+ stream_update->avi_infopacket) {
36113612 resource_build_info_frame(pipe_ctx);
36123613 dc->hwss.update_info_frame(pipe_ctx);
36133614
@@ -5079,6 +5080,7 @@ static bool full_update_required(struct dc *dc, · 1465 unmodified lines
50795080 stream_update->hfvsif_infopacket ||
50805081 stream_update->vtem_infopacket ||
50815082 stream_update->adaptive_sync_infopacket ||
5083+ stream_update->avi_infopacket ||
50825084 stream_update->dpms_off ||
50835085 stream_update->allow_freesync ||
50845086 stream_update->vrr_active_variable ||
drivers/gpu/drm/amd/display/dc/core/dc_resource.c+6−0
@@ -4410,8 +4410,14 @@ static void set_avi_info_frame( · 4409 unmodified lines
44104410 unsigned int fr_ind = pipe_ctx->stream->timing.fr_index;
44114411 enum dc_timing_3d_format format;
44124412
4413+ if (stream->avi_infopacket.valid) {
4414+ *info_packet = stream->avi_infopacket;
4415+ return;
4416+ }
4417+
44134418 memset(&hdmi_info, 0, sizeof(union hdmi_info_packet));
44144419
4420+
44154421 color_space = pipe_ctx->stream->output_color_space;
44164422 if (color_space == COLOR_SPACE_UNKNOWN)
44174423 color_space = (stream->timing.pixel_encoding == PIXEL_ENCODING_RGB) ?
drivers/gpu/drm/amd/display/dc/dc.h+2−3
@@ -55,7 +55,7 @@ struct aux_payload; · 54 unmodified lines
5555 struct set_config_cmd_payload;
5656 struct dmub_notification;
5757
58−#define DC_VER "3.2.350"
58+#define DC_VER "3.2.351"
5959
6060 /**
6161 * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
@@ -1163,6 +1163,7 @@ struct dc_debug_options { · 1101 unmodified lines
11631163 unsigned int auxless_alpm_lfps_silence_ns;
11641164 unsigned int auxless_alpm_lfps_t1t2_us;
11651165 short auxless_alpm_lfps_t1t2_offset_us;
1166+ bool disable_stutter_for_wm_program;
11661167 };
11671168
11681169
@@ -1391,7 +1392,6 @@ union surface_update_flags { · 222 unmodified lines
13911392 uint32_t in_transfer_func_change:1;
13921393 uint32_t input_csc_change:1;
13931394 uint32_t coeff_reduction_change:1;
1394− uint32_t output_tf_change:1;
13951395 uint32_t pixel_format_change:1;
13961396 uint32_t plane_size_change:1;
13971397 uint32_t gamut_remap_change:1;
@@ -1735,7 +1735,6 @@ struct dc { · 337 unmodified lines
17351735
17361736 /* Require to optimize clocks and bandwidth for added/removed planes */
17371737 bool optimized_required;
1738− bool wm_optimized_required;
17391738 bool idle_optimizations_allowed;
17401739 bool enable_c20_dtm_b0;
17411740
drivers/gpu/drm/amd/display/dc/dc_stream.h+3−0
@@ -203,6 +203,7 @@ struct dc_stream_state { · 202 unmodified lines
203203 struct dc_info_packet hfvsif_infopacket;
204204 struct dc_info_packet vtem_infopacket;
205205 struct dc_info_packet adaptive_sync_infopacket;
206+ struct dc_info_packet avi_infopacket;
206207 uint8_t dsc_packed_pps[128];
207208 struct rect src; /* composition area */
208209 struct rect dst; /* stream addressable area */
@@ -335,6 +336,8 @@ struct dc_stream_update { · 126 unmodified lines
335336 struct dc_info_packet *hfvsif_infopacket;
336337 struct dc_info_packet *vtem_infopacket;
337338 struct dc_info_packet *adaptive_sync_infopacket;
339+ struct dc_info_packet *avi_infopacket;
340+
338341 bool *dpms_off;
339342 bool integer_scaling_update;
340343 bool *allow_freesync;
drivers/gpu/drm/amd/display/dc/dc_types.h+1−0
@@ -1217,6 +1217,7 @@ struct dc_panel_config { · 1216 unmodified lines
12171217 bool rc_disable;
12181218 bool rc_allow_static_screen;
12191219 bool rc_allow_fullscreen_VPB;
1220+ bool read_psrcap_again;
12201221 unsigned int replay_enable_option;
12211222 } psr;
12221223 /* ABM */
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c+21−3
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939
4040 #define CTX \
4141 dccg_dcn->base.ctx
42+#include "logger_types.h"
4243 #define DC_LOGGER \
4344 dccg->ctx->logger
4445
@@ -1136,7 +1137,7 @@ static void dcn35_set_dppclk_enable(struct dccg *dccg, · 1091 unmodified lines
11361137 default:
11371138 break;
11381139 }
1139− //DC_LOG_DEBUG("%s: dpp_inst(%d) DPPCLK_EN = %d\n", __func__, dpp_inst, enable);
1140+ DC_LOG_DEBUG("%s: dpp_inst(%d) DPPCLK_EN = %d\n", __func__, dpp_inst, enable);
11401141
11411142 }
11421143
@@ -1406,6 +1407,10 @@ static void dccg35_set_dtbclk_dto( · 263 unmodified lines
14061407 * PIPEx_DTO_SRC_SEL should not be programmed during DTBCLK update since OTG may still be on, and the
14071408 * programming is handled in program_pix_clk() regardless, so it can be removed from here.
14081409 */
1410+ DC_LOG_DEBUG("%s: OTG%d DTBCLK DTO enabled: pixclk_khz=%d, ref_dtbclk_khz=%d, req_dtbclk_khz=%d, phase=%d, modulo=%d\n",
1411+ __func__, params->otg_inst, params->pixclk_khz,
1412+ params->ref_dtbclk_khz, req_dtbclk_khz, phase, modulo);
1413+
14091414 } else {
14101415 switch (params->otg_inst) {
14111416 case 0:
@@ -1431,6 +1436,8 @@ static void dccg35_set_dtbclk_dto( · 19 unmodified lines
14311436
14321437 REG_WRITE(DTBCLK_DTO_MODULO[params->otg_inst], 0);
14331438 REG_WRITE(DTBCLK_DTO_PHASE[params->otg_inst], 0);
1439+
1440+ DC_LOG_DEBUG("%s: OTG%d DTBCLK DTO disabled\n", __func__, params->otg_inst);
14341441 }
14351442 }
14361443
@@ -1475,6 +1482,8 @@ static void dccg35_set_dpstreamclk( · 38 unmodified lines
14751482 BREAK_TO_DEBUGGER();
14761483 return;
14771484 }
1485+ DC_LOG_DEBUG("%s: dp_hpo_inst(%d) DPSTREAMCLK_EN = %d, DPSTREAMCLK_SRC_SEL = %d\n",
1486+ __func__, dp_hpo_inst, (src == REFCLK) ? 0 : 1, otg_inst);
14781487 }
14791488
14801489
@@ -1514,6 +1523,8 @@ static void dccg35_set_dpstreamclk_root_clock_gating( · 33 unmodified lines
15141523 BREAK_TO_DEBUGGER();
15151524 return;
15161525 }
1526+ DC_LOG_DEBUG("%s: dp_hpo_inst(%d) DPSTREAMCLK_ROOT_GATE_DISABLE = %d\n",
1527+ __func__, dp_hpo_inst, enable ? 1 : 0);
15171528 }
15181529
15191530
@@ -1553,7 +1564,7 @@ static void dccg35_set_physymclk_root_clock_gating( · 33 unmodified lines
15531564 BREAK_TO_DEBUGGER();
15541565 return;
15551566 }
1556− //DC_LOG_DEBUG("%s: dpp_inst(%d) PHYESYMCLK_ROOT_GATE_DISABLE:\n", __func__, phy_inst, enable ? 0 : 1);
1567+ DC_LOG_DEBUG("%s: dpp_inst(%d) PHYESYMCLK_ROOT_GATE_DISABLE: %d\n", __func__, phy_inst, enable ? 0 : 1);
15571568
15581569 }
15591570
@@ -1626,6 +1637,8 @@ static void dccg35_set_physymclk( · 66 unmodified lines
16261637 BREAK_TO_DEBUGGER();
16271638 return;
16281639 }
1640+ DC_LOG_DEBUG("%s: phy_inst(%d) PHYxSYMCLK_EN = %d, PHYxSYMCLK_SRC_SEL = %d\n",
1641+ __func__, phy_inst, force_enable ? 1 : 0, clk_src);
16291642 }
16301643
16311644 static void dccg35_set_valid_pixel_rate(
@@ -1673,6 +1686,7 @@ static void dccg35_dpp_root_clock_control( · 41 unmodified lines
16731686 }
16741687
16751688 dccg->dpp_clock_gated[dpp_inst] = !clock_on;
1689+ DC_LOG_DEBUG("%s: dpp_inst(%d) clock_on = %d\n", __func__, dpp_inst, clock_on);
16761690 }
16771691
16781692 static void dccg35_disable_symclk32_se(
@@ -1731,6 +1745,7 @@ static void dccg35_disable_symclk32_se( · 52 unmodified lines
17311745 BREAK_TO_DEBUGGER();
17321746 return;
17331747 }
1748+
17341749 }
17351750
17361751 static void dccg35_init_cb(struct dccg *dccg)
@@ -1738,7 +1753,6 @@ static void dccg35_init_cb(struct dccg *dccg) · 1 unmodified line
17381753 (void)dccg;
17391754 /* Any RCG should be done when driver enter low power mode*/
17401755 }
1741−
17421756 void dccg35_init(struct dccg *dccg)
17431757 {
17441758 int otg_inst;
@@ -1753,6 +1767,8 @@ void dccg35_init(struct dccg *dccg) · 8 unmodified lines
17531767 for (otg_inst = 0; otg_inst < 2; otg_inst++) {
17541768 dccg31_disable_symclk32_le(dccg, otg_inst);
17551769 dccg31_set_symclk32_le_root_clock_gating(dccg, otg_inst, false);
1770+ DC_LOG_DEBUG("%s: OTG%d SYMCLK32_LE disabled and root clock gating disabled\n",
1771+ __func__, otg_inst);
17561772 }
17571773
17581774 // if (dccg->ctx->dc->debug.root_clock_optimization.bits.symclk32_se)
@@ -1765,6 +1781,8 @@ void dccg35_init(struct dccg *dccg) · 6 unmodified lines
17651781 dccg35_set_dpstreamclk(dccg, REFCLK, otg_inst,
17661782 otg_inst);
17671783 dccg35_set_dpstreamclk_root_clock_gating(dccg, otg_inst, false);
1784+ DC_LOG_DEBUG("%s: OTG%d DPSTREAMCLK disabled and root clock gating disabled\n",
1785+ __func__, otg_inst);
17681786 }
17691787
17701788 /*
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c+1−0
@@ -169,6 +169,7 @@ static bool dmub_replay_copy_settings(struct dmub_replay *dmub, · 168 unmodified lines
169169 copy_settings_data->max_deviation_line = link->dpcd_caps.pr_info.max_deviation_line;
170170 copy_settings_data->smu_optimizations_en = link->replay_settings.replay_smu_opt_enable;
171171 copy_settings_data->replay_timing_sync_supported = link->replay_settings.config.replay_timing_sync_supported;
172+ copy_settings_data->replay_support_fast_resync_in_ultra_sleep_mode = link->replay_settings.config.replay_support_fast_resync_in_ultra_sleep_mode;
172173
173174 copy_settings_data->debug.bitfields.enable_ips_visual_confirm = dc->dc->debug.enable_ips_visual_confirm;
174175
drivers/gpu/drm/amd/display/dc/dm_services.h+6−5
@@ -277,12 +277,13 @@ void dm_perf_trace_timestamp(const char *func_name, unsigned int line, struct dc · 276 unmodified lines
277277 /*
278278 * SMU message tracing
279279 */
280−void dm_trace_smu_msg(uint32_t msg_id, uint32_t param_in, struct dc_context *ctx);
281−void dm_trace_smu_delay(uint32_t delay, struct dc_context *ctx);
282−
283−#define TRACE_SMU_MSG(msg_id, param_in, ctx) dm_trace_smu_msg(msg_id, param_in, ctx)
284−#define TRACE_SMU_DELAY(response_delay, ctx) dm_trace_smu_delay(response_delay, ctx)
280+void dm_trace_smu_enter(uint32_t msg_id, uint32_t param_in, unsigned int delay, struct dc_context *ctx);
281+void dm_trace_smu_exit(bool success, uint32_t response, struct dc_context *ctx);
285282
283+#define TRACE_SMU_MSG_DELAY(msg_id, param_in, delay, ctx) dm_trace_smu_enter(msg_id, param_in, delay, ctx)
284+#define TRACE_SMU_MSG(msg_id, param_in, ctx) dm_trace_smu_enter(msg_id, param_in, 0, ctx)
285+#define TRACE_SMU_MSG_ENTER(msg_id, param_in, ctx) dm_trace_smu_enter(msg_id, param_in, 0, ctx)
286+#define TRACE_SMU_MSG_EXIT(success, response, ctx) dm_trace_smu_exit(success, response, ctx)
286287
287288 /*
288289 * DMUB Interfaces
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn3.c+11−10
@@ -48,18 +48,19 @@ static void set_reserved_time_on_all_planes_with_stream_index(struct display_con · 47 unmodified lines
4848
4949 static void remove_duplicates(double *list_a, int *list_a_size)
5050 {
51− int cur_element = 0;
52− // For all elements b[i] in list_b[]
53− while (cur_element < *list_a_size - 1) {
54− if (list_a[cur_element] == list_a[cur_element + 1]) {
55− for (int j = cur_element + 1; j < *list_a_size - 1; j++) {
56− list_a[j] = list_a[j + 1];
57− }
58− *list_a_size = *list_a_size - 1;
59− } else {
60− cur_element++;
51+ int j = 0;
52+
53+ if (*list_a_size == 0)
54+ return;
55+
56+ for (int i = 1; i < *list_a_size; i++) {
57+ if (list_a[j] != list_a[i]) {
58+ j++;
59+ list_a[j] = list_a[i];
6160 }
6261 }
62+
63+ *list_a_size = j + 1;
6364 }
6465
6566 static bool increase_mpc_combine_factor(unsigned int *mpc_combine_factor, unsigned int limit)
drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c+33−5
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include "dcn32_hubbub.h"
2929 #include "dm_services.h"
3030 #include "reg_helper.h"
31+#include "dal_asic_id.h"
3132
3233
3334 #define CTX \
@@ -72,6 +73,14 @@ static void dcn32_init_crb(struct hubbub *hubbub) · 38 unmodified lines
7273 REG_UPDATE(DCHUBBUB_DEBUG_CTRL_0, DET_DEPTH, 0x47F);
7374 }
7475
76+static void hubbub32_set_sdp_control(struct hubbub *hubbub, bool dc_control)
77+{
78+ struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
79+
80+ REG_UPDATE(DCHUBBUB_SDPIF_CFG0,
81+ SDPIF_PORT_CONTROL, dc_control);
82+}
83+
7584 void hubbub32_set_request_limit(struct hubbub *hubbub, int memory_channel_count, int words_per_channel)
7685 {
7786 struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
@@ -754,8 +763,18 @@ static bool hubbub32_program_watermarks( · 676 unmodified lines
754763 unsigned int refclk_mhz,
755764 bool safe_to_lower)
756765 {
766+ struct dc *dc = hubbub->ctx->dc;
757767 bool wm_pending = false;
758768
769+ if (!safe_to_lower && dc->debug.disable_stutter_for_wm_program &&
770+ (ASICREV_IS_GC_11_0_0(dc->ctx->asic_id.hw_internal_rev) ||
771+ ASICREV_IS_GC_11_0_3(dc->ctx->asic_id.hw_internal_rev))) {
772+ /* before raising watermarks, SDP control give to DF, stutter must be disabled */
773+ wm_pending = true;
774+ hubbub32_set_sdp_control(hubbub, false);
775+ hubbub1_allow_self_refresh_control(hubbub, false);
776+ }
777+
759778 if (hubbub32_program_urgent_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower))
760779 wm_pending = true;
761780
@@ -786,10 +805,20 @@ static bool hubbub32_program_watermarks( · 24 unmodified lines
786805 REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND,
787806 DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 0x1FF);*/
788807
789− if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter)
790− hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
808+ if (safe_to_lower) {
809+ /* after lowering watermarks, stutter setting is restored, SDP control given to DC */
810+ hubbub1_allow_self_refresh_control(hubbub, !dc->debug.disable_stutter);
811+
812+ if (dc->debug.disable_stutter_for_wm_program &&
813+ (ASICREV_IS_GC_11_0_0(dc->ctx->asic_id.hw_internal_rev) ||
814+ ASICREV_IS_GC_11_0_3(dc->ctx->asic_id.hw_internal_rev))) {
815+ hubbub32_set_sdp_control(hubbub, true);
816+ }
817+ } else if (dc->debug.disable_stutter) {
818+ hubbub1_allow_self_refresh_control(hubbub, !dc->debug.disable_stutter);
819+ }
791820
792− hubbub32_force_usr_retraining_allow(hubbub, hubbub->ctx->dc->debug.force_usr_allow);
821+ hubbub32_force_usr_retraining_allow(hubbub, dc->debug.force_usr_allow);
793822
794823 return wm_pending;
795824 }
@@ -974,8 +1003,7 @@ void hubbub32_init(struct hubbub *hubbub) · 178 unmodified lines
9741003 ignore the "df_pre_cstate_req" from the SDP port control.
9751004 only the DCN will determine when to connect the SDP port
9761005 */
977− REG_UPDATE(DCHUBBUB_SDPIF_CFG0,
978− SDPIF_PORT_CONTROL, 1);
1006+ hubbub32_set_sdp_control(hubbub, true);
9791007 /*Set SDP's max outstanding request to 512
9801008 must set the register back to 0 (max outstanding = 256) in zero frame buffer mode*/
9811009 REG_UPDATE(DCHUBBUB_SDPIF_CFG1,
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c+1−1
@@ -3347,7 +3347,7 @@ void dcn10_prepare_bandwidth( · 3346 unmodified lines
33473347 context,
33483348 false);
33493349
3350− dc->wm_optimized_required = hubbub->funcs->program_watermarks(hubbub,
3350+ dc->optimized_required = hubbub->funcs->program_watermarks(hubbub,
33513351 &context->bw_ctx.bw.dcn.watermarks,
33523352 dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000,
33533353 true);
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c+8−9
@@ -1982,10 +1982,8 @@ static void dcn20_program_pipe( · 1981 unmodified lines
19821982 * updating on slave planes
19831983 */
19841984 if (pipe_ctx->update_flags.bits.enable ||
1985− pipe_ctx->update_flags.bits.plane_changed ||
1986− pipe_ctx->stream->update_flags.bits.out_tf ||
1987− (pipe_ctx->plane_state &&
1988− pipe_ctx->plane_state->update_flags.bits.output_tf_change))
1985+ pipe_ctx->update_flags.bits.plane_changed ||
1986+ pipe_ctx->stream->update_flags.bits.out_tf)
19891987 hws->funcs.set_output_transfer_func(dc, pipe_ctx, pipe_ctx->stream);
19901988
19911989 /* If the pipe has been enabled or has a different opp, we
@@ -2390,10 +2388,10 @@ void dcn20_prepare_bandwidth( · 398 unmodified lines
23902388 }
23912389
23922390 /* program dchubbub watermarks:
2393− * For assigning wm_optimized_required, use |= operator since we don't want
2391+ * For assigning optimized_required, use |= operator since we don't want
23942392 * to clear the value if the optimize has not happened yet
23952393 */
2396− dc->wm_optimized_required |= hubbub->funcs->program_watermarks(hubbub,
2394+ dc->optimized_required |= hubbub->funcs->program_watermarks(hubbub,
23972395 &context->bw_ctx.bw.dcn.watermarks,
23982396 dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000,
23992397 false);
@@ -2406,10 +2404,10 @@ void dcn20_prepare_bandwidth( · 6 unmodified lines
24062404 if (hubbub->funcs->program_compbuf_size) {
24072405 if (context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes) {
24082406 compbuf_size_kb = context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes;
2409− dc->wm_optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.dml.ip.min_comp_buffer_size_kbytes);
2407+ dc->optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.dml.ip.min_comp_buffer_size_kbytes);
24102408 } else {
24112409 compbuf_size_kb = context->bw_ctx.bw.dcn.compbuf_size_kb;
2412− dc->wm_optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.bw.dcn.compbuf_size_kb);
2410+ dc->optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.bw.dcn.compbuf_size_kb);
24132411 }
24142412
24152413 hubbub->funcs->program_compbuf_size(hubbub, compbuf_size_kb, false);
@@ -3131,7 +3129,8 @@ void dcn20_fpga_init_hw(struct dc *dc) · 715 unmodified lines
31313129 res_pool->dccg->funcs->dccg_init(res_pool->dccg);
31323130
31333131 //Enable ability to power gate / don't force power on permanently
3134− hws->funcs.enable_power_gating_plane(hws, true);
3132+ if (hws->funcs.enable_power_gating_plane)
3133+ hws->funcs.enable_power_gating_plane(hws, true);
31353134
31363135 // Specific to FPGA dccg and registers
31373136 REG_WRITE(RBBMIF_TIMEOUT_DIS, 0xFFFFFFFF);
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c+6−8
@@ -1383,22 +1383,22 @@ void dcn401_prepare_bandwidth(struct dc *dc, · 1382 unmodified lines
13831383 false);
13841384
13851385 /* program dchubbub watermarks:
1386− * For assigning wm_optimized_required, use |= operator since we don't want
1386+ * For assigning optimized_required, use |= operator since we don't want
13871387 * to clear the value if the optimize has not happened yet
13881388 */
1389− dc->wm_optimized_required |= hubbub->funcs->program_watermarks(hubbub,
1389+ dc->optimized_required |= hubbub->funcs->program_watermarks(hubbub,
13901390 &context->bw_ctx.bw.dcn.watermarks,
13911391 dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000,
13921392 false);
13931393 /* update timeout thresholds */
13941394 if (hubbub->funcs->program_arbiter) {
1395− dc->wm_optimized_required |= hubbub->funcs->program_arbiter(hubbub, &context->bw_ctx.bw.dcn.arb_regs, false);
1395+ dc->optimized_required |= hubbub->funcs->program_arbiter(hubbub, &context->bw_ctx.bw.dcn.arb_regs, false);
13961396 }
13971397
13981398 /* decrease compbuf size */
13991399 if (hubbub->funcs->program_compbuf_segments) {
14001400 compbuf_size = context->bw_ctx.bw.dcn.arb_regs.compbuf_size;
1401− dc->wm_optimized_required |= (compbuf_size != dc->current_state->bw_ctx.bw.dcn.arb_regs.compbuf_size);
1401+ dc->optimized_required |= (compbuf_size != dc->current_state->bw_ctx.bw.dcn.arb_regs.compbuf_size);
14021402
14031403 hubbub->funcs->program_compbuf_segments(hubbub, compbuf_size, false);
14041404 }
@@ -2032,10 +2032,8 @@ void dcn401_program_pipe( · 627 unmodified lines
20322032 * updating on slave planes
20332033 */
20342034 if (pipe_ctx->update_flags.bits.enable ||
2035− pipe_ctx->update_flags.bits.plane_changed ||
2036− pipe_ctx->stream->update_flags.bits.out_tf ||
2037− (pipe_ctx->plane_state &&
2038− pipe_ctx->plane_state->update_flags.bits.output_tf_change))
2035+ pipe_ctx->update_flags.bits.plane_changed ||
2036+ pipe_ctx->stream->update_flags.bits.out_tf)
20392037 hws->funcs.set_output_transfer_func(dc, pipe_ctx, pipe_ctx->stream);
20402038
20412039 /* If the pipe has been enabled or has a different opp, we
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c+14−0
@@ -703,6 +703,20 @@ bool edp_setup_psr(struct dc_link *link, · 702 unmodified lines
703703 if (!link)
704704 return false;
705705
706+ /* This is a workaround: some vendors require the source to
707+ * read the PSR cap; otherwise, the vendor's PSR feature will
708+ * fall back to its default behavior, causing a misconfiguration
709+ * of this feature.
710+ */
711+ if (link->panel_config.psr.read_psrcap_again) {
712+ dm_helpers_dp_read_dpcd(
713+ link->ctx,
714+ link,
715+ DP_PSR_SUPPORT,
716+ &link->dpcd_caps.psr_info.psr_version,
717+ sizeof(link->dpcd_caps.psr_info.psr_version));
718+ }
719+
706720 //Clear PSR cfg
707721 memset(&psr_configuration, 0, sizeof(psr_configuration));
708722 dm_helpers_dp_write_dpcd(
drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c+21−4
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include "stream_encoder.h"
3030
3131 #include "resource.h"
32+#include "clk_mgr.h"
3233 #include "include/irq_service_interface.h"
3334 #include "virtual/virtual_stream_encoder.h"
3435 #include "dce110/dce110_resource.h"
@@ -836,17 +837,24 @@ static enum dc_status build_mapped_resource( · 801 unmodified lines
836837 return DC_OK;
837838 }
838839
839−static enum dc_status dce100_validate_bandwidth(
840+enum dc_status dce100_validate_bandwidth(
840841 struct dc *dc,
841842 struct dc_state *context,
842843 enum dc_validate_mode validate_mode)
843844 {
844845 int i;
845846 bool at_least_one_pipe = false;
847+ struct dc_stream_state *stream = NULL;
848+ const uint32_t max_pix_clk_khz = max(dc->clk_mgr->clks.max_supported_dispclk_khz, 400000);
846849
847850 for (i = 0; i < dc->res_pool->pipe_count; i++) {
848− if (context->res_ctx.pipe_ctx[i].stream)
851+ stream = context->res_ctx.pipe_ctx[i].stream;
852+ if (stream) {
849853 at_least_one_pipe = true;
854+
855+ if (stream->timing.pix_clk_100hz >= max_pix_clk_khz * 10)
856+ return DC_FAIL_BANDWIDTH_VALIDATE;
857+ }
850858 }
851859
852860 if (at_least_one_pipe) {
@@ -854,7 +862,16 @@ static enum dc_status dce100_validate_bandwidth( · 1 unmodified line
854862 context->bw_ctx.bw.dce.dispclk_khz = 681000;
855863 context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ;
856864 } else {
857− context->bw_ctx.bw.dce.dispclk_khz = 0;
865+ /* On DCE 6.0 and 6.4 the PLL0 is both the display engine clock and
866+ * the DP clock, and shouldn't be turned off. Just select the display
867+ * clock value from its low power mode.
868+ */
869+ if (dc->ctx->dce_version == DCE_VERSION_6_0 ||
870+ dc->ctx->dce_version == DCE_VERSION_6_4)
871+ context->bw_ctx.bw.dce.dispclk_khz = 352000;
872+ else
873+ context->bw_ctx.bw.dce.dispclk_khz = 0;
874+
858875 context->bw_ctx.bw.dce.yclk_khz = 0;
859876 }
860877
@@ -881,7 +898,7 @@ static bool dce100_validate_surface_sets( · 20 unmodified lines
881898 return true;
882899 }
883900
884−static enum dc_status dce100_validate_global(
901+enum dc_status dce100_validate_global(
885902 struct dc *dc,
886903 struct dc_state *context)
887904 {
drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.h+9−0
@@ -41,6 +41,15 @@ struct resource_pool *dce100_create_resource_pool( · 40 unmodified lines
4141
4242 enum dc_status dce100_validate_plane(const struct dc_plane_state *plane_state, struct dc_caps *caps);
4343
44+enum dc_status dce100_validate_global(
45+ struct dc *dc,
46+ struct dc_state *context);
47+
48+enum dc_status dce100_validate_bandwidth(
49+ struct dc *dc,
50+ struct dc_state *context,
51+ enum dc_validate_mode validate_mode);
52+
4453 enum dc_status dce100_add_stream_to_ctx(
4554 struct dc *dc,
4655 struct dc_state *new_ctx,
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c+3−66
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include "stream_encoder.h"
3535
3636 #include "resource.h"
37+#include "clk_mgr.h"
3738 #include "include/irq_service_interface.h"
3839 #include "irq/dce60/irq_service_dce60.h"
3940 #include "dce110/dce110_timing_generator.h"
@@ -863,70 +864,6 @@ static void dce60_resource_destruct(struct dce110_resource_pool *pool) · 823 unmodified lines
863864 }
864865 }
865866
866−static enum dc_status dce60_validate_bandwidth(
867− struct dc *dc,
868− struct dc_state *context,
869− enum dc_validate_mode validate_mode)
870−{
871− int i;
872− bool at_least_one_pipe = false;
873−
874− for (i = 0; i < dc->res_pool->pipe_count; i++) {
875− if (context->res_ctx.pipe_ctx[i].stream)
876− at_least_one_pipe = true;
877− }
878−
879− if (at_least_one_pipe) {
880− /* TODO implement when needed but for now hardcode max value*/
881− context->bw_ctx.bw.dce.dispclk_khz = 681000;
882− context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ;
883− } else {
884− /* On DCE 6.0 and 6.4 the PLL0 is both the display engine clock and
885− * the DP clock, and shouldn't be turned off. Just select the display
886− * clock value from its low power mode.
887− */
888− if (dc->ctx->dce_version == DCE_VERSION_6_0 ||
889− dc->ctx->dce_version == DCE_VERSION_6_4)
890− context->bw_ctx.bw.dce.dispclk_khz = 352000;
891− else
892− context->bw_ctx.bw.dce.dispclk_khz = 0;
893−
894− context->bw_ctx.bw.dce.yclk_khz = 0;
895− }
896−
897− return DC_OK;
898−}
899−
900−static bool dce60_validate_surface_sets(
901− struct dc_state *context)
902−{
903− int i;
904−
905− for (i = 0; i < context->stream_count; i++) {
906− if (context->stream_status[i].plane_count == 0)
907− continue;
908−
909− if (context->stream_status[i].plane_count > 1)
910− return false;
911−
912− if (context->stream_status[i].plane_states[0]->format
913− >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
914− return false;
915− }
916−
917− return true;
918−}
919−
920−static enum dc_status dce60_validate_global(
921− struct dc *dc,
922− struct dc_state *context)
923−{
924− if (!dce60_validate_surface_sets(context))
925− return DC_FAIL_SURFACE_VALIDATE;
926−
927− return DC_OK;
928−}
929−
930867 static void dce60_destroy_resource_pool(struct resource_pool **pool)
931868 {
932869 struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
@@ -940,10 +877,10 @@ static const struct resource_funcs dce60_res_pool_funcs = { · 7 unmodified lines
940877 .destroy = dce60_destroy_resource_pool,
941878 .link_enc_create = dce60_link_encoder_create,
942879 .panel_cntl_create = dce60_panel_cntl_create,
943− .validate_bandwidth = dce60_validate_bandwidth,
880+ .validate_bandwidth = dce100_validate_bandwidth,
944881 .validate_plane = dce100_validate_plane,
945882 .add_stream_to_ctx = dce100_add_stream_to_ctx,
946− .validate_global = dce60_validate_global,
883+ .validate_global = dce100_validate_global,
947884 .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link
948885 };
949886
drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c+3−57
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #include "stream_encoder.h"
3333
3434 #include "resource.h"
35+#include "clk_mgr.h"
3536 #include "include/irq_service_interface.h"
3637 #include "irq/dce80/irq_service_dce80.h"
3738 #include "dce110/dce110_timing_generator.h"
@@ -869,61 +870,6 @@ static void dce80_resource_destruct(struct dce110_resource_pool *pool) · 831 unmodified lines
869870 }
870871 }
871872
872−static enum dc_status dce80_validate_bandwidth(
873− struct dc *dc,
874− struct dc_state *context,
875− enum dc_validate_mode validate_mode)
876−{
877− int i;
878− bool at_least_one_pipe = false;
879−
880− for (i = 0; i < dc->res_pool->pipe_count; i++) {
881− if (context->res_ctx.pipe_ctx[i].stream)
882− at_least_one_pipe = true;
883− }
884−
885− if (at_least_one_pipe) {
886− /* TODO implement when needed but for now hardcode max value*/
887− context->bw_ctx.bw.dce.dispclk_khz = 681000;
888− context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ;
889− } else {
890− context->bw_ctx.bw.dce.dispclk_khz = 0;
891− context->bw_ctx.bw.dce.yclk_khz = 0;
892− }
893−
894− return DC_OK;
895−}
896−
897−static bool dce80_validate_surface_sets(
898− struct dc_state *context)
899−{
900− int i;
901−
902− for (i = 0; i < context->stream_count; i++) {
903− if (context->stream_status[i].plane_count == 0)
904− continue;
905−
906− if (context->stream_status[i].plane_count > 1)
907− return false;
908−
909− if (context->stream_status[i].plane_states[0]->format
910− >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
911− return false;
912− }
913−
914− return true;
915−}
916−
917−static enum dc_status dce80_validate_global(
918− struct dc *dc,
919− struct dc_state *context)
920−{
921− if (!dce80_validate_surface_sets(context))
922− return DC_FAIL_SURFACE_VALIDATE;
923−
924− return DC_OK;
925−}
926−
927873 static void dce80_destroy_resource_pool(struct resource_pool **pool)
928874 {
929875 struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
@@ -937,10 +883,10 @@ static const struct resource_funcs dce80_res_pool_funcs = { · 7 unmodified lines
937883 .destroy = dce80_destroy_resource_pool,
938884 .link_enc_create = dce80_link_encoder_create,
939885 .panel_cntl_create = dce80_panel_cntl_create,
940− .validate_bandwidth = dce80_validate_bandwidth,
886+ .validate_bandwidth = dce100_validate_bandwidth,
941887 .validate_plane = dce100_validate_plane,
942888 .add_stream_to_ctx = dce100_add_stream_to_ctx,
943− .validate_global = dce80_validate_global,
889+ .validate_global = dce100_validate_global,
944890 .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link
945891 };
946892
drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c+1−0
@@ -927,6 +927,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 926 unmodified lines
927927 .enable_legacy_fast_update = true,
928928 .using_dml2 = false,
929929 .disable_dsc_power_gate = true,
930+ .min_disp_clk_khz = 100000,
930931 };
931932
932933 static const struct dc_panel_config panel_config_defaults = {
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c+1−0
@@ -739,6 +739,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 738 unmodified lines
739739 .fpo_vactive_min_active_margin_us = 200,
740740 .fpo_vactive_max_blank_us = 1000,
741741 .enable_legacy_fast_update = false,
742+ .disable_stutter_for_wm_program = true
742743 };
743744
744745 static struct dce_aux *dcn32_aux_engine_create(
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.h+2−1
@@ -1230,7 +1230,8 @@ unsigned int dcn32_get_max_hw_cursor_size(const struct dc *dc, · 1229 unmodified lines
12301230 SR(DCHUBBUB_ARB_MALL_CNTL), \
12311231 SR(DCN_VM_FAULT_ADDR_MSB), SR(DCN_VM_FAULT_ADDR_LSB), \
12321232 SR(DCN_VM_FAULT_CNTL), SR(DCN_VM_FAULT_STATUS), \
1233− SR(SDPIF_REQUEST_RATE_LIMIT)
1233+ SR(SDPIF_REQUEST_RATE_LIMIT), \
1234+ SR(DCHUBBUB_SDPIF_CFG0)
12341235
12351236 /* DCCG */
12361237
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h+5−1
@@ -4142,10 +4142,14 @@ struct dmub_cmd_replay_copy_settings_data { · 4141 unmodified lines
41424142 * @hpo_link_enc_inst: HPO link encoder instance
41434143 */
41444144 uint8_t hpo_link_enc_inst;
4145+ /**
4146+ * Determines if fast resync in ultra sleep mode is enabled/disabled.
4147+ */
4148+ uint8_t replay_support_fast_resync_in_ultra_sleep_mode;
41454149 /**
41464150 * @pad: Align structure to 4 byte boundary.
41474151 */
4148− uint8_t pad[2];
4152+ uint8_t pad[1];
41494153 };
41504154
41514155
drivers/gpu/drm/amd/include/mes_v11_api_def.h+2−1
@@ -238,7 +238,8 @@ union MESAPI_SET_HW_RESOURCES { · 237 unmodified lines
238238 uint32_t enable_mes_sch_stb_log : 1;
239239 uint32_t limit_single_process : 1;
240240 uint32_t is_strix_tmz_wa_enabled :1;
241− uint32_t reserved : 13;
241+ uint32_t enable_lr_compute_wa : 1;
242+ uint32_t reserved : 12;
242243 };
243244 uint32_t uint32_t_all;
244245 };
drivers/gpu/drm/amd/include/mes_v12_api_def.h+2−1
@@ -287,7 +287,8 @@ union MESAPI_SET_HW_RESOURCES { · 286 unmodified lines
287287 uint32_t limit_single_process : 1;
288288 uint32_t unmapped_doorbell_handling: 2;
289289 uint32_t enable_mes_fence_int: 1;
290− uint32_t reserved : 10;
290+ uint32_t enable_lr_compute_wa : 1;
291+ uint32_t reserved : 9;
291292 };
292293 uint32_t uint32_all;
293294 };
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_12_ppsmc.h+2−1
@@ -120,7 +120,8 @@ · 119 unmodified lines
120120 #define PPSMC_MSG_GetBadPageSeverity 0x5B
121121 #define PPSMC_MSG_GetSystemMetricsTable 0x5C
122122 #define PPSMC_MSG_GetSystemMetricsVersion 0x5D
123−#define PPSMC_Message_Count 0x5E
123+#define PPSMC_MSG_ResetVCN 0x5E
124+#define PPSMC_Message_Count 0x5F
124125
125126 //PPSMC Reset Types for driver msg argument
126127 #define PPSMC_RESET_TYPE_DRIVER_MODE_1_RESET 0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0_0_pptable.hrenamed from drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h+0−0

File renamed without changes.

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c+1−0
@@ -136,6 +136,7 @@ const struct cmn2asic_msg_mapping smu_v13_0_12_message_map[SMU_MSG_MAX_COUNT] = · 135 unmodified lines
136136 MSG_MAP(RmaDueToBadPageThreshold, PPSMC_MSG_RmaDueToBadPageThreshold, 0),
137137 MSG_MAP(SetThrottlingPolicy, PPSMC_MSG_SetThrottlingPolicy, 0),
138138 MSG_MAP(ResetSDMA, PPSMC_MSG_ResetSDMA, 0),
139+ MSG_MAP(ResetVCN, PPSMC_MSG_ResetVCN, 0),
139140 MSG_MAP(GetStaticMetricsTable, PPSMC_MSG_GetStaticMetricsTable, 1),
140141 MSG_MAP(GetSystemMetricsTable, PPSMC_MSG_GetSystemMetricsTable, 1),
141142 };
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c+3−0
@@ -353,6 +353,9 @@ static void smu_v13_0_12_init_caps(struct smu_context *smu) · 352 unmodified lines
353353 smu_v13_0_6_cap_set(smu, SMU_CAP(PLDM_VERSION));
354354 }
355355
356+ if (fw_ver > 0x04560900)
357+ smu_v13_0_6_cap_set(smu, SMU_CAP(VCN_RESET));
358+
356359 if (fw_ver >= 0x04560700) {
357360 if (fw_ver >= 0x04560900) {
358361 smu_v13_0_6_cap_set(smu, SMU_CAP(TEMP_METRICS));
drivers/gpu/drm/amd/ras/rascore/Makefile+0−0

Empty file added.

drivers/gpu/drm/amd/ras/rascore/ras_core_status.h+37−0
@@ -0,0 +1,37 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright 2025 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+ */
24+
25+#ifndef __RAS_CORE_STATUS_H__
26+#define __RAS_CORE_STATUS_H__
27+
28+#define RAS_CORE_OK 0
29+#define RAS_CORE_NOT_SUPPORTED 248
30+#define RAS_CORE_FAIL_ERROR_QUERY 249
31+#define RAS_CORE_FAIL_ERROR_INJECTION 250
32+#define RAS_CORE_FAIL_FATAL_RECOVERY 251
33+#define RAS_CORE_FAIL_POISON_CONSUMPTION 252
34+#define RAS_CORE_FAIL_POISON_CREATION 253
35+#define RAS_CORE_FAIL_NO_VALID_BANKS 254
36+#define RAS_CORE_GPU_IN_MODE1_RESET 255
37+#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t