AMD General

The KCQ is not used for mes_v12_1 anymore , so it won't affect it  at all, but 
It's still good to keep the  same logic as v12_0 .

 Reviewed-by : Shaoyun.liu < [email protected]>

Regards
Shaoyun.liu
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Deucher, 
Alexander
Sent: Thursday, May 21, 2026 8:20 PM
To: [email protected]; Koenig, Christian 
<[email protected]>; Khatri, Sunil <[email protected]>; Lin, Amber 
<[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Liu, Shaoyun 
<[email protected]>
Cc: Chen, Michael <[email protected]>; Deucher, Alexander 
<[email protected]>; Liu, Shaoyun <[email protected]>; Zhang, 
Jesse(Jie) <[email protected]>
Subject: [PATCH 12/42] drm/amdgpu/mes_v12_1: use mes schedule pipe for legacy 
queues on unified MES

From: Jesse Zhang <[email protected]>

when suspend_all_gangs is issued to pipe0 MES during system suspend or runtime 
PM, pipe0 can only suspend and resume queues it has tracked.
KCQs registered with a non-zero pipe slot may not be correctly handled, leaving 
them in an inconsistent state after resume.

v3: fix the schedule pipe issue

Suggested-by: Michael Chen <[email protected]>
Suggested-by: Alex Deucher <[email protected]>
Suggested-by: Shaoyun Liu <[email protected]>
Signed-off-by: Jesse Zhang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/mes_v12_1.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c 
b/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c
index b169e577e5838..2099beedd5755 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c
@@ -417,10 +417,15 @@ static int mes_v12_1_map_legacy_queue(struct amdgpu_mes 
*mes,
                convert_to_mes_queue_type(input->queue_type);
        mes_add_queue_pkt.map_legacy_kq = 1;

-       if (mes->adev->enable_uni_mes)
-               pipe = AMDGPU_MES_KIQ_PIPE;
-       else
+       if (mes->adev->enable_uni_mes) {
+               /* Keep scheduler queue on KIQ pipe; map all other kernel 
queues on sched pipe. */
+               if (input->queue_type == AMDGPU_RING_TYPE_MES)
+                       pipe = AMDGPU_MES_KIQ_PIPE;
+               else
+                       pipe = AMDGPU_MES_SCHED_PIPE;
+       } else {
                pipe = AMDGPU_MES_SCHED_PIPE;
+       }

        return mes_v12_1_submit_pkt_and_poll_completion(mes,
                        input->xcc_id, pipe,
@@ -457,10 +462,15 @@ static int mes_v12_1_unmap_legacy_queue(struct amdgpu_mes 
*mes,
                        convert_to_mes_queue_type(input->queue_type);
        }

-       if (mes->adev->enable_uni_mes)
-               pipe = AMDGPU_MES_KIQ_PIPE;
-       else
+       if (mes->adev->enable_uni_mes) {
+               /* Keep scheduler queue on KIQ pipe; map all other kernel 
queues on sched pipe. */
+               if (input->queue_type == AMDGPU_RING_TYPE_MES)
+                       pipe = AMDGPU_MES_KIQ_PIPE;
+               else
+                       pipe = AMDGPU_MES_SCHED_PIPE;
+       } else {
                pipe = AMDGPU_MES_SCHED_PIPE;
+       }

        return mes_v12_1_submit_pkt_and_poll_completion(mes,
                        input->xcc_id, pipe,
--
2.54.0

Reply via email to