From 90452146ffae4935f276f9c94cbba8b1ee4cfb6a Mon Sep 17 00:00:00 2001 From: Kunhui-Li Date: Fri, 3 Sep 2021 09:50:31 +0800 Subject: [PATCH] config_tools: support SRIOV based GPU sharing in launch script We will use SRIOV based GPU sharing to replace default GVT-d config on adl-s-crb platform. So add the logic of passthru gpu VF, If the string "sriov" is found in launch xml, we will hardcode different value to gpu VF and set different parameter for WaaG and LaaG in launch script. The relevant line in the generated launch script will look like this: Laag: "-s 2,passthru,0/2/1,gpu \" WaaG: "-s 2,passthru,0/2/2,igd-vf \" Tracked-On: #6290 Signed-off-by: Kunhui-Li --- misc/config_tools/launch_config/com.py | 14 +++++++++----- misc/config_tools/launch_config/pt.py | 8 ++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/misc/config_tools/launch_config/com.py b/misc/config_tools/launch_config/com.py index ee1ee1fd7..15c5da1fc 100644 --- a/misc/config_tools/launch_config/com.py +++ b/misc/config_tools/launch_config/com.py @@ -220,19 +220,23 @@ def interrupt_storm(pt_sel, config): print('intr_storm_monitor="--intr_monitor 10000,10,1,100"', file=config) print("", file=config) - def gvt_arg_set(dm, vmid, uos_type, config): gvt_args = dm['gvt_args'][vmid] gpu_bdf = launch_cfg_lib.get_gpu_bdf() - if gvt_args == "gvtd" and gpu_bdf is not None: + if gpu_bdf is not None: 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,{}/{}/{},gpu \\'.format(bus, dev, fun), file=config) - elif gvt_args: - print(' -s 2,pci-gvt -G "$2" \\', file=config) + if gvt_args == "gvtd": + print(' -s 2,passthru,{}/{}/{},gpu \\'.format(bus, dev, fun), file=config) + elif gvt_args == "sriov" and uos_type in launch_cfg_lib.LINUX_LIKE_OS and uos_type != "PREEMPT-RT LINUX": + print(' -s 2,passthru,{}/{}/1,gpu \\'.format(bus, dev), file=config) + elif gvt_args == "sriov" and uos_type == "WINDOWS": + print(' -s 2,passthru,{}/{}/2,igd-vf \\'.format(bus, dev), file=config) + elif gvt_args: + print(' -s 2,pci-gvt -G "$2" \\', file=config) def log_level_set(uos_type, config): diff --git a/misc/config_tools/launch_config/pt.py b/misc/config_tools/launch_config/pt.py index 25c131414..a57f3ebd0 100644 --- a/misc/config_tools/launch_config/pt.py +++ b/misc/config_tools/launch_config/pt.py @@ -242,7 +242,7 @@ def gen_pt_head(names, dm, sel, vmid, config): if not sel.vpid[pt_dev] or not sel.vpid[pt_dev][vmid]: continue print('["{}"]="{}"'.format(pt_dev, sel.vpid[pt_dev][vmid]), file=config) - if dm['gvt_args'][vmid] == "gvtd": + if dm['gvt_args'][vmid] == "gvtd" or dm['gvt_args'][vmid] == "sriov": gpu_vpid = launch_cfg_lib.get_gpu_vpid() print('["gpu"]="{}"'.format(gpu_vpid), file=config) print(')', file=config) @@ -252,9 +252,13 @@ def gen_pt_head(names, dm, sel, vmid, config): if not sel.bdf[pt_dev] or not sel.bdf[pt_dev][vmid]: continue print('["{}"]="0000:{}"'.format(pt_dev, sel.bdf[pt_dev][vmid]), file=config) + gpu_bdf = launch_cfg_lib.get_gpu_bdf() if dm['gvt_args'][vmid] == "gvtd": - gpu_bdf = launch_cfg_lib.get_gpu_bdf() print('["gpu"]="0000:{}"'.format(gpu_bdf), file=config) + elif uos_type in launch_cfg_lib.LINUX_LIKE_OS and uos_type != "PREEMPT-RT LINUX" and dm['gvt_args'][vmid] == "sriov": + print('["gpu"]="0000:{}.1"'.format(gpu_bdf[0:5]), file=config) + elif dm['gvt_args'][vmid] == "sriov" and uos_type == "WINDOWS": + print('["gpu"]="0000:{}.2"'.format(gpu_bdf[0:5]), file=config) print(')', file=config) print("", file=config)