Commit
d65a459dbc9a6c3b051e22c96f73598e34b31bfc
drm/amdgpu: report the BO alignment in bytes in GEM_LIST_HANDLES
The uapi documents drm_amdgpu_gem_list_handles_entry.alignment as
"physical start_addr alignment in bytes", and GEM_OP
GET_GEM_CREATE_INFO returns the same value in bytes, but
GEM_LIST_HANDLES returns tbo.page_alignment, which is in pages. For a BO
created with a 64 KiB alignment on navi31:
GET_GEM_CREATE_INFO: alignment=65536
GEM_LIST_HANDLES: alignment=16
so a user such as CRIU that recreates BOs from this list uses the wrong
alignment. Convert it to bytes.
Fixes: f9db1fc52ceb ("drm/amdgpu: Add ioctl to get all gem handles for a process")
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit aa4493ae949c13e79aba0731394dd7a7e431342b)
Cc: stable@vger.kernel.org
Jesse Zhang <Jesse.Zhang@amd.com> · 2026-10-12 01:28 UTC · committed by Alex Deucher
1 file changed,
+1
−1
modified drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
| @@ -1238,7 +1238,7 @@ int amdgpu_gem_list_handles_ioctl(struct drm_device *dev, void *data, | |||
| 1238 | 1238 | bo_entry->alloc_flags = bo->flags & AMDGPU_GEM_CREATE_SETTABLE_MASK; | |
| 1239 | 1239 | bo_entry->preferred_domains = bo->preferred_domains; | |
| 1240 | 1240 | bo_entry->gem_handle = id; | |
| 1241 | - | bo_entry->alignment = bo->tbo.page_alignment; | |
| 1241 | + | bo_entry->alignment = (u64)bo->tbo.page_alignment << PAGE_SHIFT; | |
| 1242 | 1242 | ||
| 1243 | 1243 | if (bo->tbo.base.import_attach) | |
| 1244 | 1244 | bo_entry->flags |= AMDGPU_GEM_LIST_HANDLES_FLAG_IS_IMPORT; | |