コード例 #1
0
def dm_arg_set(names, sel, virt_io, dm, vmid, config):

    uos_type = names['uos_types'][vmid]
    board_name = names['board_name']

    boot_image_type(dm, vmid, config)

    # uuid get
    sos_vmid = launch_cfg_lib.get_sos_vmid()
    scenario_uuid = launch_cfg_lib.get_scenario_uuid(vmid, sos_vmid)

    # 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"):
            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)
        # mac_seed
        print("   --mac_seed $mac_seed \\", file=config)

    if dm['rtos_type'][vmid] != "no":
        if virt_io:
            print("   --virtio_poll 1000000 \\", file=config)

        if dm['rtos_type'][vmid] == "Soft RT":
            print("   --rtvm \\", file=config)

        if dm['rtos_type'][vmid] == "Hard RT":
            print("   --lapic_pt \\", file=config)

    # windows
    if uos_type == "WINDOWS":
        print("   --windows \\", file=config)

    # pm_channel set
    if dm['pm_channel'][vmid] and dm['pm_channel'][vmid] != None:
        pm_key = dm['pm_channel'][vmid]
        pm_vuart = "--pm_notify_channel uart"
        if vmid in dm["allow_trigger_s5"] and dm["allow_trigger_s5"][
                vmid] == 'y':
            pm_vuart = pm_vuart + ",allow_trigger_s5 "
        else:
            pm_vuart = pm_vuart + " "
        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)
                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)
        elif pm_key == "vuart1(pty)":
            print("   {} \\".format(pm_vuart +
                                    launch_cfg_lib.PM_CHANNEL_DIC[pm_key]),
                  file=config)
        else:
            print("   {} \\".format(launch_cfg_lib.PM_CHANNEL_DIC[pm_key]),
                  file=config)

    # set logger_setting for all VMs
    print("   $logger_setting \\", file=config)

    # GVT args set
    gvt_arg_set(dm, vmid, uos_type, config)

    # XHCI args set
    xhci_args_set(dm, vmid, config)

    # VIRTIO args set
    virtio_args_set(dm, virt_io, vmid, config)

    # vbootloader setting
    vboot_arg_set(dm, vmid, config)

    # pcpu-list args set
    pcpu_arg_set(dm, vmid, config)

    # shm regions args set
    shm_arg_set(dm, vmid, config)

    # ssram set
    ssram_enabled = 'n'
    try:
        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':
        print("   --ssram \\", file=config)

    for value in sel.bdf.values():
        if value[vmid]:
            print("   $intr_storm_monitor \\", file=config)
            break

    if uos_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 board_name == "apl-mrb":
            print("   -i /run/acrn/ioc_$vm_name,0x20 \\", file=config)
            print("   -l com2,/run/acrn/ioc_$vm_name \\", file=config)

        if not is_nuc_whl_linux(names, vmid):
            print("   -s {},wdt-i6300esb \\".format(
                launch_cfg_lib.virtual_dev_slot("wdt-i6300esb")),
                  file=config)

    set_dm_pt(names, sel, vmid, config, dm)

    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)
コード例 #2
0
ファイル: com.py プロジェクト: HSchroeder/acrn-hypervisor
def dm_arg_set(names, sel, virt_io, dm, vmid, config):

    uos_type = names['uos_types'][vmid]
    board_name = names['board_name']

    boot_image_type(dm, vmid, config)

    # uuid get
    scenario_uuid = launch_cfg_lib.get_scenario_uuid(vmid)
    sos_vmid = launch_cfg_lib.get_sos_vmid()

    # 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"):
            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)
        # mac_seed
        print("   --mac_seed $mac_seed \\", file=config)

    if dm['rtos_type'][vmid] != "no":
        if virt_io:
            print("   --virtio_poll 1000000 \\", file=config)

        if dm['rtos_type'][vmid] == "Soft RT":
            print("   --rtvm \\", file=config)

        if dm['rtos_type'][vmid] == "Hard RT":
            print("   --lapic_pt \\", file=config)

    # windows
    if uos_type == "WINDOWS":
        print("   --windows \\", file=config)

    # pm_channel set
    if dm['pm_channel'][vmid] and dm['pm_channel'][vmid] != None:
        pm_key = dm['pm_channel'][vmid]
        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)
                return
        print("   {} \\".format(launch_cfg_lib.PM_CHANNEL_DIC[pm_key]), file=config)

    # set logger_setting for all VMs
    print("   $logger_setting \\", file=config)

    # XHCI args set
    xhci_args_set(dm, vmid, config)

    # VIRTIO args set
    virtio_args_set(dm, virt_io, vmid, config)

    # GVT args set
    gvt_arg_set(dm, vmid, uos_type, config)

    # vbootloader setting
    vboot_arg_set(dm, vmid, config)

    # pcpu-list args set
    pcpu_arg_set(dm, vmid, config)

    for value in sel.bdf.values():
        if value[vmid]:
            print("   $intr_storm_monitor \\", file=config)
            break

    if uos_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 uos_type != "PREEMPT-RT LINUX":
            print("   -s {},virtio-hyper_dmabuf \\".format(launch_cfg_lib.virtual_dev_slot("virtio-hyper_dmabuf")), file=config)
        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)

        if not is_nuc_whl_linux(names, vmid):
            print("   -s {},wdt-i6300esb \\".format(launch_cfg_lib.virtual_dev_slot("wdt-i6300esb")), file=config)

    set_dm_pt(names, sel, vmid, config)
    print("   $vm_name", file=config)
    print("}", file=config)
