drm/amdgpu: Only add rqs for initialized rings.
I don't see another way to figure out if a ring is initialized if the hardware block might not be initialized. Entities have been fixed up to handle num_rqs = 0. Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:

committed by
Alex Deucher

parent
1decbf6bb0
commit
2a84e48e97
@@ -124,6 +124,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev,
|
|||||||
struct amdgpu_ring *rings[AMDGPU_MAX_RINGS];
|
struct amdgpu_ring *rings[AMDGPU_MAX_RINGS];
|
||||||
struct drm_sched_rq *rqs[AMDGPU_MAX_RINGS];
|
struct drm_sched_rq *rqs[AMDGPU_MAX_RINGS];
|
||||||
unsigned num_rings;
|
unsigned num_rings;
|
||||||
|
unsigned num_rqs = 0;
|
||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case AMDGPU_HW_IP_GFX:
|
case AMDGPU_HW_IP_GFX:
|
||||||
@@ -166,12 +167,16 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < num_rings; ++j)
|
for (j = 0; j < num_rings; ++j) {
|
||||||
rqs[j] = &rings[j]->sched.sched_rq[priority];
|
if (!rings[j]->adev)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
rqs[num_rqs++] = &rings[j]->sched.sched_rq[priority];
|
||||||
|
}
|
||||||
|
|
||||||
for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j)
|
for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j)
|
||||||
r = drm_sched_entity_init(&ctx->entities[i][j].entity,
|
r = drm_sched_entity_init(&ctx->entities[i][j].entity,
|
||||||
rqs, num_rings, &ctx->guilty);
|
rqs, num_rqs, &ctx->guilty);
|
||||||
if (r)
|
if (r)
|
||||||
goto error_cleanup_entities;
|
goto error_cleanup_entities;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user