Skip to contentSkip to conversation

vfio: selftests: Find devices that have VFIO selftest drivers

PATCH In review Josh Hilke 2 participants 2 messages Nov 20

Subsystems (4)
lore
Share & tools
lore

Josh Hilke

author
#0 lore raw

PATCH v9 1/1 vfio: selftests: Find devices that have VFIO selftest drivers

Add list_supported_devices.sh to print the PCI addresses, names, and selftest driver paths of devices on the host that have a VFIO selftest driver. Group the output into sections based on whether vfio-pci is loaded, whether the vfio-pci denylist blocks the device, and whether a GPU requires an architecture check at probe time.

Match NVIDIA GPUs by vendor ID and PCI display class, since nv_falcon identifies compatible GPUs by reading BAR0 rather than by PCI device ID. Group them under "Possibly supported", list the valid GPU architectures, and warn that nv_falcon skips MSI tests.

Add -q to print only the PCI addresses of usable devices so the output can go straight to setup.sh. Add -a for use with -q to include unusable devices as well.

When vfio-pci is loaded with disable_denylist=Y, the script lists the denylisted devices under "Supported (on denylist, but denylist disabled):" and includes them in the -q output. When vfio-pci is not loaded, the script lists all devices as unusable and omits them from -q unless -a is also passed.

Example on a host with Intel IOAT, NVIDIA GPU, and Intel DSA devices when vfio-pci is loaded with disable_denylist=N:

$ ./list_supported_devices.sh
Supported:
  0000:00:04.0 - Intel IOAT SKX [8086:2021] - lib/drivers/ioat/ioat.c
  ...

Possibly supported (depends on GPU architecture):
0000:3b:00.0 - NVIDIA GPU [10de:1eb8] - lib/drivers/nv_falcon/nv_falcon.c

nv_falcon supports Kepler, Maxwell, Pascal, Volta, Turing, Ampere, Ada, and Hopper GPUs. It does not support send_msi() and will skip tests that try to send MSIs.

Unusable (available, but denylisted by the kernel):
0000:6a:01.0 - Intel DSA SPR [8086:0b25] - lib/drivers/dsa/dsa.c
...

To use denylisted devices, load vfio-pci with disable_denylist=1 (or boot the kernel with vfio_pci.disable_denylist=1).

$ ./list_supported_devices.sh -q
0000:00:04.0
...
0000:3b:00.0
$ ./list_supported_devices.sh -q -a
0000:00:04.0
...
0000:3b:00.0
0000:6a:01.0
...

---
Changelog

v8 -> v9, all changes suggested by David Matlack:
- Match NVIDIA GPUs by vendor 0x10de and PCI display class 0x03, group them under "Possibly supported (depends on GPU architecture):" with a note listing valid GPU architectures and warning that MSI tests skip, and include them in -q output.
- Print the selftest driver path lib/drivers/<driver>/<driver>.c at the end of each device line.
- Use is_*() naming consistently for condition-checking functions.
- Add a blank line between output sections.

v8: https://lore.kernel.org/kvm/[email protected]/
v7: https://lore.kernel.org/kvm/[email protected]/
v6: https://lore.kernel.org/kvm/[email protected]/
v5: https://lore.kernel.org/kvm/[email protected]/

 tools/testing/selftests/vfio/Makefile         |   1 +
 .../vfio/scripts/list_supported_devices.sh    | 251 ++++++++++++++++++
 2 files changed, 252 insertions(+)
 create mode 100755 tools/testing/selftests/vfio/scripts/list_supported_devices.sh
tools/testing/selftests/vfio/Makefile +1 -0
index 2c32c48db509..160aa989828f 100644
@@ -16,6 +16,7 @@ TEST_GEN_PROGS += vfio_pci_sriov_uapi_test
 
 TEST_FILES += scripts/cleanup.sh
 TEST_FILES += scripts/lib.sh
+TEST_FILES += scripts/list_supported_devices.sh
 TEST_FILES += scripts/run.sh
 TEST_FILES += scripts/setup.sh
 
tools/testing/selftests/vfio/scripts/list_supported_devices.sh new file +251 -0

251 lines not on this page · raw message

Signature · 1 line
2.56.1.750.gf70dc682cf-goog
reviewer Tested-by on v9 1/1
#1 lore raw
Quoted 5 lines · Josh Hilke

Add list_supported_devices.sh to print the PCI addresses, names, and selftest driver paths of devices on the host that have a VFIO selftest driver. Group the output into sections based on whether vfio-pci is loaded, whether the vfio-pci denylist blocks the device, and whether a GPU requires an architecture check at probe time.

...

Quoted 2 lines

Output LGTM, but I'm most definitely not going to try and understand the bash magic :-)

Thanks for enduring, much appreciated!