acrn-config: add support to parse 'severity' item tag

Add support to parse 'severity' item tag from webUI and set them into
scenario configurations.

Tracked-On: #3854
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Wei Liu 2019-12-19 14:16:13 +08:00 committed by wenlingz
parent ca2855f230
commit 197e4a0620
5 changed files with 14 additions and 1 deletions

View File

@ -17,7 +17,7 @@ HV_LICENSE_FILE = SOURCE_PATH + 'misc/acrn-config/library/hypervisor_license'
PY_CACHES = ["__pycache__", "../board_config/__pycache__", "../scenario_config/__pycache__"]
GUEST_FLAG = ["0UL", "GUEST_FLAG_SECURE_WORLD_ENABLED", "GUEST_FLAG_LAPIC_PASSTHROUGH",
"GUEST_FLAG_IO_COMPLETION_POLLING", "GUEST_FLAG_CLOS_REQUIRED",
"GUEST_FLAG_HIDE_MTRR", "GUEST_FLAG_RT", "GUEST_FLAG_HIGHEST_SEVERITY"]
"GUEST_FLAG_HIDE_MTRR", "GUEST_FLAG_RT"]
# Support 512M, 1G, 2G
# pre launch less then 2G, sos vm less than 24G
START_HPA_SIZE_LIST = ['0x20000000', '0x40000000', '0x80000000', 'CONFIG_SOS_RAM_SIZE', 'VM0_MEM_SIZE']

View File

@ -17,6 +17,7 @@ KERN_TYPE_LIST = ['KERNEL_BZIMAGE', 'KERNEL_ZEPHYR']
KERN_BOOT_ADDR_LIST = ['0x100000']
GUEST_FLAG = common.GUEST_FLAG
VM_SEVERITY = ['SEVERITY_SAFETY_VM', 'SEVERITY_RTVM', 'SEVERITY_SOS', 'SEVERITY_STANDARD_VM']
VUART_TYPE = ['VUART_LEGACY_PIO', 'VUART_PCI']
VUART_BASE = ['SOS_COM1_BASE', 'SOS_COM2_BASE', 'COM1_BASE',
'COM2_BASE', 'COM3_BASE', 'COM4_BASE', 'INVALID_COM_BASE']

View File

@ -37,6 +37,7 @@ def get_scenario_item_values(board_info, scenario_info):
scenario_item_values["vm,vcpu_affinity"] = hw_info.get_processor_val()
scenario_item_values["vm,guest_flags"] = guest_flags
scenario_item_values["vm,clos"] = hw_info.get_clos_val()
scenario_item_values["vm,severity"] = scenario_cfg_lib.VM_SEVERITY
scenario_item_values["vm,os_config,kern_type"] = scenario_cfg_lib.KERN_TYPE_LIST
scenario_item_values.update(scenario_cfg_lib.avl_vuart_ui_select(scenario_info))

View File

@ -268,6 +268,7 @@ class VmInfo:
clos_set = {}
guest_flag_idx = {}
cpus_per_vm = {}
severity = {}
def __init__(self, board_file, scenario_file):
self.board_info = board_file
@ -293,6 +294,7 @@ class VmInfo:
self.cpus_per_vm = scenario_cfg_lib.get_leaf_tag_map(
self.scenario_info, "vcpu_affinity", "pcpu_id")
self.clos_set = scenario_cfg_lib.get_leaf_tag_map(self.scenario_info, "clos")
self.severity = scenario_cfg_lib.get_leaf_tag_map(self.scenario_info, "severity")
self.epc_section.get_info()
self.mem_info.get_info()
self.os_cfg.get_info()

View File

