When the compute queue is unavailable to run the IB,
return -EBUSY instead of silently failing.

Make sure the IB is always executed during reset:
Set preempt condition (may be cleared during reset),
and flush HDP cache so the GPU sees the updated value.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 3c181628d87e..1366d6070481 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -1487,7 +1487,14 @@ static int gfx_v8_0_do_edc_gpr_workarounds(struct 
amdgpu_device *adev)
 
        /* bail if the compute ring is not ready */
        if (!ring->sched.ready)
-               return 0;
+               return -EBUSY;
+
+       if (amdgpu_in_reset(adev)) {
+               /* Set preempt condition to execute IB */
+               amdgpu_ring_set_preempt_cond_exec(ring, true);
+               /* Flush HDP cache so the GPU can see the updated COND_EXEC 
value */
+               amdgpu_device_flush_hdp(adev, NULL);
+       }
 
        tmp = RREG32(mmGB_EDC_MODE);
        WREG32(mmGB_EDC_MODE, 0);
-- 
2.54.0

Reply via email to