示例#1
0
def virtio_args_set(dm, virt_io, vmid, config):

    # virtio-input set, the value type is a list
    for input_val in virt_io['input'][vmid]:
        if input_val:
            print("   -s {},virtio-input,{} \\".format(
                launch_cfg_lib.virtual_dev_slot("virtio-input{}".format(input_val)), input_val), file=config)

    # virtio-blk set, the value type is a list
    i = 0
    for mount_flag in launch_cfg_lib.MOUNT_FLAG_DIC[vmid]:
        blk = virt_io['block'][vmid][i]
        if not mount_flag:
            if blk:
                rootfs_img = blk.strip(':')
                print("   -s {},virtio-blk,{} \\".format(launch_cfg_lib.virtual_dev_slot("virtio-blk{}".format(blk)), rootfs_img), file=config)
            i += 1
            continue

        rootfs_img = blk.split(':')[1].strip(':')
        print("   -s {},virtio-blk,/data{}/{} \\".format(launch_cfg_lib.virtual_dev_slot("blk_mount_{}".format(i)), i, rootfs_img), file=config)
        i += 1

    # virtio-net set, the value type is a list
    for net in virt_io['network'][vmid]:
        if net:
            print("   -s {},virtio-net,tap_{} \\".format(launch_cfg_lib.virtual_dev_slot("virtio-net{}".format(net)), net), 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)
示例#2
0
def virtio_args_set(dm, virt_io, vmid, config):

    # virtio-input set, the value type is a list
    for input_val in virt_io['input'][vmid]:
        if input_val:
            print("   -s {},virtio-input,{} \\".format(
                launch_cfg_lib.virtual_dev_slot(
                    "virtio-input{}".format(input_val)), input_val),
                  file=config)

    # virtio-blk set, the value type is a list
    for blk in virt_io['block'][vmid]:
        if blk:
            print("   -s {},virtio-blk,{} \\".format(
                launch_cfg_lib.virtual_dev_slot("virtio-blk{}".format(blk)),
                blk.strip(':')),
                  file=config)

    # virtio-net set, the value type is a list
    for net in virt_io['network'][vmid]:
        if net:
            net_name = net
            if ',' in net:
                net_name = net.split(',')[0]
            print("   -s {},virtio-net,{} \\".format(
                launch_cfg_lib.virtual_dev_slot("virtio-net{}".format(net)),
                net_name),
                  file=config)
示例#3
0
def shm_arg_set(dm, vmid, config):

    if dm['shm_enabled'] == "n":
        return
    for shm_region in dm["shm_regions"][vmid]:
        print("   -s {},ivshmem,{} \\".format(
            launch_cfg_lib.virtual_dev_slot("shm_region_{}".format(shm_region)), shm_region), file=config)
示例#4
0
def vritio_args_set(virt_io, vmid, config):

    # virtio-input set, the value type is a list
    for input_val in virt_io['input'][vmid]:
        if input_val:
            print("   -s {},virtio-input,{} \\".format(
                launch_cfg_lib.virtual_dev_slot(
                    "virtio-input{}".format(input_val)), input_val),
                  file=config)
