From 10409ee40baf593b810cd0140f3c2f0d737c1a65 Mon Sep 17 00:00:00 2001 From: Osvaldo Janeri Filho Date: Wed, 30 Sep 2026 11:04:08 -0400 Subject: [PATCH] pcib: Only apply ARI translation to a bridge's own secondary bus ARI changes RID interpretation only for the device on a downstream port's secondary bus. pcib_xlate_ari() applied that translation to every config access through an ARI-enabled bridge, including cycles forwarded to a subordinate bus. A non-zero slot on a subordinate bus then panics an INVARIANTS kernel and is misrouted otherwise. Translate only when the access targets this bridge's secondary bus. Reviewed by: kib, jhb Fixes: 55d3ea1731d1 ("Add support for PCIe ARI") Sponsored by: AMD Differential Revision: https://reviews.freebsd.org/D60033 --- sys/dev/pci/pci_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 5cdb1de71c3f..aa04bfa054c1 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -2346,7 +2346,8 @@ pcib_xlate_ari(device_t pcib, int bus, int *slot, int *func) sc = device_get_softc(pcib); ari_func = *func; - if (sc->flags & PCIB_ENABLE_ARI) { + /* ARI applies only to this port's secondary bus. */ + if ((sc->flags & PCIB_ENABLE_ARI) && bus == sc->bus.sec) { KASSERT(*slot == 0, ("Non-zero slot number with ARI enabled!")); *slot = PCIE_ARI_SLOT(ari_func);