[PATCH] drm/amdgpu: correctly sign extend 48bit addresses v2

Christian König ckoenig.leichtzumerken at gmail.com
Tue Aug 28 11:39:51 UTC 2018


Correct sign extend the GMC addresses to 48bit.

v2: sign extending turned out easier than thought.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 5ddd4e87480b..2884dc169dce 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -1361,6 +1361,8 @@ void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
  */
 u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
 {
+	uint64_t addr;
+
 	WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_SYSTEM);
 	WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_TT &&
 		     !amdgpu_gtt_mgr_has_gart_addr(&bo->tbo.mem));
@@ -1370,7 +1372,11 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
 	WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_VRAM &&
 		     !(bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS));
 
-	return bo->tbo.offset;
+	addr = bo->tbo.offset;
+	if (addr >= AMDGPU_VA_HOLE_START)
+		addr |= AMDGPU_VA_HOLE_END;
+
+	return addr;
 }
 
 /**
-- 
2.17.1



More information about the amd-gfx mailing list