From 252ba0b047c26f56f84fb7e6d46a892cd19492e3 Mon Sep 17 00:00:00 2001 From: Yonghua Huang Date: Fri, 11 Aug 2023 07:00:56 +0800 Subject: [PATCH] hv: allocate ivshmem shared memory from E820 ACRN boot fails when size of ivshmem device is configured to 512MB, this patch allocates this memory from E820 table instead of reserving in hypervisor. Tracked-On: #8502 Signed-off-by: Yonghua Huang Reviewed-by: Junjie Mao --- hypervisor/dm/vpci/ivshmem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hypervisor/dm/vpci/ivshmem.c b/hypervisor/dm/vpci/ivshmem.c index 75383e004..46a0e1c84 100644 --- a/hypervisor/dm/vpci/ivshmem.c +++ b/hypervisor/dm/vpci/ivshmem.c @@ -66,16 +66,15 @@ struct ivshmem_device { struct ivshmem_shm_region *region; }; -/* IVSHMEM_SHM_SIZE is provided by offline tool */ -static uint8_t ivshmem_base[IVSHMEM_SHM_SIZE] __aligned(PDE_SIZE); static struct ivshmem_device ivshmem_dev[IVSHMEM_DEV_NUM]; static spinlock_t ivshmem_dev_lock = { .head = 0U, .tail = 0U, }; void init_ivshmem_shared_memory() { uint32_t i; - uint64_t addr = hva2hpa(&ivshmem_base); + uint64_t addr; + addr = e820_alloc_memory(roundup(IVSHMEM_SHM_SIZE, PDE_SIZE), MEM_SIZE_MAX); for (i = 0U; i < ARRAY_SIZE(mem_regions); i++) { mem_regions[i].hpa = addr; addr += mem_regions[i].size;