The RLC SPM register is not properly saved and restored for GFXOFF
so reemit it in the IB path.

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_ib.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index f98a7c6797b3c..6210edf1937aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -121,6 +121,9 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, struct 
amdgpu_job *job,
                       struct dma_fence **f)
 {
        struct amdgpu_device *adev = ring->adev;
+       bool emit_spm_needed = adev->gfx.rlc.funcs->update_spm_vmid &&
+               (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE ||
+                ring->funcs->type == AMDGPU_RING_TYPE_GFX);
        struct amdgpu_ib *ib;
        struct dma_fence *tmp = NULL;
        struct amdgpu_fence *af;
@@ -209,6 +212,10 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, struct 
amdgpu_job *job,
        if (need_pipe_sync)
                amdgpu_ring_emit_pipeline_sync(ring);
 
+       if (emit_spm_needed)
+               adev->gfx.rlc.funcs->update_spm_vmid(adev, ring->xcc_id,
+                                                    adev->vm_manager.spm_vmid);
+
        if (emit_gds_needed)
                amdgpu_ring_emit_gds_switch(ring, job->vmid, job->gds_base,
                                            job->gds_size, job->gws_base,
-- 
2.56.0

Reply via email to