示例#5
0
def ipu_pt(sel, vmid, config):

    if not sel.bdf['ipu'][vmid] and not sel.bdf['ipu_i2c'][vmid]:
        return

    bdf_ipu = sel.bdf['ipu'][vmid]
    if bdf_ipu:
        bus = bdf_ipu[0:2]
        dev = bdf_ipu[3:5]
        fun = bdf_ipu[6:7]
        slot_ipu = sel.slot['ipu'][vmid]

    bdf_ipu_i2c = sel.bdf['ipu_i2c'][vmid]
    if bdf_ipu_i2c:
        bus_i2c = bdf_ipu_i2c[0:2]
        dev_i2c = bdf_ipu_i2c[3:5]
        fun_i2c = bdf_ipu_i2c[6:7]
        slot_ipu_i2c = sel.slot['ipu_i2c'][vmid]

    if bdf_ipu or bdf_ipu_i2c:
        print("ipu_passthrough=0", file=config)
        print("", file=config)
        print("# Check the device file of /dev/vbs_ipu to determine the IPU mode", file=config)
        print('if [ ! -e "/dev/vbs_ipu" ]; then', file=config)
        print("ipu_passthrough=1", file=config)
        print("fi", file=config)
        print('boot_ipu_option=""', file=config)
        print("if [ $ipu_passthrough == 1 ];then", file=config)

    if bdf_ipu:
        print("    # for ipu passthrough - ipu device", file=config)
        print('    if [ -d "/sys/bus/pci/devices/${passthru_bdf["ipu"]}" ]; then', file=config)
        print('        echo ${passthru_vpid["ipu"]} > /sys/bus/pci/drivers/pci-stub/new_id', file=config)
        print('        echo ${passthru_bdf["ipu"]} > /sys/bus/pci/devices/${passthru_bdf["ipu"]}/driver/unbind', file=config)
        print('        echo ${passthru_bdf["ipu"]} > /sys/bus/pci/drivers/pci-stub/bind', file=config)
        print('        boot_ipu_option="$boot_ipu_option"" -s {},passthru,{}/{}/{} "'.format(
            slot_ipu, bus, dev, fun), file=config)
        print("    fi", file=config)
        print("", file=config)

    if bdf_ipu_i2c:
        print("    # for ipu passthrough - ipu related i2c", file=config)
        print("    # please use virtual slot for i2c to make sure that the i2c controller", file=config)
        print("    # could get the same virtaul BDF as physical BDF", file=config)
        print('    if [ -d "/sys/bus/pci/devices/${passthru_bdf["ipu_i2c"]}" ]; then', file=config)
        print('        echo ${passthru_vpid["ipu_i2c"]} > /sys/bus/pci/drivers/pci-stub/new_id', file=config)
        print('        echo ${passthru_bdf["ipu_i2c"]} > /sys/bus/pci/devices/${passthru_bdf["ipu_i2c"]}/driver/unbind', file=config)
        print('        echo ${passthru_bdf["ipu_i2c"]} > /sys/bus/pci/drivers/pci-stub/bind', file=config)
        print('        boot_ipu_option="$boot_ipu_option"" -s {},passthru,{}/{}/{} "'.format(
            slot_ipu_i2c, bus_i2c, dev_i2c, fun_i2c), file=config)
        print("    fi", file=config)

    if bdf_ipu or bdf_ipu_i2c:
        print("else", file=config)
        print('    boot_ipu_option="$boot_ipu_option"" -s {},virtio-ipu "'.format(launch_cfg_lib.virtual_dev_slot("virtio-ipu")), file=config)
        print("fi", file=config)
        print("", file=config)
示例#6
0
def set_dm_pt(names, sel, vmid, config):

    #cap_pt = launch_cfg_lib.get_board_pt_dev(names, vmid)
    uos_type = names['uos_types'][vmid]

    if sel.bdf['usb_xdci'][vmid] and sel.slot['usb_xdci'][vmid]:
        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]), file=config)

    if uos_type in ("ANDROID", "ALIOS"):
        print("   $boot_audio_option \\", file=config)
    if uos_type == "WINDOWS":
        if sel.bdf['audio'][vmid] and sel.slot['audio'][vmid]:
            print("   -s {},passthru,{}/{}/{}  \\".format(
                launch_cfg_lib.virtual_dev_slot("win_audio"),
                sel.bdf['audio'][vmid][0:2], sel.bdf['audio'][vmid][3:5],
                sel.bdf['audio'][vmid][6:7]),
                  file=config)

    if sel.bdf['cse'][vmid] and sel.slot['cse'][vmid]:
        print("   $boot_cse_option \\", file=config)

    if sel.bdf["sd_card"][vmid] and sel.slot['sd_card'][vmid]:
        print('   -s {},passthru,{}/{}/{} \\'.format(sel.slot["sd_card"][vmid], sel.bdf["sd_card"][vmid][0:2], \
            sel.bdf["sd_card"][vmid][3:5], sel.bdf["sd_card"][vmid][6:7]), file=config)

    if sel.bdf['bluetooth'][vmid] and sel.slot['bluetooth'][vmid]:
        print('   -s {},passthru,{}/{}/{} \\'.format(sel.slot["bluetooth"][vmid], sel.bdf["bluetooth"][vmid][0:2], \
            sel.bdf["bluetooth"][vmid][3:5], sel.bdf["bluetooth"][vmid][6:7]), file=config)

    if sel.bdf['wifi'][vmid] and sel.slot['wifi'][vmid]:
        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)

    if sel.bdf['ipu'][vmid] or sel.bdf['ipu_i2c'][vmid]:
        print("   $boot_ipu_option      \\", file=config)

    if sel.bdf['ethernet'][vmid] and sel.slot['ethernet'][vmid]:
        print("   -s {},passthru,{}/{}/{} \\".format(sel.slot["ethernet"][vmid], sel.bdf["ethernet"][vmid][0:2], \
            sel.bdf["ethernet"][vmid][3:5], sel.bdf["ethernet"][vmid][6:7]), file=config)

    if sel.bdf['sata'] and sel.slot["sata"][vmid]:
        print("   -s {},passthru,{}/{}/{} \\".format(sel.slot["sata"][vmid], sel.bdf["sata"][vmid][0:2], \
            sel.bdf["sata"][vmid][3:5], sel.bdf["sata"][vmid][6:7]), file=config)

    if sel.bdf['nvme'] and sel.slot["nvme"][vmid]:
        print("   -s {},passthru,{}/{}/{} \\".format(sel.slot["nvme"][vmid], sel.bdf["nvme"][vmid][0:2], \
            sel.bdf["nvme"][vmid][3:5], sel.bdf["nvme"][vmid][6:7]), file=config)
