]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/amdgpu: Implement MES suspend/resume gang functionality for v12
authorJesse.Zhang <Jesse.Zhang@amd.com>
Sun, 3 Aug 2025 13:21:42 +0000 (21:21 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 5 Sep 2025 21:38:07 +0000 (17:38 -0400)
This commit implements the actual MES (Micro Engine Scheduler) suspend
and resume gang operations for version 12 hardware. Previously these
functions were just stubs returning success.

v2: Always use AMDGPU_MES_SCHED_PIPE

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c

index ff5df28b57ec027b5126de46fb0ba37daca7dcdd..0075bb2ed66c89ca41a04e02f12986112fb39c1a 100644 (file)
@@ -568,13 +568,41 @@ static int mes_v12_0_unmap_legacy_queue(struct amdgpu_mes *mes,
 static int mes_v12_0_suspend_gang(struct amdgpu_mes *mes,
                                  struct mes_suspend_gang_input *input)
 {
-       return 0;
+       union MESAPI__SUSPEND mes_suspend_gang_pkt;
+
+       memset(&mes_suspend_gang_pkt, 0, sizeof(mes_suspend_gang_pkt));
+
+       mes_suspend_gang_pkt.header.type = MES_API_TYPE_SCHEDULER;
+       mes_suspend_gang_pkt.header.opcode = MES_SCH_API_SUSPEND;
+       mes_suspend_gang_pkt.header.dwsize = API_FRAME_SIZE_IN_DWORDS;
+
+       mes_suspend_gang_pkt.suspend_all_gangs = input->suspend_all_gangs;
+       mes_suspend_gang_pkt.gang_context_addr = input->gang_context_addr;
+       mes_suspend_gang_pkt.suspend_fence_addr = input->suspend_fence_addr;
+       mes_suspend_gang_pkt.suspend_fence_value = input->suspend_fence_value;
+
+       return mes_v12_0_submit_pkt_and_poll_completion(mes, AMDGPU_MES_SCHED_PIPE,
+                       &mes_suspend_gang_pkt, sizeof(mes_suspend_gang_pkt),
+                       offsetof(union MESAPI__SUSPEND, api_status));
 }
 
 static int mes_v12_0_resume_gang(struct amdgpu_mes *mes,
                                 struct mes_resume_gang_input *input)
 {
-       return 0;
+       union MESAPI__RESUME mes_resume_gang_pkt;
+
+       memset(&mes_resume_gang_pkt, 0, sizeof(mes_resume_gang_pkt));
+
+       mes_resume_gang_pkt.header.type = MES_API_TYPE_SCHEDULER;
+       mes_resume_gang_pkt.header.opcode = MES_SCH_API_RESUME;
+       mes_resume_gang_pkt.header.dwsize = API_FRAME_SIZE_IN_DWORDS;
+
+       mes_resume_gang_pkt.resume_all_gangs = input->resume_all_gangs;
+       mes_resume_gang_pkt.gang_context_addr = input->gang_context_addr;
+
+       return mes_v12_0_submit_pkt_and_poll_completion(mes, AMDGPU_MES_SCHED_PIPE,
+                       &mes_resume_gang_pkt, sizeof(mes_resume_gang_pkt),
+                       offsetof(union MESAPI__RESUME, api_status));
 }
 
 static int mes_v12_0_query_sched_status(struct amdgpu_mes *mes, int pipe)