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

From: David Matlack

Date: Mon Jul 06 2026 - 18:51:40 EST


On 2026-07-02 11:28 PM, Narayana Murty N wrote:
> 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

This should be based on the IOMMU mode, not __powerpc__, as that is what
actually determines what gets returned.