示例#7
0
def sriov_args_set(dm, sriov, vmid, config):

    # sriov-gpu
    gpu_bdf = sriov['gpu'][vmid]
    if gpu_bdf:
        bus = int(gpu_bdf[0:2], 16)
        dev = int(gpu_bdf[3:5], 16)
        fun = int(gpu_bdf[6:7], 16)
        print('   -s 2,passthru,{}/{}/{},igd-vf  \\'.format(bus, dev, fun), file=config)

    # sriov-net
    if sriov['network'][vmid]:
        net_bdf = sriov['network'][vmid]
        bus = int(net_bdf[0:2], 16)
        dev = int(net_bdf[3:5], 16)
        fun = int(net_bdf[6:7], 16)
        print("   -s {},passthru,{}/{}/{} \\".format(
            launch_cfg_lib.virtual_dev_slot("sriov-net{}".format(net_bdf)), bus, dev, fun
        ), file=config)
示例#8
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(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)
示例#9
0
def xhci_args_set(dm, vmid, config):
    # usb_xhci set, the value is string
    if dm['xhci'][vmid]:
        print("   -s {},xhci,{} \\".format(
            launch_cfg_lib.virtual_dev_slot("xhci"), dm['xhci'][vmid]), file=config)
示例#10
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)
示例#11
0
def dm_arg_set(names, sel, virt_io, dm, vmid, config):

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

    # vboot loader for vsbl
    boot_image_type(dm, vmid, config)
    root_img = dm['rootfs_img'][vmid]

    # 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 board_name == "apl-up2" or is_nuc_whl_clr(names, vmid):
        print("   $logger_setting \\", 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)
        if board_name == "apl-up2":
            print("   --pm_notify_channel power_button \\", file=config)
        if board_name == "apl-mrb":
            print("   --pm_notify_channel ioc \\", file=config)

    if is_nuc_whl_clr(names, vmid):
        print("   --pm_notify_channel uart \\", file=config)
        print('   --pm_by_vuart pty,/run/acrn/life_mngr_$vm_name  \\',
              file=config)
        print('   -l com2,/run/acrn/life_mngr_$vm_name \\', file=config)
        print("   -s {},virtio-net,tap0 \\".format(
            launch_cfg_lib.virtual_dev_slot("virtio-net")),
              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)
        print("   --pm_notify_channel uart --pm_by_vuart tty,/dev/ttyS1 \\",
              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)

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

    # VIRTIO args set
    vritio_args_set(virt_io, vmid, config)

    # GVT args set
    gvt_arg_set(uos_type, config)

    # vbootloader setting
    vboot_arg_set(dm, vmid, config)

    # redirect console
    if dm['console_type'][vmid] == "com1(ttyS0)":
        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"):
        if board_name in ("apl-mrb", "apl-up2"):
            print("   -s {},virtio-net,$tap \\".format(
                launch_cfg_lib.virtual_dev_slot("virtio-net")),
                  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)
            #print("   -s {},xhci,1-1:1-2:1-3:2-1:2-2:2-3:cap=apl \\".format(launch_cfg_lib.virtual_dev_slot("xhci")), file=config)

    if dm['vbootloader'][vmid] and dm['vbootloader'][vmid] == "vsbl":
        print("   -s {},virtio-blk$boot_dev_flag,/data/{} \\".format(
            launch_cfg_lib.virtual_dev_slot("virtio-blk"), root_img),
              file=config)
    elif dm['vbootloader'][vmid] and dm['vbootloader'][vmid] == "ovmf":
        print("   -s {},virtio-blk,{} \\".format(
            launch_cfg_lib.virtual_dev_slot("virtio-blk"), root_img),
              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)
