Re: [PATCH] vfio: selftests: Skip vfio_dma_map_limit_test if mapping returns -EINVAL

Alex Mastro
2025-11-09T01:20:35Z

On Sat, Nov 08, 2025 at 02:37:10PM -0700, Alex Williamson wrote:
> On Sat, 8 Nov 2025 12:19:48 -0800
> Alex Mastro <amastro@fb.com> wrote:
> > Here's my attempt at adding some machinery to query iova ranges, with
> > normalization to iommufd's struct. I kept the vfio capability chain stuff
> > relatively generic so we can use it for other things in the future if needed.
>
> Seems we were both hacking on this, I hadn't seen you posted this
> before sending:
>
> https://lore.kernel.org/kvm/20251108212954.26477-1-alex@shazbot.org/T/#u
>
> Maybe we can combine the best merits of each. Thanks,

Yes! I have been thinking along the following lines
- Your idea to change the end of address space test to allocate at the end of
the supported range is better and more general than my idea of skipping the
test if ~(iova_t)0 is out of bounds. We should do that.
- Introducing the concept iova allocator makes sense.
- I think it's worthwhile to keep common test concepts like vfio_pci_device
less opinionated/stateful so as not to close the door on certain categories of
testing in the future. For example, if we ever wanted to test IOVA range
contraction after binding additional devices to an IOAS or vfio container.
- What do you think about making the concept of an IOVA allocator something
standalone for which tests that need it can create one? I think it would
compose pretty cleanly on top of my vfio_pci_iova_ranges().

Alex