aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2026-07-28 23:29:35 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2026-07-30 00:40:05 +0000
commite795a31cb4d66368bdbe5ac7f61c0899d3ed39f8 (patch)
tree97a39d4aee08b7a537f5c5fdec8a82c2cb52ae6c
parentfd594981c55b3a4e316e72265065566a54d40d38 (diff)
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
-rw-r--r--sys/dev/pci/pci_iov.c21
1 files 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);