コード例 #3
0
def dm_arg_set(names, sel, virt_io, dm, vmid, config):

    uos_type = names['uos_types'][vmid]
    board_name = names['board_name']

    boot_image_type(dm, vmid, config)

    # uuid get
    scenario_uuid = launch_cfg_lib.get_scenario_uuid()
    sos_vmid = launch_cfg_lib.get_sos_vmid()
    if not str(sos_vmid).isnumeric():
        sos_vmid = 0
        key = "launch config err:"
        launch_cfg_lib.ERR_LIST[
            key] = "There is no SOS_VM in scenario config file!"

    # clearlinux/android/alios
    dm_str = 'acrn-dm -A -m $mem_size -s 0:0,hostbridge -U {}'.format(
        scenario_uuid[vmid + sos_vmid])
    if uos_type in ("CLEARLINUX", "ANDROID", "ALIOS"):
        if uos_type == "CLEARLINUX":
            print("{} \\".format(dm_str), file=config)
        else:
            print('{} $npk_virt \\'.format(dm_str), file=config)

    if uos_type in ("CLEARLINUX", "ANDROID", "ALIOS"):
        if uos_type in ("ANDROID", "ALIOS"):
            print("   -s {},virtio-rpmb \\".format(
                launch_cfg_lib.virtual_dev_slot("virtio-rpmb")),
                  file=config)

    # mac_seed
    if uos_type in ("CLEARLINUX", "ANDROID", "ALIOS"):
        print("   --mac_seed $mac_seed \\", file=config)

    # hard rt os
    if uos_type == "PREEMPT-RT LINUX":
        print("{} \\".format(dm_str), file=config)
        print("   --lapic_pt \\", file=config)
        print("   --rtvm \\", file=config)
        print("   --virtio_poll 1000000 \\", file=config)

    # vxworks
    if uos_type == "VXWORKS":
        print("{} \\".format(dm_str), file=config)
        print("   --virtio_poll 1000000 \\", file=config)
        print("   --lapic_pt \\", file=config)

    # zephyr
    if uos_type == "ZEPHYR":
        print("{} \\".format(dm_str), file=config)

    # windows
    if uos_type == "WINDOWS":
        print("{} \\".format(dm_str), file=config)
        print("   --windows \\", file=config)

    # pm_channel set
    if dm['pm_channel'][vmid] and dm['pm_channel'][vmid] != None:
        pm_key = dm['pm_channel'][vmid]
        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)
                return
        print("   {} \\".format(launch_cfg_lib.PM_CHANNEL_DIC[pm_key]),
              file=config)

    # set logger_setting for all VMs
    print("   $logger_setting \\", file=config)

    # XHCI args set
    xhci_args_set(dm, vmid, config)

    # VIRTIO args set
    virtio_args_set(dm, virt_io, vmid, config)

    # GVT args set
    gvt_arg_set(dm, vmid, uos_type, config)

    # vbootloader setting
    vboot_arg_set(dm, vmid, config)

    # redirect console
    if dm['vuart0'][vmid] == "Enable":
        print("   -s 1:0,lpc \\", file=config)
        print("   -l com1,stdio \\", 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)
        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)

        if sel:
            print("   $intr_storm_monitor \\", file=config)

        if not is_nuc_whl_clr(names, vmid):
            print("   -s {},wdt-i6300esb \\".format(
                launch_cfg_lib.virtual_dev_slot("wdt-i6300esb")),
                  file=config)

    if uos_type in ("ANDROID", "ALIOS"):
        print("   --enable_trusty \\", file=config)

    set_dm_pt(names, sel, vmid, config)
    print("   $vm_name", file=config)
    print("}", file=config)