[PATCH] drm/amdgpu: check ring being ready before using

Christian König deathsimple at vodafone.de
Wed Jan 18 15:08:38 UTC 2017


Am 18.01.2017 um 15:45 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.

Not a big issue, but when you send out a patch for the second time it is 
good practice to add "v2" to the subject and something like "v2: changed 
xyz...." to the commit message.

>
> Signed-off-by: Ding Pixel <pding at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 08dd97b..6e948e4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -83,6 +83,13 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
>   		}
>   		break;
>   	}
> +
> +	if (!(*out_ring && (*out_ring)->adev)) {
> +		DRM_ERROR("Ring %d is not initialized on IP %d\n",
> +			  ring, ip_type);
> +		return -EINVAL;
> +	}
> +
>   	return 0;
>   }
>   




More information about the amd-gfx mailing list