Re: [PATCH v2 1/1] vfio: selftests: Find devices that have VFIO selftest drivers

From: Sean Christopherson

Date: Fri May 08 2026 - 14:17:25 EST


On Tue, Apr 14, 2026, Josh Hilke wrote:
> +# Print the segment:bus:device.function numbers of PCI devices that can be used
> +# to run VFIO selftests.
> +function main() {
> + local vendor_device_id
> +
> + for vendor_device_id in "${DEVICES[@]}"; do
> + lspci -D -d "${vendor_device_id}" | awk '{print $1}'

For ignorant people like me, it would be helpful to capture what device was actually
found. I mean, I don't necessarily know exactly what these devices do, but as the
list grows, at least having a general sense of what device I'm going to be feeding
into VFIO would be helpful.

E.g. something like this (ignore my terrible script skills)?

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later

# List of devices which have a VFIO selftest driver
DEVICES=(
"8086:0b25","Intel SPR DSA"
"8086:11fb","Intel GNR-D DSA"
"8086:1212","Intel DR DSA"
"8086:0cf8","Intel CBDMA"
)

# Print the segment:bus:device.function numbers of PCI devices that can be used
# to run VFIO selftests.
function main() {
local found
local i

OLDIFS=$IFS
IFS=','

for i in "${DEVICES[@]}"; do
set -- $i
found=$(lspci -D -d "$1" | cut -f 1 -d ' ')
if [[ -n $found ]]; then
echo "$2 ($1) Device IDs:"
echo $found
fi
done

IFS=$OLDIFS
}

main


# ./devices.sh
Intel SPR DSA (8086:0b25) Device IDs:
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


> + done
> +}
> +
> +main "$@"

Why pass along args? The script doesn't actually recognize any arguments.

> --
> 2.54.0.rc0.605.g598a273b03-goog
>