HV: use separated vm_config.c for each scenario

Previously we use unified vm_config.c for all scenarios and use MACROs
for each configuration items, then the initialization of vm_configs[]
becomes more complicated when definition of MACROs increase, so change
the coding style that all configurable items could be explicitly shown in
vm_configuration.c to make code more readable.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2019-04-04 13:02:45 +08:00
committed by Eddie Dong
parent d8cec9f9c4
commit d3e4f69595
8 changed files with 96 additions and 107 deletions

View File

@@ -5,51 +5,11 @@
*/
#include <vm_config.h>
#include <cpu.h>
#include <errno.h>
#include <acrn_common.h>
#include <page.h>
#include <logmsg.h>
#include <cat.h>
#include <vm_configurations.h>
#define INIT_VM_CONFIG(idx) \
{ \
.type = VM##idx##_CONFIG_TYPE, \
.name = VM##idx##_CONFIG_NAME, \
.pcpu_bitmap = VM##idx##_CONFIG_PCPU_BITMAP, \
.guest_flags = VM##idx##_CONFIG_FLAGS, \
.clos = VM##idx##_CONFIG_CLOS, \
.memory = { \
.start_hpa = VM##idx##_CONFIG_MEM_START_HPA, \
.size = VM##idx##_CONFIG_MEM_SIZE, \
}, \
.os_config = { \
.name = VM##idx##_CONFIG_OS_NAME, \
.bootargs = VM##idx##_CONFIG_OS_BOOTARGS, \
}, \
.vm_vuart = true, \
.pci_ptdev_num = VM##idx##_CONFIG_PCI_PTDEV_NUM, \
.pci_ptdevs = vm##idx##_pci_ptdevs, \
}
static struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] __aligned(PAGE_SIZE) = {
#ifdef VM0_CONFIGURED
INIT_VM_CONFIG(0),
#endif
#ifdef VM1_CONFIGURED
INIT_VM_CONFIG(1),
#endif
#ifdef VM2_CONFIGURED
INIT_VM_CONFIG(2),
#endif
#ifdef VM3_CONFIGURED
INIT_VM_CONFIG(3),
#endif
};
/*
* @pre vm_id < CONFIG_MAX_VM_NUM