vfio: selftests: igb: Add driver for Intel 82576 deviceAdd a VFIO selftest driver for the Intel Gigabit Ethernet controller(IGB), specifically targeting the 82576 device. IGB is fully virtualized
vfio: selftests: igb: Add driver for Intel 82576 deviceAdd a VFIO selftest driver for the Intel Gigabit Ethernet controller(IGB), specifically targeting the 82576 device. IGB is fully virtualizedin QEMU which makes it easy to run VFIO selftests without needing anyspecific hardware.Since IGB is an Ethernet device, it cannot support DMA transfers smallerthan the minimum Ethernet payload size (60 bytes) without hardware paddingcorrupting adjacent memory. The driver asserts that the transfer size isat least 60 bytes to prevent this.All VFIO selftest drivers must implement DMA/memcpy operations, but IGBdoesn't have a native memcpy feature, so the loopback feature (describedin section 3.5.6.3 of IGB specification) is used to implement it. Tosupport testing on both QEMU and physical hardware, the driver uses PHYinternal loopback with some QEMU-specific fallbacks. The driver alsosupports MSI-X routing and interrupt management, and disables PCIecompletion timeout retries to ensure clean recovery during invalid-DMAtests.Users can verify the driver works in QEMU by building the kernel,building VFIO selftests, and then running the vfio_pci_driver_test usingthis 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-7Assisted-by: Gemini:gemini-3.1-pro-previewCo-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.comSigned-off-by: Alex Williamson <alex@shazbot.org>
show more ...