[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251107222058.2009244-1-dmatlack@google.com>
Date: Fri, 7 Nov 2025 22:20:58 +0000
From: David Matlack <dmatlack@...gle.com>
To: Alex Williamson <alex.williamson@...hat.com>
Cc: Alex Mastro <amastro@...com>, Alex Williamson <alex@...zbot.org>,
David Matlack <dmatlack@...gle.com>, Jason Gunthorpe <jgg@...pe.ca>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] vfio: selftests: Skip vfio_dma_map_limit_test if mapping
returns -EINVAL
Skip vfio_dma_map_limit_test.{unmap_range,unmap_all} (instead of
failing) on systems that do not support mapping in the page-sized region
at the top of the u64 address space. Use -EINVAL as the signal for
detecting systems with this limitation, as that is what both VFIO Type1
and iommufd return.
A more robust solution that could be considered in the future would be
to explicitly check the range of supported IOVA regions and key off
that, instead of inferring from -EINVAL.
Fixes: de8d1f2fd5a5 ("vfio: selftests: add end of address space DMA map/unmap tests")
Signed-off-by: David Matlack <dmatlack@...gle.com>
---
.../testing/selftests/vfio/vfio_dma_mapping_test.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
index 4f1ea79a200c..52b49cae58fe 100644
--- a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
+++ b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
@@ -249,7 +249,12 @@ TEST_F(vfio_dma_map_limit_test, unmap_range)
u64 unmapped;
int rc;
- vfio_pci_dma_map(self->device, region);
+ rc = __vfio_pci_dma_map(self->device, region);
+ if (rc == -EINVAL)
+ SKIP(return, "Unable to map at iova 0x%lx\n", region->iova);
+ else
+ ASSERT_EQ(rc, 0);
+
ASSERT_EQ(region->iova, to_iova(self->device, region->vaddr));
rc = __vfio_pci_dma_unmap(self->device, region, &unmapped);
@@ -263,7 +268,12 @@ TEST_F(vfio_dma_map_limit_test, unmap_all)
u64 unmapped;
int rc;
- vfio_pci_dma_map(self->device, region);
+ rc = __vfio_pci_dma_map(self->device, region);
+ if (rc == -EINVAL)
+ SKIP(return, "Unable to map at iova 0x%lx\n", region->iova);
+ else
+ ASSERT_EQ(rc, 0);
+
ASSERT_EQ(region->iova, to_iova(self->device, region->vaddr));
rc = __vfio_pci_dma_unmap_all(self->device, &unmapped);
base-commit: a1388fcb52fcad3e0b06e2cdd0ed757a82a5be30
--
2.51.2.1041.gc1ab5b90ca-goog
Powered by blists - more mailing lists