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 --- .../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