On Mon, May 26, 2025 at 2:07 AM Yi Liu <yi.l.liu@xxxxxxxxx> wrote: > > On 2025/5/24 07:29, David Matlack wrote: > > This series introduces VFIO selftests, located in > > tools/testing/selftests/vfio/. > > > > VFIO selftests aim to enable kernel developers to write and run tests > > that take the form of userspace programs that interact with VFIO and > > IOMMUFD uAPIs. VFIO selftests can be used to write functional tests for > > new features, regression tests for bugs, and performance tests for > > optimizations. > > > > These tests are designed to interact with real PCI devices, i.e. they do > > not rely on mocking out or faking any behavior in the kernel. This > > allows the tests to exercise not only VFIO but also IOMMUFD, the IOMMU > > driver, interrupt remapping, IRQ handling, etc. > > > > We chose selftests to host these tests primarily to enable integration > > with the existing KVM selftests. As explained in the next section, > > enabling KVM developers to test the interaction between VFIO and KVM is > > one of the motivators of this series. > > interesting. Two quick questions: > 1) does this selftest support all the vfio iommu drivers (typ1 and > spapr_tce)? Maybe also the iommufd vfio_compat as well. This series supports the following IOMMU drivers [1]: - VFIO Type1 IOMMU - VFIO Type1v2 IOMMU - IOMMUFD compat-mode with Type1 - IOMMUFD compat-mode with Type1v2 - IOMMUFD I have not lookied at spapr_tce or any other modes, but I implemented the code in such a way that other modes could be added in the future. [1] https://github.com/dmatlack/linux/blob/9832935d7a44aab725ff627c6acf22b8a17d407f/tools/testing/selftests/vfio/lib/vfio_pci_device.c#L409 > 2) I know Alex has a test suit as the below. Has this series referred > it? > > https://github.com/awilliam/tests/commits/for-clg/ I was not aware of these tests, thanks for sharing the link. If we think the approach taken in this series makes sense, we could presumably port those tests to tools/testing/selftests/vfio/. I would be happy to help with that.