summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2026-01-28 18:47:01 +0300
committerAlex Deucher <alexander.deucher@amd.com>2026-02-23 22:16:30 +0300
commit866eedef4cc6d8e06c1888860ef2b98c8f6aaca4 (patch)
treeb1cf2d56384786d4c2e32fd70973fbb4281202b0
parent2e88530255e76e11266bcdbb1eaf533e75f95d37 (diff)
downloadlinux-866eedef4cc6d8e06c1888860ef2b98c8f6aaca4.tar.xz
drm/amdgpu: add amdgpu_gtt_node_to_byte_offset helper
Having a helper avoids code duplication. Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 871388b86503..c43f352df953 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -220,6 +220,14 @@ static inline u64 amdgpu_compute_gart_address(struct amdgpu_gmc *gmc,
return gmc->gart_start + entity->gart_window_offs[index];
}
+/**
+ * amdgpu_gtt_node_to_byte_offset() - Returns a byte offset of a gtt node
+ */
+static inline u64 amdgpu_gtt_node_to_byte_offset(const struct drm_mm_node *gtt_node)
+{
+ return gtt_node->start * (u64)PAGE_SIZE;
+}
+
void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct amdgpu_hmm_range *range);
int amdgpu_ttm_tt_get_userptr(const struct ttm_buffer_object *tbo,
uint64_t *user_addr);