[PATCH] drm/amdgpu: check ring being ready before using
Christian König
deathsimple at vodafone.de
Wed Jan 18 13:26:58 UTC 2017
Am 18.01.2017 um 11:37 schrieb Pixel Ding:
> From: Ding Pixel <pding at amd.com>
>
> Return success when the ring is properly initialized, otherwise return
> failure.
>
> Tonga SRIOV VF doesn't have UVD and VCE engines, the initialization of
> these IPs is bypassed. The system crashes if application submit IB to
> their rings which are not ready to use. It could be a common issue if
> IP having ring buffer is disabled for some reason on specific ASIC, so
> it should check the ring being ready to use.
>
> Bug: amdgpu_test crashes system on Tonga VF.
Good catch, we probably have problem using the second VCE ring as well.
>
> Signed-off-by: Ding Pixel <pding at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 08dd97b..0a235b9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -83,6 +83,12 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
> }
> break;
> }
> +
> + if (!(*out_ring && (*out_ring)->ready)) {
Don't check ring->ready here, that member is used during GPU reset to
test if we have successfully restarted the ring.
Instead check if ring->adev is set, that is used in ring_init() to check
if a ring is initialized or not.
> + DRM_ERROR("invalid ip type: %d\n", ip_type);
Please adjust the error message to something like "ring %d not
initialized on IP %d\".
Regards,
Christian.
> + return -EINVAL;
> + }
> +
> return 0;
> }
>
More information about the amd-gfx
mailing list