summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/vfio/lib/iova_allocator.c
diff options
context:
space:
mode:
authorDavid Matlack <dmatlack@google.com>2025-11-26 23:17:28 +0000
committerAlex Williamson <alex@shazbot.org>2025-11-28 10:58:06 -0700
commit831c37a5bf046bbdf65c042b53fd2e8cac0b1a5a (patch)
tree2a3d7f25ceee10cf2598ca4e56ead68c6408beb0 /tools/testing/selftests/vfio/lib/iova_allocator.c
parent2607a4361312bf407931597423fe23db406ca8d3 (diff)
vfio: selftests: Stop passing device for IOMMU operations
Drop the struct vfio_pci_device wrappers for IOMMU map/unmap functions and require tests to directly call iommu_map(), iommu_unmap(), etc. This results in more concise code, and also makes it clear the map operations are happening on a struct iommu, not necessarily on a specific device, especially when multi-device tests are introduced. Do the same for iova_allocator_init() as that function only needs the struct iommu, not struct vfio_pci_device. 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-14-dmatlack@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
Diffstat (limited to 'tools/testing/selftests/vfio/lib/iova_allocator.c')
-rw-r--r--tools/testing/selftests/vfio/lib/iova_allocator.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/vfio/lib/iova_allocator.c b/tools/testing/selftests/vfio/lib/iova_allocator.c
index f03648361ba2..b3b6b27f5d1e 100644
--- a/tools/testing/selftests/vfio/lib/iova_allocator.c
+++ b/tools/testing/selftests/vfio/lib/iova_allocator.c
@@ -21,13 +21,13 @@
#include <vfio_util.h>
-struct iova_allocator *iova_allocator_init(struct vfio_pci_device *device)
+struct iova_allocator *iova_allocator_init(struct iommu *iommu)
{
struct iova_allocator *allocator;
struct iommu_iova_range *ranges;
u32 nranges;
- ranges = vfio_pci_iova_ranges(device, &nranges);
+ ranges = iommu_iova_ranges(iommu, &nranges);
VFIO_ASSERT_NOT_NULL(ranges);
allocator = malloc(sizeof(*allocator));