]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
iommu/vt-d: Fix linker error on 32-bit
authorJoerg Roedel <jroedel@suse.de>
Thu, 10 Jun 2021 08:31:20 +0000 (10:31 +0200)
committerJoerg Roedel <jroedel@suse.de>
Thu, 10 Jun 2021 08:33:14 +0000 (10:33 +0200)
A recent commit broke the build on 32-bit x86. The linker throws these
messages:

ld: drivers/iommu/intel/perf.o: in function `dmar_latency_snapshot':
perf.c:(.text+0x40c): undefined reference to `__udivdi3'
ld: perf.c:(.text+0x458): undefined reference to `__udivdi3'

The reason are the 64-bit divides in dmar_latency_snapshot(). Use the
div_u64() helper function for those.

Fixes: 55ee5e67a59a ("iommu/vt-d: Add common code for dmar latency performance monitors")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20210610083120.29224-1-joro@8bytes.org
drivers/iommu/intel/perf.c

index faaa96dda437703a65126eb8732995a4dc52df75..73b7ec7055521553a9acfc36c24d72cf2259ca83 100644 (file)
@@ -141,14 +141,14 @@ int dmar_latency_snapshot(struct intel_iommu *iommu, char *str, size_t size)
                                if (val == UINT_MAX)
                                        val = 0;
                                else
-                                       val /= 1000;
+                                       val = div_u64(val, 1000);
                                break;
                        case COUNTS_MAX:
-                               val /= 1000;
+                               val = div_u64(val, 1000);
                                break;
                        case COUNTS_SUM:
                                if (lstat[i].samples)
-                                       val /= (lstat[i].samples * 1000);
+                                       val = div_u64(val, (lstat[i].samples * 1000));
                                else
                                        val = 0;
                                break;