HV: e820 refinement

- add e820 info in struct acrn_vm;

- rename rebuild_sos_vm_e820() to create_sos_vm_e820();

- add create_prelaunched_vm_e820() for partition mode;

- rename create_e820_table() to create_zeropage_e820() and merge for
  both sharing mode and partition mode;

- move create_xxx_vm_e820() to vm.c;

- move create_zeropage_e820() to vm_load.c;

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-02-01 23:12:09 +08:00
committed by Eddie Dong
parent 11bfe3d43e
commit 0f745b4d15
5 changed files with 122 additions and 119 deletions

View File

@@ -36,15 +36,9 @@ struct e820_mem_params {
/* HV read multiboot header to get e820 entries info and calc total RAM info */
void init_e820(void);
/* before boot sos_vm(service OS), call it to hide the HV RAM entry in e820 table from sos_vm */
void rebuild_sos_vm_e820(void);
/* get some RAM below 1MB in e820 entries, hide it from sos_vm, return its start address */
uint64_t e820_alloc_low_memory(uint32_t size_arg);
/* copy the original e820 entries info to param_e820 */
uint32_t create_e820_table(struct e820_entry *param_e820);
/* get total number of the e820 entries */
uint32_t get_e820_entries_count(void);
@@ -54,15 +48,4 @@ const struct e820_entry *get_e820_entry(void);
/* get the e820 total memory info */
const struct e820_mem_params *get_e820_mem_info(void);
#ifdef CONFIG_PARTITION_MODE
/*
* Default e820 mem map:
*
* Assumption is every VM launched by ACRN in partition mode uses 2G of RAM.
* there is reserved memory of 64K for MPtable and PCI hole of 512MB
*/
#define NUM_E820_ENTRIES 5U
extern const struct e820_entry ve820_entry[NUM_E820_ENTRIES];
#endif
#endif

View File

@@ -10,6 +10,7 @@
#include <vpci.h>
#include <page.h>
#include <cpu_caps.h>
#include <e820.h>
#ifdef CONFIG_PARTITION_MODE
#include <mptable.h>
@@ -132,6 +133,8 @@ struct acrn_vm {
struct vm_hw_info hw; /* Reference to this VM's HW information */
struct vm_sw_info sw; /* Reference to SW associated with this VM */
struct vm_pm_info pm; /* Reference to this VM's arch information */
uint32_t e820_entry_num;
struct e820_entry *e820_entries;
uint16_t vm_id; /* Virtual machine identifier */
enum vm_state state; /* VM state */
struct acrn_vuart vuart; /* Virtual UART */
@@ -291,6 +294,15 @@ struct acrn_vm *get_vm_from_vmid(uint16_t vm_id);
struct acrn_vm *get_sos_vm(void);
#ifdef CONFIG_PARTITION_MODE
/*
* Default e820 mem map:
*
* Assumption is every VM launched by ACRN in partition mode uses 2G of RAM.
* there is reserved memory of 64K for MPtable and PCI hole of 512MB
*/
#define NUM_E820_ENTRIES 5U
extern const struct e820_entry ve820_entry[NUM_E820_ENTRIES];
struct vm_config_arraies {
int32_t num_vm_config;
struct acrn_vm_config vm_config_array[CONFIG_MAX_VM_NUM];