Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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)

Signed-off-by: Yi Lai <yi1.lai@intel.com>
Reviewed-by: David Matlack <dmatlack@google.com>
Link: https://lore.kernel.org/r/20260320010930.481380-1-yi1.lai@intel.com
Signed-off-by: Alex Williamson <alex@shazbot.org>

authored by

Yi Lai and committed by
Alex Williamson
c82cfe15 1347a742

+13 -2
+13 -2
tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c
··· 65 65 66 66 static int dsa_probe(struct vfio_pci_device *device) 67 67 { 68 - if (!vfio_pci_device_match(device, PCI_VENDOR_ID_INTEL, 69 - PCI_DEVICE_ID_INTEL_DSA_SPR0)) 68 + const u16 vendor_id = vfio_pci_config_readw(device, PCI_VENDOR_ID); 69 + const u16 device_id = vfio_pci_config_readw(device, PCI_DEVICE_ID); 70 + 71 + if (vendor_id != PCI_VENDOR_ID_INTEL) 70 72 return -EINVAL; 73 + 74 + switch (device_id) { 75 + case PCI_DEVICE_ID_INTEL_DSA_SPR0: 76 + case PCI_DEVICE_ID_INTEL_DSA_DMR: 77 + case PCI_DEVICE_ID_INTEL_DSA_GNRD: 78 + break; 79 + default: 80 + return -EINVAL; 81 + } 71 82 72 83 if (dsa_int_handle_request_required(device)) { 73 84 dev_err(device, "Device requires requesting interrupt handles\n");