acrn-config: support non-contiguous HPA for hybrid scenario

The patch adds acrn-config tool support for adding
non-continguous HPA allocations for pre-launched VMs
in hybrid scenario.

Tracked-On: #4217
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Vijay Dhanraj 2019-12-06 19:17:16 -08:00 committed by wenlingz
parent c8a4ca6c78
commit 9729fe07fd
4 changed files with 13 additions and 10 deletions

View File

@ -20,6 +20,7 @@ def ve820_per_launch(config, hpa_size, hpa2_size):
return err_dic
board_name = board_cfg_lib.undline_name(board_name)
pre_vm_cnt = board_cfg_lib.get_pre_launch_cnt(board_cfg_lib.SCENARIO_INFO_FILE)
low_mem_to_pci_hole_len = '0xA0000000'
low_mem_to_pci_hole = '0x20000000'
@ -36,7 +37,7 @@ def ve820_per_launch(config, hpa_size, hpa2_size):
print("#include <vm.h>", file=config)
print("", file=config)
for i in range(board_cfg_lib.VM_COUNT):
for i in range(pre_vm_cnt):
if (int(hpa_size[i], 16) <= 512 * 1024 * 1024):
low_mem_hpa_len.append(int(hpa_size[i], 16) - 1 * 1024 * 1024)
high_mem_hpa_len.append(0)
@ -58,7 +59,7 @@ def ve820_per_launch(config, hpa_size, hpa2_size):
else:
print("#define VM{}_VE820_ENTRIES_{}\t{}U".format(i, board_name, 5), file=config)
for i in range(board_cfg_lib.VM_COUNT):
for i in range(pre_vm_cnt):
print("static const struct e820_entry vm{}_ve820_entry[{}] = {{".format(
i, "VM{}_VE820_ENTRIES_{}".format(i, board_name)), file=config)
print("\t{\t/* usable RAM under 1MB */", file=config)
@ -144,7 +145,7 @@ def ve820_per_launch(config, hpa_size, hpa2_size):
print("*/", file=config)
print("void create_prelaunched_vm_e820(struct acrn_vm *vm)", file=config)
print("{", file=config)
for i in range(board_cfg_lib.VM_COUNT):
for i in range(pre_vm_cnt):
print("\tif (vm->vm_id == {}U)".format(hex(i)), file=config)
print("\t{", file=config)
print("\t\tvm->e820_entry_num = VM{}_VE820_ENTRIES_{};".format(i, board_name), file=config)
@ -202,7 +203,7 @@ def generate_file(config):
return err_dic
# HPA size for both VMs should have valid length.
for i in range(board_cfg_lib.VM_COUNT):
for i in range(pre_vm_cnt):
if hpa_size_list[i] == '0x0' or hpa_size_list[i] == '0X0':
board_cfg_lib.print_red("HPA size should not be zero", err=True)
err_dic['board config: generate ve820.c failed'] = "HPA size should not be zero"

View File

@ -176,7 +176,7 @@ def gen_logical_partition_header(vm_info, config):
i, vm_info.mem_info.mem_size[i]), file=config)
print("#define VM{0}_CONFIG_MEM_START_HPA2\t\t{1}UL".format(
i, vm_info.mem_info.mem_start_hpa2[i]), file=config)
print("#define VM{0}_CONFIG_MEM_SIZE_HPA2\t\t\t{1}UL".format(
print("#define VM{0}_CONFIG_MEM_SIZE_HPA2\t\t{1}UL".format(
i, vm_info.mem_info.mem_size_hpa2[i]), file=config)
print('#define VM{0}_CONFIG_OS_BOOTARG_ROOT\t\t"root={1} "'.format(
i, vm_info.os_cfg.kern_root_dev[i]), file=config)
@ -279,7 +279,7 @@ def gen_hybrid_header(vm_info, config):
print("#define VM0_CONFIG_MEM_SIZE\t\t{0}UL".format(vm_info.mem_info.mem_size[0]), file=config)
print("#define VM0_CONFIG_MEM_START_HPA2\t{0}UL".format(
vm_info.mem_info.mem_start_hpa2[0]), file=config)
print("#define VM0_CONFIG_MEM_SIZE_HPA2\t\t{0}UL".format(vm_info.mem_info.mem_size_hpa2[0]), file=config)
print("#define VM0_CONFIG_MEM_SIZE_HPA2\t{0}UL".format(vm_info.mem_info.mem_size_hpa2[0]), file=config)
print("", file=config)
print("#define SOS_VM_BOOTARGS\t\t\tSOS_ROOTFS\t\\", file=config)
print('\t\t\t\t\t"rw rootwait "\t\\', file=config)

View File

@ -17,6 +17,8 @@
<memory>
<start_hpa desc="The start physical address in host for the VM">0x100000000</start_hpa>
<size desc="The memory size in Bytes for the VM">0x20000000</size>
<start_hpa2 configurable="0" desc="Start of second HPA for non-contiguous allocations in host for the VM">0x0</start_hpa2>
<size_hpa2 configurable="0" desc="Memory size of second HPA for non-contiguous allocations in Bytes for the VM">0x0</size_hpa2>
</memory>
<os_config>
<name desc="Specify the OS name of VM, currently it is not referenced by hypervisor code.">Zephyr</name>

View File

@ -19,8 +19,8 @@
<memory>
<start_hpa desc="The start physical address in host for the VM">0x100000000</start_hpa>
<size desc="The memory size in Bytes for the VM">0x20000000</size>
<start_hpa2 desc="The start physical address in host for the VM">0x0</start_hpa2>
<size_hpa2 desc="The memory size in Bytes for the VM">0x0</size_hpa2>
<start_hpa2 desc="Start of second HPA for non-contiguous allocations in host for the VM">0x0</start_hpa2>
<size_hpa2 desc="Memory size of second HPA for non-contiguous allocations in Bytes for the VM">0x0</size_hpa2>
</memory>
<os_config>
<name desc="Specify the OS name of VM, currently it is not referenced by hypervisor code.">ClearLinux</name>
@ -68,8 +68,8 @@
<memory>
<start_hpa desc="The start physical address in host for the VM">0x120000000</start_hpa>
<size desc="The memory size in Bytes for the VM">0x20000000</size>
<start_hpa2 desc="The start physical address in host for the VM">0x0</start_hpa2>
<size_hpa2 desc="The memory size in Bytes for the VM">0x0</size_hpa2>
<start_hpa2 desc="Start of second HPA for non-contiguous allocations in host for the VM">0x0</start_hpa2>
<size_hpa2 desc="Memory size of second HPA for non-contiguous allocations in Bytes for the VM">0x0</size_hpa2>
</memory>
<os_config>
<name desc="Specify the OS name of VM, currently it is not referenced by hypervisor code.">ClearLinux</name>