示例#12
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)
示例#13
0
def dm_arg_set(names, sel, dm, vmid, config):

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

    # vbootlaoder for vsbl
    boot_image_type(dm, vmid, config)

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

    # clearlinux/android/alios
    dm_str = 'acrn-dm -A -m $mem_size $boot_GVT_option"$GVT_args" -s 0:0,hostbridge  -s 1:0,lpc -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 board_name == "apl-up2" or is_nuc_clr(names, vmid):
        print("   $logger_setting \\", 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)
        if board_name == "apl-up2":
            print("   --pm_notify_channel power_button \\", file=config)
        if board_name == "apl-mrb":
            print("   --pm_notify_channel ioc \\", file=config)

    if is_nuc_clr(names, vmid):
        print("   --pm_notify_channel uart \\", file=config)
        print('   --pm_by_vuart pty,/run/acrn/life_mngr_$vm_name  \\',
              file=config)
        print('   -l com2,/run/acrn/life_mngr_$vm_name \\', file=config)
        print("   -s {},virtio-net,tap0 \\".format(
            launch_cfg_lib.virtual_dev_slot("virtio-net")),
              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("acrn-dm -A -m $mem_size -s 0:0,hostbridge -U {} \\".format(
            scenario_uuid[vmid + sos_vmid]),
              file=config)
        #print("   -k /usr/lib/kernel/default-iot-lts2018-preempt-rt \\", file=config)
        print("   -k /usr/lib/kernel/default-iot-lts2018-preempt-rt \\",
              file=config)
        print("   --lapic_pt \\", file=config)
        print("   --rtvm \\", file=config)
        print("   --virtio_poll 1000000 \\", file=config)
        print("   --pm_notify_channel uart --pm_by_vuart tty,/dev/ttyS1 \\",
              file=config)

    # vxworks
    if uos_type == "VXWORKS":
        print("acrn-dm -A -m $mem_size -s 0:0,hostbridge -U {} \\".format(
            scenario_uuid[vmid + sos_vmid]),
              file=config)
        print("   -s {},virtio-blk,./VxWorks.img \\".format(
            launch_cfg_lib.virtual_dev_slot("virtio-blk")),
              file=config)
        print("   --virtio_poll 1000000 \\", file=config)
        print("   --lapic_pt \\", file=config)

    # zephyr
    if uos_type == "ZEPHYR":
        print("acrn-dm -A -m $mem_size -s 0:0,hostbridge -s 1:0,lpc -U {} \\".
              format(scenario_uuid[vmid + sos_vmid]),
              file=config)
        print("   -s {},virtio-blk,./zephyr.img \\".format(
            launch_cfg_lib.virtual_dev_slot("virtio-blk")),
              file=config)

    # windows
    if uos_type == "WINDOWS":
        print("acrn-dm -A -m $mem_size -s 0:0,hostbridge -s 1:0,lpc -U {} \\".
              format(scenario_uuid[vmid + sos_vmid]),
              file=config)
        print('   -s 2,pci-gvt -G "$3"  \\', file=config)
        print("   -s {},virtio-blk,./win10-ltsc.img \\".format(
            launch_cfg_lib.virtual_dev_slot("virtio-blk")),
              file=config)

# vbootloader of ovmf
#if uos_type != "PREEMPT-RT LINUX" and dm['vbootloader'][vmid] == "ovmf":
    if dm['vbootloader'][vmid] == "ovmf":
        print("   --ovmf /usr/share/acrn/bios/OVMF.fd \\", file=config)

    # redirect console
    if dm['console_type'][vmid] == "com1(ttyS0)":
        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"):
        if board_name in ("apl-mrb", "apl-up2"):
            print("   -s {},virtio-net,$tap \\".format(
                launch_cfg_lib.virtual_dev_slot("virtio-net")),
                  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 not is_nuc_clr(names, vmid):
            print("   -s {},wdt-i6300esb \\".format(
                launch_cfg_lib.virtual_dev_slot("wdt-i6300esb")),
                  file=config)
            print("   $intr_storm_monitor \\", file=config)
            if dm['vbootloader'][vmid] == "vsbl":
                print("   $boot_image_option \\", file=config)
            print(
                "   -s {},virtio-blk$boot_dev_flag,/data/$5/$5.img \\".format(
                    launch_cfg_lib.virtual_dev_slot("virtio-blk")),
                file=config)
            print("   -s {},xhci,1-1:1-2:1-3:2-1:2-2:2-3:cap=apl \\".format(
                launch_cfg_lib.virtual_dev_slot("xhci")),
                  file=config)
        else:
            print("   -s {},virtio-blk,/home/clear/uos/uos.img \\".format(
                launch_cfg_lib.virtual_dev_slot("virtio-blk")),
                  file=config)

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

    set_dm_pt(names, sel, vmid, config)
    if uos_type != "PREEMPT-RT LINUX":
        print("   $vm_name", file=config)
    else:
        print("   hard_rtvm", file=config)
    print("}", file=config)