This is v2 of a series which adds VFIO selftest driver for the Intel 82576 Ethernet Gigabit Controller (IGB). This device is emulated in QEMU and is also ubiquitous on many systems which makes it a good candidate device for running VFIO selftests.
v1: https://lore.kernel.org/kvm/[email protected]/ Major changes in v2 =================== 1. Patches 2 through 9 add Alex Williamson's series which adds support for the physical device since v1 only supported the QEMU-emulated device. https://lore.kernel.org/kvm/[email protected]/ 2. Patch 10 adds the official IGB header files to the driver, which eliminates duplicate register definitions. Testing ======= - VFIO selftests builds clean at every commit - vfio_pci_driver_test passes using IGB driver + QEMU. Use the following VNG command to run the tests: 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" Future work =========== Modify QEMU's implementation of IGB loopback data transfer to be asynchronous. Alex noted that QEMU's emulation of transmitting data in loopback mode is synchronous, i.e by the time memcpy_start() returns, the data is already in the Rx queue. This won't work for testing continuous DMA (memcpy) across Live Update + kexec. One solution is to simulate the line rate in QEMU. This would allow us to slow down the rate of DMA, so that it continues for the duration of Live Update. Assistance ========== - Claude Opus 4.7 with additional assistance from GPT 5.5 for Alex's patches - Gemini 3.1 Pro Preview for my patches -------- Changelog: v1 -> v2 - Removed the chunking loop in igb_memcpy_start() (David) - Removed redundant writes to status_error and hdr_addr (David) - Include official IGB header files (David) Alex Williamson (8): selftests/vfio: igb: Use PHY internal loopback on 82576 selftests/vfio: igb: Use advanced TX and RX descriptors selftests/vfio: igb: Program MSI-X interrupt routing selftests/vfio: igb: Extend memcpy completion timeout for line-rate hardware selftests/vfio: igb: Disable PCIe completion timeout retries selftests/vfio: Add vfio_pci_irq_reenable() helper selftests/vfio: igb: Factor hardware programming into igb_hw_init() selftests/vfio: igb: Recover after DMA-read faults Josh Hilke (2): selftests/vfio: igb: Add driver for IGB QEMU device selftests/vfio: igb: Use offical IGB headers in selftest driver .../selftests/vfio/lib/drivers/igb/igb.c | 524 ++++++++++++++++++ .../lib/include/libvfio/vfio_pci_device.h | 2 + tools/testing/selftests/vfio/lib/libvfio.mk | 2 + .../selftests/vfio/lib/vfio_pci_device.c | 22 + .../selftests/vfio/lib/vfio_pci_driver.c | 2 + 5 files changed, 552 insertions(+) create mode 100644 tools/testing/selftests/vfio/lib/drivers/igb/igb.c -- 2.54.0.794.g4f17f83d09-goog

