Skip to content

Commit d1f2144

Browse files
committed
drm/amdgpu/gfx10: rework reset sequence
To match other GFX IPs. Acked-by: Vitaly Prosyak <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 097af47 commit d1f2144

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6692,13 +6692,13 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,
66926692
return 0;
66936693
}
66946694

6695-
static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)
6695+
static int gfx_v10_0_kgq_init_queue(struct amdgpu_ring *ring, bool reset)
66966696
{
66976697
struct amdgpu_device *adev = ring->adev;
66986698
struct v10_gfx_mqd *mqd = ring->mqd_ptr;
66996699
int mqd_idx = ring - &adev->gfx.gfx_ring[0];
67006700

6701-
if (!amdgpu_in_reset(adev) && !adev->in_suspend) {
6701+
if (!reset && !amdgpu_in_reset(adev) && !adev->in_suspend) {
67026702
memset((void *)mqd, 0, sizeof(*mqd));
67036703
mutex_lock(&adev->srbm_mutex);
67046704
nv_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
@@ -6750,7 +6750,7 @@ static int gfx_v10_0_cp_async_gfx_ring_resume(struct amdgpu_device *adev)
67506750

67516751
r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
67526752
if (!r) {
6753-
r = gfx_v10_0_gfx_init_queue(ring);
6753+
r = gfx_v10_0_kgq_init_queue(ring, false);
67546754
amdgpu_bo_kunmap(ring->mqd_obj);
67556755
ring->mqd_ptr = NULL;
67566756
}
@@ -9460,10 +9460,22 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)
94609460
if (r)
94619461
return r;
94629462

9463-
/* reset the ring */
9464-
ring->wptr = 0;
9465-
*ring->wptr_cpu_addr = 0;
9466-
amdgpu_ring_clear_ring(ring);
9463+
r = amdgpu_bo_reserve(ring->mqd_obj, false);
9464+
if (unlikely(r != 0)) {
9465+
DRM_ERROR("fail to resv mqd_obj\n");
9466+
return r;
9467+
}
9468+
r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
9469+
if (!r) {
9470+
r = gfx_v10_0_kgq_init_queue(ring, true);
9471+
amdgpu_bo_kunmap(ring->mqd_obj);
9472+
ring->mqd_ptr = NULL;
9473+
}
9474+
amdgpu_bo_unreserve(ring->mqd_obj);
9475+
if (r) {
9476+
DRM_ERROR("fail to unresv mqd_obj\n");
9477+
return r;
9478+
}
94679479

94689480
return amdgpu_ring_test_ring(ring);
94699481
}

0 commit comments

Comments
 (0)