The branch main has been updated by kbowling:

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

commit e795a31cb4d66368bdbe5ac7f61c0899d3ed39f8
Author:     Kevin Bowling <[email protected]>
AuthorDate: 2026-07-28 23:29:35 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-07-30 00:40:05 +0000

    pci_iov: Permit non-ARI VFs on a secondary bus
    
    A non-zero VF device number does not always require ARI. The Intel
    82576 and I350 [1] explicitly support a non-ARI layout that places VFs
    on the next bus.
    
    Check every requested VF RID and reject a non-zero device only when it
    is on the PF bus. This retains the ARI guard for invalid same-bus
    layouts while permitting the documented second-bus layout.
    
    [1] Intel I350 Datasheet, sections 7.8.2.6.1.2, 9.6.4.6
    
    Sponsored by:   BBOX.io
---
 sys/dev/pci/pci_iov.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/sys/dev/pci/pci_iov.c b/sys/dev/pci/pci_iov.c
index 0e6104fe37f2..932d83536b7f 100644
--- a/sys/dev/pci/pci_iov.c
+++ b/sys/dev/pci/pci_iov.c
@@ -759,9 +759,24 @@ pci_iov_config(struct cdev *cdev, struct pci_iov_arg *arg)
                }
        }
 
-       if (!ari_enabled && PCI_RID2SLOT(last_rid) != 0) {
-               error = ENOSPC;
-               goto out;
+       if (!ari_enabled) {
+               uint16_t vf_rid;
+
+               /*
+                * Without ARI, VFs on the PF's bus must use device 0.
+                * VFs on another bus use the conventional device/function
+                * encoding and may have a non-zero device number.  For
+                * example, Intel 82576 and I350 VFs start at device 16 on
+                * the next bus when ARI is unavailable.
+                */
+               vf_rid = first_rid;
+               for (i = 0; i < num_vfs; i++, vf_rid += rid_stride) {
+                       if (PCI_RID2BUS(vf_rid) == pci_get_bus(dev) &&
+                           PCI_RID2SLOT(vf_rid) != 0) {
+                               error = ENOSPC;
+                               goto out;
+                       }
+               }
        }
 
        iov_ctl = IOV_READ(dinfo, PCIR_SRIOV_CTL, 2);

Reply via email to