mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-05 05:32:05 +00:00
acrn-config: add pci vuart to launch script
Add pci vuart to launch script if the pci vuart is enabled. Add pci vuart sanity check for launch script: - vuart0 and console vuart cannot be enabled at the same time - vuart1 cannot be eabled if the legacy vuart 1 is enabled Tracked-On: #5425 Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
This commit is contained in:
parent
6ecd58f51a
commit
29fbefea74
@ -636,6 +636,16 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
print(" -s {},wdt-i6300esb \\".format(launch_cfg_lib.virtual_dev_slot("wdt-i6300esb")), file=config)
|
||||
|
||||
set_dm_pt(names, sel, vmid, config)
|
||||
|
||||
if dm['console_vuart'][vmid] == "Enable":
|
||||
print(" -s {},uart,vuart_idx:0 \\".format(launch_cfg_lib.virtual_dev_slot("console_vuart")), file=config)
|
||||
for vuart_id in dm["communication_vuarts"][vmid]:
|
||||
if not vuart_id:
|
||||
break
|
||||
print(" -s {},uart,vuart_idx:{} \\".format(
|
||||
launch_cfg_lib.virtual_dev_slot("communication_vuart_{}".format(vuart_id)), vuart_id), file=config)
|
||||
|
||||
|
||||
print(" $vm_name", file=config)
|
||||
print("}", file=config)
|
||||
|
||||
|
@ -34,6 +34,8 @@ class AcrnDmArgs:
|
||||
else:
|
||||
self.args["shm_regions"][vmid] = []
|
||||
self.args["xhci"] = common.get_leaf_tag_map(self.launch_info, "usb_xhci")
|
||||
self.args["communication_vuarts"] = common.get_leaf_tag_map(self.launch_info, "communication_vuarts", "communication_vuart")
|
||||
self.args["console_vuart"] = common.get_leaf_tag_map(self.launch_info, "console_vuart")
|
||||
|
||||
def check_item(self):
|
||||
(rootfs, num) = board_cfg_lib.get_rootfs(self.board_info)
|
||||
@ -46,6 +48,8 @@ class AcrnDmArgs:
|
||||
err_dic = scenario_cfg_lib.vm_cpu_affinity_check(self.launch_info, cpu_affinity, "pcpu_id")
|
||||
launch_cfg_lib.ERR_LIST.update(err_dic)
|
||||
launch_cfg_lib.check_shm_regions(self.args["shm_regions"], self.scenario_info)
|
||||
launch_cfg_lib.check_console_vuart(self.args["console_vuart"],self.args["vuart0"], self.scenario_info)
|
||||
launch_cfg_lib.check_communication_vuart(self.args["communication_vuarts"], self.scenario_info)
|
||||
|
||||
|
||||
class AvailablePthru():
|
||||
|
@ -21,7 +21,7 @@ PY_CACHES = ["__pycache__", "../board_config/__pycache__", "../scenario_config/_
|
||||
GUEST_FLAG = ["0UL", "GUEST_FLAG_SECURE_WORLD_ENABLED", "GUEST_FLAG_LAPIC_PASSTHROUGH",
|
||||
"GUEST_FLAG_IO_COMPLETION_POLLING", "GUEST_FLAG_HIDE_MTRR", "GUEST_FLAG_RT"]
|
||||
|
||||
MULTI_ITEM = ["guest_flag", "pcpu_id", "vcpu_clos", "input", "block", "network", "pci_dev", "shm_region"]
|
||||
MULTI_ITEM = ["guest_flag", "pcpu_id", "vcpu_clos", "input", "block", "network", "pci_dev", "shm_region", "communication_vuart"]
|
||||
|
||||
SIZE_K = 1024
|
||||
SIZE_M = SIZE_K * 1024
|
||||
@ -48,6 +48,7 @@ class MultiItem():
|
||||
self.vir_network = []
|
||||
self.pci_dev = []
|
||||
self.shm_region = []
|
||||
self.communication_vuart = []
|
||||
|
||||
class TmpItem():
|
||||
|
||||
@ -289,6 +290,10 @@ def get_leaf_value(tmp, tag_str, leaf):
|
||||
if leaf.tag == "shm_region" and tag_str == "shm_region":
|
||||
tmp.multi.shm_region.append(leaf.text)
|
||||
|
||||
# get communication_vuart for vm
|
||||
if leaf.tag == "communication_vuart" and tag_str == "communication_vuart":
|
||||
tmp.multi.communication_vuart.append(leaf.text)
|
||||
|
||||
|
||||
def get_sub_value(tmp, tag_str, vm_id):
|
||||
|
||||
@ -324,6 +329,10 @@ def get_sub_value(tmp, tag_str, vm_id):
|
||||
if tmp.multi.shm_region and tag_str == "shm_region":
|
||||
tmp.tag[vm_id] = tmp.multi.shm_region
|
||||
|
||||
# append communication_vuart for vm
|
||||
if tmp.multi.communication_vuart and tag_str == "communication_vuart":
|
||||
tmp.tag[vm_id] = tmp.multi.communication_vuart
|
||||
|
||||
|
||||
def get_leaf_tag_map(config_file, branch_tag, tag_str=''):
|
||||
"""
|
||||
|
@ -634,3 +634,38 @@ def check_shm_regions(launch_shm_regions, scenario_info):
|
||||
ERR_LIST[shm_region_key] = "shm {} should be configured in scenario setting and the size should be decimal" \
|
||||
"in MB and spaces should not exist.".format(shm_region)
|
||||
return
|
||||
|
||||
|
||||
def check_console_vuart(launch_console_vuart, vuart0, scenario_info):
|
||||
vuarts = common.get_vuart_info(scenario_info)
|
||||
|
||||
for uos_id, console_vuart_enable in launch_console_vuart.items():
|
||||
key = 'uos:id={},console_vuart'.format(uos_id)
|
||||
if console_vuart_enable == "Enable" and vuart0[uos_id] == "Enable":
|
||||
ERR_LIST[key] = "vuart0 and console_vuart of uos {} should not be enabled " \
|
||||
"at the same time".format(uos_id)
|
||||
return
|
||||
if console_vuart_enable == "Enable" and int(uos_id) in vuarts.keys() \
|
||||
and 0 in vuarts[uos_id] and vuarts[uos_id][0]['base'] == "INVALID_PCI_BASE":
|
||||
ERR_LIST[key] = "console_vuart of uos {} should be enabled in scenario setting".format(uos_id)
|
||||
return
|
||||
|
||||
|
||||
def check_communication_vuart(launch_communication_vuarts, scenario_info):
|
||||
vuarts = common.get_vuart_info(scenario_info)
|
||||
vuart1_setting = common.get_vuart_info_id(common.SCENARIO_INFO_FILE, 1)
|
||||
|
||||
for uos_id, vuart_list in launch_communication_vuarts.items():
|
||||
vuart_key = 'uos:id={},communication_vuarts,communication_vuart'.format(uos_id)
|
||||
for vuart_id in vuart_list:
|
||||
if not vuart_id:
|
||||
return
|
||||
if int(vuart_id) not in vuarts[uos_id].keys():
|
||||
ERR_LIST[vuart_key] = "communication_vuart {} of uos {} should be configured" \
|
||||
"in scenario setting.".format(vuart_id, uos_id)
|
||||
return
|
||||
if int(vuart_id) == 1 and vuarts[uos_id][1]['base'] != "INVALID_PCI_BASE":
|
||||
if uos_id in vuart1_setting.keys() and vuart1_setting[uos_id]['base'] != "INVALID_COM_BASE":
|
||||
ERR_LIST[vuart_key] = "uos {}'s communication_vuart 1 and legacy_vuart 1 should " \
|
||||
"not be configured at the same time.".format(uos_id)
|
||||
return
|
Loading…
Reference in New Issue
Block a user