If gfx is hung, we shouldn't need this since gfx won't be
powered down, but we could potentially have a case where
a queue can be preempted, but due logic errors in the commands,
the fence never signals.  GFX could potentially go into
the off state.  Protect against that.

Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 1e275c2e7dd3e..2552561f997a8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -2285,6 +2285,8 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device 
*adev,
        int ring_err;
 
        guard(mutex)(&adev->gfx.mec.reset_mutex);
+       if (use_mmio)
+               amdgpu_gfx_off_ctrl(adev, false);
        /* stop the drm schedulers for all compute queues */
        amdgpu_gfx_reset_stop_compute_scheds(adev, ring);
        /* suspend all will determine which queues are hung.
@@ -2388,6 +2390,9 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device 
*adev,
        if (!ring_err)
                amdgpu_gfx_reset_start_compute_scheds(adev, ring);
 
+       if (use_mmio)
+               amdgpu_gfx_off_ctrl(adev, true);
+
        /* If this reset is triggered by non-KCQ, the KCQ result after resume 
must
         * not override the reset result; otherwise a false reset failure is 
returned
         * to the non-KCQ caller
-- 
2.54.0

Reply via email to