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:		55d3ea1731 ("Add support for PCIe ARI")
Sponsored by:	AMD
Differential Revision:	https://reviews.freebsd.org/D60033
This commit is contained in:
Osvaldo Janeri Filho authored and John Baldwin committed 2026-09-30 11:04:08 -04:00
1 parent 0be29268ae
commit 10409ee40b
1 file changed
+2 -1
+2 -1
View File
@@ -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);