summaryrefslogtreecommitdiff
path: root/drivers/vfio
diff options
context:
space:
mode:
authorKirti Wankhede <kwankhede@nvidia.com>2020-06-02 21:42:36 +0300
committerAlex Williamson <alex.williamson@redhat.com>2020-06-02 22:38:21 +0300
commitcd0bb41ea86027d3a5c3555772692323cbc05bc1 (patch)
tree77528895b6881c2bbfd290e9f0a77616576c232b /drivers/vfio
parent95fc87b44104d9a524ff3e975bbfbd7c1f1a2dd5 (diff)
downloadlinux-cd0bb41ea86027d3a5c3555772692323cbc05bc1.tar.xz
vfio iommu: Use shift operation for 64-bit integer division
Fixes compilation error with ARCH=i386. Error fixed by this commit: ld: drivers/vfio/vfio_iommu_type1.o: in function `vfio_dma_populate_bitmap': >> vfio_iommu_type1.c:(.text+0x666): undefined reference to `__udivdi3' Fixes: d6a4c185660c ("vfio iommu: Implementation of ioctl for dirty pages tracking") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/vfio_iommu_type1.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index a6d632d44c82..0e4e71799290 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -227,11 +227,12 @@ static void vfio_dma_bitmap_free(struct vfio_dma *dma)
static void vfio_dma_populate_bitmap(struct vfio_dma *dma, size_t pgsize)
{
struct rb_node *p;
+ unsigned long pgshift = __ffs(pgsize);
for (p = rb_first(&dma->pfn_list); p; p = rb_next(p)) {
struct vfio_pfn *vpfn = rb_entry(p, struct vfio_pfn, node);
- bitmap_set(dma->bitmap, (vpfn->iova - dma->iova) / pgsize, 1);
+ bitmap_set(dma->bitmap, (vpfn->iova - dma->iova) >> pgshift, 1);
}
}