mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 04:33:55 +00:00
acrn-config: refine GPU vpid format for launch script
Refine GPU vpid format for launch script. Tracked-On: #4641 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
a0e18eec34
commit
b69e2685d5
@ -205,6 +205,13 @@ 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]
|
||||
|
||||
# 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 sel.bdf[pt_dev][vmid]:
|
||||
pt_none = False
|
||||
@ -212,11 +219,6 @@ def gen_pt(names, dm, 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)
|
||||
@ -224,17 +226,11 @@ def gen_pt(names, dm, sel, vmid, config):
|
||||
|
||||
media_pt(uos_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]
|
||||
pt_none = True
|
||||
|
||||
for pt_dev in cap_pt:
|
||||
if sel.bdf[pt_dev][vmid]:
|
||||
pt_none = False
|
||||
if pt_none:
|
||||
return
|
||||
|
||||
print("# pci devices for passthru", file=config)
|
||||
print("declare -A passthru_vpid", file=config)
|
||||
@ -245,19 +241,19 @@ def gen_pt_head(names, dm, 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)
|
||||
if dm['gvt_args'][vmid] == "gvtd":
|
||||
gpu_vpid = launch_cfg_lib.get_gpu_vpid()
|
||||
print('["gpu"]="{}"'.format(gpu_vpid), file=config)
|
||||
print(')', file=config)
|
||||
|
||||
print("passthru_bdf=(", file=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)
|
||||
if dm['gvt_args'][vmid] == "gvtd":
|
||||
print('["gpu"]="0000:{}"'.format(launch_cfg_lib.GPU_BDF), file=config)
|
||||
print(')', file=config)
|
||||
|
||||
print("", file=config)
|
||||
|
@ -554,5 +554,5 @@ def get_gpu_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]
|
||||
vpid = " ".join(vpid_line.split()[2].split(':'))
|
||||
return vpid
|
||||
|
Loading…
Reference in New Issue
Block a user