Index: sys/arm64/arm64/gic_v3_its.c =================================================================== --- sys/arm64/arm64/gic_v3_its.c +++ sys/arm64/arm64/gic_v3_its.c @@ -61,6 +61,7 @@ #define GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET 88 +#include "pcib_if.h" #include "pic_if.h" /* Device and PIC methods */ @@ -1574,14 +1575,34 @@ static uint32_t its_get_devid_thunder(device_t pci_dev) { + devclass_t pci_class; + device_t pci_parent; + boolean_t ari_enabled; + uint32_t bus; int bsf; int pem; - uint32_t bus; + + /* Check if ARI enabled on this bus */ + pci_class = devclass_find("pci"); + pci_parent = device_get_parent(pci_dev); + KASSERT(device_get_devclass(pci_parent) == pci_class, + ("%s: non-pci device requested LPI", __func__)); + ari_enabled = PCIB_ARI_ENABLED(device_get_parent(pci_parent)); bus = pci_get_bus(pci_dev); - bsf = PCI_RID(pci_get_bus(pci_dev), pci_get_slot(pci_dev), - pci_get_function(pci_dev)); + if (ari_enabled) { + /* + * For ARI enabled device/slot is ignored + * and function/identifier is extended to 8 bits + */ + bsf = + ((pci_get_bus(pci_dev) & PCI_BUSMAX) << PCI_RID_BUS_SHIFT) | + ((pci_get_function(pci_dev) & PCIE_ARI_FUNCMAX) << PCI_RID_FUNC_SHIFT); + } else { + bsf = PCI_RID(pci_get_bus(pci_dev), pci_get_slot(pci_dev), + pci_get_function(pci_dev)); + } /* Check if accessing internal PCIe (low bus numbers) */ if (bus < GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET) {