diff options
author | Christian König <christian.koenig@amd.com> | 2016-07-25 11:56:18 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-08-08 11:32:17 -0400 |
commit | cdb7e8f2733579e35ec2883bde7b594d07ad67e9 (patch) | |
tree | ef1b244bae983088efd5c62e9fdb1447121916c2 /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |
parent | 78bbbd9c0fcde51b56c5bec99dd286cbad698712 (diff) |
drm/amdgpu: add more warning to amdgpu_bo_offset
Warn when we try to get the address and the BO isn't locked or reserved.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@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.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 93573586e2de..67de19c46ddb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -737,3 +737,21 @@ void amdgpu_bo_fence(struct amdgpu_bo *bo, struct fence *fence, | |||
737 | else | 737 | else |
738 | reservation_object_add_excl_fence(resv, fence); | 738 | reservation_object_add_excl_fence(resv, fence); |
739 | } | 739 | } |
740 | |||
741 | /** | ||
742 | * amdgpu_bo_gpu_offset - return GPU offset of bo | ||
743 | * @bo: amdgpu object for which we query the offset | ||
744 | * | ||
745 | * Returns current GPU offset of the object. | ||
746 | * | ||
747 | * Note: object should either be pinned or reserved when calling this | ||
748 | * function, it might be useful to add check for this for debugging. | ||
749 | */ | ||
750 | u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo) | ||
751 | { | ||
752 | WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_SYSTEM); | ||
753 | WARN_ON_ONCE(!ww_mutex_is_locked(&bo->tbo.resv->lock) && | ||
754 | !bo->pin_count); | ||
755 | |||
756 | return bo->tbo.offset; | ||
757 | } | ||