Skip to content

Commit 1dbcf77

Browse files
jiadozhualexdeucher
authored andcommitted
drm/amdgpu: Reset CP_VMID_PREEMPT after trailing fence signaled
When MEC executes unmap_queue for mid command buffer preemption, it will kick the write pointer of the gfx ring, set CP_VMID_PREEMPT to trigger the preemption and wait for CP_VMID_PREEMPT becomes zero after the preemption done. There is a race condition that PFP may excute the resetting command before MEC set CP_VMID_PREEMPT. As a result, hang happens as CP_VMID_PREEMPT is always 0xffff. To avoid this, we send resetting CP_VMID_PREEMPT command after the trailing fence is siganled and update gfx write pointer explicitly. Signed-off-by: Jiadong Zhu <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] # 6.3.x Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2535
1 parent 858fd16 commit 1dbcf77

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5369,10 +5369,6 @@ static int gfx_v9_0_ring_preempt_ib(struct amdgpu_ring *ring)
53695369
amdgpu_ring_alloc(ring, 13);
53705370
gfx_v9_0_ring_emit_fence(ring, ring->trail_fence_gpu_addr,
53715371
ring->trail_seq, AMDGPU_FENCE_FLAG_EXEC | AMDGPU_FENCE_FLAG_INT);
5372-
/*reset the CP_VMID_PREEMPT after trailing fence*/
5373-
amdgpu_ring_emit_wreg(ring,
5374-
SOC15_REG_OFFSET(GC, 0, mmCP_VMID_PREEMPT),
5375-
0x0);
53765372

53775373
/* assert IB preemption, emit the trailing fence */
53785374
kiq->pmf->kiq_unmap_queues(kiq_ring, ring, PREEMPT_QUEUES_NO_UNMAP,
@@ -5395,6 +5391,10 @@ static int gfx_v9_0_ring_preempt_ib(struct amdgpu_ring *ring)
53955391
DRM_WARN("ring %d timeout to preempt ib\n", ring->idx);
53965392
}
53975393

5394+
/*reset the CP_VMID_PREEMPT after trailing fence*/
5395+
amdgpu_ring_emit_wreg(ring,
5396+
SOC15_REG_OFFSET(GC, 0, mmCP_VMID_PREEMPT),
5397+
0x0);
53985398
amdgpu_ring_commit(ring);
53995399

54005400
/* deassert preemption condition */

0 commit comments

Comments
 (0)