aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
diff options
context:
space:
mode:
authorFlora Cui <Flora.Cui@amd.com>2016-08-18 00:55:13 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-08-19 12:31:19 -0400
commit408778e8e9656105aa4df2fe7dce54244ccdd3d7 (patch)
tree7a2df61cf702fde6b21bf9932cb38d779cf4dec2 /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
parentc632d7994360aa06158ccb089ad7e4814ce8f08b (diff)
drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted()
abort if the bo is pined to other domain already Signed-off-by: Flora Cui <Flora.Cui@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 4d084eeb4e09..0a0f3cb89f92 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,
520 return -EINVAL; 520 return -EINVAL;
521 521
522 if (bo->pin_count) { 522 if (bo->pin_count) {
523 uint32_t mem_type = bo->tbo.mem.mem_type;
524
525 if (domain != amdgpu_mem_type_to_domain(mem_type))
526 return -EINVAL;
527
523 bo->pin_count++; 528 bo->pin_count++;
524 if (gpu_addr) 529 if (gpu_addr)
525 *gpu_addr = amdgpu_bo_gpu_offset(bo); 530 *gpu_addr = amdgpu_bo_gpu_offset(bo);