Revert "drm/amdgpu: re-enable SPM updates in the the IB path"
Subsystems (2)
Alex Deucher
maintainerPATCH 1/5 Revert "drm/amdgpu: re-enable SPM updates in the the IB path"
This reverts commit d44428868e5b9f97c6216eee1b4f82aec7a6e8d2.
This causes flakiness in gfx11 CI tests. Revert.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -7
@@ -121,9 +121,6 @@ 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;
@@ -212,10 +209,6 @@ 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,
Signature · 1 line
2.56.1
Alex Deucher
maintainerPATCH 2/5 Revert "drm/amdgpu: reemit RLC SPM register in ring reemit"
This reverts commit 8a4dfdc0d2adfc362ec310ff70526e79ff8377b6.
This causes flakiness in gfx11 CI tests. Revert.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -6
@@ -715,9 +715,6 @@ 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;
@@ -749,9 +746,6 @@ 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++;
Signature · 1 line
2.56.1
Alex Deucher
maintainerPATCH 3/5 drm/amdgpu/gfx7,8: program the RLC SPM in RLC resume
In reply to Alex DeucherThe register needs to be reprogrammed after a suspend and resume or a GPU reset so program it in rlc_resume rather than rlc_init.
--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -4
@@ -3254,10 +3254,6 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev)return r; } -/* init spm vmid with 0xf */ -if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); -return 0 ; }
@@ -3479,6 +3475,10 @@ static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev) adev->gfx.rlc.funcs->start (adev); +/* init spm vmid with 0xf */ +if (adev->gfx.rlc.funcs->update_spm_vmid) + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); +return 0 ; }
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -4
@@ -1274,10 +1274,6 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)return r; } -/* init spm vmid with 0xf */ -if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); -return 0 ; }
@@ -4086,6 +4082,9 @@ static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)gfx_v8_0_init_pg (adev); adev->gfx.rlc.funcs->start (adev); +/* init spm vmid with 0xf */ +if (adev->gfx.rlc.funcs->update_spm_vmid) + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid);return 0 ; }
Signature · 1 line
2.56.1
Alex Deucher
maintainerPATCH 4/5 drm/amdgpu/gfx9.4.3: program the RLC SPM in RLC resume
In reply to Alex DeucherThe register needs to be reprogrammed after a suspend and resume or a GPU reset so program it in rlc_resume rather than rlc_init.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +4 -4
@@ -1395,10 +1395,6 @@ static void gfx_v9_4_3_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)static int gfx_v9_4_3_rlc_init (struct amdgpu_device *adev) { -/* init spm vmid with 0xf */ -if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); -return 0 ; }
@@ -1588,6 +1584,10 @@ static int gfx_v9_4_3_xcc_rlc_resume(struct amdgpu_device *adev, int xcc_id)gfx_v9_4_3_xcc_init_pg (adev, xcc_id);amdgpu_gfx_rlc_exit_safe_mode (adev, xcc_id); +/* init spm vmid with 0xf */ +if (adev->gfx.rlc.funcs->update_spm_vmid) + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); +return 0 ; }
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH 4/5] drm/amdgpu/gfx9.4.3: program the RLC SPM in RLC resume
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] drm/amdgpu: gfx_v9_4_3_xcc_rlc_resume() passes 0 instead of xcc_id - [Medium] drm/amdgpu: moving…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] drm/amdgpu: gfx_v9_4_3_xcc_rlc_resume() passes 0 instead of xcc_id
- [Medium] drm/amdgpu: moving update_spm_vmid() to gfx_v9_4_3_xcc_rlc_resume() skips VFs
--
commit 754d99a96da547c9e401d40cfbeb309d0d3aa36f
Author: Alex Deucher <[email protected]>
drm/amdgpu/gfx9.4.3: program the RLC SPM in RLC resume
This commit moves the RLC SPM VMID programming from gfx_v9_4_3_rlc_init() to gfx_v9_4_3_xcc_rlc_resume() so that the register is reprogrammed after suspend/resume and GPU reset.
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +0
-4@@ -1395,10 +1395,6 @@ static void gfx_v9_4_3_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)static int gfx_v9_4_3_rlc_init (struct amdgpu_device *adev) { -/* init spm vmid with 0xf */ -if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); -return 0 ; }
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c static int gfx_v9_4_3_xcc_rlc_resume(struct amdgpu_device *adev, int xcc_id) · line 1592
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +4
-0@@ -1588,6 +1584,10 @@ static int gfx_v9_4_3_xcc_rlc_resume(struct amdgpu_device *adev, int xcc_id)gfx_v9_4_3_xcc_init_pg (adev, xcc_id);amdgpu_gfx_rlc_exit_safe_mode (adev, xcc_id); +/* init spm vmid with 0xf */ +if (adev->gfx.rlc.funcs->update_spm_vmid) + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); +return 0 ; }
[Severity: High]
Should update_spm_vmid() pass xcc_id instead of 0 here?
gfx_v9_4_3_rlc_resume() and gfx_v9_4_3_xcp_resume() call gfx_v9_4_3_xcc_rlc_resume() for each XCC instance, and gfx_v9_4_3_update_spm_vmid() uses the instance argument with GET_INST(GC, inst) to select which XCC's regRLC_SPM_MC_CNTL register to write. Passing 0 programs XCC 0 on every iteration and leaves regRLC_SPM_MC_CNTL on all other XCCs at its hardware reset default of VMID 0.
[Severity: Medium]
Does moving update_spm_vmid() into gfx_v9_4_3_xcc_rlc_resume() skip SPM VMID initialization on SR-IOV VFs?
Both callers of gfx_v9_4_3_xcc_rlc_resume() (gfx_v9_4_3_rlc_resume() and gfx_v9_4_3_xcp_resume()) skip calling it when amdgpu_sriov_vf(adev) is true:
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:gfx_v9_4_3_rlc_resume() {
if (amdgpu_sriov_vf(adev))
return 0;
num_xcc = NUM_XCC(adev->gfx.xcc_mask);
for (i = 0; i < num_xcc; i++) {
r = gfx_v9_4_3_xcc_rlc_resume(adev, i);
...
}Unlike gfx_v9_4_3_rlc_init(), which ran during sw_init on VFs as well, gfx_v9_4_3_update_spm_vmid() is no longer reached on SR-IOV VFs, leaving regRLC_SPM_MC_CNTL unprogrammed in SR-IOV one-VF mode despite the amdgpu_sriov_is_pp_one_vf(adev) handling in gfx_v9_4_3_update_spm_vmid().
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Alex Deucher
maintainerPATCH 5/5 drm/amdgpu: bring back the ring parameter for update_spm_vmid()
In reply to Alex DeucherNot emitting the spm update via the ring causes CI flakiness on gfx11. Add back the SPM ring emission, but skip the MMIO path if ring is specified. Do this for all chips with gfxoff.
v2: drop ring code in gfx 12.1. We aren't supporting KCQs on 12.1 so the code is not used.
v3: emit via the ring for all chips with gfxoff
v4: skip MMIO writes when ring is non-NULL, fix ib emit size
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 16 ++++++++++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 17 ++++++++++++++--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 18 ++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 10 +++++++--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 7 +++++-- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 17 +++++++++++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 7 +++++-- 10 files changed, 91 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +8 -0
@@ -121,6 +121,10 @@ 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 && + 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 +213,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, ring, + 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,
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h +1 -1
@@ -292,7 +292,7 @@ struct amdgpu_rlc_funcs {void (*reset)(struct amdgpu_device *adev);void (*start)(struct amdgpu_device *adev);void (*update_spm_vmid)(struct amdgpu_device *adev,int xcc_id, -unsigned int vmid); +struct amdgpu_ring *ring,unsigned vmid);bool (*is_rlcg_access_range)(struct amdgpu_device *adev,uint32_t reg); };
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +14 -2
@@ -8187,8 +8187,18 @@ static void gfx_v10_0_update_spm_vmid_internal(struct amdgpu_device *adev, }static void gfx_v10_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) -{ +struct amdgpu_ring *ring,unsigned int vmid) +{ +if (ring) { +if ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) || + (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE )) { +u32 reg =SOC15_REG_OFFSET (GC ,0 , mmRLC_SPM_MC_CNTL); +u32 data = (vmid &RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK ) <<RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT ; +amdgpu_ring_emit_wreg (ring, reg, data); + } +return ; + } +amdgpu_gfx_off_ctrl (adev, false);gfx_v10_0_update_spm_vmid_internal (adev, vmid);
@@ -9692,6 +9702,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = { .get_wptr = gfx_v10_0_ring_get_wptr_gfx, .set_wptr = gfx_v10_0_ring_set_wptr_gfx, .emit_frame_size =/* totally 242 maximum if 16 IBs */ +5 +/* update_spm_vmid */ 5 +/* COND_EXEC */ 7 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
@@ -9749,6 +9760,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = { .get_wptr = gfx_v10_0_ring_get_wptr_compute, .set_wptr = gfx_v10_0_ring_set_wptr_compute, .emit_frame_size = +5 +/* update_spm_vmid */ 20 +/* gfx_v10_0_ring_emit_gds_switch */ 7 +/* gfx_v10_0_ring_emit_hdp_flush */ 5 + /* hdp invalidate */
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +14 -3
@@ -363,6 +363,7 @@ static void gfx_v11_0_ring_invalidate_tlbs(struct amdgpu_ring *ring,static void gfx_v11_0_set_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v11_0_unset_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v11_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, +struct amdgpu_ring *ring,unsigned int vmid);static void gfx_v11_0_userq_priv_fault_work (struct work_struct *work); static void gfx_v11_0_update_perf_clk(struct amdgpu_device *adev,
@@ -2606,7 +2607,7 @@ static int gfx_v11_0_rlc_resume(struct amdgpu_device *adev)* The RLC comes up with RLC_SPM_MC_CNTL cleared, program the SPM VMID * once it runs, also after a GPU reset or a resume. */ -gfx_v11_0_update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); +gfx_v11_0_update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }
@@ -5615,12 +5616,22 @@ static int gfx_v11_0_update_gfx_clock_gating(struct amdgpu_device *adev, }static void gfx_v11_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) +struct amdgpu_ring *ring,unsigned vmid) {u32 reg, pre_data, data; -amdgpu_gfx_off_ctrl (adev, false); reg =SOC15_REG_OFFSET (GC ,0 , regRLC_SPM_MC_CNTL); + +if (ring) { +if ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) || + (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE )) { + data = (vmid &RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK ) <<RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT ; +amdgpu_ring_emit_wreg (ring, reg, data); + } +return ; + } + +amdgpu_gfx_off_ctrl (adev, false);if (amdgpu_sriov_is_pp_one_vf (adev) && !amdgpu_sriov_runtime (adev)) pre_data =RREG32_NO_KIQ (reg);else
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +16 -2
@@ -287,6 +287,7 @@ static void gfx_v12_0_ring_invalidate_tlbs(struct amdgpu_ring *ring,static void gfx_v12_0_set_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v12_0_unset_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v12_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, +struct amdgpu_ring *ring,unsigned int vmid);static void gfx_v12_0_userq_priv_fault_work (struct work_struct *work); static void gfx_v12_0_update_perf_clk(struct amdgpu_device *adev,
@@ -2158,7 +2159,7 @@ static int gfx_v12_0_rlc_resume(struct amdgpu_device *adev)* The RLC comes up with RLC_SPM_MC_CNTL cleared, program the SPM VMID * once it runs, also after a GPU reset or a resume. */ -gfx_v12_0_update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); +gfx_v12_0_update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }
@@ -3978,12 +3979,23 @@ static void gfx_v12_0_update_perf_clk(struct amdgpu_device *adev,static void gfx_v12_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, +struct amdgpu_ring *ring,unsigned vmid) {u32 reg, data; -amdgpu_gfx_off_ctrl (adev, false); reg =SOC15_REG_OFFSET (GC ,0 , regRLC_SPM_MC_CNTL); + +if (ring) { +if ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) || + (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE )) { + data = (vmid &RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK ) <<RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT ; +amdgpu_ring_emit_wreg (ring, reg, data); + } +return ; + } + +amdgpu_gfx_off_ctrl (adev, false);if (amdgpu_sriov_is_pp_one_vf (adev)) data =RREG32_NO_KIQ (reg);else
@@ -5322,6 +5334,7 @@ static const struct amdgpu_ring_funcs gfx_v12_0_ring_funcs_gfx = { .get_wptr = gfx_v12_0_ring_get_wptr_gfx, .set_wptr = gfx_v12_0_ring_set_wptr_gfx, .emit_frame_size =/* totally 242 maximum if 16 IBs */ +5 +/* update_spm_vmid */ 5 +/* COND_EXEC */ 7 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
@@ -5369,6 +5382,7 @@ static const struct amdgpu_ring_funcs gfx_v12_0_ring_funcs_compute = { .get_wptr = gfx_v12_0_ring_get_wptr_compute, .set_wptr = gfx_v12_0_ring_set_wptr_compute, .emit_frame_size = +5 +/* update_spm_vmid */ 7 +/* gfx_v12_0_ring_emit_hdp_flush */ 5 +/* hdp invalidate */ 7 + /* gfx_v12_0_ring_emit_pipeline_sync */
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +7 -3
@@ -217,7 +217,7 @@ static int gfx_v12_1_init_cp_compute_microcode_bo(struct amdgpu_device *adev);static void gfx_v12_1_xcc_update_medium_grain_clock_gating (struct amdgpu_device *adev,bool enable,int xcc_id,bool force);static void gfx_v12_1_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid); +struct amdgpu_ring *ring,unsigned vmid); static void gfx_v12_1_wait_reg_mem(struct amdgpu_ring *ring, int eng_sel, int mem_space, int opt, uint32_t addr0,
@@ -1866,7 +1866,7 @@ static int gfx_v12_1_xcc_rlc_resume(struct amdgpu_device *adev,int r;/* init spm vmid with 0xf */ -gfx_v12_1_update_spm_vmid (adev, xcc_id, adev->vm_manager.spm_vmid); +gfx_v12_1_update_spm_vmid (adev, xcc_id,NULL , adev->vm_manager.spm_vmid);if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) {gfx_v12_1_xcc_init_csb (adev, xcc_id);
@@ -2945,10 +2945,14 @@ static void gfx_v12_1_update_perf_clk(struct amdgpu_device *adev,static void gfx_v12_1_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) +struct amdgpu_ring *ring, +unsigned vmid) {u32 reg, data; +if (ring) +return ; + reg =SOC15_REG_OFFSET (GC ,GET_INST (GC , xcc_id), regRLC_SPM_MC_CNTL);if (amdgpu_sriov_is_pp_one_vf (adev)) data =RREG32_NO_KIQ (reg);
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5 -2
@@ -3477,16 +3477,19 @@ static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev)/* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }static void gfx_v7_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) +struct amdgpu_ring *ring,unsigned vmid) {u32 data; +if (ring) +return ; +amdgpu_gfx_off_ctrl (adev, false); data =RREG32 (mmRLC_SPM_VMID);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -2
@@ -4084,7 +4084,8 @@ static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)/* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid); +return 0 ; }
@@ -5483,10 +5484,13 @@ static void gfx_v8_0_unset_safe_mode(struct amdgpu_device *adev, int xcc_id) }static void gfx_v8_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) +struct amdgpu_ring *ring,unsigned vmid) {u32 data; +if (ring) +return ; +amdgpu_gfx_off_ctrl (adev, false);if (amdgpu_sriov_is_pp_one_vf (adev))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +15 -2
@@ -5227,8 +5227,18 @@ static void gfx_v9_0_update_spm_vmid_internal(struct amdgpu_device *adev, }static void gfx_v9_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) -{ +struct amdgpu_ring *ring,unsigned int vmid) +{ +if (ring) { +if ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) || + (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE )) { +u32 reg =SOC15_REG_OFFSET (GC ,0 , mmRLC_SPM_MC_CNTL); +u32 data = (vmid &RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK ) <<RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT ; +amdgpu_ring_emit_wreg (ring, reg, data); + } +return ; + } +amdgpu_gfx_off_ctrl (adev, false);gfx_v9_0_update_spm_vmid_internal (adev, vmid);
@@ -7548,6 +7558,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = { .get_wptr = gfx_v9_0_ring_get_wptr_gfx, .set_wptr = gfx_v9_0_ring_set_wptr_gfx, .emit_frame_size =/* totally 242 maximum if 16 IBs */ +5 +/* update_spm_vmid */ 5 +/* COND_EXEC */ 13 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
@@ -7604,6 +7615,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_sw_ring_funcs_gfx = { .get_wptr = amdgpu_sw_ring_get_wptr_gfx, .set_wptr = amdgpu_sw_ring_set_wptr_gfx, .emit_frame_size =/* totally 242 maximum if 16 IBs */ +5 +/* update_spm_vmid */ 5 +/* COND_EXEC */ 13 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
@@ -7663,6 +7675,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = { .get_wptr = gfx_v9_0_ring_get_wptr_compute, .set_wptr = gfx_v9_0_ring_set_wptr_compute, .emit_frame_size = +5 +/* update_spm_vmid */ 20 +/* gfx_v9_0_ring_emit_gds_switch */ 7 +/* gfx_v9_0_ring_emit_hdp_flush */ 5 + /* hdp invalidate */
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +5 -2
@@ -1586,7 +1586,7 @@ static int gfx_v9_4_3_xcc_rlc_resume(struct amdgpu_device *adev, int xcc_id)/* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }
@@ -1609,10 +1609,13 @@ static int gfx_v9_4_3_rlc_resume(struct amdgpu_device *adev) }static void gfx_v9_4_3_update_spm_vmid (struct amdgpu_device *adev, -int inst,unsigned int vmid) +int inst,struct amdgpu_ring *ring,unsigned int vmid) {u32 reg, pre_data, data; +if (ring) +return ; + reg =SOC15_REG_OFFSET (GC ,GET_INST (GC , inst), regRLC_SPM_MC_CNTL);if (amdgpu_sriov_is_pp_one_vf (adev) && !amdgpu_sriov_runtime (adev)) pre_data =RREG32_NO_KIQ (reg);
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH 5/5] drm/amdgpu: bring back the ring parameter for update_spm_vmid()
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] drm/amdgpu: hardcoded XCC 0 in gfx_v9_4_3_xcc_rlc_resume() skips XCCs 1..N-1 - [Medium] drm/amdgpu…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [High] drm/amdgpu: hardcoded XCC 0 in gfx_v9_4_3_xcc_rlc_resume() skips XCCs 1..N-1
- [Medium] drm/amdgpu: gfx9 compute emit_frame_size exceeds max_dw in amdgpu_ring_init()
- [Medium] drm/amdgpu: update_spm_vmid() skipped on SR-IOV VFs in gfx_v8_0 and gfx_v9_4_3
--
commit 08b45306962b59cde3c232193cc26534f308aaa2
Author: Alex Deucher <[email protected]>
drm/amdgpu: bring back the ring parameter for update_spm_vmid()
This commit restores the ring parameter to update_spm_vmid() so that GFX9, GFX10, GFX11, and GFX12.0 emit the SPM VMID update on the ring during IB scheduling while skipping MMIO updates when a ring is provided.
[ ... ]
Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2
-2@@ -4084,7 +4084,8 @@ static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)/* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid); +return 0 ; }@@ -5483,10 +5484,13 @@ static void gfx_v8_0_unset_safe_mode(struct amdgpu_device *adev, int xcc_id) } static void gfx_v8_0_update_spm_vmid(struct amdgpu_device *adev, int xcc_id, -unsigned int vmid)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_unset_safe_mode(struct amdgpu_device *adev, int xcc_id) · line 5496
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4
-0+ struct amdgpu_ring *ring, unsigned vmid) {u32 data; +if (ring) +return ; +amdgpu_gfx_off_ctrl (adev, false);if (amdgpu_sriov_is_pp_one_vf (adev))
[Severity: Medium]
Does returning early when ring is non-NULL leave mmRLC_SPM_VMID unprogrammed on SR-IOV VFs in one-VF mode?
gfx_v8_0_rlc_resume() returns early when amdgpu_sriov_vf(adev) is true before reaching the update_spm_vmid(adev, 0, NULL, ...) call:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:gfx_v8_0_rlc_resume() {
if (amdgpu_sriov_vf(adev)) {
gfx_v8_0_init_csb(adev);
return 0;
}
...
}With amdgpu_ib_schedule() passing a non-NULL ring, gfx_v8_0_update_spm_vmid() now returns before reaching the amdgpu_sriov_is_pp_one_vf(adev) branch, so mmRLC_SPM_VMID is never programmed on SR-IOV VFs. The same issue affects gfx_v9_4_3_update_spm_vmid(), because both gfx_v9_4_3_rlc_resume() and gfx_v9_4_3_xcp_resume() skip calling gfx_v9_4_3_xcc_rlc_resume() when amdgpu_sriov_vf(adev) is true.
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0
[ ... ]
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = { · line 7681
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0@@ -7663,6 +7675,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = { .get_wptr = gfx_v9_0_ring_get_wptr_compute, .set_wptr = gfx_v9_0_ring_set_wptr_compute, .emit_frame_size = +5 +/* update_spm_vmid */ 20 +/* gfx_v9_0_ring_emit_gds_switch */ 7 +/* gfx_v9_0_ring_emit_hdp_flush */ 5 + /* hdp invalidate */
[Severity: Medium]
Does adding 5 dwords here trigger WARN_ON(max_ibs_dw > max_dw) in amdgpu_ring_init() for every GFX9 compute ring?
This increases gfx_v9_0_ring_funcs_compute.emit_frame_size from 145 to 150. In amdgpu_ring_init(), max_ibs_dw is 150 + 125 * 7 = 1025, which rounds up to 1280 with align_mask (0xff), exceeding the max_dw of 1024 passed by gfx_v9_0_compute_ring_init().
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +1
-1@@ -1586,7 +1586,7 @@ static int gfx_v9_4_3_xcc_rlc_resume(struct amdgpu_device *adev, int xcc_id)/* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }@@ -1609,10 +1609,13 @@ static int gfx_v9_4_3_rlc_resume(struct amdgpu_device *adev) }
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c static int gfx_v9_4_3_rlc_resume(struct amdgpu_device *adev) · line 1619
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +4
-1static void gfx_v9_4_3_update_spm_vmid (struct amdgpu_device *adev, -int inst,unsigned int vmid) +int inst,struct amdgpu_ring *ring,unsigned int vmid) {u32 reg, pre_data, data; +if (ring) +return ; + reg =SOC15_REG_OFFSET (GC ,GET_INST (GC , inst), regRLC_SPM_MC_CNTL);
[Severity: High]
Should gfx_v9_4_3_xcc_rlc_resume() pass xcc_id instead of 0 to update_spm_vmid()?
Previously, amdgpu_ib_schedule() called update_spm_vmid() with ring->xcc_id on each IB submission, programming regRLC_SPM_MC_CNTL on all XCCs. Now that gfx_v9_4_3_update_spm_vmid() returns early when ring is non-NULL, gfx_v9_4_3_xcc_rlc_resume() is the only caller that programs the register, and passing hardcoded 0 leaves XCCs 1..num_xcc-1 at their hardware reset value of VMID 0 (the kernel VMID).
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Re: [PATCH 5/5] drm/amdgpu: bring back the ring parameter for update_spm_vmid()
In reply to Alex DeucherQuoted 386 lines · Alex Deucher
Not emitting the spm update via the ring causes CI flakiness on gfx11. Add back the SPM ring emission, but skip the MMIO path if ring is specified. Do this for all chips with gfxoff.
v2: drop ring code in gfx 12.1. We aren't supporting KCQs on 12.1 so the code is not used.
v3: emit via the ring for all chips with gfxoff
v4: skip MMIO writes when ring is non-NULL, fix ib emit sizeCc Vitaly Prosyak <[email protected]>Cc Pierre-Eric Pelloux-Prayer <[email protected]>Cc Sunil Khatri <[email protected]>Cc Christian König <[email protected]>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 | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 16 ++++++++++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 17 ++++++++++++++--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 18 ++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 10 +++++++--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 7 +++++-- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 17 +++++++++++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 7 +++++-- 10 files changed, 91 insertions(+), 19 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +8
-0@@ -121,6 +121,10 @@ 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 && + 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 +213,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, ring, + 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,drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h +1
-1@@ -292,7 +292,7 @@ struct amdgpu_rlc_funcs {void (*reset)(struct amdgpu_device *adev);void (*start)(struct amdgpu_device *adev);void (*update_spm_vmid)(struct amdgpu_device *adev,int xcc_id, -unsigned int vmid); +struct amdgpu_ring *ring,unsigned vmid);bool (*is_rlcg_access_range)(struct amdgpu_device *adev,uint32_t reg); };drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +14
-2@@ -8187,8 +8187,18 @@ static void gfx_v10_0_update_spm_vmid_internal(struct amdgpu_device *adev, }static void gfx_v10_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) -{ +struct amdgpu_ring *ring,unsigned int vmid) +{ +if (ring) { +if ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) || + (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE )) { +u32 reg =SOC15_REG_OFFSET (GC ,0 , mmRLC_SPM_MC_CNTL); +u32 data = (vmid &RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK ) <<RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT ; +amdgpu_ring_emit_wreg (ring, reg, data); + } +return ; + } +amdgpu_gfx_off_ctrl (adev, false);gfx_v10_0_update_spm_vmid_internal (adev, vmid);@@ -9692,6 +9702,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = { .get_wptr = gfx_v10_0_ring_get_wptr_gfx, .set_wptr = gfx_v10_0_ring_set_wptr_gfx, .emit_frame_size =/* totally 242 maximum if 16 IBs */ +5 +/* update_spm_vmid */ 5 +/* COND_EXEC */ 7 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +@@ -9749,6 +9760,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = { .get_wptr = gfx_v10_0_ring_get_wptr_compute, .set_wptr = gfx_v10_0_ring_set_wptr_compute, .emit_frame_size = +5 +/* update_spm_vmid */ 20 +/* gfx_v10_0_ring_emit_gds_switch */ 7 +/* gfx_v10_0_ring_emit_hdp_flush */ 5 + /* hdp invalidate */drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +14
-3@@ -363,6 +363,7 @@ static void gfx_v11_0_ring_invalidate_tlbs(struct amdgpu_ring *ring,static void gfx_v11_0_set_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v11_0_unset_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v11_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, +struct amdgpu_ring *ring,unsigned int vmid);static void gfx_v11_0_userq_priv_fault_work (struct work_struct *work); static void gfx_v11_0_update_perf_clk(struct amdgpu_device *adev,@@ -2606,7 +2607,7 @@ static int gfx_v11_0_rlc_resume(struct amdgpu_device *adev)* The RLC comes up with RLC_SPM_MC_CNTL cleared, program the SPM VMID * once it runs, also after a GPU reset or a resume. */ -gfx_v11_0_update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); +gfx_v11_0_update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }@@ -5615,12 +5616,22 @@ static int gfx_v11_0_update_gfx_clock_gating(struct amdgpu_device *adev, }static void gfx_v11_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) +struct amdgpu_ring *ring,unsigned vmid) {u32 reg, pre_data, data; -amdgpu_gfx_off_ctrl (adev, false); reg =SOC15_REG_OFFSET (GC ,0 , regRLC_SPM_MC_CNTL); + +if (ring) { +if ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) || + (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE )) { + data = (vmid &RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK ) <<RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT ; +amdgpu_ring_emit_wreg (ring, reg, data); + } +return ; + } + +amdgpu_gfx_off_ctrl (adev, false);if (amdgpu_sriov_is_pp_one_vf (adev) && !amdgpu_sriov_runtime (adev)) pre_data =RREG32_NO_KIQ (reg);else drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +16
-2@@ -287,6 +287,7 @@ static void gfx_v12_0_ring_invalidate_tlbs(struct amdgpu_ring *ring,static void gfx_v12_0_set_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v12_0_unset_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v12_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, +struct amdgpu_ring *ring,unsigned int vmid);static void gfx_v12_0_userq_priv_fault_work (struct work_struct *work); static void gfx_v12_0_update_perf_clk(struct amdgpu_device *adev,@@ -2158,7 +2159,7 @@ static int gfx_v12_0_rlc_resume(struct amdgpu_device *adev)* The RLC comes up with RLC_SPM_MC_CNTL cleared, program the SPM VMID * once it runs, also after a GPU reset or a resume. */ -gfx_v12_0_update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); +gfx_v12_0_update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }@@ -3978,12 +3979,23 @@ static void gfx_v12_0_update_perf_clk(struct amdgpu_device *adev,static void gfx_v12_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, +struct amdgpu_ring *ring,unsigned vmid) {u32 reg, data; -amdgpu_gfx_off_ctrl (adev, false); reg =SOC15_REG_OFFSET (GC ,0 , regRLC_SPM_MC_CNTL); + +if (ring) { +if ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) || + (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE )) { + data = (vmid &RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK ) <<RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT ; +amdgpu_ring_emit_wreg (ring, reg, data); + } +return ; + } + +amdgpu_gfx_off_ctrl (adev, false);if (amdgpu_sriov_is_pp_one_vf (adev)) data =RREG32_NO_KIQ (reg);else @@ -5322,6 +5334,7 @@ static const struct amdgpu_ring_funcs gfx_v12_0_ring_funcs_gfx = { .get_wptr = gfx_v12_0_ring_get_wptr_gfx, .set_wptr = gfx_v12_0_ring_set_wptr_gfx, .emit_frame_size =/* totally 242 maximum if 16 IBs */ +5 +/* update_spm_vmid */ 5 +/* COND_EXEC */ 7 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +@@ -5369,6 +5382,7 @@ static const struct amdgpu_ring_funcs gfx_v12_0_ring_funcs_compute = { .get_wptr = gfx_v12_0_ring_get_wptr_compute, .set_wptr = gfx_v12_0_ring_set_wptr_compute, .emit_frame_size = +5 +/* update_spm_vmid */ 7 +/* gfx_v12_0_ring_emit_hdp_flush */ 5 +/* hdp invalidate */ 7 + /* gfx_v12_0_ring_emit_pipeline_sync */drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +7
-3@@ -217,7 +217,7 @@ static int gfx_v12_1_init_cp_compute_microcode_bo(struct amdgpu_device *adev);static void gfx_v12_1_xcc_update_medium_grain_clock_gating (struct amdgpu_device *adev,bool enable,int xcc_id,bool force);static void gfx_v12_1_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid); +struct amdgpu_ring *ring,unsigned vmid); static void gfx_v12_1_wait_reg_mem(struct amdgpu_ring *ring, int eng_sel, int mem_space, int opt, uint32_t addr0,@@ -1866,7 +1866,7 @@ static int gfx_v12_1_xcc_rlc_resume(struct amdgpu_device *adev,int r;/* init spm vmid with 0xf */ -gfx_v12_1_update_spm_vmid (adev, xcc_id, adev->vm_manager.spm_vmid); +gfx_v12_1_update_spm_vmid (adev, xcc_id,NULL , adev->vm_manager.spm_vmid);if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) {gfx_v12_1_xcc_init_csb (adev, xcc_id);@@ -2945,10 +2945,14 @@ static void gfx_v12_1_update_perf_clk(struct amdgpu_device *adev,static void gfx_v12_1_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) +struct amdgpu_ring *ring, +unsigned vmid) {u32 reg, data; +if (ring) +return ; + reg =SOC15_REG_OFFSET (GC ,GET_INST (GC , xcc_id), regRLC_SPM_MC_CNTL);if (amdgpu_sriov_is_pp_one_vf (adev)) data =RREG32_NO_KIQ (reg);drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5
-2@@ -3477,16 +3477,19 @@ static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev)/* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }static void gfx_v7_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) +struct amdgpu_ring *ring,unsigned vmid) {u32 data; +if (ring) +return ; +amdgpu_gfx_off_ctrl (adev, false); data =RREG32 (mmRLC_SPM_VMID);drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6
-2@@ -4084,7 +4084,8 @@ static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)/* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid); +return 0 ; }@@ -5483,10 +5484,13 @@ static void gfx_v8_0_unset_safe_mode(struct amdgpu_device *adev, int xcc_id) }static void gfx_v8_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) +struct amdgpu_ring *ring,unsigned vmid) {u32 data; +if (ring) +return ; +amdgpu_gfx_off_ctrl (adev, false);if (amdgpu_sriov_is_pp_one_vf (adev))drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +15
-2@@ -5227,8 +5227,18 @@ static void gfx_v9_0_update_spm_vmid_internal(struct amdgpu_device *adev, }static void gfx_v9_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -unsigned int vmid) -{ +struct amdgpu_ring *ring,unsigned int vmid) +{ +if (ring) { +if ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) || + (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE )) { +u32 reg =SOC15_REG_OFFSET (GC ,0 , mmRLC_SPM_MC_CNTL); +u32 data = (vmid &RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK ) <<RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT ; +amdgpu_ring_emit_wreg (ring, reg, data); + } +return ; + } +amdgpu_gfx_off_ctrl (adev, false);gfx_v9_0_update_spm_vmid_internal (adev, vmid);@@ -7548,6 +7558,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = { .get_wptr = gfx_v9_0_ring_get_wptr_gfx, .set_wptr = gfx_v9_0_ring_set_wptr_gfx, .emit_frame_size =/* totally 242 maximum if 16 IBs */ +5 +/* update_spm_vmid */ 5 +/* COND_EXEC */ 13 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +@@ -7604,6 +7615,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_sw_ring_funcs_gfx = { .get_wptr = amdgpu_sw_ring_get_wptr_gfx, .set_wptr = amdgpu_sw_ring_set_wptr_gfx, .emit_frame_size =/* totally 242 maximum if 16 IBs */ +5 +/* update_spm_vmid */ 5 +/* COND_EXEC */ 13 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +@@ -7663,6 +7675,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = { .get_wptr = gfx_v9_0_ring_get_wptr_compute, .set_wptr = gfx_v9_0_ring_set_wptr_compute, .emit_frame_size = +5 +/* update_spm_vmid */ 20 +/* gfx_v9_0_ring_emit_gds_switch */ 7 +/* gfx_v9_0_ring_emit_hdp_flush */ 5 + /* hdp invalidate */drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +5
-2@@ -1586,7 +1586,7 @@ static int gfx_v9_4_3_xcc_rlc_resume(struct amdgpu_device *adev, int xcc_id)/* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); + adev->gfx.rlc.funcs->update_spm_vmid (adev,0 ,NULL , adev->vm_manager.spm_vmid);return 0 ; }@@ -1609,10 +1609,13 @@ static int gfx_v9_4_3_rlc_resume(struct amdgpu_device *adev) }static void gfx_v9_4_3_update_spm_vmid (struct amdgpu_device *adev, -int inst,unsigned int vmid) +int inst,struct amdgpu_ring *ring,unsigned int vmid) {u32 reg, pre_data, data; +if (ring) +return ; + reg =SOC15_REG_OFFSET (GC ,GET_INST (GC , inst), regRLC_SPM_MC_CNTL);if (amdgpu_sriov_is_pp_one_vf (adev) && !amdgpu_sriov_runtime (adev)) pre_data =RREG32_NO_KIQ (reg);
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/amdgpu: missing Fixes trailer for reverted commit d44428868e5b --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] drm/amdgpu: missing Fixes trailer for reverted commit d44428868e5b
--
commit 36fa0c29e9f1b1b0ebcda0c9f28cb357bd14196e
Author: Alex Deucher <[email protected]>
Quoted 7 lines
Revert "drm/amdgpu: re-enable SPM updates in the the IB path"
This reverts commit
d44428868e5b9f97c6216eee1b4f82aec7a6e8d2.This causes flakiness in gfx11 CI tests. Revert.
Signed-off-by Alex Deucher <[email protected]>
[Severity: Low]
Since commit d44428868e5b ("drm/amdgpu: re-enable SPM updates in the the IB path") carries its own Fixes: tag, should this revert include:
so stable and backport trees do not pick up the original commit without this revert?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1