hv: remove CONFIG_PARTITION_MODE for pre-launched VM vE820 creation

Preparing for hybrid mode:

- create vE820 for pre-launched VMs and do other init code when the
  vm_config->type is PRE_LAUNCHED_VM.
- create ve820.c for each board because without wrapping by
  CONFIG_PARTITION_MODE, ve820_entry[] needs to be visible even when
  compiling target boards that haven't enabled pre-launched VMs.
- remove create_prelaunched_vm_e820() from vm.c and implement board
  specific function for each $(CONFIG_BOARD)/ve820.c. The reasons being:
  - don't need to define ve820_entry[32] for those boards that don't
    support pre-launched VMs.
  - more importantly, this makes it much easier to create different per-VM
    vE820 when it's needed.

Tracked-On: #2291
Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
Zide Chen
2019-03-13 09:11:36 -07:00
committed by wenlingz
parent ca6e341147
commit 5398c901f6
9 changed files with 87 additions and 20 deletions

View File

@@ -5,8 +5,10 @@
*/
#include <e820.h>
#include <vm.h>
const struct e820_entry ve820_entry[E820_MAX_ENTRIES] = {
#define VE820_ENTRIES_APL_MRB 5U
static const struct e820_entry ve820_entry[VE820_ENTRIES_APL_MRB] = {
{ /* usable RAM under 1MB */
.baseaddr = 0x0UL,
.length = 0xF0000UL, /* 960KB */
@@ -37,3 +39,12 @@ const struct e820_entry ve820_entry[E820_MAX_ENTRIES] = {
.type = E820_TYPE_RESERVED
},
};
/**
* @pre vm != NULL
*/
void create_prelaunched_vm_e820(struct acrn_vm *vm)
{
vm->e820_entry_num = VE820_ENTRIES_APL_MRB;
vm->e820_entries = (struct e820_entry *)ve820_entry;
}