board_inspector: check the number of PCI domains

Today ACRN works only on platforms with a single PCI domain (which is true
for most client and IoT platforms). This limitation is also used to
simplify the implementation of the board inspector. As a result, on
platforms with multiple PCI domains, the board inspector may crash when
parsing information about PCI devices.

This patch adds a check on the number of PCI domains before the board
inspector attempts to extract any information, and terminates the tool
early if multiple PCI domains are detected.

Tracked-On: #6689
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2022-04-20 11:27:57 +08:00 committed by acrnsi-robot
parent 53efa3851e
commit 8bf5b18400
1 changed files with 10 additions and 0 deletions

View File

@ -80,6 +80,13 @@ def native_check():
logging.error("Board inspector is running inside an unsupported Virtual Machine (VM). " \
"Only KVM or QEMU is supported. Unexpected results may occur.")
def check_pci_domains():
root_buses = filter(lambda x: x.startswith("pci"), os.listdir("/sys/devices"))
domain_ids = set(map(lambda x: x.split(":")[0].replace("pci", ""), root_buses))
if len(domain_ids) > 1:
logging.fatal(f"ACRN does not support platforms with multiple PCI domains {domain_ids}. Check if the BIOS has any configuration that consolidates those domains into one.")
sys.exit(1)
def bring_up_cores():
cpu_ids = get_offline_cpu_ids()
for id in cpu_ids:
@ -96,6 +103,9 @@ def main(board_name, board_xml, args):
# Check if this is native os
native_check()
# Check if there exists multiple PCI domains (which is not supported)
check_pci_domains()
# Bring up all cores
bring_up_cores()