The only case when they may not go idle is when we are dealing
with a GPU hang, in which case we should just forcibly disable
these even when they aren't idle.

Signed-off-by: Timur Kristóf <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 7bd668f71b41..9fe430e3ae65 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -4868,14 +4868,12 @@ static int gfx_v8_0_hw_fini(struct amdgpu_ip_block 
*ip_block)
        }
 
        amdgpu_gfx_rlc_enter_safe_mode(adev, 0);
-       if (!gfx_v8_0_wait_for_idle(ip_block))
-               gfx_v8_0_cp_enable(adev, false);
-       else
+       if (!amdgpu_in_reset(adev) && gfx_v8_0_wait_for_idle(ip_block))
                pr_err("cp is busy, skip halt cp\n");
-       if (!gfx_v8_0_wait_for_rlc_idle(adev))
-               adev->gfx.rlc.funcs->stop(adev);
-       else
-               pr_err("rlc is busy, skip halt rlc\n");
+       if (!amdgpu_in_reset(adev) && gfx_v8_0_wait_for_rlc_idle(adev))
+               pr_err("rlc is busy\n");
+       gfx_v8_0_cp_enable(adev, false);
+       adev->gfx.rlc.funcs->stop(adev);
        amdgpu_gfx_rlc_exit_safe_mode(adev, 0);
 
        return 0;
-- 
2.54.0

Reply via email to