]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/amdgpu: add more warning to amdgpu_bo_offset
authorChristian König <christian.koenig@amd.com>
Mon, 25 Jul 2016 15:56:18 +0000 (17:56 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 8 Aug 2016 15:32:17 +0000 (11:32 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h

index 93573586e2de72a10d1cc6daca5df0781b150cbc..67de19c46ddb2319ba6ccddc05275d7daa538fc7 100644 (file)
@@ -737,3 +737,21 @@ void amdgpu_bo_fence(struct amdgpu_bo *bo, struct fence *fence,
        else
                reservation_object_add_excl_fence(resv, fence);
 }
+
+/**
+ * amdgpu_bo_gpu_offset - return GPU offset of bo
+ * @bo:        amdgpu object for which we query the offset
+ *
+ * Returns current GPU offset of the object.
+ *
+ * Note: object should either be pinned or reserved when calling this
+ * function, it might be useful to add check for this for debugging.
+ */
+u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
+{
+       WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_SYSTEM);
+       WARN_ON_ONCE(!ww_mutex_is_locked(&bo->tbo.resv->lock) &&
+                    !bo->pin_count);
+
+       return bo->tbo.offset;
+}
index ae188a88082d0a07203fc90e2e5e20391e404dfd..d650b42279e515e88aeafbc4b1ce346ccf927c0f 100644 (file)
@@ -85,21 +85,6 @@ static inline void amdgpu_bo_unreserve(struct amdgpu_bo *bo)
        ttm_bo_unreserve(&bo->tbo);
 }
 
-/**
- * amdgpu_bo_gpu_offset - return GPU offset of bo
- * @bo:        amdgpu object for which we query the offset
- *
- * Returns current GPU offset of the object.
- *
- * Note: object should either be pinned or reserved when calling this
- * function, it might be useful to add check for this for debugging.
- */
-static inline u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
-{
-       WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_SYSTEM);
-       return bo->tbo.offset;
-}
-
 static inline unsigned long amdgpu_bo_size(struct amdgpu_bo *bo)
 {
        return bo->tbo.num_pages << PAGE_SHIFT;
@@ -169,6 +154,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
 int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
 void amdgpu_bo_fence(struct amdgpu_bo *bo, struct fence *fence,
                     bool shared);
+u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo);
 
 /*
  * sub allocation