vfio: selftests: Support DMR and GNR-D DSA devices
Subsystems (4)
PATCH v2 1/1 vfio: selftests: Support DMR and GNR-D DSA devices
Currently, the VFIO DSA driver test only supports the SPR DSA device ID. Attempting to run the test on newer platforms like DMR or GNR-D results in a "No driver found" error, causing the test to be skipped.
Refactor dsa_probe() to use a switch statement for checking device IDs. This improves maintainability and makes it easier to add new device IDs in the future.
Add the following DSA device IDs to the supported list:PCI_DEVICE_ID_INTEL_DSA_DMR (0x1212) PCI_DEVICE_ID_INTEL_DSA_GNRD (0x11fb)
--- .../testing/selftests/vfio/lib/drivers/dsa/dsa.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c +13 -2
@@ -65,9 +65,20 @@ static bool dsa_int_handle_request_required(struct vfio_pci_device *device)static int dsa_probe (struct vfio_pci_device *device) { -if (!vfio_pci_device_match (device,PCI_VENDOR_ID_INTEL , -PCI_DEVICE_ID_INTEL_DSA_SPR0 )) +const u16 vendor_id =vfio_pci_config_readw (device,PCI_VENDOR_ID ); +const u16 device_id =vfio_pci_config_readw (device,PCI_DEVICE_ID ); + +if (vendor_id !=PCI_VENDOR_ID_INTEL ) +return -EINVAL ; + +switch (device_id) { +case PCI_DEVICE_ID_INTEL_DSA_SPR0 : +case PCI_DEVICE_ID_INTEL_DSA_DMR : +case PCI_DEVICE_ID_INTEL_DSA_GNRD : +break ; +default :return -EINVAL ; + }if (dsa_int_handle_request_required (device)) {dev_err (device,"Device requires requesting interrupt handles\n" );
Signature · 1 line
2.43.0
Quoted 9 lines · Yi Lai
Currently, the VFIO DSA driver test only supports the SPR DSA device ID. Attempting to run the test on newer platforms like DMR or GNR-D results in a "No driver found" error, causing the test to be skipped.
Refactor
dsa_probe()to use a switch statement for checking device IDs. This improves maintainability and makes it easier to add new device IDs in the future.
Quoted 5 lines
Add the following DSA device IDs to the supported list:
PCI_DEVICE_ID_INTEL_DSA_DMR(0x1212)PCI_DEVICE_ID_INTEL_DSA_GNRD(0x11fb)Signed-off-by Yi Lai <[email protected]>
Quoted 34 lines · On Fri, 20 Mar 2026 09:09:29 +0800 Yi Lai <[email protected]> wrote:
Currently, the VFIO DSA driver test only supports the SPR DSA device ID. Attempting to run the test on newer platforms like DMR or GNR-D results in a "No driver found" error, causing the test to be skipped.
Refactor
dsa_probe()to use a switch statement for checking device IDs. This improves maintainability and makes it easier to add new device IDs in the future.Add the following DSA device IDs to the supported list:
PCI_DEVICE_ID_INTEL_DSA_DMR(0x1212)PCI_DEVICE_ID_INTEL_DSA_GNRD(0x11fb)Signed-off-by Yi Lai <[email protected]>--- .../testing/selftests/vfio/lib/drivers/dsa/dsa.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c +7
-2@@ -65,9 +65,20 @@ static bool dsa_int_handle_request_required(struct vfio_pci_device *device)static int dsa_probe (struct vfio_pci_device *device) { -if (!vfio_pci_device_match (device,PCI_VENDOR_ID_INTEL , -PCI_DEVICE_ID_INTEL_DSA_SPR0 )) +const u16 vendor_id =vfio_pci_config_readw (device,PCI_VENDOR_ID ); +const u16 device_id =vfio_pci_config_readw (device,PCI_DEVICE_ID ); + +if (vendor_id !=PCI_VENDOR_ID_INTEL ) +return -EINVAL ; + +switch (device_id) {
tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c static bool dsa_int_handle_request_required(struct vfio_pci_device *device) · line 84
Quoted 10 lines
tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c +6
-0+case PCI_DEVICE_ID_INTEL_DSA_SPR0 : +case PCI_DEVICE_ID_INTEL_DSA_DMR : +case PCI_DEVICE_ID_INTEL_DSA_GNRD : +break ; +default :return -EINVAL ; + }if (dsa_int_handle_request_required (device)) {dev_err (device,"Device requires requesting interrupt handles\n" );
Applied to vfio next branch for v7.1. Thanks,
Alex