From: Alex Williamson <alex.williamson@nvidia.com>
To: jrhilke@google.com
Cc: Alex Williamson <alex.williamson@nvidia.com>,
Alex Williamson <alex@shazbot.org>, kvm <kvm@vger.kernel.org>,
David Matlack <dmatlack@google.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Jason Gunthorpe <jgg@nvidia.com>
Subject: [PATCH 0/8] selftests/vfio: igb: 82576 hardware compatibility
Date: Fri, 15 May 2026 16:03:07 -0600 [thread overview]
Message-ID: <20260515220330.565792-1-alex.williamson@nvidia.com> (raw)
This series is based on Josh Hilke's initial igb selftest driver
posted as:
https://lore.kernel.org/all/20260511211839.2781731-1-jrhilke@google.com/
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(-)
--
2.51.0
next reply other threads:[~2026-05-15 22:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 22:03 Alex Williamson [this message]
2026-05-15 22:03 ` [PATCH 1/8] selftests/vfio: igb: Use PHY internal loopback on 82576 Alex Williamson
2026-05-15 22:03 ` [PATCH 2/8] selftests/vfio: igb: Use advanced TX and RX descriptors Alex Williamson
2026-05-15 22:03 ` [PATCH 3/8] selftests/vfio: igb: Program MSI-X interrupt routing Alex Williamson
2026-05-15 22:03 ` [PATCH 4/8] selftests/vfio: igb: Extend memcpy completion timeout for line-rate hardware Alex Williamson
2026-05-15 22:03 ` [PATCH 5/8] selftests/vfio: igb: Disable PCIe completion timeout retries Alex Williamson
2026-05-15 22:03 ` [PATCH 6/8] selftests/vfio: Add vfio_pci_irq_reenable() helper Alex Williamson
2026-05-15 22:03 ` [PATCH 7/8] selftests/vfio: igb: Factor hardware programming into igb_hw_init() Alex Williamson
2026-05-15 22:03 ` [PATCH 8/8] selftests/vfio: igb: Recover after DMA-read faults Alex Williamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260515220330.565792-1-alex.williamson@nvidia.com \
--to=alex.williamson@nvidia.com \
--cc=alex@shazbot.org \
--cc=dmatlack@google.com \
--cc=jgg@nvidia.com \
--cc=jrhilke@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.