config_tools: support IVSHMEM devices region ID configuration

This patch adds ivshmem region ID configuration support when user
   configure ACRN IVSHMEM devices via ACRN config tool, this ID provides
   VMs with a stable identification of multiple shared memory regions.

   Also add logic to generate launch script with region ID configured
   as below:
   `add_virtual_device  8 ivshmem hv:/shm_region_0,256,1`

Tracked-On: #8566
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Yonghua Huang 2024-03-17 21:25:55 +08:00 committed by acrnsi-robot
parent f6bb15c85c
commit a7a6732580
4 changed files with 25 additions and 0 deletions

View File

@ -21,6 +21,8 @@
#define MAX_IVSHMEM_MSIX_TBL_ENTRY_NUM 8U
struct ivshmem_shm_region {
char name[32];
uint16_t region_id;
uint8_t reserved[6];
uint64_t hpa;
uint64_t size;
struct ivshmem_device *doorbell_peers[MAX_IVSHMEM_PEER_NUM];

View File

@ -55,6 +55,22 @@
</b-col>
</b-row>
<b-row class="align-items-center my-2">
<b-col md="2">
<label>
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<IconInfo/>
</template>
<span v-html="this.IVSHMEMRegionType.properties.IVSHMEM_REGION_ID.description"></span>
</n-popover>IVSHMEM Region ID:
</label>
</b-col>
<b-col md="4">
<b-form-input v-model="IVSHMEM_VMO.IVSHMEM_REGION_ID"/>
</b-col>
</b-row>
<div class="m-3 mt-4 d-flex flex-column gap-2">
<b>Shared VMs</b>
<p>Select all VMs that will use this shared memory region</p>

View File

@ -286,6 +286,11 @@ 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:annotation acrn:title="IVSHMEM Region ID">
<xs:documentation>A stable identification when multiple shared memory regions are provided.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="IVSHMEM_VMS" type="IVSHMEMVMS">
<xs:annotation acrn:title="Shared VMs">
<xs:documentation>Select all VMs that use the shared memory region.</xs:documentation>

View File

@ -64,9 +64,11 @@
<xsl:for-each select="hv//IVSHMEM/IVSHMEM_REGION[PROVIDED_BY = 'Hypervisor']">
<xsl:if test="text()">
<xsl:variable name="memsize" select="IVSHMEM_SIZE" />
<xsl:variable name="regionid" select="IVSHMEM_REGION_ID" />
<xsl:text>{ \</xsl:text>
<xsl:value-of select="$newline" />
<xsl:value-of select="acrn:initializer('name', concat('IVSHMEM_SHM_REGION_', position() - 1, ', \'), true())" />
<xsl:value-of select="acrn:initializer('region_id', concat(string($regionid), ', \'), true())" />
<xsl:value-of select="acrn:initializer('size', concat('0x', acrn:convert-num-base(string($memsize), 10, 16), '00000UL', ', \'), true())" />
<xsl:choose>
<xsl:when test="last() = position()">