From: Josh Hilke <jrhilke@google.com>
To: Alex Williamson <alex@shazbot.org>
Cc: David Matlack <dmatlack@google.com>,
Vipin Sharma <vipinsh@google.com>,
Raghavendra Rao Ananta <rananta@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Josh Hilke <jrhilke@google.com>
Subject: [PATCH 0/2] vfio: selftests: Automate finding/setting up devices for testing
Date: Thu, 9 Apr 2026 01:51:37 +0000 [thread overview]
Message-ID: <20260409015139.2800185-1-jrhilke@google.com> (raw)
This series introduces two improvements to make setting up devices for VFIO
selftests more user-friendly.
1. Add functionality to the VFIO selftest setup script to find devices on a
user's system that are compatible with the VFIO selftest framework (i.e. devices
that have a VFIO selftest driver).
Example:
$ ./tools/testing/selftests/vfio/scripts/setup.sh -l
Supported devices:
0000:6a:01.0
0000:6f:01.0
0000:74:01.0
0000:79:01.0
0000:e7:01.0
0000:ec:01.0
0000:f1:01.0
0000:f6:01.0
2. Modify the VFIO selftest setup script to try to find and set up a compatible
device automatically. "Set up the device for testing" means unbind the device
from its driver, then bind it to VFIO. The user is no longer required to find a
segment:bus:device.function number to pass to the script (though this
functionality is still available through a -d option).
Example of automated device setup:
$ ./tools/testing/selftests/vfio/scripts/setup.sh
+ echo "0000:6a:01.0" > /sys/bus/pci/drivers/idxd/unbind
+ echo "vfio-pci" > /sys/bus/pci/devices/0000:6a:01.0/driver_override
+ echo "0000:6a:01.0" > /sys/bus/pci/drivers/vfio-pci/bind
Successfully set up 0000:6a:01.0
Example of manual device setup:
$ ./tools/testing/selftests/vfio/scripts/setup.sh -d 0000:6a:01.0
+ echo "0000:6a:01.0" > /sys/bus/pci/drivers/idxd/unbind
+ echo "vfio-pci" > /sys/bus/pci/devices/0000:6a:01.0/driver_override
+ echo "0000:6a:01.0" > /sys/bus/pci/drivers/vfio-pci/bind
Successfully set up 0000:6a:01.0
Josh Hilke (2):
vfio: selftests: Find devices that are compatible with VFIO selftests
vfio: selftests: Automate finding/setting up devices for testing
tools/testing/selftests/vfio/scripts/setup.sh | 63 +++++++++++++++++--
1 file changed, 59 insertions(+), 4 deletions(-)
--
2.53.0.1213.gd9a14994de-goog
next reply other threads:[~2026-04-09 1:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 1:51 Josh Hilke [this message]
2026-04-09 1:51 ` [PATCH 1/2] vfio: selftests: Find devices that are compatible with VFIO selftests Josh Hilke
2026-04-10 22:40 ` David Matlack
2026-04-09 1:51 ` [PATCH 2/2] vfio: selftests: Automate setting up devices for testing Josh Hilke
2026-04-10 22:49 ` David Matlack
2026-04-10 22:54 ` David Matlack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260409015139.2800185-1-jrhilke@google.com \
--to=jrhilke@google.com \
--cc=alex@shazbot.org \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rananta@google.com \
--cc=vipinsh@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox