AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for legacy queues on unified MES
@ 2026-03-30  1:33 Jesse Zhang
  2026-03-30  1:33 ` [PATCH v3 2/2] drm/amdgpu/mes_v12_1: " Jesse Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jesse Zhang @ 2026-03-30  1:33 UTC (permalink / raw)
  To: amd-gfx
  Cc: Alexander.Deucher, Christian Koenig, Shaoyun Liu, Michael Chen,
	Jesse Zhang, Alex Deucher, Jesse Zhang

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 <michael.chen@amd.com>
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Suggested-by: Shaoyun Liu <shaoyun.liu@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
index 023c7345ea54..67fb5161c0e5 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
@@ -528,10 +528,15 @@ static int mes_v12_0_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_0_submit_pkt_and_poll_completion(mes, pipe,
 			&mes_add_queue_pkt, sizeof(mes_add_queue_pkt),
@@ -567,10 +572,15 @@ static int mes_v12_0_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; unmap 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_0_submit_pkt_and_poll_completion(mes, pipe,
 			&mes_remove_queue_pkt, sizeof(mes_remove_queue_pkt),
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] drm/amdgpu/mes_v12_1: use mes schedule pipe for legacy queues on unified MES
  2026-03-30  1:33 [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for legacy queues on unified MES Jesse Zhang
@ 2026-03-30  1:33 ` Jesse Zhang
  2026-04-07  2:57 ` [PATCH v3 1/2] drm/amdgpu/mes_v12_0: " Zhang, Jesse(Jie)
  2026-04-07 14:40 ` Chen, Michael
  2 siblings, 0 replies; 4+ messages in thread
From: Jesse Zhang @ 2026-03-30  1:33 UTC (permalink / raw)
  To: amd-gfx
  Cc: Alexander.Deucher, Christian Koenig, Shaoyun Liu, Michael Chen,
	Jesse Zhang, Alex Deucher, Jesse Zhang

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 <michael.chen@amd.com>
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Suggested-by: Shaoyun Liu <shaoyun.liu@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
---
 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 0e9089544769..71cc4e176541 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c
@@ -414,10 +414,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,
@@ -454,10 +459,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.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for legacy queues on unified MES
  2026-03-30  1:33 [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for legacy queues on unified MES Jesse Zhang
  2026-03-30  1:33 ` [PATCH v3 2/2] drm/amdgpu/mes_v12_1: " Jesse Zhang
@ 2026-04-07  2:57 ` Zhang, Jesse(Jie)
  2026-04-07 14:40 ` Chen, Michael
  2 siblings, 0 replies; 4+ messages in thread
From: Zhang, Jesse(Jie) @ 2026-04-07  2:57 UTC (permalink / raw)
  To: Zhang, Jesse(Jie), amd-gfx@lists.freedesktop.org
  Cc: Deucher, Alexander, Koenig, Christian, Liu, Shaoyun,
	Chen, Michael, Deucher, Alexander

[AMD Official Use Only - AMD Internal Distribution Only]

Ping ...

> -----Original Message-----
> From: Jesse Zhang <Jesse.Zhang@amd.com>
> Sent: Monday, March 30, 2026 9:33 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; Liu, Shaoyun <Shaoyun.Liu@amd.com>; Chen,
> Michael <Michael.Chen@amd.com>; Zhang, Jesse(Jie)
> <Jesse.Zhang@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>;
> Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>
> Subject: [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for
> legacy queues on unified MES
>
> 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 <michael.chen@amd.com>
> Suggested-by: Alex Deucher <alexander.deucher@amd.com>
> Suggested-by: Shaoyun Liu <shaoyun.liu@amd.com>
> Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
> b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
> index 023c7345ea54..67fb5161c0e5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
> @@ -528,10 +528,15 @@ static int mes_v12_0_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_0_submit_pkt_and_poll_completion(mes, pipe,
>                       &mes_add_queue_pkt, sizeof(mes_add_queue_pkt), @@ -
> 567,10 +572,15 @@ static int mes_v12_0_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; unmap 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_0_submit_pkt_and_poll_completion(mes, pipe,
>                       &mes_remove_queue_pkt, sizeof(mes_remove_queue_pkt),
> --
> 2.49.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for legacy queues on unified MES
  2026-03-30  1:33 [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for legacy queues on unified MES Jesse Zhang
  2026-03-30  1:33 ` [PATCH v3 2/2] drm/amdgpu/mes_v12_1: " Jesse Zhang
  2026-04-07  2:57 ` [PATCH v3 1/2] drm/amdgpu/mes_v12_0: " Zhang, Jesse(Jie)
@ 2026-04-07 14:40 ` Chen, Michael
  2 siblings, 0 replies; 4+ messages in thread
From: Chen, Michael @ 2026-04-07 14:40 UTC (permalink / raw)
  To: Zhang, Jesse(Jie), amd-gfx@lists.freedesktop.org
  Cc: Deucher, Alexander, Koenig, Christian, Liu, Shaoyun

[-- Attachment #1: Type: text/plain, Size: 3264 bytes --]

[AMD Official Use Only - AMD Internal Distribution Only]

Reviewed-by: Michael Chen <michael.chen@amd.com>
________________________________
From: Jesse Zhang <Jesse.Zhang@amd.com>
Sent: Sunday, March 29, 2026 9:33 PM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Liu, Shaoyun <Shaoyun.Liu@amd.com>; Chen, Michael <Michael.Chen@amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>
Subject: [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for legacy queues on unified MES

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 <michael.chen@amd.com>
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Suggested-by: Shaoyun Liu <shaoyun.liu@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
index 023c7345ea54..67fb5161c0e5 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
@@ -528,10 +528,15 @@ static int mes_v12_0_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_0_submit_pkt_and_poll_completion(mes, pipe,
                         &mes_add_queue_pkt, sizeof(mes_add_queue_pkt),
@@ -567,10 +572,15 @@ static int mes_v12_0_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; unmap 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_0_submit_pkt_and_poll_completion(mes, pipe,
                         &mes_remove_queue_pkt, sizeof(mes_remove_queue_pkt),
--
2.49.0


[-- Attachment #2: Type: text/html, Size: 6621 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-07 14:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30  1:33 [PATCH v3 1/2] drm/amdgpu/mes_v12_0: use mes schedule pipe for legacy queues on unified MES Jesse Zhang
2026-03-30  1:33 ` [PATCH v3 2/2] drm/amdgpu/mes_v12_1: " Jesse Zhang
2026-04-07  2:57 ` [PATCH v3 1/2] drm/amdgpu/mes_v12_0: " Zhang, Jesse(Jie)
2026-04-07 14:40 ` Chen, Michael

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox