git: 621498b58cda - main - pci_iov: Clear NumVFs when configuration fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 30 Jul 2026 01:09:59 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=621498b58cdab36a237d5f0b5c902952ad743fa9
commit 621498b58cdab36a237d5f0b5c902952ad743fa9
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-07-28 23:30:28 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-07-30 00:43:03 +0000
pci_iov: Clear NumVFs when configuration fails
pci_iov_config() programs NumVFs before validating the final VF RID
layout and allocating all generic resources. A subsequent error ran the
driver uninit callback but left the hardware NumVFs register programmed
while the software VF count returned to zero.
Clear NumVFs in the error path after the driver uninit callback,
matching normal SR-IOV teardown ordering. This prevents stale hardware
state after a failed configuration and permits a clean retry.
MFC after: 1 week
Sponsored by: BBOX.io
---
sys/dev/pci/pci_iov.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/dev/pci/pci_iov.c b/sys/dev/pci/pci_iov.c
index 932d83536b7f..643f0e59b9b8 100644
--- a/sys/dev/pci/pci_iov.c
+++ b/sys/dev/pci/pci_iov.c
@@ -807,8 +807,10 @@ pci_iov_config(struct cdev *cdev, struct pci_iov_arg *arg)
return (0);
out:
- if (iov_inited)
+ if (iov_inited) {
PCI_IOV_UNINIT(dev);
+ IOV_WRITE(dinfo, PCIR_SRIOV_NUM_VFS, 0, 2);
+ }
for (i = 0; i <= PCIR_MAX_BAR_0; i++) {
if (iov->iov_bar[i].res != NULL) {