config_tools: Add ivshmem region ID to launch script

Add missed ivshmem region ID. If no region ID in scenario,
will set 0 as default.

Tracked-On: #8645

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Zhang Chen 2024-06-20 16:41:21 +08:00 committed by acrnsi-robot
parent 9d7f14e783
commit b55440dce9
2 changed files with 9 additions and 3 deletions

View File

@ -303,12 +303,18 @@ def generate_for_one_vm(board_etree, hv_scenario_etree, vm_scenario_etree, vm_id
for ivshmem in eval_xpath_all(vm_scenario_etree, f"//IVSHMEM_REGION[PROVIDED_BY = 'Device Model' and .//VM_NAME = '{vm_name}']"):
vbdf = eval_xpath(ivshmem, f".//VBDF/text()")
slot = get_slot_by_vbdf(vbdf)
script.add_virtual_device("ivshmem", slot, options=f"dm:/{ivshmem.find('NAME').text},{ivshmem.find('IVSHMEM_SIZE').text}")
if ivshmem.find('IVSHMEM_REGION_ID') is not None:
script.add_virtual_device("ivshmem", slot, options=f"dm:/{ivshmem.find('NAME').text},{ivshmem.find('IVSHMEM_SIZE').text},{ivshmem.find('IVSHMEM_REGION_ID').text}")
else:
script.add_virtual_device("ivshmem", slot, options=f"dm:/{ivshmem.find('NAME').text},{ivshmem.find('IVSHMEM_SIZE').text},{0}")
for ivshmem in eval_xpath_all(vm_scenario_etree, f"//IVSHMEM_REGION[PROVIDED_BY = 'Hypervisor' and .//VM_NAME = '{vm_name}']"):
vbdf = eval_xpath(ivshmem, f".//VBDF/text()")
slot = get_slot_by_vbdf(vbdf)
script.add_virtual_device("ivshmem", slot, options=f"hv:/{ivshmem.find('NAME').text},{ivshmem.find('IVSHMEM_SIZE').text}")
if ivshmem.find('IVSHMEM_REGION_ID') is not None:
script.add_virtual_device("ivshmem", slot, options=f"hv:/{ivshmem.find('NAME').text},{ivshmem.find('IVSHMEM_SIZE').text},{ivshmem.find('IVSHMEM_REGION_ID').text}")
else:
script.add_virtual_device("ivshmem", slot, options=f"hv:/{ivshmem.find('NAME').text},{ivshmem.find('IVSHMEM_SIZE').text},{0}")
if eval_xpath(vm_scenario_etree, ".//console_vuart/text()") == "PCI":
script.add_virtual_device("uart", options="vuart_idx:0")

View File

@ -286,7 +286,7 @@ in megabytes. The value should be a power of 2
and no more than 512.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="IVSHMEM_REGION_ID" type="xs:integer" default="0">
<xs:element name="IVSHMEM_REGION_ID" type="xs:string" default="0">
<xs:annotation acrn:title="IVSHMEM Region ID">
<xs:documentation>A stable identification when multiple shared memory regions are provided.</xs:documentation>
</xs:annotation>