Re: [PATCH 2/2] vfio: selftests: Automate setting up devices for testing
From: Josh Hilke
Date: Mon Apr 13 2026 - 20:15:31 EST
On Mon, Apr 13, 2026 at 8:07 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Fri, Apr 10, 2026, David Matlack wrote:
> > On 2026-04-09 01:51 AM, Josh Hilke wrote:
> > > Update the VFIO selftest setup script to find a device that has a VFIO selftest
> > > driver on the system, and set it up (i.e unbind that device from its driver, and
> > > then bind that device to VFIO).
> >
> > I am leaning toward putting this behind an explicit flag (maybe -p for
> > pick_device or -a for automatic device setup?) that way we are sure the
> > user is ok with letting the script start messing with devices on their
> > system.
>
> In the spirit of "do one thing and do it well", I would rather put "discovery" in
> a separate script entirely, and then tweak setup.sh as necessary to allow piping
> in a BDF from the discovery script.
>
> The mechanics of configuring a device for VFIO (setup.sh) are largely generic,
> i.e. not unique to the selftests, whereas print_supported_devices() is very much
> tightly coupled to selftests.
>
> And with respect to making sure the user actually wants the script to mess with
> their system, the permissions required for each script can and should be different.
> `lspci`, and discovery in general, typically doesn't require root, whereas most
> systems will be configured to have things like "sriov_numvfs" writable only from
> root.
I'll put device discovery in a separate script for v3.
Regarding David's feedback, I'll also use -p for automatic device
setup, and make the phrasing for "supported devices" more precise.