mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-11 13:49:39 +00:00
config-tools: enable PTM through config-tools
Configure PTM in post-launched VM using <PTM> element. If the //vm/PTM sets to 'y', pci_dev.c.xsl appends the virtual root port to corresponding struct acrn_vm_pci_dev_config of that VM. Currently it supports only post-launched VMs. Configure enable_ptm for dm argument. If a uos/enable_ptm with uos id = 'vm_id 'sets to 'y' and the vm/PTM with the same vm_id sets to 'y', append an "enable_ptm" flag to the end of passthrough ethernet devices. Currently there is only ethernet card can support the "enable_ptm"flag. For the schema validation, the <PTM> can only be ['y', 'n']. For the launched script validation, the <enable_ptm> can only be ['y', 'n']. If the <enable_ptm> sets to 'y' but the corresponding <PTM> sets to 'n', the launch script will fail to generate. Tracked-On: #6054 Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
This commit is contained in:
@@ -411,7 +411,7 @@ def launch_end(names, args, virt_io, vmid, config):
|
||||
uos_launch(names, args, virt_io, vmid, config)
|
||||
|
||||
|
||||
def set_dm_pt(names, sel, vmid, config):
|
||||
def set_dm_pt(names, sel, vmid, config, dm):
|
||||
|
||||
uos_type = names['uos_types'][vmid]
|
||||
|
||||
@@ -449,8 +449,12 @@ def set_dm_pt(names, sel, vmid, config):
|
||||
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 vmid in dm["enable_ptm"] and dm["enable_ptm"][vmid] == 'y':
|
||||
print(" -s {},passthru,{}/{}/{},enable_ptm \\".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)
|
||||
else:
|
||||
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], \
|
||||
@@ -642,7 +646,7 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, 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)
|
||||
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)
|
||||
|
@@ -52,6 +52,7 @@ def get_launch_item_values(board_info, scenario_info=None):
|
||||
launch_item_values['uos,vuart0'] = launch_cfg_lib.DM_VUART0
|
||||
launch_item_values['uos,poweroff_channel'] = launch_cfg_lib.PM_CHANNEL
|
||||
launch_item_values["uos,cpu_affinity"] = board_cfg_lib.get_processor_info()
|
||||
launch_item_values['uos,enable_ptm'] = launch_cfg_lib.PTM
|
||||
launch_cfg_lib.set_shm_regions(launch_item_values, scenario_info)
|
||||
launch_cfg_lib.set_pci_vuarts(launch_item_values, scenario_info)
|
||||
|
||||
|
@@ -36,6 +36,7 @@ class AcrnDmArgs:
|
||||
self.args["xhci"] = common.get_leaf_tag_map(self.launch_info, "usb_xhci")
|
||||
self.args["communication_vuarts"] = common.get_leaf_tag_map(self.launch_info, "communication_vuarts", "communication_vuart")
|
||||
self.args["console_vuart"] = common.get_leaf_tag_map(self.launch_info, "console_vuart")
|
||||
self.args["enable_ptm"] = common.get_leaf_tag_map(self.launch_info, "enable_ptm")
|
||||
|
||||
def check_item(self):
|
||||
(rootfs, num) = board_cfg_lib.get_rootfs(self.board_info)
|
||||
@@ -44,12 +45,14 @@ class AcrnDmArgs:
|
||||
launch_cfg_lib.mem_size_check(self.args["mem_size"], "mem_size")
|
||||
launch_cfg_lib.args_aval_check(self.args["vbootloader"], "vbootloader", launch_cfg_lib.BOOT_TYPE)
|
||||
launch_cfg_lib.args_aval_check(self.args["vuart0"], "vuart0", launch_cfg_lib.DM_VUART0)
|
||||
launch_cfg_lib.args_aval_check(self.args["enable_ptm"], "enable_ptm", launch_cfg_lib.PTM)
|
||||
cpu_affinity = launch_cfg_lib.uos_cpu_affinity(self.args["cpu_affinity"])
|
||||
err_dic = scenario_cfg_lib.vm_cpu_affinity_check(self.launch_info, cpu_affinity, "pcpu_id")
|
||||
launch_cfg_lib.ERR_LIST.update(err_dic)
|
||||
launch_cfg_lib.check_shm_regions(self.args["shm_regions"], self.scenario_info)
|
||||
launch_cfg_lib.check_console_vuart(self.args["console_vuart"],self.args["vuart0"], self.scenario_info)
|
||||
launch_cfg_lib.check_communication_vuart(self.args["communication_vuarts"], self.scenario_info)
|
||||
launch_cfg_lib.check_enable_ptm(self.args["enable_ptm"], self.scenario_info)
|
||||
|
||||
|
||||
class AvailablePthru():
|
||||
|
Reference in New Issue
Block a user