selftests/vfio: igb: 82576 hardware compatibility
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest8 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | selftests/vfio: igb: Use PHY internal loopback on 82576tools/ tools/ | +89 | 0 replies | |
| 2/8 | selftests/vfio: igb: Use advanced TX and RX descriptorstools/ tools/ | +47 | 0 replies | |
| 3/8 | selftests/vfio: igb: Program MSI-X interrupt routingtools/ tools/ | +41 | 0 replies | |
| 4/8 | selftests/vfio: igb: Extend memcpy completion timeout for line-rate hardwaretools/ | +13 | 0 replies | |
| 5/8 | selftests/vfio: igb: Disable PCIe completion timeout retriestools/ tools/ | +14 | 0 replies | |
| 6/8 | selftests/vfio: Add vfio_pci_irq_reenable() helpertools/ tools/ | +24 | 0 replies | |
| 7/8 | selftests/vfio: igb: Factor hardware programming into igb_hw_init()tools/ | +34 | 0 replies | |
| 8/8 | selftests/vfio: igb: Recover after DMA-read faultstools/ | +40 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/8] selftests/vfio: igb: 82576 hardware compatibility
This series is based on Josh Hilke's initial igb selftest driver posted as:
https://lore.kernel.org/all/[email protected]/
That posting validated the driver against QEMU's emulated igb only; it has not been tested on physical 82576 hardware. Real 82576 silicon rejects several of the shortcuts the submitted driver relies on (MAC loopback, legacy TX descriptors, read-to-clear EICR, autoneg-based link bring-up, and an unbounded fault-recovery story), and adding real-hardware coverage is the goal here.
Two of the patches add accommodations specifically for QEMU's emulated igb (which does not implement PHY-register-0 bit 14 and does not drive STATUS.LU from CTRL.SLU) so that Josh's "run selftests without hardware" workflow continues to work. One of these (RCTL.LBM_MAC) deviates from datasheet 8.10.1 guidance; empirically the bit has no observable effect on real 82576 because MAC loopback is not implemented (3.5.6.2). See patch 1 for both rationales.
1) selftests/vfio: igb: Use PHY internal loopback on 82576
Replace MAC-loopback-via-RCTL.LBM_MAC and PHY autonegotiation with PHY internal loopback per datasheet 3.5.6.3.1. Force the MAC link state via CTRL.FRCSPD/FRCDPX/SLU since the descriptor engine otherwise waits for a real negotiated link. Keep RCTL.LBM_MAC (deviates from 8.10.1 guidance but empirically inert on real hardware per 3.5.6.2) and prefix the loopback setup with a one-shot autoneg-restart PHY write (the next PHY write clears autoneg-enable before autoneg can start, so this is a no-op on real silicon); both are required by QEMU's emulation. Drop the dead igb_read_phy() and its now-unused macros.
2) selftests/vfio: igb: Use advanced TX and RX descriptors
Program SRRCTL.DESCTYPE for advanced one-buffer receive descriptors (datasheet 7.1.5.2, 8.10.2) and build advanced TX data descriptors with DEXT/DTYP/IFCS/EOP/PAYLEN (7.2.2.3) rather than the simplified legacy format the submitted driver used. Drop the unused legacy TX descriptor macros.
3) selftests/vfio: igb: Program MSI-X interrupt routing
Configure GPIE.Multiple_MSIX and GPIE.EIAME (Table 7-47), EIAC and EIAM for vector 0 (8.8.5, 8.8.6), and switch EICR clearing from read-to-clear to write-to-clear (7.3.4.2 / 8.8.5 forbid reading EICR while EIAC is programmed).
4) selftests/vfio: igb: Extend memcpy completion timeout for line-rate hardware
The submitted 1 ms cap is well below the 32 ms line-rate floor for a 4 MB transfer at 1 Gb/s. Bump to ~200 ms (6x margin).
5) selftests/vfio: igb: Disable PCIe completion timeout retries
Clear GCR.Completion_Timeout_Resend (datasheet 8.6.1) so the intentional unmapped-IOVA tests do not generate an unbounded stream of retried reads on real hardware.
6) selftests/vfio: Add vfio_pci_irq_reenable() helper
New libvfio helper that re-issues VFIO_DEVICE_SET_IRQS against existing eventfds, for drivers that recover from VFIO_DEVICE_RESET without disturbing user-side eventfds (and any fd a test fixture may have cached).
7) selftests/vfio: igb: Factor hardware programming into igb_hw_init()
Pure refactor splitting igb_init() into a one-shot outer (region-size check, BAR map, CTRL.RST, IMC, vfio_pci_msix_enable) and a reusable inner that programs the registers CTRL.RST clears.
8) selftests/vfio: igb: Recover after DMA-read faults
Add igb_error_reset_and_reinit() and call it from igb_memcpy_wait() on completion timeout. Datasheet 4.2.1.6.1 describes CTRL.RST as the recovery mechanism, but empirically CTRL.RST alone leaves the descriptor engine wedged after a DMA-read fault; the 82576 advertises PCIe FLR (datasheet 4.2.1.5.1) and VFIO_DEVICE_RESET drives it.
Testing:
- Selftest builds clean at every commit (verified bisect-buildable).
- QEMU emulated igb via vng on a host kernel built with VFIO and Intel IOMMU enabled: vfio_pci_driver_test 35/35 pass across all four IOMMU mode permutations.
- Physical 82576 on Intel Alderlake platform: vfio_pci_driver_test 35/35 pass across all four IOMMU mode permutations.
Assisted:
- Series developed primarily with Claude Opus 4.7 with additional assistance from GPT 5.5. Spec references spot checked and cross checked against multiple models.
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
.../selftests/vfio/lib/drivers/igb/igb.c | 318 +++++++++++++----- .../vfio/lib/drivers/igb/registers.h | 58 +++- .../lib/include/libvfio/vfio_pci_device.h | 2 + .../selftests/vfio/lib/vfio_pci_device.c | 22 ++ 4 files changed, 302 insertions(+), 98 deletions(-)
Signature · 1 line
2.51.0