diff --git a/misc/config_tools/hv_config/board_defconfig.py b/misc/config_tools/hv_config/board_defconfig.py index 6b73bcd22..b22e123ca 100644 --- a/misc/config_tools/hv_config/board_defconfig.py +++ b/misc/config_tools/hv_config/board_defconfig.py @@ -132,12 +132,6 @@ def get_serial_console(config): if serial_value: print('CONFIG_SERIAL_MMIO_BASE={}'.format(serial_value), file=config) - -def get_miscfg(hv_info, config): - - print("CONFIG_GPU_SBDF={}".format(hv_info.mis.gpu_sbdf), file=config) - - def get_features(hv_info, config): print("CONFIG_{}=y".format(hv_info.features.scheduler), file=config) @@ -199,7 +193,6 @@ def generate_file(hv_info, config): print('CONFIG_BOARD="{}"'.format(board_name), file=config) get_memory(hv_info, config) - get_miscfg(hv_info, config) get_features(hv_info, config) get_capacities(hv_info, config) get_serial_console(config) diff --git a/misc/config_tools/hv_config/hv_item.py b/misc/config_tools/hv_config/hv_item.py index 9c48498d1..60f43ea8f 100644 --- a/misc/config_tools/hv_config/hv_item.py +++ b/misc/config_tools/hv_config/hv_item.py @@ -77,20 +77,6 @@ class CapHv: hv_cfg_lib.hv_range_check(self.max_pci_dev_num, "CAPACITIES", "MAX_PCI_DEV_NUM", hv_cfg_lib.RANGE_DB['PCI_DEV_NUM']) hv_cfg_lib.max_msix_table_num_check(self.max_msix_table_num, "CAPACITIES", "MAX_MSIX_TABLE_NUM") - -class MisCfg: - - def __init__(self, hv_file): - self.hv_file = hv_file - self.gpu_sbdf = 0 - - def get_info(self): - self.gpu_sbdf = common.get_hv_item_tag(self.hv_file, "MISC_CFG", "GPU_SBDF") - - def check_item(self): - hv_cfg_lib.hv_size_check(self.gpu_sbdf, "MISC_CFG", "GPU_SBDF") - - class Features: def __init__(self, hv_file): self.hv_file = hv_file @@ -173,19 +159,16 @@ class HvInfo: self.mem = Memory(self.hv_file) self.cap = CapHv(self.hv_file) self.log = LogOpt(self.hv_file) - self.mis = MisCfg(self.hv_file) self.features = Features(self.hv_file) def get_info(self): self.mem.get_info() self.log.get_info() self.cap.get_info() - self.mis.get_info() self.features.get_info() def check_item(self): self.mem.check_item() self.log.check_item() self.cap.check_item() - self.mis.check_item() self.features.check_item() diff --git a/misc/config_tools/static_allocators/bdf.py b/misc/config_tools/static_allocators/bdf.py index a7086dbdb..1644b815f 100644 --- a/misc/config_tools/static_allocators/bdf.py +++ b/misc/config_tools/static_allocators/bdf.py @@ -119,7 +119,23 @@ def create_device_node(allocation_etree, vm_id, devdict): if common.get_node(f"./func", dev_node) is None: common.append_node(f"./func", f"{bdf.func:#04x}", dev_node) +def create_gpu_sbdf(board_etree, allocation_etree): + """ + Extract the integrated GPU bdf from board.xml. If the device is not present, set bdf to "0xFFFF" which indicates the device + doesn't exist. + """ + bus = "0x0" + device_node = common.get_node(f"//bus[@type='pci' and @address='{bus}']/device[vendor='0x8086' and class='0x030000']", board_etree) + if device_node is None: + common.append_node("/acrn-config/hv/MISC_CFG/GPU_SBDF", '0xFFFF', allocation_etree) + else: + address = device_node.get('address') + dev = int(address, 16) >> 16 + func = int(address, 16) & 0xffff + common.append_node("/acrn-config/hv/MISC_CFG/GPU_SBDF", f"{(int(bus, 16) << 8) | (dev << 3) | func:#06x}", allocation_etree) + def fn(board_etree, scenario_etree, allocation_etree): + create_gpu_sbdf(board_etree, allocation_etree) vm_nodes = scenario_etree.xpath("//vm") for vm_node in vm_nodes: vm_id = vm_node.get('id') diff --git a/misc/config_tools/xforms/config_common.xsl b/misc/config_tools/xforms/config_common.xsl index e4765c28e..632cd3199 100644 --- a/misc/config_tools/xforms/config_common.xsl +++ b/misc/config_tools/xforms/config_common.xsl @@ -247,8 +247,9 @@ - + +