Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 Aug 2026 07:40:58 +0000
From:      Kevin Bowling <kbowling@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 799f8ebd69fd - stable/14 - pci_iov: Clear NumVFs when configuration fails
Message-ID:  <6a743a8a.369db.a0fe207@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=799f8ebd69fd0af7c38cf3729eaab50a54821529

commit 799f8ebd69fd0af7c38cf3729eaab50a54821529
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-07-28 23:30:28 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-06 07:39:10 +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.
    
    Sponsored by:   BBOX.io
    
    (cherry picked from commit 621498b58cdab36a237d5f0b5c902952ad743fa9)
---
 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 920d13e99ea0..ecae70ca0d4a 100644
--- a/sys/dev/pci/pci_iov.c
+++ b/sys/dev/pci/pci_iov.c
@@ -781,8 +781,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) {


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a743a8a.369db.a0fe207>