[PATCH v2 2/4] drm/amdgpu: Only add rqs for initialized rings.
Christian König
ckoenig.leichtzumerken at gmail.com
Wed Jan 30 10:42:06 UTC 2019
Am 30.01.19 um 02:53 schrieb Bas Nieuwenhuizen:
> 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 at basnieuwenhuizen.nl>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 11 ++++++++---
> 1 file 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..30407e55593b 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,
> struct amdgpu_ring *rings[AMDGPU_MAX_RINGS];
> struct drm_sched_rq *rqs[AMDGPU_MAX_RINGS];
> unsigned num_rings;
> + unsigned num_rqs = 0;
>
> switch (i) {
> case AMDGPU_HW_IP_GFX:
> @@ -166,12 +167,16 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev,
> break;
> }
>
> - for (j = 0; j < num_rings; ++j)
> - rqs[j] = &rings[j]->sched.sched_rq[priority];
> + for (j = 0; j < num_rings; ++j) {
> + if (rings[j]->adev) {
Better do "if (!ring[j]->adev) continue;".
With that done the patch is Reviewed-by: Christian König
<christian.koenig at amd.com>.
Regards,
Christian.
> + rqs[num_rqs++] =
> + &rings[j]->sched.sched_rq[priority];
> + }
> + }
>
> for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j)
> r = drm_sched_entity_init(&ctx->entities[i][j].entity,
> - rqs, num_rings, &ctx->guilty);
> + rqs, num_rqs, &ctx->guilty);
> if (r)
> goto error_cleanup_entities;
> }
More information about the amd-gfx
mailing list