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

Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index aa5cc5642e87b..cfdee25a152b5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -141,11 +141,19 @@ static void amdgpu_userq_hang_detect_work(struct 
work_struct *work)
                                                 AMDGPU_RESET_TYPE_PER_QUEUE)) {
                int r;
 
+               if (queue->queue_type == AMDGPU_HW_IP_GFX ||
+                   queue->queue_type == AMDGPU_HW_IP_COMPUTE ||
+                   queue->queue_type == AMDGPU_HW_IP_DMA)
+                       amdgpu_gfx_off_ctrl(adev, false);
                if (queue->queue_type == AMDGPU_HW_IP_COMPUTE)
                        r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL,
                                                         queue, NULL, NULL);
                else
                        r = userq_funcs->reset(queue);
+               if (queue->queue_type == AMDGPU_HW_IP_GFX ||
+                   queue->queue_type == AMDGPU_HW_IP_COMPUTE ||
+                   queue->queue_type == AMDGPU_HW_IP_DMA)
+                       amdgpu_gfx_off_ctrl(adev, true);
                if (r)
                        gpu_reset = true;
        } else {
-- 
2.55.0

Reply via email to