Skip to content

Commit 6ac55ea

Browse files
committed
drm/amdgpu: move reset support type checks into the caller
Rather than checking in the callbacks, check if the reset type is supported in the caller. Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent ea2791d commit 6ac55ea

25 files changed

+37
-79
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
112112
amdgpu_job_core_dump(adev, job);
113113

114114
if (amdgpu_gpu_recovery &&
115+
amdgpu_ring_is_reset_type_supported(ring, AMDGPU_RESET_TYPE_SOFT_RESET) &&
115116
amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {
116117
dev_err(adev->dev, "ring %s timeout, but soft recovered\n",
117118
s_job->sched->name);
@@ -131,7 +132,9 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
131132
/* attempt a per ring reset */
132133
if (unlikely(adev->debug_disable_gpu_ring_reset)) {
133134
dev_err(adev->dev, "Ring reset disabled by debug mask\n");
134-
} else if (amdgpu_gpu_recovery && ring->funcs->reset) {
135+
} else if (amdgpu_gpu_recovery &&
136+
amdgpu_ring_is_reset_type_supported(ring, AMDGPU_RESET_TYPE_PER_QUEUE) &&
137+
ring->funcs->reset) {
135138
dev_err(adev->dev, "Starting %s ring reset\n",
136139
s_job->sched->name);
137140
r = amdgpu_ring_reset(ring, job->vmid, &job->hw_fence);

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,3 +825,34 @@ int amdgpu_ring_reset_helper_end(struct amdgpu_ring *ring,
825825
drm_sched_wqueue_start(&ring->sched);
826826
return 0;
827827
}
828+
829+
bool amdgpu_ring_is_reset_type_supported(struct amdgpu_ring *ring,
830+
u32 reset_type)
831+
{
832+
switch (ring->funcs->type) {
833+
case AMDGPU_RING_TYPE_GFX:
834+
if (ring->adev->gfx.gfx_supported_reset & reset_type)
835+
return true;
836+
break;
837+
case AMDGPU_RING_TYPE_COMPUTE:
838+
if (ring->adev->gfx.compute_supported_reset & reset_type)
839+
return true;
840+
break;
841+
case AMDGPU_RING_TYPE_SDMA:
842+
if (ring->adev->sdma.supported_reset & reset_type)
843+
return true;
844+
break;
845+
case AMDGPU_RING_TYPE_VCN_DEC:
846+
case AMDGPU_RING_TYPE_VCN_ENC:
847+
if (ring->adev->vcn.supported_reset & reset_type)
848+
return true;
849+
break;
850+
case AMDGPU_RING_TYPE_VCN_JPEG:
851+
if (ring->adev->jpeg.supported_reset & reset_type)
852+
return true;
853+
break;
854+
default:
855+
break;
856+
}
857+
return false;
858+
}

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,4 +568,6 @@ void amdgpu_ring_reset_helper_begin(struct amdgpu_ring *ring,
568568
struct amdgpu_fence *guilty_fence);
569569
int amdgpu_ring_reset_helper_end(struct amdgpu_ring *ring,
570570
struct amdgpu_fence *guilty_fence);
571+
bool amdgpu_ring_is_reset_type_supported(struct amdgpu_ring *ring,
572+
u32 reset_type);
571573
#endif

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,9 +1522,6 @@ int amdgpu_vcn_ring_reset(struct amdgpu_ring *ring,
15221522
{
15231523
struct amdgpu_device *adev = ring->adev;
15241524

1525-
if (!(adev->vcn.supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
1526-
return -EOPNOTSUPP;
1527-
15281525
if (adev->vcn.inst[ring->me].using_unified_queue)
15291526
return -EINVAL;
15301527

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9523,9 +9523,6 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring,
95239523
u64 addr;
95249524
int r;
95259525

9526-
if (!(adev->gfx.gfx_supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
9527-
return -EOPNOTSUPP;
9528-
95299526
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
95309527
return -EINVAL;
95319528

@@ -9591,9 +9588,6 @@ static int gfx_v10_0_reset_kcq(struct amdgpu_ring *ring,
95919588
unsigned long flags;
95929589
int i, r;
95939590

9594-
if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
9595-
return -EOPNOTSUPP;
9596-
95979591
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
95989592
return -EINVAL;
95999593

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6808,9 +6808,6 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring,
68086808
struct amdgpu_device *adev = ring->adev;
68096809
int r;
68106810

6811-
if (!(adev->gfx.gfx_supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
6812-
return -EOPNOTSUPP;
6813-
68146811
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
68156812

68166813
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, false);
@@ -6974,9 +6971,6 @@ static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring,
69746971
struct amdgpu_device *adev = ring->adev;
69756972
int r = 0;
69766973

6977-
if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
6978-
return -EOPNOTSUPP;
6979-
69806974
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
69816975

69826976
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true);

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5303,9 +5303,6 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring,
53035303
struct amdgpu_device *adev = ring->adev;
53045304
int r;
53055305

5306-
if (!(adev->gfx.gfx_supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
5307-
return -EOPNOTSUPP;
5308-
53095306
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
53105307

53115308
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, false);
@@ -5421,9 +5418,6 @@ static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring,
54215418
struct amdgpu_device *adev = ring->adev;
54225419
int r;
54235420

5424-
if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
5425-
return -EOPNOTSUPP;
5426-
54275421
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
54285422

54295423
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true);

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7183,9 +7183,6 @@ static int gfx_v9_0_reset_kcq(struct amdgpu_ring *ring,
71837183
unsigned long flags;
71847184
int i, r;
71857185

7186-
if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
7187-
return -EOPNOTSUPP;
7188-
71897186
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
71907187
return -EINVAL;
71917188

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3565,9 +3565,6 @@ static int gfx_v9_4_3_reset_kcq(struct amdgpu_ring *ring,
35653565
unsigned long flags;
35663566
int r;
35673567

3568-
if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
3569-
return -EOPNOTSUPP;
3570-
35713568
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
35723569
return -EINVAL;
35733570

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,6 @@ static int jpeg_v2_0_ring_reset(struct amdgpu_ring *ring,
773773
{
774774
int r;
775775

776-
if (!(ring->adev->jpeg.supported_reset & AMDGPU_RESET_TYPE_PER_QUEUE))
777-
return -EOPNOTSUPP;
778-
779776
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
780777
r = jpeg_v2_0_stop(ring->adev);
781778
if (r)

0 commit comments

Comments
 (0)