HV: separate e820 related code as e820.c/h

1. e820 is modulized as separated files.
2. move boot_regs into multiboot.h as it's related with
multiboot info header

Tracked-On: #1842
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Minggui Cao
2018-12-07 14:41:02 +08:00
committed by wenlingz
parent c5d827ab1f
commit b69d24b1d4
13 changed files with 276 additions and 261 deletions

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
struct e820_mem_params {
uint64_t mem_bottom;
uint64_t mem_top;
uint64_t total_mem_size;
uint64_t max_ram_blk_base; /* used for the start address of UOS */
uint64_t max_ram_blk_size;
};
void init_e820(void);
void obtain_e820_mem_info(void);
void rebuild_vm0_e820(void);
uint64_t e820_alloc_low_memory(uint32_t size_arg);
extern uint32_t e820_entries;
extern struct e820_entry e820[E820_MAX_ENTRIES];
extern struct e820_mem_params e820_mem;
uint32_t create_e820_table(struct e820_entry *param_e820);
#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 e820_default_entries[NUM_E820_ENTRIES];
#endif

View File

@@ -70,17 +70,7 @@
#define LDTR_AR (0x0082U) /* LDT, type must be 2, refer to SDM Vol3 26.3.1.2 */
#define TR_AR (0x008bU) /* TSS (busy), refer to SDM Vol3 26.3.1.2 */
struct e820_mem_params {
uint64_t mem_bottom;
uint64_t mem_top;
uint64_t total_mem_size;
uint64_t max_ram_blk_base; /* used for the start address of UOS */
uint64_t max_ram_blk_size;
};
int prepare_vm0_memmap_and_e820(struct acrn_vm *vm);
uint64_t e820_alloc_low_memory(uint32_t size_arg);
/* Definition for a mem map lookup */
struct vm_lu_mem_map {
struct list_head list; /* EPT mem map lookup list*/
@@ -107,25 +97,6 @@ int gva2gpa(struct acrn_vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *err_c
enum vm_paging_mode get_vcpu_paging_mode(struct acrn_vcpu *vcpu);
void init_e820(void);
void obtain_e820_mem_info(void);
extern uint32_t e820_entries;
extern struct e820_entry e820[E820_MAX_ENTRIES];
#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 e820_default_entries[NUM_E820_ENTRIES];
#endif
extern uint32_t boot_regs[2];
extern struct e820_mem_params e820_mem;
int rdmsr_vmexit_handler(struct acrn_vcpu *vcpu);
int wrmsr_vmexit_handler(struct acrn_vcpu *vcpu);
void init_msr_emulation(struct acrn_vcpu *vcpu);

View File

@@ -80,4 +80,7 @@ struct multiboot_module {
int parse_hv_cmdline(void);
int init_vm_boot_info(struct acrn_vm *vm);
/* boot_regs store the multiboot header address */
extern uint32_t boot_regs[2];
#endif