config_tools: update HV_RAM_SIZE calculation algorithm

update HV_RAM_SIZE calculation algorithm to 20MB + VM number*
16MB, which consists of text segment rodata(2MB), bss data(about
1MB), bss.ppt_pages(2.4MB), bss.ctx_tables(6MB), bss.vm_array(
3.2MB), bss.ivshmem_base(2MB+1.8MB for alignment) and
bss.post_uos_sworld_memory(16MB*post-launched VM number).

Tracked-On: #5927
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Shuang Zheng 2021-04-12 15:51:53 +00:00 committed by wenlingz
parent b8e0ef3240
commit fee0025db8
3 changed files with 17 additions and 44 deletions

View File

@ -5,7 +5,7 @@
import sys
import subprocess
import board_cfg_lib
import board_cfg_lib, scenario_cfg_lib
import hv_cfg_lib
import common
@ -13,23 +13,6 @@ import common
DESC = """# Board defconfig generated by acrn-config tool
"""
VM_NUM_MAP_TOTAL_HV_RAM_SIZE = {
# 120M
2:0x7800000,
# 150M
3:0x9600000,
# 190M
4:0xBE00000,
# 210M
5:0xD200000,
# 250M
6:0xFA00000,
# 300M
7:0x12C00000,
# 328M
8:0x14800000,
}
HV_RAM_SIZE_MAX = 0x40000000
MEM_ALIGN = 2 * common.SIZE_M
@ -74,12 +57,12 @@ def get_memory(hv_info, config):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}
if common.VM_COUNT in list(VM_NUM_MAP_TOTAL_HV_RAM_SIZE.keys()):
hv_ram_size = VM_NUM_MAP_TOTAL_HV_RAM_SIZE[common.VM_COUNT]
else:
common.print_red("VM num should not be greater than 8", err=True)
err_dic["board config: total vm number error"] = "VM num should not be greater than 8"
return err_dic
post_launched_vm_num = 0
for id in common.VM_TYPES:
if common.VM_TYPES[id] in scenario_cfg_lib.VM_DB and \
scenario_cfg_lib.VM_DB[common.VM_TYPES[id]]["load_type"] == "POST_LAUNCHED_VM":
post_launched_vm_num += 1
hv_ram_size = common.HV_BASE_RAM_SIZE + common.POST_LAUNCHED_VM_RAM_SIZE * post_launched_vm_num
ivshmem_enabled = common.get_hv_item_tag(common.SCENARIO_INFO_FILE, "FEATURES", "IVSHMEM", "IVSHMEM_ENABLED")
total_shm_size = 0

View File

@ -40,6 +40,9 @@ MAX_VM_NUM = 8
MAX_VUART_NUM = 8
HV_BASE_RAM_SIZE = 0x1400000
POST_LAUNCHED_VM_RAM_SIZE = 0x1000000
class MultiItem():
def __init__(self):

View File

@ -7,24 +7,7 @@
import sys, os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
import common, board_cfg_lib
VM_NUM_MAP_TOTAL_HV_RAM_SIZE = {
# 120M
2:0x7800000,
# 150M
3:0x9600000,
# 190M
4:0xBE00000,
# 210M
5:0xD200000,
# 250M
6:0xFA00000,
# 300M
7:0x12C00000,
# 328M
8:0x14800000,
}
import common, board_cfg_lib, scenario_cfg_lib
HV_RAM_SIZE_MAX = 0x40000000
@ -34,8 +17,12 @@ def fn(board_etree, scenario_etree, allocation_etree):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}
vm_count = common.count_nodes("//*[local-name() = 'vm']", scenario_etree)
hv_ram_size = VM_NUM_MAP_TOTAL_HV_RAM_SIZE[vm_count]
post_launched_vm_num = 0
for id in common.VM_TYPES:
if common.VM_TYPES[id] in scenario_cfg_lib.VM_DB and \
scenario_cfg_lib.VM_DB[common.VM_TYPES[id]]["load_type"] == "POST_LAUNCHED_VM":
post_launched_vm_num += 1
hv_ram_size = common.HV_BASE_RAM_SIZE + common.POST_LAUNCHED_VM_RAM_SIZE * post_launched_vm_num
ivshmem_enabled = common.get_text("//IVSHMEM_ENABLED", scenario_etree)
total_shm_size = 0