mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
acrn-config: configuration source refactor for new layout
Now the hypervisor configuration source code layout is changed, so acrn-config need to change accordingly to make sure XML based configuration build success; Tracked-On: #5077 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
38caecae56
commit
6cafb9cf01
@ -18,7 +18,8 @@ INCLUDE_HEADER = """
|
||||
#include <board.h>
|
||||
#include <vtd.h>
|
||||
#include <msr.h>
|
||||
#include <pci.h>"""
|
||||
#include <pci.h>
|
||||
"""
|
||||
|
||||
MSR_IA32_L2_MASK_BASE = 0x00000D10
|
||||
MSR_IA32_L2_MASK_END = 0x00000D4F
|
||||
@ -101,7 +102,7 @@ def populate_clos_mask_msr(rdt_res, cat_mask_list, config):
|
||||
idx = 0
|
||||
for cat_mask in cat_mask_list:
|
||||
print("\t{", file=config)
|
||||
print("\t\t.clos_mask = {0}U,".format(cat_mask), file=config)
|
||||
print("\t\t.clos_mask = CLOS_MASK_{},".format(idx), file=config)
|
||||
print("\t\t.msr_index = MSR_IA32_{0}_MASK_BASE + {1},".format(
|
||||
rdt_res, idx), file=config)
|
||||
print("\t},", file=config)
|
||||
@ -117,7 +118,7 @@ def populate_mba_delay_mask(rdt_res, mba_delay_list, config):
|
||||
idx = 0
|
||||
for mba_delay_mask in mba_delay_list:
|
||||
print("\t{", file=config)
|
||||
print("\t\t.mba_delay = {0}U,".format(mba_delay_mask), file=config)
|
||||
print("\t\t.mba_delay = MBA_MASK_{},".format(idx), file=config)
|
||||
print("\t\t.msr_index = MSR_IA32_{0}_MASK_BASE + {1},".format(
|
||||
rdt_res, idx), file=config)
|
||||
print("\t},", file=config)
|
||||
@ -147,7 +148,7 @@ def gen_rdt_res(config):
|
||||
if len(rdt_resources) == 0 or common_clos_max == 0:
|
||||
print("struct platform_clos_info platform_{0}_clos_array[MAX_PLATFORM_CLOS_NUM];".format("l2"), file=config)
|
||||
print("struct platform_clos_info platform_{0}_clos_array[MAX_PLATFORM_CLOS_NUM];".format("l3"), file=config)
|
||||
print("struct platform_clos_info platform_{0}_clos_array[MAX_PLATFORM_CLOS_NUM];".format("mba"), file=config)
|
||||
print("struct platform_clos_info platform_{0}_clos_array[MAX_MBA_CLOS_NUM_ENTRIES];".format("mba"), file=config)
|
||||
else:
|
||||
for idx, rdt_res in enumerate(rdt_resources):
|
||||
if rdt_res == "L2":
|
||||
@ -180,7 +181,7 @@ def gen_rdt_res(config):
|
||||
if res_present[RDT.L3.value] == 0:
|
||||
print("struct platform_clos_info platform_{0}_clos_array[{1}];".format("l3", "MAX_PLATFORM_CLOS_NUM"), file=config)
|
||||
if res_present[RDT.MBA.value] == 0:
|
||||
print("struct platform_clos_info platform_{0}_clos_array[{1}];".format("mba", "MAX_PLATFORM_CLOS_NUM"), file=config)
|
||||
print("struct platform_clos_info platform_{0}_clos_array[{1}];".format("mba", "MAX_MBA_CLOS_NUM_ENTRIES"), file=config)
|
||||
|
||||
print("#endif", file=config)
|
||||
|
||||
@ -261,19 +262,8 @@ def gen_pci_hide(config):
|
||||
|
||||
def gen_known_caps_pci_devs(config):
|
||||
"""Generate information for known capabilities of pci devices"""
|
||||
|
||||
vpid_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<PCI_VID_PID>", "</PCI_VID_PID>")
|
||||
for dev,known_dev in board_cfg_lib.KNOWN_CAPS_PCI_DEVS_DB.items():
|
||||
if dev not in board_cfg_lib.KNOWN_CAPS_PCI_DEVS:
|
||||
board_cfg_lib.KNOWN_CAPS_PCI_DEVS[dev] = []
|
||||
for k_dev in known_dev:
|
||||
for vpid_line in vpid_lines:
|
||||
if k_dev in vpid_line:
|
||||
bdf = vpid_line.split()[0]
|
||||
board_cfg_lib.KNOWN_CAPS_PCI_DEVS[dev].append(bdf)
|
||||
break
|
||||
|
||||
for dev,bdf_list in board_cfg_lib.KNOWN_CAPS_PCI_DEVS.items():
|
||||
known_caps_pci_devs = board_cfg_lib.get_known_caps_pci_devs()
|
||||
for dev,bdf_list in known_caps_pci_devs.items():
|
||||
if dev == "TSN":
|
||||
print("", file=config)
|
||||
bdf_list_len = len(bdf_list)
|
||||
|
@ -9,16 +9,19 @@ import sys
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
|
||||
import board_cfg_lib
|
||||
import board_c
|
||||
import board_info_h
|
||||
import pci_devices_h
|
||||
import acpi_platform_h
|
||||
import misc_cfg_h
|
||||
import common
|
||||
import vbar_base_h
|
||||
|
||||
ACRN_PATH = common.SOURCE_ROOT_DIR
|
||||
ACRN_CONFIG_DEF = ACRN_PATH + "hypervisor/arch/x86/configs/"
|
||||
ACRN_CONFIG_DEF = ACRN_PATH + "misc/vm_configs/"
|
||||
|
||||
ACRN_DEFAULT_ACPI = ACRN_PATH + "hypervisor/include/arch/x86/default_acpi_info.h"
|
||||
GEN_FILE = ["pci_devices.h", "board.c", "_acpi_info.h", "misc_cfg.h", ".config"]
|
||||
GEN_FILE = ["pci_devices.h", "board.c", "platform_acpi_info.h", "misc_cfg.h",
|
||||
"board_info.h", "vbar_base.h"]
|
||||
|
||||
|
||||
def main(args):
|
||||
@ -49,6 +52,10 @@ def main(args):
|
||||
# check if this is the scenario config which matched board info
|
||||
# get board name
|
||||
(err_dic, board) = common.get_board_name()
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
(err_dic, scenario) = common.get_scenario_name()
|
||||
if err_dic:
|
||||
return err_dic
|
||||
board_cfg_lib.BOARD_NAME = board
|
||||
@ -59,22 +66,36 @@ def main(args):
|
||||
err_dic['board config: Not match'] = "The board xml and scenario xml should be matched"
|
||||
return err_dic
|
||||
|
||||
output = ''
|
||||
if params['--out']:
|
||||
if os.path.isabs(params['--out']):
|
||||
board_dir = os.path.join(params['--out'], board + '/')
|
||||
config_board_kconfig = os.path.join(board_dir, GEN_FILE[4])
|
||||
output = params['--out']
|
||||
else:
|
||||
board_dir = os.path.join(ACRN_PATH + params['--out'], board + '/')
|
||||
config_board_kconfig = os.path.join(board_dir, GEN_FILE[4])
|
||||
output = ACRN_PATH + params['--out']
|
||||
else:
|
||||
board_dir = os.path.join(ACRN_CONFIG_DEF, board + '/')
|
||||
config_board_kconfig = os.path.join(board_dir, GEN_FILE[4])
|
||||
common.mkdir(board_dir)
|
||||
output = ACRN_CONFIG_DEF
|
||||
|
||||
config_pci = board_dir + GEN_FILE[0]
|
||||
config_board = board_dir + GEN_FILE[1]
|
||||
config_acpi = board_dir + board + GEN_FILE[2]
|
||||
config_misc_cfg = board_dir + GEN_FILE[3]
|
||||
board_fix_dir = os.path.join(output, "boards/" + board + '/')
|
||||
scen_board_dir = os.path.join(output, "scenarios/" + scenario + "/" + board + '/')
|
||||
common.mkdir(board_fix_dir)
|
||||
common.mkdir(scen_board_dir)
|
||||
|
||||
config_pci = board_fix_dir + GEN_FILE[0]
|
||||
config_board = board_fix_dir + GEN_FILE[1]
|
||||
config_acpi = board_fix_dir + GEN_FILE[2]
|
||||
config_board_h = board_fix_dir + GEN_FILE[4]
|
||||
config_misc_cfg = scen_board_dir + GEN_FILE[3]
|
||||
config_vbar_base = scen_board_dir + GEN_FILE[5]
|
||||
|
||||
# generate pci_devices.h
|
||||
with open(config_pci, 'w+') as config:
|
||||
pci_devices_h.generate_file(config)
|
||||
|
||||
# generate board_info.h
|
||||
with open(config_board_h, 'w+') as config:
|
||||
err_dic = board_info_h.generate_file(config)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
# generate board.c
|
||||
with open(config_board, 'w+') as config:
|
||||
@ -82,11 +103,11 @@ def main(args):
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
# generate pci_devices.h
|
||||
with open(config_pci, 'w+') as config:
|
||||
pci_devices_h.generate_file(config)
|
||||
# generate vbar_base.h
|
||||
with open(config_vbar_base, 'w+') as config:
|
||||
vbar_base_h.generate_file(config)
|
||||
|
||||
# generate ($board)_acpi_info.h
|
||||
# generate platform_acpi_info.h
|
||||
with open(config_acpi, 'w+') as config:
|
||||
acpi_platform_h.generate_file(config, ACRN_DEFAULT_ACPI)
|
||||
|
||||
|
99
misc/acrn-config/board_config/board_info_h.py
Normal file
99
misc/acrn-config/board_config/board_info_h.py
Normal file
@ -0,0 +1,99 @@
|
||||
# Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import common
|
||||
import board_cfg_lib
|
||||
|
||||
BOARD_INFO_DEFINE="""#ifndef BOARD_INFO_H
|
||||
#define BOARD_INFO_H
|
||||
"""
|
||||
|
||||
BOARD_INFO_ENDIF="""
|
||||
#endif /* BOARD_INFO_H */"""
|
||||
|
||||
def gen_known_caps_pci_head(config):
|
||||
|
||||
bdf_list_len = 0
|
||||
known_caps_pci_devs = board_cfg_lib.get_known_caps_pci_devs()
|
||||
for dev,bdf_list in known_caps_pci_devs.items():
|
||||
if dev == "TSN":
|
||||
bdf_list_len = len(bdf_list)
|
||||
print("#define MAX_VMSIX_ON_MSI_PDEVS_NUM\t{}U".format(bdf_list_len), file=config)
|
||||
|
||||
|
||||
def find_hi_mmio_window(config):
|
||||
|
||||
i_cnt = 0
|
||||
mmio_min = 0
|
||||
mmio_max = 0
|
||||
is_hi_mmio = False
|
||||
|
||||
iomem_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<IOMEM_INFO>", "</IOMEM_INFO>")
|
||||
|
||||
for line in iomem_lines:
|
||||
if "PCI Bus" not in line:
|
||||
continue
|
||||
|
||||
line_start_addr = int(line.split('-')[0], 16)
|
||||
line_end_addr = int(line.split('-')[1].split()[0], 16)
|
||||
if line_start_addr < common.SIZE_4G and line_end_addr < common.SIZE_4G:
|
||||
continue
|
||||
elif line_start_addr < common.SIZE_4G and line_end_addr >= common.SIZE_4G:
|
||||
i_cnt += 1
|
||||
is_hi_mmio = True
|
||||
mmio_min = common.SIZE_4G
|
||||
mmio_max = line_end_addr
|
||||
continue
|
||||
|
||||
is_hi_mmio = True
|
||||
if i_cnt == 0:
|
||||
mmio_min = line_start_addr
|
||||
mmio_max = line_end_addr
|
||||
|
||||
if mmio_max < line_end_addr:
|
||||
mmio_max = line_end_addr
|
||||
i_cnt += 1
|
||||
|
||||
print("", file=config)
|
||||
if is_hi_mmio:
|
||||
print("#define HI_MMIO_START\t\t\t0x%xUL" % common.round_down(mmio_min, common.SIZE_G), file=config)
|
||||
print("#define HI_MMIO_END\t\t\t0x%xUL" % common.round_up(mmio_max, common.SIZE_G), file=config)
|
||||
else:
|
||||
print("#define HI_MMIO_START\t\t\t~0UL", file=config)
|
||||
print("#define HI_MMIO_END\t\t\t0UL", file=config)
|
||||
print("#define HI_MMIO_SIZE\t\t\t{}UL".format(hex(board_cfg_lib.HI_MMIO_OFFSET)), file=config)
|
||||
|
||||
|
||||
def generate_file(config):
|
||||
# get cpu processor list
|
||||
cpu_list = board_cfg_lib.get_processor_info()
|
||||
max_cpu_num = len(cpu_list)
|
||||
|
||||
# set macro of max clos number
|
||||
common_clos_max = board_cfg_lib.get_common_clos_max()
|
||||
max_mba_clos_entries = common_clos_max
|
||||
|
||||
# start to generate board_info.h
|
||||
print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
|
||||
print(BOARD_INFO_DEFINE, file=config)
|
||||
|
||||
# define CONFIG_MAX_PCPCU_NUM
|
||||
print("#define MAX_PCPU_NUM\t\t\t{}U".format(max_cpu_num), file=config)
|
||||
print("#define MAX_PLATFORM_CLOS_NUM\t\t{}U".format(common_clos_max), file=config)
|
||||
print("#define MAX_MBA_CLOS_NUM_ENTRIES\t{}U".format(max_mba_clos_entries), file=config)
|
||||
|
||||
# define MAX_VMSIX_ON_MSI_PDEVS_NUM
|
||||
gen_known_caps_pci_head(config)
|
||||
|
||||
# define MAX_HIDDEN_PDEVS_NUM
|
||||
if board_cfg_lib.BOARD_NAME in list(board_cfg_lib.KNOWN_HIDDEN_PDEVS_BOARD_DB):
|
||||
print("#define MAX_HIDDEN_PDEVS_NUM\t\t{}U".format(len(board_cfg_lib.KNOWN_HIDDEN_PDEVS_BOARD_DB[board_cfg_lib.BOARD_NAME])), file=config)
|
||||
else:
|
||||
print("#define MAX_HIDDEN_PDEVS_NUM\t\t0U", file=config)
|
||||
|
||||
# generate HI_MMIO_START/HI_MMIO_END
|
||||
find_hi_mmio_window(config)
|
||||
|
||||
print(BOARD_INFO_ENDIF, file=config)
|
@ -6,10 +6,8 @@
|
||||
import common
|
||||
import board_cfg_lib
|
||||
|
||||
MISC_CFG_HEADER = """
|
||||
#ifndef MISC_CFG_H
|
||||
#define MISC_CFG_H
|
||||
"""
|
||||
MISC_CFG_HEADER = """#ifndef MISC_CFG_H
|
||||
#define MISC_CFG_H"""
|
||||
|
||||
NATIVE_TTYS_DIC = {}
|
||||
MISC_CFG_END = """#endif /* MISC_CFG_H */"""
|
||||
@ -140,55 +138,6 @@ def parse_boot_info():
|
||||
return (err_dic, sos_cmdlines, sos_rootfs, vuart0_dic, vuart1_dic)
|
||||
|
||||
|
||||
def find_hi_mmio_window(config):
|
||||
|
||||
i_cnt = 0
|
||||
mmio_min = 0
|
||||
mmio_max = 0
|
||||
is_hi_mmio = False
|
||||
|
||||
iomem_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<IOMEM_INFO>", "</IOMEM_INFO>")
|
||||
|
||||
for line in iomem_lines:
|
||||
if "PCI Bus" not in line:
|
||||
continue
|
||||
|
||||
line_start_addr = int(line.split('-')[0], 16)
|
||||
line_end_addr = int(line.split('-')[1].split()[0], 16)
|
||||
if line_start_addr < common.SIZE_4G and line_end_addr < common.SIZE_4G:
|
||||
continue
|
||||
elif line_start_addr < common.SIZE_4G and line_end_addr >= common.SIZE_4G:
|
||||
i_cnt += 1
|
||||
is_hi_mmio = True
|
||||
mmio_min = common.SIZE_4G
|
||||
mmio_max = line_end_addr
|
||||
continue
|
||||
|
||||
is_hi_mmio = True
|
||||
if i_cnt == 0:
|
||||
mmio_min = line_start_addr
|
||||
mmio_max = line_end_addr
|
||||
|
||||
if mmio_max < line_end_addr:
|
||||
mmio_max = line_end_addr
|
||||
i_cnt += 1
|
||||
|
||||
print("", file=config)
|
||||
if is_hi_mmio:
|
||||
print("#define HI_MMIO_START\t\t0x%xUL" % common.round_down(mmio_min, common.SIZE_G), file=config)
|
||||
print("#define HI_MMIO_END\t\t0x%xUL" % common.round_up(mmio_max, common.SIZE_G), file=config)
|
||||
else:
|
||||
print("#define HI_MMIO_START\t\t~0UL", file=config)
|
||||
print("#define HI_MMIO_END\t\t0UL", file=config)
|
||||
|
||||
def gen_known_caps_pci_head(config):
|
||||
|
||||
for dev,bdf_list in board_cfg_lib.KNOWN_CAPS_PCI_DEVS.items():
|
||||
if dev == "TSN":
|
||||
bdf_list_len = len(bdf_list)
|
||||
print("#define MAX_VMSIX_ON_MSI_PDEVS_NUM\t{}U".format(bdf_list_len), file=config)
|
||||
|
||||
|
||||
def generate_file(config):
|
||||
"""
|
||||
Start to generate board.c
|
||||
@ -196,10 +145,6 @@ def generate_file(config):
|
||||
"""
|
||||
board_cfg_lib.get_valid_irq(common.BOARD_INFO_FILE)
|
||||
|
||||
# get cpu processor list
|
||||
cpu_list = board_cfg_lib.get_processor_info()
|
||||
max_cpu_num = len(cpu_list)
|
||||
|
||||
# get the vuart0/vuart1 which user chosed from scenario.xml of board_private section
|
||||
(err_dic, ttys_n) = board_cfg_lib.parser_hv_console()
|
||||
if err_dic:
|
||||
@ -233,28 +178,13 @@ def generate_file(config):
|
||||
# start to generate misc_cfg.h
|
||||
print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
|
||||
print("{}".format(MISC_CFG_HEADER), file=config)
|
||||
|
||||
# define CONFIG_MAX_PCPCU_NUM
|
||||
print("#define MAX_PCPU_NUM\t{}U".format(max_cpu_num), file=config)
|
||||
|
||||
# set macro of max clos number
|
||||
common_clos_max = board_cfg_lib.get_common_clos_max()
|
||||
max_cache_clos_entries = common_clos_max
|
||||
max_mba_clos_entries = common_clos_max
|
||||
if board_cfg_lib.is_cdp_enabled():
|
||||
max_cache_clos_entries = 2 * common_clos_max
|
||||
|
||||
print("#define MAX_CACHE_CLOS_NUM_ENTRIES\t{}U".format(max_cache_clos_entries), file=config)
|
||||
print("#define MAX_MBA_CLOS_NUM_ENTRIES\t{}U".format(max_mba_clos_entries), file=config)
|
||||
print("#define MAX_PLATFORM_CLOS_NUM\t{}U".format(common_clos_max), file=config)
|
||||
gen_known_caps_pci_head(config)
|
||||
print("", file=config)
|
||||
|
||||
# define rootfs with macro
|
||||
for i in range(root_dev_num):
|
||||
print('#define ROOTFS_{}\t\t"root={} "'.format(i, root_devs[i]), file=config)
|
||||
#for i in range(root_dev_num):
|
||||
# print('#define ROOTFS_{}\t\t"root={} "'.format(i, root_devs[i]), file=config)
|
||||
|
||||
# sos rootfs and console
|
||||
print("", file=config)
|
||||
if "SOS_VM" in common.VM_TYPES.values():
|
||||
print('#define SOS_ROOTFS\t\t"root={} "'.format(sos_rootfs[0]), file=config)
|
||||
if ttys_n:
|
||||
@ -283,18 +213,31 @@ def generate_file(config):
|
||||
|
||||
# sos boot command line
|
||||
print("", file=config)
|
||||
|
||||
if "SOS_VM" in common.VM_TYPES.values():
|
||||
sos_bootarg_diff(sos_cmdlines, config)
|
||||
|
||||
# set macro for HIDDEN PTDEVS
|
||||
print("", file=config)
|
||||
if board_cfg_lib.BOARD_NAME in list(board_cfg_lib.KNOWN_HIDDEN_PDEVS_BOARD_DB):
|
||||
print("#define MAX_HIDDEN_PDEVS_NUM {}U".format(len(board_cfg_lib.KNOWN_HIDDEN_PDEVS_BOARD_DB[board_cfg_lib.BOARD_NAME])), file=config)
|
||||
else:
|
||||
print("#define MAX_HIDDEN_PDEVS_NUM 0U", file=config)
|
||||
|
||||
# generate HI_MMIO_START/HI_MMIO_END
|
||||
find_hi_mmio_window(config)
|
||||
if board_cfg_lib.is_rdt_supported():
|
||||
print("", file=config)
|
||||
common_clos_max = board_cfg_lib.get_common_clos_max()
|
||||
max_cache_clos_entries = common_clos_max
|
||||
if board_cfg_lib.is_cdp_enabled():
|
||||
max_cache_clos_entries = 2 * common_clos_max
|
||||
print("#define MAX_CACHE_CLOS_NUM_ENTRIES\t{}U".format(max_cache_clos_entries), file=config)
|
||||
|
||||
(rdt_resources, rdt_res_clos_max, _) = board_cfg_lib.clos_info_parser(common.BOARD_INFO_FILE)
|
||||
cat_mask_list = common.get_hv_item_tag(common.SCENARIO_INFO_FILE, "FEATURES", "RDT", "CLOS_MASK")
|
||||
mba_delay_list = common.get_hv_item_tag(common.SCENARIO_INFO_FILE, "FEATURES", "RDT", "MBA_DELAY")
|
||||
idx = 0
|
||||
for mba_delay_mask in mba_delay_list:
|
||||
print("#define MBA_MASK_{}\t{}U".format(idx, mba_delay_mask), file=config)
|
||||
idx += 1
|
||||
|
||||
idx = 0
|
||||
for cat_mask in cat_mask_list:
|
||||
print("#define CLOS_MASK_{}\t{}U".format(idx, cat_mask), file=config)
|
||||
idx += 1
|
||||
|
||||
print("", file=config)
|
||||
|
||||
|
@ -9,8 +9,7 @@ import common
|
||||
|
||||
PCI_HEADER = r"""
|
||||
#ifndef PCI_DEVICES_H_
|
||||
#define PCI_DEVICES_H_
|
||||
"""
|
||||
#define PCI_DEVICES_H_"""
|
||||
PCI_END_HEADER = r"""
|
||||
#endif /* PCI_DEVICES_H_ */"""
|
||||
|
||||
@ -22,15 +21,7 @@ def write_pbdf(i_cnt, bdf, bar_attr, config):
|
||||
:param bar_attr: it is a class, contains PIC bar attribute
|
||||
:param config: it is a file pointer of pci information for writing to
|
||||
"""
|
||||
# if there is only one host bridge, then will discard the index of suffix
|
||||
if i_cnt == 0 and bar_attr.name.upper() == "HOST BRIDGE":
|
||||
tmp_sub_name = "_".join(bar_attr.name.split()).upper()
|
||||
else:
|
||||
if '-' in bar_attr.name:
|
||||
tmp_sub_name = common.undline_name(bar_attr.name) + "_" + str(i_cnt)
|
||||
else:
|
||||
tmp_sub_name = "_".join(bar_attr.name.split()).upper() + "_" + str(i_cnt)
|
||||
|
||||
tmp_sub_name = board_cfg_lib.get_sub_pci_name(i_cnt, bar_attr)
|
||||
board_cfg_lib.PCI_DEV_BAR_DESC.pci_dev_dic[bdf].name_w_i_cnt = tmp_sub_name
|
||||
|
||||
bus = int(bdf.split(':')[0], 16)
|
||||
@ -38,52 +29,7 @@ def write_pbdf(i_cnt, bdf, bar_attr, config):
|
||||
fun = int(bdf.split('.')[1], 16)
|
||||
print("#define %-32s" % tmp_sub_name, end="", file=config)
|
||||
print(" .pbdf.bits = {{.b = 0x{:02X}U, .d = 0x{:02X}U, .f = 0x{:02X}U}}".format(
|
||||
bus, dev, fun), end="", file=config)
|
||||
|
||||
if not bar_attr.remappable:
|
||||
align = ' ' * 48
|
||||
print("\n{}/* TODO: add {} 64bit BAR support */".format(align, tmp_sub_name), file=config)
|
||||
return
|
||||
|
||||
|
||||
def write_vbar(i_cnt, bdf, pci_bar_dic, bar_attr, config):
|
||||
"""
|
||||
Parser and generate vbar
|
||||
:param i_cnt: the number of pci devices have the same PCI sub class name
|
||||
:param bdf: it is a string what contains BDF
|
||||
:param pci_bar_dic: it is a dictionary of pci vbar for those BDF
|
||||
:param bar_attr: it is a class, contains PIC bar attribute
|
||||
:param config: it is a file pointer of pci information for writing to
|
||||
"""
|
||||
tail = 0
|
||||
align = ' ' * 48
|
||||
ptdev_mmio_str = ''
|
||||
|
||||
tmp_sub_name = common.undline_name(bar_attr.name) + "_" + str(i_cnt)
|
||||
if bdf in pci_bar_dic.keys():
|
||||
bar_list = list(pci_bar_dic[bdf].keys())
|
||||
bar_len = len(bar_list)
|
||||
bar_num = 0
|
||||
for bar_i in bar_list:
|
||||
if not bar_attr.remappable:
|
||||
return
|
||||
|
||||
if tail == 0:
|
||||
print(", \\", file=config)
|
||||
tail += 1
|
||||
bar_num += 1
|
||||
bar_val = pci_bar_dic[bdf][bar_i].addr
|
||||
if pci_bar_dic[bdf][bar_i].remapped:
|
||||
ptdev_mmio_str = 'PTDEV_HI_MMIO_START + '
|
||||
|
||||
if bar_num == bar_len:
|
||||
print("{}.vbar_base[{}] = {}{}UL".format(align, bar_i, ptdev_mmio_str, bar_val), file=config)
|
||||
else:
|
||||
print("{}.vbar_base[{}] = {}{}UL, \\".format(
|
||||
align, bar_i, ptdev_mmio_str, bar_val), file=config)
|
||||
|
||||
else:
|
||||
print("", file=config)
|
||||
bus, dev, fun), file=config)
|
||||
|
||||
|
||||
def generate_file(config):
|
||||
@ -100,12 +46,10 @@ def generate_file(config):
|
||||
# write the header into pci
|
||||
print("{0}".format(PCI_HEADER), file=config)
|
||||
|
||||
sub_name_count = board_cfg_lib.parser_pci()
|
||||
|
||||
print("#define %-32s" % "PTDEV_HI_MMIO_SIZE", " {}UL".format(hex(board_cfg_lib.HI_MMIO_OFFSET)), file=config)
|
||||
board_cfg_lib.parser_pci()
|
||||
|
||||
compared_bdf = []
|
||||
for cnt_sub_name in sub_name_count.keys():
|
||||
for cnt_sub_name in board_cfg_lib.SUB_NAME_COUNT.keys():
|
||||
i_cnt = 0
|
||||
for bdf, bar_attr in board_cfg_lib.PCI_DEV_BAR_DESC.pci_dev_dic.items():
|
||||
if cnt_sub_name == bar_attr.name and bdf not in compared_bdf:
|
||||
@ -115,7 +59,6 @@ def generate_file(config):
|
||||
|
||||
print("",file=config)
|
||||
write_pbdf(i_cnt, bdf, bar_attr, config)
|
||||
write_vbar(i_cnt, bdf, board_cfg_lib.PCI_DEV_BAR_DESC.pci_bar_dic, bar_attr, config)
|
||||
|
||||
i_cnt += 1
|
||||
|
||||
|
81
misc/acrn-config/board_config/vbar_base_h.py
Normal file
81
misc/acrn-config/board_config/vbar_base_h.py
Normal file
@ -0,0 +1,81 @@
|
||||
# Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import common
|
||||
import board_cfg_lib
|
||||
import scenario_cfg_lib
|
||||
|
||||
VBAR_INFO_DEFINE="""#ifndef VBAR_BASE_H_
|
||||
#define VBAR_BASE_H_
|
||||
"""
|
||||
|
||||
VBAR_INFO_ENDIF="""#endif /* VBAR_BASE_H_ */"""
|
||||
|
||||
def write_vbar(i_cnt, bdf, pci_bar_dic, bar_attr, config):
|
||||
"""
|
||||
Parser and generate vbar
|
||||
:param i_cnt: the number of pci devices have the same PCI sub class name
|
||||
:param bdf: it is a string what contains BDF
|
||||
:param pci_bar_dic: it is a dictionary of pci vbar for those BDF
|
||||
:param bar_attr: it is a class, contains PIC bar attribute
|
||||
:param config: it is a file pointer of pci information for writing to
|
||||
"""
|
||||
align = ' ' * 54
|
||||
ptdev_mmio_str = ''
|
||||
|
||||
tmp_sub_name = board_cfg_lib.get_sub_pci_name(i_cnt, bar_attr)
|
||||
if bdf in pci_bar_dic.keys():
|
||||
bar_list = list(pci_bar_dic[bdf].keys())
|
||||
bar_len = len(bar_list)
|
||||
bar_num = 0
|
||||
for bar_i in bar_list:
|
||||
if not bar_attr.remappable:
|
||||
print("/* TODO: add {} 64bit BAR support */".format(tmp_sub_name), file=config)
|
||||
|
||||
bar_num += 1
|
||||
bar_val = pci_bar_dic[bdf][bar_i].addr
|
||||
if pci_bar_dic[bdf][bar_i].remapped:
|
||||
ptdev_mmio_str = 'PTDEV_HI_MMIO_START + '
|
||||
|
||||
if bar_num == bar_len:
|
||||
if bar_len == 1:
|
||||
print("#define %-38s" % (tmp_sub_name+"_VBAR"), " .vbar_base[{}] = {}{}UL".format(bar_i, ptdev_mmio_str, bar_val), file=config)
|
||||
else:
|
||||
print("{}.vbar_base[{}] = {}{}UL".format(align, bar_i, ptdev_mmio_str, bar_val), file=config)
|
||||
elif bar_num == 1:
|
||||
print("#define %-38s" % (tmp_sub_name+"_VBAR"), " .vbar_base[{}] = {}{}UL, \\".format(bar_i, ptdev_mmio_str, bar_val), file=config)
|
||||
else:
|
||||
print("{}.vbar_base[{}] = {}{}UL, \\".format(align, bar_i, ptdev_mmio_str, bar_val), file=config)
|
||||
print("", file=config)
|
||||
|
||||
|
||||
def generate_file(config):
|
||||
# start to generate board_info.h
|
||||
print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
|
||||
print(VBAR_INFO_DEFINE, file=config)
|
||||
common.get_vm_types()
|
||||
pre_vm = False
|
||||
for vm_type in common.VM_TYPES.values():
|
||||
if scenario_cfg_lib.VM_DB[vm_type]['load_type'] == "PRE_LAUNCHED_VM":
|
||||
pre_vm = True
|
||||
|
||||
if not pre_vm:
|
||||
print(VBAR_INFO_ENDIF, file=config)
|
||||
return
|
||||
|
||||
compared_bdf = []
|
||||
for cnt_sub_name in board_cfg_lib.SUB_NAME_COUNT.keys():
|
||||
i_cnt = 0
|
||||
for bdf, bar_attr in board_cfg_lib.PCI_DEV_BAR_DESC.pci_dev_dic.items():
|
||||
if cnt_sub_name == bar_attr.name and bdf not in compared_bdf:
|
||||
compared_bdf.append(bdf)
|
||||
else:
|
||||
continue
|
||||
|
||||
write_vbar(i_cnt, bdf, board_cfg_lib.PCI_DEV_BAR_DESC.pci_bar_dic, bar_attr, config)
|
||||
|
||||
i_cnt += 1
|
||||
|
||||
print(VBAR_INFO_ENDIF, file=config)
|
@ -235,6 +235,4 @@ def generate_file(hv_info, config):
|
||||
get_serial_console(config)
|
||||
get_log_opt(hv_info, config)
|
||||
|
||||
print("CONFIG_ENFORCE_VALIDATED_ACPI_INFO=y", file=config)
|
||||
|
||||
return err_dic
|
||||
|
@ -35,7 +35,6 @@ TSN_DEVS = ["8086:4b30", "8086:4b31", "8086:4b32", "8086:4ba0", "8086:4ba1", "80
|
||||
KNOWN_CAPS_PCI_DEVS_DB = {
|
||||
"TSN":TSN_DEVS,
|
||||
}
|
||||
KNOWN_CAPS_PCI_DEVS = {}
|
||||
|
||||
def get_info(board_info, msg_s, msg_e):
|
||||
"""
|
||||
@ -364,6 +363,7 @@ class Pci_Dev_Bar_Desc:
|
||||
self.pci_bar_dic = {}
|
||||
|
||||
PCI_DEV_BAR_DESC = Pci_Dev_Bar_Desc()
|
||||
SUB_NAME_COUNT = {}
|
||||
|
||||
|
||||
def get_value_after_str(line, key):
|
||||
@ -411,6 +411,7 @@ def remap_bar_addr_to_high(bar_addr, line):
|
||||
|
||||
def parser_pci():
|
||||
""" Parse PCI lines """
|
||||
global SUB_NAME_COUNT, HI_MMIO_OFFSET
|
||||
cur_bdf = 0
|
||||
prev_bdf = 0
|
||||
tmp_bar_dic = {}
|
||||
@ -463,13 +464,11 @@ def parser_pci():
|
||||
tmp_bar_dic = {}
|
||||
|
||||
# output all the pci device list to pci_device.h
|
||||
sub_name_count = collections.Counter(cal_sub_pci_name)
|
||||
SUB_NAME_COUNT = collections.Counter(cal_sub_pci_name)
|
||||
|
||||
if tmp_bar_dic:
|
||||
PCI_DEV_BAR_DESC.pci_bar_dic[cur_bdf] = tmp_bar_dic
|
||||
|
||||
return sub_name_count
|
||||
|
||||
|
||||
def is_rdt_supported():
|
||||
"""
|
||||
@ -529,3 +528,32 @@ def get_common_clos_max():
|
||||
common_clos_max = min(tmp_clos_max_list)
|
||||
|
||||
return common_clos_max
|
||||
|
||||
|
||||
def get_sub_pci_name(i_cnt, bar_attr):
|
||||
tmp_sub_name = ''
|
||||
# if there is only one host bridge, then will discard the index of suffix
|
||||
if i_cnt == 0 and bar_attr.name.upper() == "HOST BRIDGE":
|
||||
tmp_sub_name = "_".join(bar_attr.name.split()).upper()
|
||||
else:
|
||||
if '-' in bar_attr.name:
|
||||
tmp_sub_name = common.undline_name(bar_attr.name) + "_" + str(i_cnt)
|
||||
else:
|
||||
tmp_sub_name = "_".join(bar_attr.name.split()).upper() + "_" + str(i_cnt)
|
||||
|
||||
return tmp_sub_name
|
||||
|
||||
def get_known_caps_pci_devs():
|
||||
known_caps_pci_devs = {}
|
||||
vpid_lines = get_info(common.BOARD_INFO_FILE, "<PCI_VID_PID>", "</PCI_VID_PID>")
|
||||
for dev,known_dev in KNOWN_CAPS_PCI_DEVS_DB.items():
|
||||
if dev not in known_caps_pci_devs:
|
||||
known_caps_pci_devs[dev] = []
|
||||
for k_dev in known_dev:
|
||||
for vpid_line in vpid_lines:
|
||||
if k_dev in vpid_line:
|
||||
bdf = vpid_line.split()[0]
|
||||
known_caps_pci_devs[dev].append(bdf)
|
||||
break
|
||||
|
||||
return known_caps_pci_devs
|
||||
|
@ -26,11 +26,11 @@ def generate_file(vm_info, config):
|
||||
:param config: it is pointer for for file write to
|
||||
:return: None
|
||||
"""
|
||||
sub_name_count = board_cfg_lib.parser_pci()
|
||||
board_cfg_lib.parser_pci()
|
||||
|
||||
compared_bdf = []
|
||||
|
||||
for cnt_sub_name in sub_name_count.keys():
|
||||
for cnt_sub_name in board_cfg_lib.SUB_NAME_COUNT.keys():
|
||||
i_cnt = 0
|
||||
for bdf, bar_attr in board_cfg_lib.PCI_DEV_BAR_DESC.pci_dev_dic.items():
|
||||
if cnt_sub_name == bar_attr.name and bdf not in compared_bdf:
|
||||
@ -42,34 +42,32 @@ def generate_file(vm_info, config):
|
||||
|
||||
i_cnt += 1
|
||||
|
||||
idx = 0
|
||||
print("{}".format(scenario_cfg_lib.HEADER_LICENSE), file=config)
|
||||
print("", file=config)
|
||||
print("#include <vm_config.h>", file=config)
|
||||
print("#include <pci_devices.h>", file=config)
|
||||
print("#include <vpci.h>", file=config)
|
||||
print("#include <vbar_base.h>", file=config)
|
||||
print("#include <mmu.h>", file=config)
|
||||
print("#include <page.h>", file=config)
|
||||
print("", file=config)
|
||||
print("/* The vbar_base info of pt devices is included in device MACROs which defined in",
|
||||
file=config)
|
||||
print(" * arch/x86/configs/$(CONFIG_BOARD)/pci_devices.h.", file=config)
|
||||
print(" * The memory range of vBAR should exactly match with the e820 layout of VM.",
|
||||
file=config)
|
||||
print(" */", file=config)
|
||||
for vm_i, pci_bdf_devs_list in vm_info.cfg_pci.pci_devs.items():
|
||||
pci_cnt = 1
|
||||
if not pci_bdf_devs_list:
|
||||
continue
|
||||
|
||||
pci_cnt = 1
|
||||
if idx == 0:
|
||||
print("", file=config)
|
||||
print("#define PTDEV(PCI_DEV)\t\tPCI_DEV, PCI_DEV##_VBAR",file=config)
|
||||
print("", file=config)
|
||||
print("struct acrn_vm_pci_dev_config " +
|
||||
"vm{}_pci_devs[{}] = {{".format(vm_i, vm_info.cfg_pci.pci_dev_num[vm_i]), file=config)
|
||||
"vm{}_pci_devs[VM{}_CONFIG_PCI_DEV_NUM] = {{".format(vm_i, vm_i), file=config)
|
||||
print("\t{", file=config)
|
||||
print("\t\t.emu_type = {},".format(PCI_DEV_TYPE[0]), file=config)
|
||||
print("\t\t.vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x00U},", file=config)
|
||||
print("\t\t.vdev_ops = &vhostbridge_ops,", file=config)
|
||||
print("\t},", file=config)
|
||||
|
||||
idx += 1
|
||||
for pci_bdf_dev in pci_bdf_devs_list:
|
||||
if not pci_bdf_dev:
|
||||
continue
|
||||
@ -81,7 +79,7 @@ def generate_file(vm_info, config):
|
||||
print("\t\t.vbdf.bits = {{.b = 0x00U, .d = 0x0{}U, .f = 0x00U}},".format(pci_cnt), file=config)
|
||||
for bdf, bar_attr in board_cfg_lib.PCI_DEV_BAR_DESC.pci_dev_dic.items():
|
||||
if bdf == pci_bdf_dev:
|
||||
print("\t\t{},".format(board_cfg_lib.PCI_DEV_BAR_DESC.pci_dev_dic[bdf].name_w_i_cnt), file=config)
|
||||
print("\t\tPTDEV({}),".format(board_cfg_lib.PCI_DEV_BAR_DESC.pci_dev_dic[bdf].name_w_i_cnt), file=config)
|
||||
else:
|
||||
continue
|
||||
print("\t},", file=config)
|
||||
|
@ -20,8 +20,7 @@ import board_defconfig
|
||||
from hv_item import HvInfo
|
||||
|
||||
ACRN_PATH = common.SOURCE_ROOT_DIR
|
||||
ACRN_CONFIG_DEF = ACRN_PATH + 'hypervisor/scenarios/'
|
||||
ACRN_CONFIGS = ACRN_PATH + "hypervisor/arch/x86/configs/"
|
||||
ACRN_CONFIG_DEF = ACRN_PATH + 'misc/vm_configs/scenarios/'
|
||||
GEN_FILE = ["vm_configurations.h", "vm_configurations.c", "pci_dev.c", ".config"]
|
||||
|
||||
|
||||
@ -148,20 +147,20 @@ def main(args):
|
||||
|
||||
if params['--out']:
|
||||
if os.path.isabs(params['--out']):
|
||||
scenario_dir = os.path.join(params['--out'], scenario + '/')
|
||||
config_hv = os.path.join(params['--out'], board_name + GEN_FILE[3])
|
||||
scen_output = params['--out'] + "/scenarios/" + scenario + "/"
|
||||
else:
|
||||
scenario_dir = os.path.join(ACRN_PATH + params['--out'], scenario + '/')
|
||||
config_hv = os.path.join(ACRN_PATH + params['--out'], board_name + GEN_FILE[3])
|
||||
scen_output = ACRN_PATH + params['--out'] + "/scenarios/" + scenario + "/"
|
||||
else:
|
||||
scenario_dir = os.path.join(ACRN_CONFIG_DEF, scenario + '/')
|
||||
config_hv = os.path.join(ACRN_CONFIGS, board_name + GEN_FILE[3])
|
||||
common.print_yel("{}".format("Override board defconfig...", warn=True))
|
||||
common.mkdir(scenario_dir)
|
||||
scen_output = ACRN_CONFIG_DEF + "/scenarios/" + scenario + "/"
|
||||
|
||||
vm_config_h = scenario_dir + GEN_FILE[0]
|
||||
vm_config_c = scenario_dir + GEN_FILE[1]
|
||||
pci_config_c = scenario_dir + GEN_FILE[2]
|
||||
scen_board = scen_output + board_name + "/"
|
||||
common.mkdir(scen_board)
|
||||
common.mkdir(scen_output)
|
||||
|
||||
vm_config_h = scen_output + GEN_FILE[0]
|
||||
vm_config_c = scen_output + GEN_FILE[1]
|
||||
pci_config_c = scen_board + GEN_FILE[2]
|
||||
config_hv = scen_board + board_name + GEN_FILE[3]
|
||||
|
||||
# parse the scenario.xml
|
||||
get_scenario_item_values(params['--board'], params['--scenario'])
|
||||
|
@ -341,7 +341,7 @@ def gen_pre_launch_vm(vm_type, vm_i, scenario_items, config):
|
||||
return err_dic
|
||||
|
||||
if vm_info.cfg_pci.pci_devs[vm_i] and vm_info.cfg_pci.pci_devs[vm_i] != None:
|
||||
print("\t\t.pci_dev_num = {}U,".format(vm_info.cfg_pci.pci_dev_num[vm_i]), file=config)
|
||||
print("\t\t.pci_dev_num = VM{}_CONFIG_PCI_DEV_NUM,".format(vm_i), file=config)
|
||||
print("\t\t.pci_devs = vm{}_pci_devs,".format(vm_i), file=config)
|
||||
|
||||
print("\t},", file=config)
|
||||
@ -370,7 +370,7 @@ def pre_launch_definiation(vm_info, config):
|
||||
if "PRE_LAUNCHED_VM" != scenario_cfg_lib.VM_DB[vm_type]['load_type']:
|
||||
continue
|
||||
print("extern struct acrn_vm_pci_dev_config " +
|
||||
"vm{}_pci_devs[{}];".format(vm_i, vm_info.cfg_pci.pci_dev_num[vm_i]), file=config)
|
||||
"vm{}_pci_devs[VM{}_CONFIG_PCI_DEV_NUM];".format(vm_i, vm_i), file=config)
|
||||
print("", file=config)
|
||||
|
||||
def generate_file(scenario_items, config):
|
||||
|
@ -34,7 +34,7 @@ def cpu_affinity_output(vm_info, i, config):
|
||||
return
|
||||
|
||||
cpu_bits = vm_info.get_cpu_bitmap(i)
|
||||
print("#define VM{0}_CONFIG_CPU_AFFINITY\t\t{1}".format(
|
||||
print("#define VM{0}_CONFIG_CPU_AFFINITY {1}".format(
|
||||
i, cpu_bits['cpu_map']), file=config)
|
||||
|
||||
def clos_config_output(scenario_items, i, config):
|
||||
@ -53,10 +53,16 @@ def clos_config_output(scenario_items, i, config):
|
||||
|
||||
def scenario_vm_num(scenario_items, config):
|
||||
|
||||
print("", file=config)
|
||||
print("/* SOS_VM_NUM can only be 0U or 1U;", file=config)
|
||||
print(" * When SOS_VM_NUM is 0U, MAX_POST_VM_NUM must be 0U too;", file=config)
|
||||
print(" * MAX_POST_VM_NUM must be bigger than CONFIG_MAX_KATA_VM_NUM;", file=config)
|
||||
print(" */", file=config)
|
||||
|
||||
load_type_cnt = scenario_items['vm'].load_order_cnt
|
||||
print("#define PRE_VM_NUM\t\t{}U".format(load_type_cnt.pre_vm), file=config)
|
||||
print("#define SOS_VM_NUM\t\t{}U".format(load_type_cnt.sos_vm), file=config)
|
||||
print("#define MAX_POST_VM_NUM\t\t{}U".format(load_type_cnt.post_vm), file=config)
|
||||
print("#define PRE_VM_NUM\t\t\t{}U".format(load_type_cnt.pre_vm), file=config)
|
||||
print("#define SOS_VM_NUM\t\t\t{}U".format(load_type_cnt.sos_vm), file=config)
|
||||
print("#define MAX_POST_VM_NUM\t\t\t{}U".format(load_type_cnt.post_vm), file=config)
|
||||
print("#define CONFIG_MAX_KATA_VM_NUM\t\t{}U".format(scenario_cfg_lib.KATA_VM_COUNT), file=config)
|
||||
|
||||
|
||||
@ -72,16 +78,17 @@ def gen_pre_launch_vm(scenario_items, config):
|
||||
cpu_bits = vm_info.get_cpu_bitmap(vm_i)
|
||||
cpu_affinity_output(vm_info, vm_i, config)
|
||||
clos_config_output(scenario_items, vm_i, config)
|
||||
print("#define VM{0}_CONFIG_MEM_START_HPA\t\t{1}UL".format(
|
||||
print("#define VM{0}_CONFIG_MEM_START_HPA {1}UL".format(
|
||||
vm_i, vm_info.mem_info.mem_start_hpa[vm_i]), file=config)
|
||||
print("#define VM{0}_CONFIG_MEM_SIZE\t\t\t{1}UL".format(
|
||||
print("#define VM{0}_CONFIG_MEM_SIZE {1}UL".format(
|
||||
vm_i, vm_info.mem_info.mem_size[vm_i]), file=config)
|
||||
if vm_info.mem_info.mem_start_hpa2[vm_i] not in (None, ''):
|
||||
print("#define VM{0}_CONFIG_MEM_START_HPA2\t\t{1}UL".format(
|
||||
print("#define VM{0}_CONFIG_MEM_START_HPA2 {1}UL".format(
|
||||
vm_i, vm_info.mem_info.mem_start_hpa2[vm_i]), file=config)
|
||||
print("#define VM{0}_CONFIG_MEM_SIZE_HPA2\t\t{1}UL".format(
|
||||
print("#define VM{0}_CONFIG_MEM_SIZE_HPA2 {1}UL".format(
|
||||
vm_i, vm_info.mem_info.mem_size_hpa2[vm_i]), file=config)
|
||||
|
||||
print("#define VM{}_CONFIG_PCI_DEV_NUM {}U".format(vm_i, vm_info.cfg_pci.pci_dev_num[vm_i]), file=config)
|
||||
print("", file=config)
|
||||
vm_i += 1
|
||||
|
||||
@ -89,26 +96,34 @@ def gen_pre_launch_vm(scenario_items, config):
|
||||
def gen_post_launch_header(scenario_items, config):
|
||||
vm_i = 0
|
||||
vm_info = scenario_items['vm']
|
||||
is_post_vm_available = False
|
||||
for vm_type in common.VM_TYPES.values():
|
||||
if "POST_LAUNCHED_VM" != scenario_cfg_lib.VM_DB[vm_type]['load_type']:
|
||||
vm_i += 1
|
||||
continue
|
||||
|
||||
is_post_vm_available = True
|
||||
cpu_affinity_output(vm_info, vm_i, config)
|
||||
clos_config_output(scenario_items, vm_i, config)
|
||||
vm_i += 1
|
||||
|
||||
if is_post_vm_available:
|
||||
print("", file=config)
|
||||
|
||||
|
||||
def gen_sos_header(scenario_items, config):
|
||||
|
||||
if 'SOS_VM' not in common.VM_TYPES.values():
|
||||
return
|
||||
print("", file=config)
|
||||
print("#define SOS_VM_BOOTARGS\t\t\tSOS_ROOTFS\t\\", file=config)
|
||||
print("\t\t\t\t\tSOS_CONSOLE\t\\", file=config)
|
||||
print("\t\t\t\t\tSOS_IDLE\t\\", file=config)
|
||||
print("\t\t\t\t\tSOS_BOOTARGS_DIFF", file=config)
|
||||
|
||||
for vm_i,vm_type in common.VM_TYPES.items():
|
||||
if vm_type == 'SOS_VM':
|
||||
clos_config_output(scenario_items, vm_i, config)
|
||||
print("", file=config)
|
||||
|
||||
|
||||
def gen_header_file(scenario_items, config):
|
||||
@ -120,15 +135,15 @@ def gen_header_file(scenario_items, config):
|
||||
|
||||
def get_dm_owned_guest_flag_mask(vm_info, config):
|
||||
|
||||
print("", file=config)
|
||||
if "SOS_VM" not in common.VM_TYPES.values():
|
||||
print("#define DM_OWNED_GUEST_FLAG_MASK\t0UL", file=config)
|
||||
print("#define DM_OWNED_GUEST_FLAG_MASK 0UL", file=config)
|
||||
else:
|
||||
print("/* Bits mask of guest flags that can be programmed by device model." +
|
||||
" Other bits are set by hypervisor only */", file=config)
|
||||
print("#define DM_OWNED_GUEST_FLAG_MASK\t" +
|
||||
print("#define DM_OWNED_GUEST_FLAG_MASK " +
|
||||
"(GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \\\n" +
|
||||
"\t\t\t\t\t\tGUEST_FLAG_RT | GUEST_FLAG_IO_COMPLETION_POLLING)", file=config)
|
||||
|
||||
print("", file=config)
|
||||
|
||||
|
||||
@ -141,15 +156,10 @@ def generate_file(scenario_items, config):
|
||||
vm_info = scenario_items['vm']
|
||||
gen_common_header(config)
|
||||
|
||||
print("#include <misc_cfg.h>\n", file=config)
|
||||
for vm_i,pci_dev_num in vm_info.cfg_pci.pci_dev_num.items():
|
||||
if pci_dev_num >= 2:
|
||||
print("#include <misc_cfg.h>", file=config)
|
||||
print("#include <pci_devices.h>", file=config)
|
||||
break
|
||||
get_dm_owned_guest_flag_mask(vm_info, config)
|
||||
scenario_vm_num(scenario_items, config)
|
||||
print("", file=config)
|
||||
get_dm_owned_guest_flag_mask(vm_info, config)
|
||||
|
||||
gen_header_file(scenario_items, config)
|
||||
print("", file=config)
|
||||
print("{0}".format(VM_END_DEFINE), file=config)
|
||||
|
Loading…
Reference in New Issue
Block a user