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:
parent
68e4c66175
commit
346490a7dc
|
@ -411,7 +411,7 @@ def launch_end(names, args, virt_io, vmid, config):
|
||||||
uos_launch(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]
|
uos_type = names['uos_types'][vmid]
|
||||||
|
|
||||||
|
@ -449,6 +449,10 @@ def set_dm_pt(names, sel, vmid, config):
|
||||||
print(" $boot_ipu_option \\", file=config)
|
print(" $boot_ipu_option \\", file=config)
|
||||||
|
|
||||||
if sel.bdf['ethernet'][vmid] and sel.slot['ethernet'][vmid]:
|
if sel.bdf['ethernet'][vmid] and sel.slot['ethernet'][vmid]:
|
||||||
|
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], \
|
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)
|
sel.bdf["ethernet"][vmid][3:5], sel.bdf["ethernet"][vmid][6:7]), file=config)
|
||||||
|
|
||||||
|
@ -642,7 +646,7 @@ def dm_arg_set(names, sel, virt_io, dm, vmid, config):
|
||||||
if not is_nuc_whl_linux(names, vmid):
|
if not is_nuc_whl_linux(names, vmid):
|
||||||
print(" -s {},wdt-i6300esb \\".format(launch_cfg_lib.virtual_dev_slot("wdt-i6300esb")), file=config)
|
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":
|
if dm['console_vuart'][vmid] == "Enable":
|
||||||
print(" -s {},uart,vuart_idx:0 \\".format(launch_cfg_lib.virtual_dev_slot("console_vuart")), file=config)
|
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,vuart0'] = launch_cfg_lib.DM_VUART0
|
||||||
launch_item_values['uos,poweroff_channel'] = launch_cfg_lib.PM_CHANNEL
|
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,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_shm_regions(launch_item_values, scenario_info)
|
||||||
launch_cfg_lib.set_pci_vuarts(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["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["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["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):
|
def check_item(self):
|
||||||
(rootfs, num) = board_cfg_lib.get_rootfs(self.board_info)
|
(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.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["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["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"])
|
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")
|
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.ERR_LIST.update(err_dic)
|
||||||
launch_cfg_lib.check_shm_regions(self.args["shm_regions"], self.scenario_info)
|
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_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_communication_vuart(self.args["communication_vuarts"], self.scenario_info)
|
||||||
|
launch_cfg_lib.check_enable_ptm(self.args["enable_ptm"], self.scenario_info)
|
||||||
|
|
||||||
|
|
||||||
class AvailablePthru():
|
class AvailablePthru():
|
||||||
|
|
|
@ -8,11 +8,14 @@ import getopt
|
||||||
import common
|
import common
|
||||||
import board_cfg_lib
|
import board_cfg_lib
|
||||||
import scenario_cfg_lib
|
import scenario_cfg_lib
|
||||||
|
import lxml
|
||||||
|
import lxml.etree
|
||||||
|
|
||||||
ERR_LIST = {}
|
ERR_LIST = {}
|
||||||
BOOT_TYPE = ['no', 'vsbl', 'ovmf']
|
BOOT_TYPE = ['no', 'vsbl', 'ovmf']
|
||||||
RTOS_TYPE = ['no', 'Soft RT', 'Hard RT']
|
RTOS_TYPE = ['no', 'Soft RT', 'Hard RT']
|
||||||
DM_VUART0 = ['Disable', 'Enable']
|
DM_VUART0 = ['Disable', 'Enable']
|
||||||
|
PTM = ['y', 'n']
|
||||||
UOS_TYPES = ['CLEARLINUX', 'ANDROID', 'ALIOS', 'PREEMPT-RT LINUX', 'VXWORKS', 'WINDOWS', 'ZEPHYR', 'YOCTO', 'UBUNTU', 'GENERIC LINUX']
|
UOS_TYPES = ['CLEARLINUX', 'ANDROID', 'ALIOS', 'PREEMPT-RT LINUX', 'VXWORKS', 'WINDOWS', 'ZEPHYR', 'YOCTO', 'UBUNTU', 'GENERIC LINUX']
|
||||||
LINUX_LIKE_OS = ['CLEARLINUX', 'PREEMPT-RT LINUX', 'YOCTO', 'UBUNTU', 'GENERIC LINUX']
|
LINUX_LIKE_OS = ['CLEARLINUX', 'PREEMPT-RT LINUX', 'YOCTO', 'UBUNTU', 'GENERIC LINUX']
|
||||||
|
|
||||||
|
@ -669,3 +672,11 @@ def check_communication_vuart(launch_communication_vuarts, scenario_info):
|
||||||
ERR_LIST[vuart_key] = "uos {}'s communication_vuart 1 and legacy_vuart 1 should " \
|
ERR_LIST[vuart_key] = "uos {}'s communication_vuart 1 and legacy_vuart 1 should " \
|
||||||
"not be configured at the same time.".format(uos_id)
|
"not be configured at the same time.".format(uos_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def check_enable_ptm(launch_enable_ptm, scenario_info):
|
||||||
|
scenario_etree = lxml.etree.parse(scenario_info)
|
||||||
|
enable_ptm_vm_list = scenario_etree.xpath("//vm[PTM = 'y']/@id")
|
||||||
|
for uos_id, enable_ptm in launch_enable_ptm.items():
|
||||||
|
key = 'uos:id={},enable_ptm'.format(uos_id)
|
||||||
|
if enable_ptm == 'y' and str(uos_id) not in enable_ptm_vm_list:
|
||||||
|
ERR_LIST[key] = "PTM of uos:{} set to 'n' in scenario xml".format(uos_id)
|
||||||
|
|
|
@ -420,6 +420,11 @@ its ``id`` attribute. When it is enabled, specify which target VM's vUART the cu
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="board_private" type="BoardPrivateConfiguration" minOccurs="0" />
|
<xs:element name="board_private" type="BoardPrivateConfiguration" minOccurs="0" />
|
||||||
|
<xs:element name="PTM" type="Boolean" default="n" minOccurs="0">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Enable and disable PTM(Precision Timing Measurement) feature.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:element>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
<xs:attribute name="id" type="xs:integer" />
|
<xs:attribute name="id" type="xs:integer" />
|
||||||
|
|
||||||
|
|
|
@ -311,12 +311,25 @@
|
||||||
<xsl:variable name="communication_vuart" select="count(./communication_vuart/base[text() = 'PCI_VUART'])" />
|
<xsl:variable name="communication_vuart" select="count(./communication_vuart/base[text() = 'PCI_VUART'])" />
|
||||||
<xsl:variable name="pci_devs" select="count(./pci_devs/pci_dev[text() != ''])" />
|
<xsl:variable name="pci_devs" select="count(./pci_devs/pci_dev[text() != ''])" />
|
||||||
<xsl:variable name="pci_hostbridge" select="1" />
|
<xsl:variable name="pci_hostbridge" select="1" />
|
||||||
|
<xsl:variable name="virtual_root_port">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="./PTM = 'y'">
|
||||||
|
<xsl:value-of select="1" />
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="0" />
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
<xsl:if test="acrn:is-pre-launched-vm($vmtype)">
|
<xsl:if test="acrn:is-pre-launched-vm($vmtype)">
|
||||||
<xsl:if test="$ivshmem + $console_vuart + $communication_vuart + $pci_devs > 0">
|
<xsl:if test="$ivshmem + $console_vuart + $communication_vuart + $pci_devs > 0">
|
||||||
<func:result select="$ivshmem + $console_vuart + $communication_vuart + $pci_devs + $pci_hostbridge" />
|
<func:result select="$ivshmem + $console_vuart + $communication_vuart + $pci_devs + $pci_hostbridge" />
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="acrn:is-post-launched-vm($vmtype) or acrn:is-sos-vm($vmtype)">
|
<xsl:if test="acrn:is-post-launched-vm($vmtype)">
|
||||||
|
<func:result select="$ivshmem + $console_vuart + $communication_vuart + $virtual_root_port" />
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="acrn:is-sos-vm($vmtype)">
|
||||||
<func:result select="$ivshmem + $console_vuart + $communication_vuart" />
|
<func:result select="$ivshmem + $console_vuart + $communication_vuart" />
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
|
@ -48,6 +48,9 @@
|
||||||
<xsl:apply-templates select="console_vuart" />
|
<xsl:apply-templates select="console_vuart" />
|
||||||
<xsl:apply-templates select="communication_vuart" />
|
<xsl:apply-templates select="communication_vuart" />
|
||||||
<xsl:apply-templates select="pci_devs" />
|
<xsl:apply-templates select="pci_devs" />
|
||||||
|
<xsl:if test="acrn:is-post-launched-vm(vm_type)">
|
||||||
|
<xsl:apply-templates select="PTM" />
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:if test="acrn:is-sos-vm(vm_type) or acrn:pci-dev-num(@id)">
|
<xsl:if test="acrn:is-sos-vm(vm_type) or acrn:pci-dev-num(@id)">
|
||||||
<xsl:value-of select="$end_of_array_initializer" />
|
<xsl:value-of select="$end_of_array_initializer" />
|
||||||
|
@ -164,4 +167,15 @@
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="PTM">
|
||||||
|
<xsl:if test="text() = 'y'">
|
||||||
|
<xsl:text>{</xsl:text>
|
||||||
|
<xsl:value-of select="$newline" />
|
||||||
|
<xsl:value-of select="acrn:initializer('vbdf.value', 'UNASSIGNED_VBDF', '')" />
|
||||||
|
<xsl:value-of select="acrn:initializer('vrp_sec_bus', '1', '')" />
|
||||||
|
<xsl:text>},</xsl:text>
|
||||||
|
<xsl:value-of select="$newline" />
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
Loading…
Reference in New Issue