When we reemit the saved ring state after a reset, we need
to reemit the RLC SPM state as well since it's done via
MMIO.

Fixes: 2fb5a4572c76 ("drm/amdgpu: remove the now-redundant runtime SPM VMID 
update")
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index c3f56253d3b87..324d25c77897a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -715,6 +715,9 @@ void amdgpu_fence_driver_force_completion(struct 
amdgpu_ring *ring,
 void amdgpu_ring_set_fence_errors_and_reemit(struct amdgpu_ring *ring,
                                             struct amdgpu_fence *guilty_fence)
 {
+       bool emit_spm_needed = ring->adev->gfx.rlc.funcs->update_spm_vmid &&
+               (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE ||
+                ring->funcs->type == AMDGPU_RING_TYPE_GFX);
        struct dma_fence *unprocessed;
        struct dma_fence __rcu **ptr;
        struct amdgpu_fence *fence;
@@ -746,6 +749,9 @@ void amdgpu_ring_set_fence_errors_and_reemit(struct 
amdgpu_ring *ring,
        }
        ring->reemit = true;
        amdgpu_ring_alloc(ring, ring->ring_backup_entries_to_copy);
+       if (emit_spm_needed)
+               ring->adev->gfx.rlc.funcs->update_spm_vmid(ring->adev, 
ring->xcc_id,
+                                                          
ring->adev->vm_manager.spm_vmid);
        spin_lock_irqsave(&ring->fence_drv.lock, flags);
        do {
                last_seq++;
-- 
2.56.0

Reply via email to