acrn-config: make HV_RAM_SIZE include IVSHMEM_SHM_SIZE

Because ivshmem memory uses hv memory, if the ivshmem feature is
enabled, HV_RAM_SIZE will include IVSHMEM_SHM_SIZE.

Tracked-On: #4853

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Shuang Zheng 2020-08-27 16:17:29 +08:00 committed by wenlingz
parent 07ed6841f5
commit 58a71b67ab
2 changed files with 32 additions and 3 deletions

View File

@ -30,6 +30,8 @@ VM_NUM_MAP_TOTAL_HV_RAM_SIZE = {
8:0x14800000,
}
HV_RAM_SIZE_MAX = 0x40000000
MEM_ALIGN = 2 * common.SIZE_M
@ -79,6 +81,33 @@ def get_memory(hv_info, config):
err_dic["board config: total vm number error"] = "VM num should not be greater than 8"
return err_dic
ivshmem_enabled = common.get_hv_item_tag(common.SCENARIO_INFO_FILE, "FEATURES", "IVSHMEM", "IVSHMEM_ENABLED")
total_shm_size = 0
if ivshmem_enabled == 'y':
raw_shmem_regions = common.get_hv_item_tag(common.SCENARIO_INFO_FILE, "FEATURES", "IVSHMEM", "IVSHMEM_REGION")
for raw_shm in raw_shmem_regions:
if raw_shm is None or raw_shm.strip() == '':
continue
raw_shm_splited = raw_shm.split(',')
if len(raw_shm_splited) == 3 and raw_shm_splited[0].strip() != '' \
and raw_shm_splited[1].strip() != '' and len(raw_shm_splited[2].strip().split(':')) >= 1:
try:
size = raw_shm_splited[1].strip()
if size.isdecimal():
int_size = int(size)
else:
int_size = int(size, 16)
total_shm_size += int_size
except Exception as e:
print(e)
hv_ram_size += total_shm_size
if hv_ram_size > HV_RAM_SIZE_MAX:
common.print_red("requested RAM size should be smaller then {}".format(HV_RAM_SIZE_MAX), err=True)
err_dic["board config: total vm number error"] = \
"requested RAM size should be smaller then {}".format(HV_RAM_SIZE_MAX)
return err_dic
# reseve 16M memory for hv sbuf, ramoops, etc.
reserved_ram = 0x1000000
# We recommend to put hv ram start address high than 0x10000000 to

View File

@ -763,10 +763,10 @@ def share_mem_check(shmem_regions, raw_shmem_regions, vm_type_info, prime_item,
except:
ERR_LIST[key] = "The size of share Memory region should be decimal or hexadecimal."
return
if int_size < 0x200000 or int_size > 0x40000000:
ERR_LIST[key] = "The size of share Memory region should be in [2M, 1G]."
if int_size < 0x200000 or int_size >= 0x40000000:
ERR_LIST[key] = "The size of share Memory region should be in [2M, 1G)."
return
if not math.log(int_size, 2).is_integer():
if not ((int_size & (int_size-1) == 0) and int_size != 0):
ERR_LIST[key] = "The size of share Memory region should be a power of 2."
return