summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/vfio/lib/drivers/igb
AgeCommit message (Collapse)Author
2026-08-10vfio: selftests: igb: Add driver for Intel 82576 deviceJosh Hilke
Add a VFIO selftest driver for the Intel Gigabit Ethernet controller (IGB), specifically targeting the 82576 device. IGB is fully virtualized in QEMU which makes it easy to run VFIO selftests without needing any specific hardware. Since IGB is an Ethernet device, it cannot support DMA transfers smaller than the minimum Ethernet payload size (60 bytes) without hardware padding corrupting adjacent memory. The driver asserts that the transfer size is at least 60 bytes to prevent this. All VFIO selftest drivers must implement DMA/memcpy operations, but IGB doesn't have a native memcpy feature, so the loopback feature (described in section 3.5.6.3 of IGB specification) is used to implement it. To support testing on both QEMU and physical hardware, the driver uses PHY internal loopback with some QEMU-specific fallbacks. The driver also supports MSI-X routing and interrupt management, and disables PCIe completion timeout retries to ensure clean recovery during invalid-DMA tests. Users can verify the driver works in QEMU by building the kernel, building VFIO selftests, and then running the vfio_pci_driver_test using this command: vng \ --run arch/x86/boot/bzImage \ --user root \ --disable-microvm \ --memory 32G \ --cpus 8 \ --qemu-opts="-M q35,accel=kvm,kernel-irqchip=split" \ --qemu-opts="-device intel-iommu,intremap=on,caching-mode=on,device-iotlb=on" \ --qemu-opts="-netdev user,id=net0 -device igb,netdev=net0,addr=09.0" \ --append "console=ttyS0 earlyprintk=ttyS0 intel_iommu=on iommu=pt" \ --exec "modprobe vfio-pci && \ ./tools/testing/selftests/vfio/scripts/setup.sh 0000:00:09.0 && \ ./tools/testing/selftests/vfio/scripts/run.sh ./tools/testing/selftests/vfio/vfio_pci_driver_test" Assisted-by: Claude:claude-opus-4-7 Assisted-by: Gemini:gemini-3.1-pro-preview Co-developed-by: Alex Williamson <alex.williamson@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@nvidia.com> Signed-off-by: Josh Hilke <jrhilke@google.com> Acked-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260805-igb_v3_b4-v10-2-9c86dc849c0d@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>