Skip to content

Commit 45cfade

Browse files
arndblucasdemarchi
authored andcommitted
drm/xe/xe2: fix 64-bit division in pte_update_size
This function does not build on 32-bit targets when the compiler fails to reduce DIV_ROUND_UP() into a shift: ld.lld: error: undefined symbol: __aeabi_uldivmod >>> referenced by xe_migrate.c >>> drivers/gpu/drm/xe/xe_migrate.o:(pte_update_size) in archive vmlinux.a There are two instances in this function. Change the first to use an open-coded shift with the same behavior, and the second one to a 32-bit calculation, which is sufficient here as the size is never more than 2^32 pages (16TB). Fixes: 237412e ("drm/xe: Enable 32bits build") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240226124736.1272949-3-arnd@kernel.org Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> (cherry picked from commit 1408784) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent d1d9598 commit 45cfade

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ static u32 pte_update_size(struct xe_migrate *m,
462462
} else {
463463
/* Clip L0 to available size */
464464
u64 size = min(*L0, (u64)avail_pts * SZ_2M);
465-
u64 num_4k_pages = DIV_ROUND_UP(size, XE_PAGE_SIZE);
465+
u32 num_4k_pages = (size + XE_PAGE_SIZE - 1) >> XE_PTE_SHIFT;
466466

467467
*L0 = size;
468468
*L0_ofs = xe_migrate_vm_addr(pt_ofs, 0);

0 commit comments

Comments
 (0)