From 0b8cefbc9ce824f8cb854066c55e9f852472670a Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Thu, 10 Sep 2020 13:25:49 +0800 Subject: [PATCH] dm: refine ivshmem usage interface Change shared memory name prefix from sos to dm Change shared memory size unit from byte to megabyte Tracked-On: #4853 Signed-off-by: Yuan Liu Acked-by: Wang, Yu1 --- devicemodel/hw/pci/ivshmem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/devicemodel/hw/pci/ivshmem.c b/devicemodel/hw/pci/ivshmem.c index 6a3bb8ab5..6da5ed387 100644 --- a/devicemodel/hw/pci/ivshmem.c +++ b/devicemodel/hw/pci/ivshmem.c @@ -63,7 +63,7 @@ #define IVSHMEM_RESERVED_REG 0x0f #define hv_land_prefix "hv:/" -#define dm_land_prefix "sos:/" +#define dm_land_prefix "dm:/" struct pci_ivshmem_vdev { struct pci_vdev *dev; @@ -272,10 +272,11 @@ pci_ivshmem_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) pr_warn("the shared memory size is incorrect, %s\n", tmp); goto err; } + size *= 0x100000; /* convert to megabytes */ if (size < 0x200000 || size >= 0x40000000 || (size & (size - 1)) != 0) { - pr_warn("invalid shared memory size %u, the size range is [2M,1G) bytes and value must be a power of 2\n", - size); + pr_warn("Invalid shared memory size %u, the size range is [2MB,512MB], the unit is megabyte and the value must be a power of 2\n", + size/0x100000); goto err; }