summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/vfio/lib/include
diff options
context:
space:
mode:
authorDavid Matlack <dmatlack@google.com>2025-11-26 23:17:32 +0000
committerAlex Williamson <alex@shazbot.org>2025-11-28 10:58:07 -0700
commitb8e96c8805ec25878ac971cad34732a6aabe34f6 (patch)
tree5146dc29200062227f090963d30d5aa2d36840f3 /tools/testing/selftests/vfio/lib/include
parent5fabc49abf7ac630babfb1525e242848d54038c1 (diff)
downloadlinux-next-b8e96c8805ec25878ac971cad34732a6aabe34f6.tar.gz
linux-next-b8e96c8805ec25878ac971cad34732a6aabe34f6.zip
vfio: selftests: Eliminate INVALID_IOVA
Eliminate INVALID_IOVA as there are platforms where UINT64_MAX is a valid iova. Reviewed-by: Alex Mastro <amastro@fb.com> Tested-by: Alex Mastro <amastro@fb.com> Reviewed-by: Raghavendra Rao Ananta <rananta@google.com> Signed-off-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20251126231733.3302983-18-dmatlack@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
Diffstat (limited to 'tools/testing/selftests/vfio/lib/include')
-rw-r--r--tools/testing/selftests/vfio/lib/include/libvfio/iommu.h3
-rw-r--r--tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h4
2 files changed, 3 insertions, 4 deletions
diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
index e35f13ed3f3c..5c9b9dc6d993 100644
--- a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
+++ b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
@@ -8,7 +8,6 @@
#include <libvfio/assert.h>
typedef u64 iova_t;
-#define INVALID_IOVA UINT64_MAX
struct iommu_mode {
const char *name;
@@ -57,7 +56,7 @@ static inline void iommu_unmap_all(struct iommu *iommu)
VFIO_ASSERT_EQ(__iommu_unmap_all(iommu, NULL), 0);
}
-iova_t __iommu_hva2iova(struct iommu *iommu, void *vaddr);
+int __iommu_hva2iova(struct iommu *iommu, void *vaddr, iova_t *iova);
iova_t iommu_hva2iova(struct iommu *iommu, void *vaddr);
struct iommu_iova_range *iommu_iova_ranges(struct iommu *iommu, u32 *nranges);
diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
index 160e003131d6..2858885a89bb 100644
--- a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
+++ b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
@@ -103,9 +103,9 @@ static inline void vfio_pci_msix_disable(struct vfio_pci_device *device)
vfio_pci_irq_disable(device, VFIO_PCI_MSIX_IRQ_INDEX);
}
-static inline iova_t __to_iova(struct vfio_pci_device *device, void *vaddr)
+static inline int __to_iova(struct vfio_pci_device *device, void *vaddr, iova_t *iova)
{
- return __iommu_hva2iova(device->iommu, vaddr);
+ return __iommu_hva2iova(device->iommu, vaddr, iova);
}
static inline iova_t to_iova(struct vfio_pci_device *device, void *vaddr)