Skip to content

Commit f8410a1

Browse files
committed
drm/amdgpu/sdma: consolidate engine reset handling
Move the force completion handling into the common engine reset function. No need to duplicate it for every IP version. Reviewed-by: Jesse Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 91134e8 commit f8410a1

File tree

4 files changed

+9
-25
lines changed

4 files changed

+9
-25
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,12 @@ int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id)
590590
* to be submitted to the queues after the reset is complete.
591591
*/
592592
if (!ret) {
593+
amdgpu_fence_driver_force_completion(gfx_ring);
593594
drm_sched_wqueue_start(&gfx_ring->sched);
594-
if (adev->sdma.has_page_queue)
595+
if (adev->sdma.has_page_queue) {
596+
amdgpu_fence_driver_force_completion(page_ring);
595597
drm_sched_wqueue_start(&page_ring->sched);
598+
}
596599
}
597600
mutex_unlock(&sdma_instance->engine_reset_mutex);
598601

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ static int sdma_v4_4_2_stop_queue(struct amdgpu_ring *ring)
17141714
static int sdma_v4_4_2_restore_queue(struct amdgpu_ring *ring)
17151715
{
17161716
struct amdgpu_device *adev = ring->adev;
1717-
u32 inst_mask, tmp_mask;
1717+
u32 inst_mask;
17181718
int i, r;
17191719

17201720
inst_mask = 1 << ring->me;
@@ -1733,21 +1733,6 @@ static int sdma_v4_4_2_restore_queue(struct amdgpu_ring *ring)
17331733
}
17341734

17351735
r = sdma_v4_4_2_inst_start(adev, inst_mask, true);
1736-
if (r)
1737-
return r;
1738-
1739-
tmp_mask = inst_mask;
1740-
for_each_inst(i, tmp_mask) {
1741-
ring = &adev->sdma.instance[i].ring;
1742-
1743-
amdgpu_fence_driver_force_completion(ring);
1744-
1745-
if (adev->sdma.has_page_queue) {
1746-
struct amdgpu_ring *page = &adev->sdma.instance[i].page;
1747-
1748-
amdgpu_fence_driver_force_completion(page);
1749-
}
1750-
}
17511736

17521737
return r;
17531738
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,10 +1618,8 @@ static int sdma_v5_0_restore_queue(struct amdgpu_ring *ring)
16181618

16191619
r = sdma_v5_0_gfx_resume_instance(adev, inst_id, true);
16201620
amdgpu_gfx_rlc_exit_safe_mode(adev, 0);
1621-
if (r)
1622-
return r;
1623-
amdgpu_fence_driver_force_completion(ring);
1624-
return 0;
1621+
1622+
return r;
16251623
}
16261624

16271625
static int sdma_v5_0_ring_preempt_ib(struct amdgpu_ring *ring)

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,10 +1534,8 @@ static int sdma_v5_2_restore_queue(struct amdgpu_ring *ring)
15341534
r = sdma_v5_2_gfx_resume_instance(adev, inst_id, true);
15351535

15361536
amdgpu_gfx_rlc_exit_safe_mode(adev, 0);
1537-
if (r)
1538-
return r;
1539-
amdgpu_fence_driver_force_completion(ring);
1540-
return 0;
1537+
1538+
return r;
15411539
}
15421540

15431541
static int sdma_v5_2_ring_preempt_ib(struct amdgpu_ring *ring)

0 commit comments

Comments
 (0)