@ -242,6 +242,7 @@ def gen_sdc_source(vm_info, config):
print("\t\t.clos = {0}U,".format(0), file=config)
else:
print("\t\t.clos = {0}U,".format(vm_info.clos_set[0]), file=config)
print("\t\t.severity = {0},".format(vm_info.severity[0].strip()), file=config)
print("\t\t.memory = {", file=config)
print("\t\t\t.start_hpa = {}UL,".format(vm_info.mem_info.mem_start_hpa[0]), file=config)
print("\t\t\t.size = {0},".format("CONFIG_SOS_RAM_SIZE"), file=config)
@ -271,6 +272,7 @@ def gen_sdc_source(vm_info, config):
vm1_cpu_num = len(vm_info.cpus_per_vm[vm1_id])
print("\t\t.vcpu_num = {}U,".format(vm1_cpu_num), file=config)
print("\t\t.vcpu_affinity = VM{}_CONFIG_VCPU_AFFINITY,".format(vm1_id), file=config)
print("\t\t.severity = {0},".format(vm_info.severity[1].strip()), file=config)
# VUART
err_dic = vuart_output(1, vm_info, config)
if err_dic:
@ -285,6 +287,7 @@ def gen_sdc_source(vm_info, config):
print("\t\t.load_order = POST_LAUNCHED_VM,", file=config)
uuid_output(uuid_2, vm_info.uuid[2], config)
vcpu_affinity_output(vm_info, 2, config)
print("\t\t.severity = {0},".format(vm_info.severity[2].strip()), file=config)
is_need_epc(vm_info.epc_section, 2, config)
print("\t\t.vuart[0] = {", file=config)
print("\t\t\t.type = VUART_LEGACY_PIO,", file=config)
@ -336,6 +339,7 @@ def gen_sdc2_source(vm_info, config):
print("\t\t.clos = {0}U,".format(0), file=config)
else:
print("\t\t.clos = {0}U,".format(vm_info.clos_set[0]), file=config)
print("\t\t.severity = {0},".format(vm_info.severity[0].strip()), file=config)
print("\t\t.memory = {", file=config)
print("\t\t\t.start_hpa = {}UL,".format(vm_info.mem_info.mem_start_hpa[0]), file=config)
print("\t\t\t.size = {0},".format("CONFIG_SOS_RAM_SIZE"), file=config)
@ -361,6 +365,7 @@ def gen_sdc2_source(vm_info, config):
# UUID
uuid_output(uuid_1, vm_info.uuid[1], config)
vcpu_affinity_output(vm_info, 1, config)
print("\t\t.severity = {0},".format(vm_info.severity[1].strip()), file=config)
is_need_epc(vm_info.epc_section, 1, config)
# VUART
err_dic = vuart_output(1, vm_info, config)
@ -373,6 +378,7 @@ def gen_sdc2_source(vm_info, config):
# UUID
uuid_output(uuid_2, vm_info.uuid[2], config)
vcpu_affinity_output(vm_info, 2, config)
print("\t\t.severity = {0},".format(vm_info.severity[2].strip()), file=config)
is_need_epc(vm_info.epc_section, 2, config)
# VUART
err_dic = vuart_output(1, vm_info, config)
@ -386,6 +392,7 @@ def gen_sdc2_source(vm_info, config):
uuid_output(uuid_3, vm_info.uuid[3], config)
is_need_epc(vm_info.epc_section, 3, config)
vcpu_affinity_output(vm_info, 3, config)
print("\t\t.severity = {0},".format(vm_info.severity[3].strip()), file=config)
print("\t\t.vuart[0] = {", file=config)
print("\t\t\t.type = VUART_LEGACY_PIO,", file=config)
print("\t\t\t.addr.port_base = INVALID_COM_BASE,", file=config)
@ -521,6 +528,7 @@ def gen_industry_source(vm_info, config):
print("\t\t.guest_flags = {0},".format(sos_guest_flags), file=config)
vcpu_affinity_output(vm_info, i, config)
print("\t\t.severity = {0},".format(vm_info.severity[i].strip()), file=config)
if i == 0:
if vm_info.clos_set[i] == None or not vm_info.clos_set[i].strip():
@ -592,6 +600,7 @@ def gen_hybrid_source(vm_info, config):
print("\t\t.guest_flags = {0},".format(sos_guest_flags), file=config)
vcpu_affinity_output(vm_info, i, config)
print("\t\t.severity = {0},".format(vm_info.severity[i].strip()), file=config)
if i != 2:
if vm_info.clos_set[i] == None or not vm_info.clos_set[i].strip():