From: Pierre-Eric Pelloux-Prayer Date: Wed, 28 Jan 2026 15:47:01 +0000 (+0100) Subject: drm/amdgpu: add amdgpu_gtt_node_to_byte_offset helper X-Git-Tag: v7.1-rc1~167^2~31^2~148 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=866eedef4cc6d8e06c1888860ef2b98c8f6aaca4;p=thirdparty%2Fkernel%2Flinux.git drm/amdgpu: add amdgpu_gtt_node_to_byte_offset helper Having a helper avoids code duplication. Signed-off-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Christian König Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index 871388b86503e..c43f352df9531 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);