git: 44fd85b1a55a - stable/14 - pci: Skip PF SR-IOV state handling for VFs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 21 Aug 2026 00:44:52 UTC
The branch stable/14 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=44fd85b1a55ad95fdc9c2ddf173151dcd8fb2d6c
commit 44fd85b1a55ad95fdc9c2ddf173151dcd8fb2d6c
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-07 13:30:06 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-21 00:43:03 +0000
pci: Skip PF SR-IOV state handling for VFs
A VF's pci_devinfo references its PF's pcicfg_iov for resource
bookkeeping, but only the PF implements the SR-IOV capability.
pci_cfg_save() and pci_cfg_restore() treated any non-NULL cfg.iov as
an owned capability and accessed the PF capability offset in VF
configuration space. Saving a VF could therefore replace the shared
PF settings with unrelated VF register values.
Skip SR-IOV capability save and restore for PCICFG_VF children. The
generic PCI and PCIe state of the VF remains preserved. This is also
required by drivers that save VF state around a PF-driven
function-level reset.
(cherry picked from commit 78547d542f776d366c36b5a2fc747ddfe99523c6)
---
sys/dev/pci/pci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index b56a6052e855..714e0498294f 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -6693,7 +6693,9 @@ pci_cfg_restore(device_t dev, struct pci_devinfo *dinfo)
pci_resume_msix(dev);
#ifdef PCI_IOV
- if (dinfo->cfg.iov != NULL)
+ /* The SR-IOV capability is implemented only by PFs. */
+ if (dinfo->cfg.iov != NULL &&
+ (dinfo->cfg.flags & PCICFG_VF) == 0)
pci_iov_cfg_restore(dev, dinfo);
#endif
}
@@ -6809,7 +6811,9 @@ pci_cfg_save(device_t dev, struct pci_devinfo *dinfo, int setstate)
pci_cfg_save_pcix(dev, dinfo);
#ifdef PCI_IOV
- if (dinfo->cfg.iov != NULL)
+ /* The SR-IOV capability is implemented only by PFs. */
+ if (dinfo->cfg.iov != NULL &&
+ (dinfo->cfg.flags & PCICFG_VF) == 0)
pci_iov_cfg_save(dev, dinfo);
#endif