Skip to content

Commit dac2d70

Browse files
arndblucasdemarchi
authored andcommitted
drm/xe: avoid plain 64-bit division
Building the xe driver for i386 results in a link time warning: x86_64-linux-ld: drivers/gpu/drm/xe/xe_migrate.o: in function `xe_migrate_vram': xe_migrate.c:(.text+0x1e15): undefined reference to `__udivdi3' Avoid this by using DIV_U64_ROUND_UP() instead of DIV_ROUND_UP(). The driver is unlikely to be used on 32=bit hardware, so the extra cost here is not too important. Fixes: 9c44fd5 ("drm/xe: Add migrate layer functions for SVM support") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20250324210612.2927194-1-arnd@kernel.org Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> (cherry picked from commit c909225) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent a5c71fd commit dac2d70

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,7 @@ void xe_migrate_wait(struct xe_migrate *m)
15471547
static u32 pte_update_cmd_size(u64 size)
15481548
{
15491549
u32 num_dword;
1550-
u64 entries = DIV_ROUND_UP(size, XE_PAGE_SIZE);
1550+
u64 entries = DIV_U64_ROUND_UP(size, XE_PAGE_SIZE);
15511551

15521552
XE_WARN_ON(size > MAX_PREEMPTDISABLE_TRANSFER);
15531553
/*
@@ -1558,7 +1558,7 @@ static u32 pte_update_cmd_size(u64 size)
15581558
* 2 dword for the page table's physical location
15591559
* 2*n dword for value of pte to fill (each pte entry is 2 dwords)
15601560
*/
1561-
num_dword = (1 + 2) * DIV_ROUND_UP(entries, 0x1ff);
1561+
num_dword = (1 + 2) * DIV_U64_ROUND_UP(entries, 0x1ff);
15621562
num_dword += entries * 2;
15631563

15641564
return num_dword;

0 commit comments

Comments
 (0)