[PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted()
Flora Cui
Flora.Cui at amd.com
Thu Aug 18 05:36:57 UTC 2016
abort if the bo is pined to other domain already
Change-Id: I0e8eb3e0af0fad1edaf647050399e5a36226a5d9
Signed-off-by: Flora Cui <Flora.Cui at amd.com>
---
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);
--
2.7.4
More information about the amd-gfx
mailing list