Re: [PATCH v2 5/5] KVM: selftests: List the known IOMMU modes in irq_test's help output
From: Sean Christopherson
Date: Wed Nov 04 2026 - 17:16:56 EST
On Wed, Nov 04, 2026, David Matlack wrote:
> On 2026-11-04 06:53 AM, Sean Christopherson wrote:
> > const char *iommu_mode_names(void)
> > {
> > return __iommu_mode_names(false);
> > }
>
> How about listing both? That keeps -h consistent with how other KVM
> selftests list the options for their arguments (e.g. backing_src_help()
> lists every backing src type), while also showing which modes can
> actually be used. e.g. on a system with only the legacy VFIO container:
>
> # ./irq_test -h
> ...
> -t Override the IOMMU mode to use
> Options: iommufd, vfio_type1v2_iommu, vfio_type1_iommu, iommufd_compat_type1v2, iommufd_compat_type1
> Available: vfio_type1v2_iommu, vfio_type1_iommu
That'd be awesome!
> The available modes also get printed when the requested mode is not
> available, i.e. when the __TEST_REQUIRE() fails:
>
> # ./irq_test -d 0000:01:00.0 -t iommufd
> 1..0 # SKIP - IOMMU mode 'iommufd' is not available. Available modes: vfio_type1v2_iommu, vfio_type1_iommu.
>
> libvfio exposes iommu_mode_names_all() and iommu_mode_names_available()
> for this, built on your helper for juggling all vs. available.