[RFC PATCH 5/6] selftests/vfio: Accept sPAPR errno for DMA range overflow

From: Narayana Murty N

Date: Fri Jul 03 2026 - 04:03:41 EST


Accept sPAPR errno for DMA range overflow

The DMA map limit test expects an overflowing IOVA range to fail with
-EOVERFLOW. That matches the Type1 and iommufd paths.

On sPAPR TCE v2, the same invalid range is rejected as outside the active
TCE window and currently returns -ENXIO. Treat that as the expected ppc
result for this RFC while keeping the existing -EOVERFLOW expectation for
other backends.

This keeps the overflow test enabled for sPAPR TCE v2 instead of skipping
it.

Signed-off-by: Narayana Murty N <nnmlinux@xxxxxxxxxxxxx>
---
tools/testing/selftests/vfio/vfio_dma_mapping_test.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
index 4411fdbd56da..cd2d3276a46c 100644
--- a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
+++ b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
@@ -316,10 +316,18 @@ TEST_F(vfio_dma_map_limit_test, overflow)
region->size = self->mmap_size;

rc = __iommu_map(self->iommu, region);
+#ifdef __powerpc__
+ ASSERT_EQ(rc, -ENXIO);
+#else
ASSERT_EQ(rc, -EOVERFLOW);
+#endif

rc = __iommu_unmap(self->iommu, region, NULL);
+#ifdef __powerpc__
+ ASSERT_EQ(rc, -ENXIO);
+#else
ASSERT_EQ(rc, -EOVERFLOW);
+#endif
}

int main(int argc, char *argv[])
--
2.51.1