Skip to content

Commit 14b2d71

Browse files
committed
drm/amdgpu/gfx10: fix KGQ reset sequence
Need to reinit the ring before remapping it and all of the KIQ handling needs to be within the kiq lock. Fixes: 1741281 ("drm/amdgpu/gfx10: add ring reset callbacks") Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 127ed49 commit 14b2d71

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9544,7 +9544,7 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring,
95449544

95459545
spin_lock_irqsave(&kiq->ring_lock, flags);
95469546

9547-
if (amdgpu_ring_alloc(kiq_ring, 5 + 7 + 7 + kiq->pmf->map_queues_size)) {
9547+
if (amdgpu_ring_alloc(kiq_ring, 5 + 7 + 7)) {
95489548
spin_unlock_irqrestore(&kiq->ring_lock, flags);
95499549
return -ENOMEM;
95509550
}
@@ -9564,12 +9564,9 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring,
95649564
0, 1, 0x20);
95659565
gfx_v10_0_ring_emit_reg_wait(kiq_ring,
95669566
SOC15_REG_OFFSET(GC, 0, mmCP_VMID_RESET), 0, 0xffffffff);
9567-
kiq->pmf->kiq_map_queues(kiq_ring, ring);
95689567
amdgpu_ring_commit(kiq_ring);
9569-
9570-
spin_unlock_irqrestore(&kiq->ring_lock, flags);
9571-
95729568
r = amdgpu_ring_test_ring(kiq_ring);
9569+
spin_unlock_irqrestore(&kiq->ring_lock, flags);
95739570
if (r)
95749571
return r;
95759572

@@ -9579,6 +9576,19 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring,
95799576
return r;
95809577
}
95819578

9579+
spin_lock_irqsave(&kiq->ring_lock, flags);
9580+
9581+
if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->map_queues_size)) {
9582+
spin_unlock_irqrestore(&kiq->ring_lock, flags);
9583+
return -ENOMEM;
9584+
}
9585+
kiq->pmf->kiq_map_queues(kiq_ring, ring);
9586+
amdgpu_ring_commit(kiq_ring);
9587+
r = amdgpu_ring_test_ring(kiq_ring);
9588+
spin_unlock_irqrestore(&kiq->ring_lock, flags);
9589+
if (r)
9590+
return r;
9591+
95829592
r = amdgpu_ring_test_ring(ring);
95839593
if (r)
95849594
return r;

0 commit comments

Comments
 (0)