mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 13:08:42 +00:00
HV: init paging before init e820
With this patch, the hv_e820 will be initialized after enable paging. This is because the hv_e820 will be initialized from efi mmap when system boot from uefi, which the efi mmap could be above 4G space. Tracked-On: #5626 Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
parent
82c28af404
commit
4e1deab3d9
@ -144,8 +144,8 @@ void init_pcpu_pre(bool is_bsp)
|
|||||||
load_pcpu_state_data();
|
load_pcpu_state_data();
|
||||||
|
|
||||||
/* Initialize the hypervisor paging */
|
/* Initialize the hypervisor paging */
|
||||||
init_e820();
|
|
||||||
init_paging();
|
init_paging();
|
||||||
|
init_e820();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need update uart_base_address here for vaddr2paddr mapping may changed
|
* Need update uart_base_address here for vaddr2paddr mapping may changed
|
||||||
|
@ -231,10 +231,12 @@ void init_paging(void)
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint64_t low32_max_ram = 0UL;
|
uint64_t low32_max_ram = 0UL;
|
||||||
uint64_t high64_max_ram = MEM_4G;
|
uint64_t high64_max_ram = MEM_4G;
|
||||||
|
uint64_t top_addr_space = CONFIG_PLATFORM_RAM_SIZE + PLATFORM_LO_MMIO_SIZE;
|
||||||
|
|
||||||
const struct e820_entry *entry;
|
struct acrn_boot_info *abi = get_acrn_boot_info();
|
||||||
uint32_t entries_count = get_e820_entries_count();
|
const struct abi_mmap *entry;
|
||||||
const struct e820_entry *p_e820 = get_e820_entry();
|
uint32_t entries_count = abi->mmap_entries;
|
||||||
|
const struct abi_mmap *p_mmap = abi->mmap_entry;
|
||||||
|
|
||||||
pr_dbg("HV MMU Initialization");
|
pr_dbg("HV MMU Initialization");
|
||||||
|
|
||||||
@ -245,8 +247,8 @@ void init_paging(void)
|
|||||||
|
|
||||||
/* Modify WB attribute for E820_TYPE_RAM */
|
/* Modify WB attribute for E820_TYPE_RAM */
|
||||||
for (i = 0U; i < entries_count; i++) {
|
for (i = 0U; i < entries_count; i++) {
|
||||||
entry = p_e820 + i;
|
entry = p_mmap + i;
|
||||||
if (entry->type == E820_TYPE_RAM) {
|
if (entry->type == MMAP_TYPE_RAM) {
|
||||||
uint64_t end = entry->baseaddr + entry->length;
|
uint64_t end = entry->baseaddr + entry->length;
|
||||||
if (end < MEM_4G) {
|
if (end < MEM_4G) {
|
||||||
low32_max_ram = max(end, low32_max_ram);
|
low32_max_ram = max(end, low32_max_ram);
|
||||||
@ -257,6 +259,7 @@ void init_paging(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
low32_max_ram = round_pde_up(low32_max_ram);
|
low32_max_ram = round_pde_up(low32_max_ram);
|
||||||
|
high64_max_ram = min(high64_max_ram, top_addr_space);
|
||||||
high64_max_ram = round_pde_down(high64_max_ram);
|
high64_max_ram = round_pde_down(high64_max_ram);
|
||||||
|
|
||||||
/* Map [0, low32_max_ram) and [4G, high64_max_ram) RAM regions as WB attribute */
|
/* Map [0, low32_max_ram) and [4G, high64_max_ram) RAM regions as WB attribute */
|
||||||
|
Loading…
Reference in New Issue
Block a user