drm/amdgpu: add AMDGPU_BO_INVALID_OFFSET
authorChristian König <christian.koenig@amd.com>
Wed, 7 Sep 2016 13:10:44 +0000 (15:10 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 14 Sep 2016 19:10:44 +0000 (15:10 -0400)
An invalid offset to be used by custom VRAM/GGT manager when we
don't have an offset for an BO.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@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 e503ca13cccbbd7910f52471a215a4ca82808ec4..151a7066c90e9e82a55ea5e3ca9dc199e1d720ca 100644 (file)
@@ -956,6 +956,7 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
                     !amdgpu_ttm_is_bound(bo->tbo.ttm));
        WARN_ON_ONCE(!ww_mutex_is_locked(&bo->tbo.resv->lock) &&
                     !bo->pin_count);
+       WARN_ON_ONCE(bo->tbo.mem.start == AMDGPU_BO_INVALID_OFFSET);
 
        return bo->tbo.offset;
 }
index 3032c541ef0e3770b7d094345d83cc90ff30025d..8255034d73eb10061c32a175b02b03f131587280 100644 (file)
@@ -31,6 +31,8 @@
 #include <drm/amdgpu_drm.h>
 #include "amdgpu.h"
 
+#define AMDGPU_BO_INVALID_OFFSET       LONG_MAX
+
 /**
  * amdgpu_mem_type_to_domain - return domain corresponding to mem_type
  * @mem_type:  ttm memory type