Set remove_queue_after_reset=1 (MES >= 0x5a) so MES drops its internal
state instead of re-unmapping an already MMIO-reset queue, which can
timeout into a GPU reset.

Suggested-by: Shaoyun Liu <[email protected]>
Signed-off-by: Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
index d80a983b1b6c..20f4fd57b1da 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
@@ -749,6 +749,17 @@ static int mes_v12_0_unmap_legacy_queue(struct amdgpu_mes 
*mes,
                mes_remove_queue_pkt.unmap_legacy_queue = 1;
                mes_remove_queue_pkt.queue_type =
                        convert_to_mes_queue_type(input->queue_type);
+               /*
+                * A reset-time unmap: the queue was already reset via MMIO 
while
+                * gangs are suspended and it is on the MES hung/fail list. Tell
+                * MES to just drop its internal state for it. Without this flag
+                * MES asks CP to unmap the already-reset (still wedged) queue
+                * again, which times out and forces a GPU reset.
+                */
+               if (input->action == RESET_QUEUES &&
+                   (mes->sched_version & AMDGPU_MES_VERSION_MASK) >= 0x5a)
+                       mes_remove_queue_pkt.remove_queue_after_reset = 1;
+
        }
 
        if (mes->adev->enable_uni_mes) {
-- 
2.49.0

Reply via email to