From 8bf5b184009a94df43498af285b65ff176477e63 Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Wed, 20 Apr 2022 11:27:57 +0800 Subject: [PATCH] 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 --- misc/config_tools/board_inspector/board_inspector.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/misc/config_tools/board_inspector/board_inspector.py b/misc/config_tools/board_inspector/board_inspector.py index 1757de2f8..666ff349a 100755 --- a/misc/config_tools/board_inspector/board_inspector.py +++ b/misc/config_tools/board_inspector/board_inspector.py @@ -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()