mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 05:02:24 +00:00
acrn-config: support passthroug GVT for WaaG by default
Modify launch config tool to support passthroug GVT for WaaG by default. Tracked-On: #4625 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com> Acked-by: Terry Zou <terry.zou@intel.com>
This commit is contained in:
parent
1bf3163d08
commit
d0beb7e9a0
@ -231,7 +231,12 @@ def gvt_arg_set(dm, vmid, uos_type, config):
|
||||
if uos_type not in ('CLEARLINUX', 'ANDROID', 'ALIOS', 'WINDOWS'):
|
||||
return
|
||||
gvt_args = dm['gvt_args'][vmid]
|
||||
if gvt_args:
|
||||
if gvt_args == "gvtd":
|
||||
bus = int(launch_cfg_lib.GPU_BDF.split(':')[0], 16)
|
||||
dev = int(launch_cfg_lib.GPU_BDF.split('.')[0].split(':')[1], 16)
|
||||
fun = int(launch_cfg_lib.GPU_BDF.split('.')[1], 16)
|
||||
print(' -s 2,passthru,{}/{}/{},gpu \\'.format(bus, dev, fun), file=config)
|
||||
elif gvt_args:
|
||||
print(' -s 2,pci-gvt -G "$2" \\', file=config)
|
||||
|
||||
|
||||
@ -318,17 +323,26 @@ def uos_launch(names, args, virt_io, vmid, config):
|
||||
print("fi", file=config)
|
||||
else:
|
||||
print("else", file=config)
|
||||
print(' launch_{} 1 "{}"'.format(launch_uos, gvt_args), file=config)
|
||||
if gvt_args == "gvtd":
|
||||
print(' launch_{} 1'.format(launch_uos), file=config)
|
||||
elif gvt_args:
|
||||
print(' launch_{} 1 "{}"'.format(launch_uos, gvt_args), file=config)
|
||||
print("fi", file=config)
|
||||
else:
|
||||
if uos_type in ("VXWORKS", "PREEMPT-RT LINUX", "ZEPHYR"):
|
||||
print("launch_{} 1".format(launch_uos), file=config)
|
||||
if uos_type in ("CLEARLINUX", "WINDOWS"):
|
||||
print('launch_{} 1 "{}"'.format(launch_uos, gvt_args), file=config)
|
||||
if gvt_args == "gvtd":
|
||||
print('launch_{} 1'.format(launch_uos), file=config)
|
||||
else:
|
||||
print('launch_{} 1 "{}"'.format(launch_uos, gvt_args), file=config)
|
||||
|
||||
if is_mount_needed(virt_io, vmid):
|
||||
print("", file=config)
|
||||
print('launch_{} {} "{}" "{}" $debug'.format(launch_uos, vmid, gvt_args, vmid), file=config)
|
||||
if gvt_args == "gvtd":
|
||||
print('launch_{} {} "{}" $debug'.format(launch_uos, vmid, vmid), file=config)
|
||||
else:
|
||||
print('launch_{} {} "{}" "{}" $debug'.format(launch_uos, vmid, gvt_args, vmid), file=config)
|
||||
print("", file=config)
|
||||
|
||||
i = 0
|
||||
@ -603,14 +617,14 @@ def gen(names, pt_sel, virt_io, dm, vmid, config):
|
||||
uos_type = names['uos_types'][vmid]
|
||||
|
||||
# passthrough bdf/vpid dictionay
|
||||
pt.gen_pt_head(names, pt_sel, vmid, config)
|
||||
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)
|
||||
|
||||
# passthrough device
|
||||
pt.gen_pt(names, pt_sel, vmid, config)
|
||||
pt.gen_pt(names, dm, pt_sel, vmid, config)
|
||||
wa_usage(uos_type, config)
|
||||
delay_use_usb_storage(uos_type, config)
|
||||
mem_size_set(dm, vmid, config)
|
||||
|
@ -200,7 +200,7 @@ def media_pt(uos_type, sel, vmid, config):
|
||||
audio_pt(uos_type, sel, vmid, config)
|
||||
|
||||
|
||||
def gen_pt(names, sel, vmid, config):
|
||||
def gen_pt(names, dm, sel, vmid, config):
|
||||
|
||||
pt_none = True
|
||||
cap_pt = launch_cfg_lib.get_pt_dev()
|
||||
@ -212,6 +212,11 @@ def gen_pt(names, sel, vmid, config):
|
||||
return
|
||||
|
||||
print("modprobe pci_stub", file=config)
|
||||
# pass thru GPU
|
||||
if dm['gvt_args'][vmid] == "gvtd":
|
||||
print('echo ${passthru_vpid["gpu"]} > /sys/bus/pci/drivers/pci-stub/new_id', file=config)
|
||||
print('echo ${passthru_bdf["gpu"]} > /sys/bus/pci/devices/${passthru_bdf["gpu"]}/driver/unbind', file=config)
|
||||
print('echo ${passthru_bdf["gpu"]} > /sys/bus/pci/drivers/pci-stub/bind', file=config)
|
||||
for pt_dev in cap_pt:
|
||||
if pt_dev not in MEDIA_DEV:
|
||||
pass_through_dev(sel, pt_dev, vmid, config)
|
||||
@ -219,7 +224,7 @@ def gen_pt(names, sel, vmid, config):
|
||||
|
||||
media_pt(uos_type, sel, vmid, config)
|
||||
|
||||
def gen_pt_head(names, 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]
|
||||
@ -240,6 +245,9 @@ def gen_pt_head(names, sel, vmid, config):
|
||||
for pt_dev in cap_pt:
|
||||
if not sel.vpid[pt_dev] or not sel.vpid[pt_dev][vmid]:
|
||||
continue
|
||||
if dm['gvt_args'][vmid] == "gvtd":
|
||||
gpu_vpid = launch_cfg_lib.get_gpu_vpid()
|
||||
print('["gpu"]="{}"'.format(gpu_vpid), file=config)
|
||||
print('["{}"]="{}"'.format(pt_dev, sel.vpid[pt_dev][vmid]), file=config)
|
||||
print(')', file=config)
|
||||
|
||||
@ -247,6 +255,8 @@ def gen_pt_head(names, sel, vmid, config):
|
||||
for pt_dev in cap_pt:
|
||||
if not sel.bdf[pt_dev] or not sel.bdf[pt_dev][vmid]:
|
||||
continue
|
||||
if dm['gvt_args'][vmid] == "gvtd":
|
||||
print('["gpu"]="0000:{}"'.format(launch_cfg_lib.GPU_BDF), file=config)
|
||||
print('["{}"]="0000:{}"'.format(pt_dev, sel.bdf[pt_dev][vmid]), file=config)
|
||||
print(')', file=config)
|
||||
|
||||
|
@ -54,6 +54,7 @@ PM_CHANNEL_DIC = {
|
||||
}
|
||||
|
||||
MOUNT_FLAG_DIC = {}
|
||||
GPU_BDF = "00:02.0"
|
||||
|
||||
|
||||
def usage(file_name):
|
||||
@ -548,3 +549,13 @@ def bdf_duplicate_check(bdf_dic):
|
||||
return
|
||||
else:
|
||||
bdf_used.append(dev_bdf)
|
||||
|
||||
|
||||
def get_gpu_vpid():
|
||||
|
||||
vpid = ''
|
||||
vpid_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<PCI_VID_PID>", "</PCI_VID_PID>")
|
||||
for vpid_line in vpid_lines:
|
||||
if GPU_BDF in vpid_line:
|
||||
vpid = vpid_line.split()[2]
|
||||
return vpid
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">PREEMPT-RT LINUX</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">Hard RT</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">1024</mem_size>
|
||||
<gvt_args configurable="0" desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<gvt_args configurable="0" desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Disable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs." readonly="true">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">VXWORKS</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">Hard RT</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">2048</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Disable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">WINDOWS</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">no</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">4096</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT.">64 448 8</gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT.">gvtd</gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Enable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">WINDOWS</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">no</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">4096</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT.">64 448 8</gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT.">gvtd</gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Enable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
@ -37,7 +37,7 @@
|
||||
<uos_type desc="UOS type">PREEMPT-RT LINUX</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">Hard RT</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">1024</mem_size>
|
||||
<gvt_args configurable="0" desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<gvt_args configurable="0" desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Disable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs." readonly="true">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">CLEARLINUX</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">no</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">2048</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT.">64 448 8</gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT.">64 448 8</gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Disable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">ZEPHYR</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">no</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">128</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Enable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">PREEMPT-RT LINUX</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">Hard RT</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">1024</mem_size>
|
||||
<gvt_args configurable="0" desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<gvt_args configurable="0" desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Disable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs." readonly="true">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">VXWORKS</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">Hard RT</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">2048</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Disable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">WINDOWS</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">no</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">4096</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT.">64 448 8</gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT.">gvtd</gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Enable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">WINDOWS</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">no</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">4096</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT.">64 448 8</gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT.">gvtd</gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Enable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
@ -37,7 +37,7 @@
|
||||
<uos_type desc="UOS type">PREEMPT-RT LINUX</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">Hard RT</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">1024</mem_size>
|
||||
<gvt_args configurable="0" desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<gvt_args configurable="0" desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Disable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs." readonly="true">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">CLEARLINUX</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">no</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">2048</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT.">64 448 8</gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT.">64 448 8</gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Disable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uos_type desc="UOS type">ZEPHYR</uos_type>
|
||||
<rtos_type desc="UOS Realtime capability">no</rtos_type>
|
||||
<mem_size desc="UOS memory size in MByte">128</mem_size>
|
||||
<gvt_args desc="GVT arguments. Recommendation is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<gvt_args desc="GVT settings. Set it to gvtd for GVTd, otherwise is GVTg arguments. The recommendation arguments for GVTg is 64 448 8. Leave it blank to disable GVT."></gvt_args>
|
||||
<vbootloader desc="virtual bootloader method" readonly="true">ovmf</vbootloader>
|
||||
<vuart0 desc="vUART0 which emulated by device model">Enable</vuart0>
|
||||
<cpu_sharing desc="Whether the binding pCPUs are sharing with other VMs.">Disabled</cpu_sharing>
|
||||
|
Loading…
Reference in New Issue
Block a user