Always restore the MQD not just when we do a reset.
This allows us to move the MQD to VRAM if we want.

Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 14 +++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 4ef3e7d9b108..ebba95fc6911 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -3591,16 +3591,16 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring 
*ring)
 
                if (adev->gfx.mec.mqd_backup[mqd_idx])
                        memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, 
sizeof(struct v9_mqd_allocation));
-       } else if (amdgpu_in_reset(adev)) { /* for GPU_RESET case */
-               /* reset MQD to a clean status */
+       } else {
+               /* restore MQD to a clean status */
                if (adev->gfx.mec.mqd_backup[mqd_idx])
                        memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], 
sizeof(struct v9_mqd_allocation));
 
-               /* reset ring buffer */
-               ring->wptr = 0;
-               atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0);
-               amdgpu_ring_clear_ring(ring);
-       } else {
+               if (amdgpu_in_reset(adev)) {
+                       /* reset ring buffer */
+                       ring->wptr = 0;
+                       atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0);
+               }
                amdgpu_ring_clear_ring(ring);
        }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index 56a415e151d4..fd5649e45486 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -1799,16 +1799,16 @@ static int gfx_v9_4_3_kcq_init_queue(struct amdgpu_ring 
*ring, int xcc_id)
 
                if (adev->gfx.mec.mqd_backup[mqd_idx])
                        memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, 
sizeof(struct v9_mqd_allocation));
-       } else if (amdgpu_in_reset(adev)) { /* for GPU_RESET case */
-               /* reset MQD to a clean status */
+       } else {
+               /* restore MQD to a clean status */
                if (adev->gfx.mec.mqd_backup[mqd_idx])
                        memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], 
sizeof(struct v9_mqd_allocation));
 
-               /* reset ring buffer */
-               ring->wptr = 0;
-               atomic64_set((atomic64_t *)&adev->wb.wb[ring->wptr_offs], 0);
-               amdgpu_ring_clear_ring(ring);
-       } else {
+               if (amdgpu_in_reset(adev)) {
+                       /* reset ring buffer */
+                       ring->wptr = 0;
+                       atomic64_set((atomic64_t 
*)&adev->wb.wb[ring->wptr_offs], 0);
+               }
                amdgpu_ring_clear_ring(ring);
        }
 
-- 
2.40.0

Reply via email to