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/gfx_v11_0.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index b2a3ceda99bc9..162f825cba84f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -6862,8 +6862,14 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring,
 {
        struct amdgpu_device *adev = ring->adev;
        bool use_mmio = adev->gfx.me.use_mmio_for_reset;
+       int r;
 
-       return amdgpu_gfx_mes_reset_queue(ring, vmid, timedout_fence, use_mmio);
+       if (use_mmio)
+               amdgpu_gfx_off_ctrl(adev, false);
+       r = amdgpu_gfx_mes_reset_queue(ring, vmid, timedout_fence, use_mmio);
+       if (use_mmio)
+               amdgpu_gfx_off_ctrl(adev, true);
+       return r;
 }
 
 static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring,
-- 
2.54.0

Reply via email to