mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-09 12:49:24 +00:00
ACRN: misc: Unify terminology for service vm/user vm
Rename SOS_VM type to SERVICE_VM rename UOS to User VM in XML description rename uos_thread_pid to user_vm_thread_pid rename devname_uos to devname_user_vm rename uosid to user_vmid rename UOS_ACK to USER_VM_ACK rename SOS_VM_CONFIG_CPU_AFFINITY to SERVICE_VM_CONFIG_CPU_AFFINITY rename SOS_COM to SERVICE_VM_COM rename SOS_UART1_VALID_NUM" to SERVICE_VM_UART1_VALID_NUM rename SOS_BOOTARGS_DIFF to SERVICE_VM_BOOTARGS_DIFF rename uos to user_vm in launch script and xml Tracked-On: #6744 Signed-off-by: Liu Long <long.liu@linux.intel.com> Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
@@ -10,10 +10,10 @@ import pt
|
||||
|
||||
|
||||
def is_nuc_whl_linux(names, vmid):
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
board_name = names['board_name']
|
||||
|
||||
if launch_cfg_lib.is_linux_like(uos_type) and board_name not in ("apl-mrb", "apl-up2"):
|
||||
if launch_cfg_lib.is_linux_like(user_vm_type) and board_name not in ("apl-mrb", "apl-up2"):
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -27,13 +27,13 @@ def is_mount_needed(virt_io, vmid):
|
||||
return False
|
||||
|
||||
|
||||
def tap_uos_net(names, virt_io, vmid, config):
|
||||
uos_type = names['uos_types'][vmid]
|
||||
def tap_user_vm_net(names, virt_io, vmid, config):
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
board_name = names['board_name']
|
||||
|
||||
vm_name = common.undline_name(uos_type).lower()
|
||||
vm_name = common.undline_name(user_vm_type).lower()
|
||||
|
||||
if launch_cfg_lib.is_linux_like(uos_type) or uos_type in ("ANDROID", "ALIOS"):
|
||||
if launch_cfg_lib.is_linux_like(user_vm_type) or user_vm_type in ("ANDROID", "ALIOS"):
|
||||
i = 0
|
||||
for mount_flag in launch_cfg_lib.MOUNT_FLAG_DIC[vmid]:
|
||||
if not mount_flag:
|
||||
@@ -48,7 +48,7 @@ def tap_uos_net(names, virt_io, vmid, config):
|
||||
print("", file=config)
|
||||
i += 1
|
||||
|
||||
print("#vm-name used to generate uos-mac address", file=config)
|
||||
print("#vm-name used to generate user-vm-mac address", file=config)
|
||||
print("mac=$(cat /sys/class/net/e*/address)", file=config)
|
||||
print("vm_name=post_vm_id$1", file=config)
|
||||
print("mac_seed=${mac:0:17}-${vm_name}", file=config)
|
||||
@@ -72,11 +72,11 @@ def tap_uos_net(names, virt_io, vmid, config):
|
||||
print("", file=config)
|
||||
|
||||
|
||||
def off_line_cpus(args, vmid, uos_type, config):
|
||||
def off_line_cpus(args, vmid, user_vm_type, config):
|
||||
"""
|
||||
:param args: the dictionary of argument for acrn-dm
|
||||
:param vmid: ID of the vm
|
||||
:param uos_type: the type of UOS
|
||||
:param user_vm_type: the type of User VM
|
||||
:param config: it is a file pointer to write offline cpu information
|
||||
"""
|
||||
pcpu_id_list = get_cpu_affinity_list(args["cpu_affinity"], vmid)
|
||||
@@ -89,7 +89,7 @@ def off_line_cpus(args, vmid, uos_type, config):
|
||||
key = "scenario config error"
|
||||
launch_cfg_lib.ERR_LIST[key] = "No available cpu to offline and pass it to vm {}".format(vmid)
|
||||
|
||||
print("# offline pinned vCPUs from SOS before launch UOS", file=config)
|
||||
print("# offline pinned vCPUs from Service VM before launch User VM", file=config)
|
||||
print('cpu_path="/sys/devices/system/cpu"', file=config)
|
||||
print("for i in `ls ${cpu_path}`; do", file=config)
|
||||
print(" for j in {}; do".format(' '.join([str(i) for i in pcpu_id_list])), file=config)
|
||||
@@ -114,18 +114,18 @@ def off_line_cpus(args, vmid, uos_type, config):
|
||||
print("", file=config)
|
||||
|
||||
|
||||
def run_container(board_name, uos_type, config):
|
||||
def run_container(board_name, user_vm_type, config):
|
||||
"""
|
||||
The container contains the clearlinux as rootfs
|
||||
:param board_name: board name
|
||||
:param uos_type: the os name of user os
|
||||
:param user_vm_type: the os name of user os
|
||||
:param config: the file pointer to store the information
|
||||
"""
|
||||
# the runC.json is store in the path under board name, but for nuc7i7dnb/nuc6cayh/kbl-nuc-i7 is under nuc/
|
||||
if 'nuc' in board_name:
|
||||
board_name = 'nuc'
|
||||
|
||||
if board_name not in ("apl-mrb", "nuc") or not launch_cfg_lib.is_linux_like(uos_type):
|
||||
if board_name not in ("apl-mrb", "nuc") or not launch_cfg_lib.is_linux_like(user_vm_type):
|
||||
return
|
||||
|
||||
print("function run_container()", file=config)
|
||||
@@ -221,7 +221,7 @@ def interrupt_storm(pt_sel, config):
|
||||
print("", file=config)
|
||||
|
||||
|
||||
def gvt_arg_set(dm, vmid, uos_type, config):
|
||||
def gvt_arg_set(dm, vmid, user_vm_type, config):
|
||||
|
||||
gvt_args = dm['gvt_args'][vmid]
|
||||
gpu_bdf = launch_cfg_lib.get_gpu_bdf()
|
||||
@@ -234,7 +234,7 @@ def gvt_arg_set(dm, vmid, uos_type, config):
|
||||
elif gvt_args:
|
||||
print(' -s 2,pci-gvt -G "$2" \\', file=config)
|
||||
|
||||
def log_level_set(uos_type, config):
|
||||
def log_level_set(user_vm_type, config):
|
||||
|
||||
print("#logger_setting, format: logger_name,level; like following", file=config)
|
||||
print('logger_setting="--logger_setting console,level=4;kmsg,level=3;disk,level=5"', file=config)
|
||||
@@ -274,17 +274,17 @@ def tap_network(virt_io, vmid, config):
|
||||
|
||||
def launch_begin(names, virt_io, vmid, config):
|
||||
board_name = names['board_name']
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
|
||||
launch_uos = common.undline_name(uos_type).lower()
|
||||
launch_uos = common.undline_name(user_vm_type).lower()
|
||||
tap_network(virt_io, vmid, config)
|
||||
run_container(board_name, uos_type, config)
|
||||
run_container(board_name, user_vm_type, config)
|
||||
print("function launch_{}()".format(launch_uos), file=config)
|
||||
print("{", file=config)
|
||||
|
||||
|
||||
def wa_usage(uos_type, config):
|
||||
if uos_type in ("ANDROID", "ALIOS"):
|
||||
def wa_usage(user_vm_type, config):
|
||||
if user_vm_type in ("ANDROID", "ALIOS"):
|
||||
print("# WA for USB role switch hang issue, disable runtime PM of xHCI device", file=config)
|
||||
print("echo on > /sys/devices/pci0000:00/0000:00:15.0/power/control", file=config)
|
||||
print("", file=config)
|
||||
@@ -295,16 +295,16 @@ def mem_size_set(args, vmid, config):
|
||||
print("mem_size={}M".format(mem_size), file=config)
|
||||
|
||||
|
||||
def uos_launch(names, args, virt_io, vmid, config):
|
||||
def user_vm_launch(names, args, virt_io, vmid, config):
|
||||
|
||||
gvt_args = args['gvt_args'][vmid]
|
||||
uos_type = names['uos_types'][vmid]
|
||||
launch_uos = common.undline_name(uos_type).lower()
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
launch_uos = common.undline_name(user_vm_type).lower()
|
||||
board_name = names['board_name']
|
||||
if 'nuc' in board_name:
|
||||
board_name = 'nuc'
|
||||
|
||||
if uos_type == "CLEARLINUX" and board_name in ("apl-mrb", "nuc"):
|
||||
if user_vm_type == "CLEARLINUX" and board_name in ("apl-mrb", "nuc"):
|
||||
print('if [ "$1" = "-C" ];then', file=config)
|
||||
print(' if [ $(hostname) = "runc" ]; then', file=config)
|
||||
print(' echo "Already in container exit!"', file=config)
|
||||
@@ -362,10 +362,10 @@ def uos_launch(names, args, virt_io, vmid, config):
|
||||
def launch_end(names, args, virt_io, vmid, config):
|
||||
|
||||
board_name = names['board_name']
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
mem_size = args["mem_size"][vmid]
|
||||
|
||||
if uos_type in ("CLEARLINUX", "ANDROID", "ALIOS") and not is_nuc_whl_linux(names, vmid):
|
||||
if user_vm_type in ("CLEARLINUX", "ANDROID", "ALIOS") and not is_nuc_whl_linux(names, vmid):
|
||||
print("debug=0", file=config)
|
||||
print("", file=config)
|
||||
print('while getopts "hdC" opt', file=config)
|
||||
@@ -404,18 +404,18 @@ def launch_end(names, args, virt_io, vmid, config):
|
||||
|
||||
sos_vmid = launch_cfg_lib.get_sos_vmid()
|
||||
if args['cpu_sharing'] == "SCHED_NOOP" or common.VM_TYPES[vmid+sos_vmid] == "POST_RT_VM":
|
||||
off_line_cpus(args, vmid, uos_type, config)
|
||||
off_line_cpus(args, vmid, user_vm_type, config)
|
||||
|
||||
uos_launch(names, args, virt_io, vmid, config)
|
||||
user_vm_launch(names, args, virt_io, vmid, config)
|
||||
|
||||
|
||||
def set_dm_pt(names, sel, vmid, config, dm):
|
||||
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
|
||||
if sel.bdf['usb_xdci'][vmid] and sel.slot['usb_xdci'][vmid]:
|
||||
sub_attr = ''
|
||||
if uos_type == "WINDOWS":
|
||||
if user_vm_type == "WINDOWS":
|
||||
sub_attr = ',d3hot_reset'
|
||||
print(' -s {},passthru,{}/{}/{}{} \\'.format(sel.slot["usb_xdci"][vmid], sel.bdf["usb_xdci"][vmid][0:2],\
|
||||
sel.bdf["usb_xdci"][vmid][3:5], sel.bdf["usb_xdci"][vmid][6:7], sub_attr), file=config)
|
||||
@@ -436,7 +436,7 @@ def set_dm_pt(names, sel, vmid, config, dm):
|
||||
sel.bdf["bluetooth"][vmid][3:5], sel.bdf["bluetooth"][vmid][6:7]), file=config)
|
||||
|
||||
if sel.bdf['wifi'][vmid] and sel.slot['wifi'][vmid]:
|
||||
if uos_type == "ANDROID":
|
||||
if user_vm_type == "ANDROID":
|
||||
print(" -s {},passthru,{}/{}/{},keep_gsi \\".format(sel.slot["wifi"][vmid], sel.bdf["wifi"][vmid][0:2], \
|
||||
sel.bdf["wifi"][vmid][3:5], sel.bdf["wifi"][vmid][6:7]), file=config)
|
||||
else:
|
||||
@@ -530,9 +530,9 @@ def virtio_args_set(dm, virt_io, vmid, config):
|
||||
|
||||
def get_cpu_affinity_list(cpu_affinity, vmid):
|
||||
pcpu_id_list = ''
|
||||
for uos_id,cpus in cpu_affinity.items():
|
||||
if vmid == uos_id:
|
||||
pcpu_id_list = [id for id in list(cpu_affinity[uos_id]) if id != None]
|
||||
for user_vmid,cpus in cpu_affinity.items():
|
||||
if vmid == user_vmid:
|
||||
pcpu_id_list = [id for id in list(cpu_affinity[user_vmid]) if id != None]
|
||||
return pcpu_id_list
|
||||
|
||||
|
||||
@@ -547,7 +547,7 @@ def pcpu_arg_set(dm, vmid, config):
|
||||
|
||||
def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
board_name = names['board_name']
|
||||
|
||||
boot_image_type(dm, vmid, config)
|
||||
@@ -558,8 +558,8 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
|
||||
# clearlinux/android/alios
|
||||
print('acrn-dm -A -m $mem_size -s 0:0,hostbridge -U {} \\'.format(scenario_uuid), file=config)
|
||||
if launch_cfg_lib.is_linux_like(uos_type) or uos_type in ("ANDROID", "ALIOS"):
|
||||
if uos_type in ("ANDROID", "ALIOS"):
|
||||
if launch_cfg_lib.is_linux_like(user_vm_type) or user_vm_type in ("ANDROID", "ALIOS"):
|
||||
if user_vm_type in ("ANDROID", "ALIOS"):
|
||||
print(' $npk_virt \\', file=config)
|
||||
print(" -s {},virtio-rpmb \\".format(launch_cfg_lib.virtual_dev_slot("virtio-rpmb")), file=config)
|
||||
print(" --enable_trusty \\", file=config)
|
||||
@@ -577,7 +577,7 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
print(" --lapic_pt \\", file=config)
|
||||
|
||||
# windows
|
||||
if uos_type == "WINDOWS":
|
||||
if user_vm_type == "WINDOWS":
|
||||
print(" --windows \\", file=config)
|
||||
|
||||
# pm_channel set
|
||||
@@ -591,11 +591,11 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
if pm_key == "vuart1(tty)":
|
||||
vuart_base = launch_cfg_lib.get_vuart1_from_scenario(sos_vmid + vmid)
|
||||
if vuart_base == "INVALID_COM_BASE":
|
||||
err_key = "uos:id={}:poweroff_channel".format(vmid)
|
||||
launch_cfg_lib.ERR_LIST[err_key] = "vuart1 of VM{} in scenario file should select 'SOS_COM2_BASE'".format(sos_vmid + vmid)
|
||||
err_key = "user_vm:id={}:poweroff_channel".format(vmid)
|
||||
launch_cfg_lib.ERR_LIST[err_key] = "vuart1 of VM{} in scenario file should select 'SERVICE_VM_COM2_BASE'".format(sos_vmid + vmid)
|
||||
return
|
||||
scenario_cfg_lib.get_sos_vuart_settings()
|
||||
print(" {} \\".format(pm_vuart + launch_cfg_lib.PM_CHANNEL_DIC[pm_key] + scenario_cfg_lib.SOS_UART1_VALID_NUM), file=config)
|
||||
print(" {} \\".format(pm_vuart + launch_cfg_lib.PM_CHANNEL_DIC[pm_key] + scenario_cfg_lib.SERVICE_VM_UART1_VALID_NUM), file=config)
|
||||
elif pm_key == "vuart1(pty)":
|
||||
print(" {} \\".format(pm_vuart + launch_cfg_lib.PM_CHANNEL_DIC[pm_key]), file=config)
|
||||
else:
|
||||
@@ -605,7 +605,7 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
print(" $logger_setting \\", file=config)
|
||||
|
||||
# GVT args set
|
||||
gvt_arg_set(dm, vmid, uos_type, config)
|
||||
gvt_arg_set(dm, vmid, user_vm_type, config)
|
||||
|
||||
# XHCI args set
|
||||
xhci_args_set(dm, vmid, config)
|
||||
@@ -628,7 +628,7 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
ssram_enabled = common.get_hv_item_tag(common.SCENARIO_INFO_FILE, "FEATURES", "SSRAM", "SSRAM_ENABLED")
|
||||
except:
|
||||
pass
|
||||
if uos_type == "PREEMPT-RT LINUX" and ssram_enabled == 'y':
|
||||
if user_vm_type == "PREEMPT-RT LINUX" and ssram_enabled == 'y':
|
||||
print(" --ssram \\", file=config)
|
||||
|
||||
for value in sel.bdf.values():
|
||||
@@ -636,14 +636,14 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
print(" $intr_storm_monitor \\", file=config)
|
||||
break
|
||||
|
||||
if uos_type != "PREEMPT-RT LINUX":
|
||||
if user_vm_type != "PREEMPT-RT LINUX":
|
||||
print(" -s 1:0,lpc \\", file=config)
|
||||
|
||||
# redirect console
|
||||
if dm['vuart0'][vmid] == "Enable":
|
||||
print(" -l com1,stdio \\", file=config)
|
||||
|
||||
if launch_cfg_lib.is_linux_like(uos_type) or uos_type in ("ANDROID", "ALIOS"):
|
||||
if launch_cfg_lib.is_linux_like(user_vm_type) or user_vm_type in ("ANDROID", "ALIOS"):
|
||||
if board_name == "apl-mrb":
|
||||
print(" -i /run/acrn/ioc_$vm_name,0x20 \\", file=config)
|
||||
print(" -l com2,/run/acrn/ioc_$vm_name \\", file=config)
|
||||
@@ -669,21 +669,21 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||
def gen(names, pt_sel, virt_io, dm, vmid, config):
|
||||
|
||||
board_name = names['board_name']
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
|
||||
# passthrough bdf/vpid dictionay
|
||||
pt.gen_pt_head(names, dm, pt_sel, vmid, config)
|
||||
|
||||
# gen launch header
|
||||
launch_begin(names, virt_io, vmid, config)
|
||||
tap_uos_net(names, virt_io, vmid, config)
|
||||
tap_user_vm_net(names, virt_io, vmid, config)
|
||||
|
||||
# passthrough device
|
||||
pt.gen_pt(names, dm, pt_sel, vmid, config)
|
||||
wa_usage(uos_type, config)
|
||||
wa_usage(user_vm_type, config)
|
||||
mem_size_set(dm, vmid, config)
|
||||
interrupt_storm(pt_sel, config)
|
||||
log_level_set(uos_type, config)
|
||||
log_level_set(user_vm_type, config)
|
||||
|
||||
# gen acrn-dm args
|
||||
dm_arg_set(names, pt_sel, virt_io, dm, vmid, config)
|
||||
|
@@ -31,29 +31,29 @@ def get_launch_item_values(board_info, scenario_info=None):
|
||||
pthru.insert_nun()
|
||||
|
||||
# pre passthrough device for ui
|
||||
launch_item_values["uos,passthrough_devices,usb_xdci"] = pthru.avl["usb_xdci"]
|
||||
launch_item_values["uos,passthrough_devices,ipu"] = pthru.avl["ipu"]
|
||||
launch_item_values["uos,passthrough_devices,ipu_i2c"] = pthru.avl["ipu_i2c"]
|
||||
launch_item_values["uos,passthrough_devices,cse"] = pthru.avl["cse"]
|
||||
launch_item_values["uos,passthrough_devices,audio"] = pthru.avl["audio"]
|
||||
launch_item_values["uos,passthrough_devices,audio_codec"] = pthru.avl["audio_codec"]
|
||||
launch_item_values["uos,passthrough_devices,sd_card"] = pthru.avl["sd_card"]
|
||||
launch_item_values["uos,passthrough_devices,wifi"] = pthru.avl["wifi"]
|
||||
launch_item_values["uos,passthrough_devices,ethernet"] = pthru.avl["ethernet"]
|
||||
launch_item_values["uos,passthrough_devices,sata"] = pthru.avl["sata"]
|
||||
launch_item_values["uos,passthrough_devices,nvme"] = pthru.avl["nvme"]
|
||||
launch_item_values["uos,passthrough_devices,bluetooth"] = pthru.avl["bluetooth"]
|
||||
launch_item_values["user_vm,passthrough_devices,usb_xdci"] = pthru.avl["usb_xdci"]
|
||||
launch_item_values["user_vm,passthrough_devices,ipu"] = pthru.avl["ipu"]
|
||||
launch_item_values["user_vm,passthrough_devices,ipu_i2c"] = pthru.avl["ipu_i2c"]
|
||||
launch_item_values["user_vm,passthrough_devices,cse"] = pthru.avl["cse"]
|
||||
launch_item_values["user_vm,passthrough_devices,audio"] = pthru.avl["audio"]
|
||||
launch_item_values["user_vm,passthrough_devices,audio_codec"] = pthru.avl["audio_codec"]
|
||||
launch_item_values["user_vm,passthrough_devices,sd_card"] = pthru.avl["sd_card"]
|
||||
launch_item_values["user_vm,passthrough_devices,wifi"] = pthru.avl["wifi"]
|
||||
launch_item_values["user_vm,passthrough_devices,ethernet"] = pthru.avl["ethernet"]
|
||||
launch_item_values["user_vm,passthrough_devices,sata"] = pthru.avl["sata"]
|
||||
launch_item_values["user_vm,passthrough_devices,nvme"] = pthru.avl["nvme"]
|
||||
launch_item_values["user_vm,passthrough_devices,bluetooth"] = pthru.avl["bluetooth"]
|
||||
|
||||
# acrn dm available optargs
|
||||
launch_item_values['uos,uos_type'] = launch_cfg_lib.UOS_TYPES
|
||||
launch_item_values["uos,rtos_type"] = launch_cfg_lib.RTOS_TYPE
|
||||
launch_item_values['user_vm,user_vm_type'] = launch_cfg_lib.USER_VM_TYPES
|
||||
launch_item_values["user_vm,rtos_type"] = launch_cfg_lib.RTOS_TYPE
|
||||
|
||||
launch_item_values["uos,vbootloader"] = launch_cfg_lib.BOOT_TYPE
|
||||
launch_item_values['uos,vuart0'] = launch_cfg_lib.DM_VUART0
|
||||
launch_item_values['uos,poweroff_channel'] = launch_cfg_lib.PM_CHANNEL
|
||||
launch_item_values["uos,cpu_affinity"] = board_cfg_lib.get_processor_info()
|
||||
launch_item_values['uos,enable_ptm'] = launch_cfg_lib.y_n
|
||||
launch_item_values['uos,allow_trigger_s5'] = launch_cfg_lib.y_n
|
||||
launch_item_values["user_vm,vbootloader"] = launch_cfg_lib.BOOT_TYPE
|
||||
launch_item_values['user_vm,vuart0'] = launch_cfg_lib.DM_VUART0
|
||||
launch_item_values['user_vm,poweroff_channel'] = launch_cfg_lib.PM_CHANNEL
|
||||
launch_item_values["user_vm,cpu_affinity"] = board_cfg_lib.get_processor_info()
|
||||
launch_item_values['user_vm,enable_ptm'] = launch_cfg_lib.y_n
|
||||
launch_item_values['user_vm,allow_trigger_s5'] = launch_cfg_lib.y_n
|
||||
launch_cfg_lib.set_shm_regions(launch_item_values, scenario_info)
|
||||
launch_cfg_lib.set_pci_vuarts(launch_item_values, scenario_info)
|
||||
|
||||
@@ -99,7 +99,7 @@ def validate_launch_setting(board_info, scenario_info, launch_info):
|
||||
def ui_entry_api(board_info, scenario_info, launch_info, out=''):
|
||||
|
||||
err_dic = {}
|
||||
arg_list = ['launch_cfg_gen.py', '--board', board_info, '--scenario', scenario_info, '--launch', launch_info, '--uosid', '0', '--out', out]
|
||||
arg_list = ['launch_cfg_gen.py', '--board', board_info, '--scenario', scenario_info, '--launch', launch_info, '--user_vmid', '0', '--out', out]
|
||||
|
||||
err_dic = common.prepare()
|
||||
if err_dic:
|
||||
@@ -113,9 +113,9 @@ def get_names():
|
||||
|
||||
names = {}
|
||||
|
||||
# get uos name
|
||||
uos_types = launch_cfg_lib.get_uos_type()
|
||||
names['uos_types'] = uos_types
|
||||
# get User Vm name
|
||||
user_vm_types = launch_cfg_lib.get_user_vm_type()
|
||||
names['user_vm_types'] = user_vm_types
|
||||
|
||||
# get board name
|
||||
(err_dic, board_name) = common.get_board_name()
|
||||
@@ -134,13 +134,13 @@ def get_names():
|
||||
|
||||
def generate_script_file(names, pt_sel, virt_io, dm, vmid, config):
|
||||
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
board_name = names['board_name']
|
||||
scenario_name = names['scenario_name']
|
||||
|
||||
header_info = "#!/bin/bash\n" +\
|
||||
"# board: {}, scenario: {}, uos: {}".format(
|
||||
board_name.upper(), scenario_name.upper(), uos_type.upper())
|
||||
"# board: {}, scenario: {}, user_vm: {}".format(
|
||||
board_name.upper(), scenario_name.upper(), user_vm_type.upper())
|
||||
|
||||
print("{}".format(header_info), file=config)
|
||||
com.gen(names, pt_sel, virt_io, dm, vmid, config)
|
||||
@@ -179,15 +179,15 @@ def main(args):
|
||||
# get toatl post vm number and total vm in launch config file
|
||||
(launch_vm_count, post_vm_count) = launch_cfg_lib.get_post_vm_cnt()
|
||||
if vm_th < 0 or vm_th > post_vm_count:
|
||||
err_dic['uosid err:'] = "--uosid shoudl be positive and less than total post vm count in scenario"
|
||||
err_dic['user_vmid err:'] = "--user_vmid shoudl be positive and less than total post vm count in scenario"
|
||||
if vm_th and vm_th not in post_num_list:
|
||||
err_dic['uosid err:'] = "--uosid generate the {} post vm, but this vm's config not in launch xml".format(vm_th)
|
||||
err_dic['user_vmid err:'] = "--user_vmid generate the {} post vm, but this vm's config not in launch xml".format(vm_th)
|
||||
if launch_vm_count > post_vm_count:
|
||||
err_dic['xm config err:'] = "too many vms config than scenario"
|
||||
|
||||
for post_num in post_num_list:
|
||||
if post_num > post_vm_count:
|
||||
err_dic['xm config err:'] = "launch xml uos id config is bigger than scenario post vm count"
|
||||
err_dic['xm config err:'] = "launch xml user vmid config is bigger than scenario post vm count"
|
||||
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
@@ -17,7 +17,7 @@ class AcrnDmArgs:
|
||||
self.launch_info = launch_info
|
||||
|
||||
def get_args(self):
|
||||
self.args["uos_type"] = common.get_leaf_tag_map(self.launch_info, "uos_type")
|
||||
self.args["user_vm_type"] = common.get_leaf_tag_map(self.launch_info, "user_vm_type")
|
||||
self.args["rtos_type"] = common.get_leaf_tag_map(self.launch_info, "rtos_type")
|
||||
self.args["mem_size"] = common.get_leaf_tag_map(self.launch_info, "mem_size")
|
||||
self.args["gvt_args"] = common.get_leaf_tag_map(self.launch_info, "gvt_args")
|
||||
@@ -41,14 +41,14 @@ class AcrnDmArgs:
|
||||
|
||||
def check_item(self):
|
||||
(rootfs, num) = board_cfg_lib.get_rootfs(self.board_info)
|
||||
launch_cfg_lib.args_aval_check(self.args["uos_type"], "uos_type", launch_cfg_lib.UOS_TYPES)
|
||||
launch_cfg_lib.args_aval_check(self.args["user_vm_type"], "user_vm_type", launch_cfg_lib.USER_VM_TYPES)
|
||||
launch_cfg_lib.args_aval_check(self.args["rtos_type"], "rtos_type", launch_cfg_lib.RTOS_TYPE)
|
||||
launch_cfg_lib.mem_size_check(self.args["mem_size"], "mem_size")
|
||||
launch_cfg_lib.args_aval_check(self.args["vbootloader"], "vbootloader", launch_cfg_lib.BOOT_TYPE)
|
||||
launch_cfg_lib.args_aval_check(self.args["vuart0"], "vuart0", launch_cfg_lib.DM_VUART0)
|
||||
launch_cfg_lib.args_aval_check(self.args["enable_ptm"], "enable_ptm", launch_cfg_lib.y_n)
|
||||
launch_cfg_lib.args_aval_check(self.args["allow_trigger_s5"], "allow_trigger_s5", launch_cfg_lib.y_n)
|
||||
cpu_affinity = launch_cfg_lib.uos_cpu_affinity(self.args["cpu_affinity"])
|
||||
cpu_affinity = launch_cfg_lib.user_vm_cpu_affinity(self.args["cpu_affinity"])
|
||||
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)
|
||||
|
@@ -115,7 +115,7 @@ def cse_pt(sel, vmid, config):
|
||||
print("", file=config)
|
||||
|
||||
|
||||
def audio_pt(uos_type, sel, vmid, config):
|
||||
def audio_pt(user_vm_type, sel, vmid, config):
|
||||
|
||||
if not sel.bdf['audio'][vmid] and not sel.bdf['audio_codec'][vmid]:
|
||||
return
|
||||
@@ -172,7 +172,7 @@ def audio_pt(uos_type, sel, vmid, config):
|
||||
print(' echo ${passthru_bdf["audio_codec"]} > /sys/bus/pci/drivers/pci-stub/bind', file=config)
|
||||
print("", file=config)
|
||||
|
||||
if uos_type == "ANDROID":
|
||||
if user_vm_type == "ANDROID":
|
||||
print(' boot_audio_option="-s {},passthru,{}/{}/{},keep_gsi '.format(
|
||||
slot_audio, bus, dev, fun), end="", file=config)
|
||||
else:
|
||||
@@ -182,7 +182,7 @@ def audio_pt(uos_type, sel, vmid, config):
|
||||
slot_codec, bus_codec, dev_codec, fun_codec), file=config)
|
||||
else:
|
||||
# only select audio device to pass through to vm
|
||||
if uos_type == "ANDROID":
|
||||
if user_vm_type == "ANDROID":
|
||||
print(' boot_audio_option="-s {},passthru,{}/{}/{},keep_gsi"'.format(
|
||||
slot_audio, bus, dev, fun), file=config)
|
||||
else:
|
||||
@@ -194,17 +194,17 @@ def audio_pt(uos_type, sel, vmid, config):
|
||||
print("fi", file=config)
|
||||
|
||||
|
||||
def media_pt(uos_type, sel, vmid, config):
|
||||
def media_pt(user_vm_type, sel, vmid, config):
|
||||
ipu_pt(sel, vmid, config)
|
||||
cse_pt(sel, vmid, config)
|
||||
audio_pt(uos_type, sel, vmid, config)
|
||||
audio_pt(user_vm_type, sel, vmid, config)
|
||||
|
||||
|
||||
def gen_pt(names, dm, sel, vmid, config):
|
||||
|
||||
pt_none = True
|
||||
cap_pt = launch_cfg_lib.get_pt_dev()
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
|
||||
print("modprobe pci_stub", file=config)
|
||||
# pass thru GPU
|
||||
@@ -224,13 +224,13 @@ def gen_pt(names, dm, sel, vmid, config):
|
||||
pass_through_dev(sel, pt_dev, vmid, config)
|
||||
continue
|
||||
|
||||
media_pt(uos_type, sel, vmid, config)
|
||||
media_pt(user_vm_type, sel, vmid, config)
|
||||
|
||||
|
||||
def gen_pt_head(names, dm, sel, vmid, config):
|
||||
|
||||
cap_pt = launch_cfg_lib.get_pt_dev()
|
||||
uos_type = names['uos_types'][vmid]
|
||||
user_vm_type = names['user_vm_types'][vmid]
|
||||
|
||||
print("# pci devices for passthru", file=config)
|
||||
print("declare -A passthru_vpid", file=config)
|
||||
|
Reference in New Issue
Block a user