acrn-config: add 'virtio-console' mediator support for launch config

Add virtio-console mediator support to parse and get 'virtio-console' item value
from launch config files, these values are editable by user.

Tracked-On: #4186
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-06 10:00:49 +08:00 committed by wenlingz
parent b6bffd01ff
commit bad3c53c1e
4 changed files with 12 additions and 16 deletions

View File

@ -465,6 +465,12 @@ def virtio_args_set(dm, virt_io, vmid, config):
net_name = net.split(',')[0]
print(" -s {},virtio-net,{} \\".format(launch_cfg_lib.virtual_dev_slot("virtio-net{}".format(net)), net_name), file=config)
# virtio-console set, the value type is a string
if virt_io['console'][vmid]:
print(" -s {},virtio-console,{} \\".format(
launch_cfg_lib.virtual_dev_slot("virtio-console"),
virt_io['console'][vmid]), file=config)
def dm_arg_set(names, sel, virt_io, dm, vmid, config):
@ -545,15 +551,9 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
vboot_arg_set(dm, vmid, config)
# redirect console
if dm['console_type'][vmid] == "com1(ttyS0)":
if dm['vuart0'][vmid] == "Enable":
print(" -s 1:0,lpc \\", file=config)
print(" -l com1,stdio \\", file=config)
print(" -s {},{} \\".format(launch_cfg_lib.virtual_dev_slot("com1(ttyS0)"),
launch_cfg_lib.RE_CONSOLE_MAP['com1(ttyS0)']), file=config)
else:
print(" -s {},{} \\".format(
launch_cfg_lib.virtual_dev_slot("virtio-console(hvc0)"),
launch_cfg_lib.RE_CONSOLE_MAP['virtio-console(hvc0)']), file=config)
if uos_type in ("CLEARLINUX", "ANDROID", "ALIOS"):
print(" -s {},virtio-hyper_dmabuf \\".format(launch_cfg_lib.virtual_dev_slot("virtio-hyper_dmabuf")), file=config)

View File

@ -45,7 +45,7 @@ def get_launch_item_values(board_info):
launch_item_values["uos,rtos_type"] = launch_cfg_lib.RTOS_TYPE
launch_item_values["uos,vbootloader"] = launch_cfg_lib.BOOT_TYPE
launch_item_values['uos,console_type'] = launch_cfg_lib.REDIRECT_CONSOLE
launch_item_values['uos,vuart0'] = launch_cfg_lib.DM_VUART0
launch_item_values['uos,gvt_args'] = launch_cfg_lib.GVT_ARGS
return launch_item_values

View File

@ -19,7 +19,7 @@ class AcrnDmArgs:
self.args["mem_size"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "mem_size")
self.args["gvt_args"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "gvt_args")
self.args["vbootloader"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "vbootloader")
self.args["console_type"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "console_type")
self.args["vuart0"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "vuart0")
self.args["off_pcpus"] = launch_cfg_lib.get_leaf_tag_map(self.scenario_info, "vcpu_affinity", "pcpu_id")
self.args["xhci"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "usb_xhci")
@ -30,7 +30,7 @@ class AcrnDmArgs:
launch_cfg_lib.mem_size_check(self.args["mem_size"], "mem_size")
launch_cfg_lib.args_aval_check(self.args["gvt_args"], "gvt_args", launch_cfg_lib.GVT_ARGS)
launch_cfg_lib.args_aval_check(self.args["vbootloader"], "vbootloader", launch_cfg_lib.BOOT_TYPE)
launch_cfg_lib.args_aval_check(self.args["console_type"], "console_type", launch_cfg_lib.REDIRECT_CONSOLE)
launch_cfg_lib.args_aval_check(self.args["vuart0"], "vuart0", launch_cfg_lib.DM_VUART0)
class AvailablePthru():
@ -152,3 +152,4 @@ class VirtioDeviceSelect():
self.dev["input"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "virtio_devices", "input")
self.dev["block"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "virtio_devices", "block")
self.dev["network"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "virtio_devices", "network")
self.dev["console"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "virtio_devices", "console")

View File

@ -15,15 +15,10 @@ LAUNCH_INFO_FILE = ""
ERR_LIST = {}
BOOT_TYPE = ['no', 'vsbl', 'ovmf']
RTOS_TYPE = ['no', 'Soft RT', 'Hard RT']
REDIRECT_CONSOLE = ['com1(ttyS0)', 'virtio-console(hvc0)']
DM_VUART0 = ['Disable', 'Enable']
UOS_TYPES = ['CLEARLINUX', 'ANDROID', 'ALIOS', 'PREEMPT-RT LINUX', 'VXWORKS', 'WINDOWS', 'ZEPHYR', 'GENERIC LINUX']
GVT_ARGS = ['64 448 8']
RE_CONSOLE_MAP = {
"com1(ttyS0)":"virtio-console,@pty:pty_port",
"virtio-console(hvc0)":"virtio-console,@stdio:stdio_port"
}
PT_SUB_PCI = {}
PT_SUB_PCI['usb_xdci'] = ['USB controller']
PT_SUB_PCI['ipu'] = ['Multimedia controller']