diff options
author | Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | 2019-01-29 20:53:20 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-02-15 11:15:30 -0500 |
commit | 2a84e48e9712ea8591a10dd59d59ccab3d54efd6 (patch) | |
tree | 288279f8c1c4ccf510330333b6887ab54c642848 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |
parent | 1decbf6bb0b4dc56c9da6c5e57b994ebfc2be3aa (diff) |
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index d85184b5b35c..7b526593eb77 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -124,6 +124,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, | |||
124 | struct amdgpu_ring *rings[AMDGPU_MAX_RINGS]; | 124 | struct amdgpu_ring *rings[AMDGPU_MAX_RINGS]; |
125 | struct drm_sched_rq *rqs[AMDGPU_MAX_RINGS]; | 125 | struct drm_sched_rq *rqs[AMDGPU_MAX_RINGS]; |
126 | unsigned num_rings; | 126 | unsigned num_rings; |
127 | unsigned num_rqs = 0; | ||
127 | 128 | ||
128 | switch (i) { | 129 | switch (i) { |
129 | case AMDGPU_HW_IP_GFX: | 130 | case AMDGPU_HW_IP_GFX: |
@@ -166,12 +167,16 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, | |||
166 | break; | 167 | break; |
167 | } | 168 | } |
168 | 169 | ||
169 | for (j = 0; j < num_rings; ++j) | 170 | for (j = 0; j < num_rings; ++j) { |
170 | rqs[j] = &rings[j]->sched.sched_rq[priority]; | 171 | if (!rings[j]->adev) |
172 | continue; | ||
173 | |||
174 | rqs[num_rqs++] = &rings[j]->sched.sched_rq[priority]; | ||
175 | } | ||
171 | 176 | ||
172 | for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j) | 177 | for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j) |
173 | r = drm_sched_entity_init(&ctx->entities[i][j].entity, | 178 | r = drm_sched_entity_init(&ctx->entities[i][j].entity, |
174 | rqs, num_rings, &ctx->guilty); | 179 | rqs, num_rqs, &ctx->guilty); |
175 | if (r) | 180 | if (r) |
176 | goto error_cleanup_entities; | 181 | goto error_cleanup_entities; |
177 | } | 182 | } |