[PATCH 1/2] drm/amdgpu: linear validate first then bind to GART

Deucher, Alexander Alexander.Deucher at amd.com
Mon Oct 16 17:44:52 UTC 2017


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Christian König
> Sent: Monday, October 16, 2017 5:27 AM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH 1/2] drm/amdgpu: linear validate first then bind to GART
> 
> From: Christian König <christian.koenig at amd.com>
> 
> For VM emulation for old UVD/VCE we need to validate the BO with linear
> VRAM flag set first and then eventually bind it to GART.
> 
> Validating with linear VRAM flag set can move the BO to GART making
> UVD/VCE read/write from an unbound GART BO.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

Cc: Stable?

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 52dd78ee8fd0..0c52295e74d3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1583,14 +1583,14 @@ int amdgpu_cs_find_mapping(struct
> amdgpu_cs_parser *parser,
>  	if (READ_ONCE((*bo)->tbo.resv->lock.ctx) != &parser->ticket)
>  		return -EINVAL;
> 
> -	r = amdgpu_ttm_bind(&(*bo)->tbo, &(*bo)->tbo.mem);
> -	if (unlikely(r))
> -		return r;
> -
> -	if ((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)
> -		return 0;
> +	if (!((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS))
> {
> +		(*bo)->flags |=
> AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
> +		amdgpu_ttm_placement_from_domain(*bo, (*bo)-
> >allowed_domains);
> +		r = ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, false,
> +				    false);
> +		if (r)
> +			return r;
> +	}
> 
> -	(*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
> -	amdgpu_ttm_placement_from_domain(*bo, (*bo)-
> >allowed_domains);
> -	return ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, false,
> false);
> +	return amdgpu_ttm_bind(&(*bo)->tbo, &(*bo)->tbo.mem);
>  }
> --
> 2.11.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list