]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: avoid plain 64-bit division
authorArnd Bergmann <arnd@arndb.de>
Mon, 24 Mar 2025 21:06:02 +0000 (22:06 +0100)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Fri, 28 Mar 2025 18:28:24 +0000 (14:28 -0400)
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: 9c44fd5f6e8a ("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>
drivers/gpu/drm/xe/xe_migrate.c

index ff0fc2fb0eb9f684cce652a94cb33c44e233dc9a..c1277d599a11ded3a7aa1810dd0e1aec756f2e49 100644 (file)
@@ -1548,7 +1548,7 @@ void xe_migrate_wait(struct xe_migrate *m)
 static u32 pte_update_cmd_size(u64 size)
 {
        u32 num_dword;
-       u64 entries = DIV_ROUND_UP(size, XE_PAGE_SIZE);
+       u64 entries = DIV_U64_ROUND_UP(size, XE_PAGE_SIZE);
 
        XE_WARN_ON(size > MAX_PREEMPTDISABLE_TRANSFER);
        /*
@@ -1559,7 +1559,7 @@ static u32 pte_update_cmd_size(u64 size)
         * 2 dword for the page table's physical location
         * 2*n dword for value of pte to fill (each pte entry is 2 dwords)
         */
-       num_dword = (1 + 2) * DIV_ROUND_UP(entries, 0x1ff);
+       num_dword = (1 + 2) * DIV_U64_ROUND_UP(entries, 0x1ff);
        num_dword += entries * 2;
 
        return num_dword;