[PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted()
Christian König
deathsimple at vodafone.de
Thu Aug 18 08:10:08 UTC 2016
Am 18.08.2016 um 07:36 schrieb Flora Cui:
> abort if the bo is pined to other domain already
>
> Change-Id: I0e8eb3e0af0fad1edaf647050399e5a36226a5d9
> Signed-off-by: Flora Cui <Flora.Cui at amd.com>
Reviewed-by: Christian König <christian.koenig at amd.com> for the whole
series.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 4d084ee..0a0f3cb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -520,6 +520,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
> return -EINVAL;
>
> if (bo->pin_count) {
> + uint32_t mem_type = bo->tbo.mem.mem_type;
> +
> + if (domain != amdgpu_mem_type_to_domain(mem_type))
> + return -EINVAL;
> +
> bo->pin_count++;
> if (gpu_addr)
> *gpu_addr = amdgpu_bo_gpu_offset(bo);
More information about the amd-gfx
mailing list