Skip to content

Commit

Permalink
config_tools: support IVSHMEM devices region ID configuration
Browse files Browse the repository at this point in the history
   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: projectacrn#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>
  • Loading branch information
yonghuah committed Mar 17, 2024
1 parent a052cda commit 7fca01c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hypervisor/include/dm/ivshmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions misc/config_tools/schema/types.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions misc/config_tools/xforms/ivshmem_cfg.h.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -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()">
Expand Down

0 comments on commit 7fca01c

Please sign in to comment.