mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-04-28 19:54:01 +00:00
As ACRN prepares to support servers with large amounts of memory current logic to allocate space for 4K pages of EPT at compile time will increase the size of .bss section of ACRN binary. Bootloaders could run into a situation where they cannot find enough contiguous space to load ACRN binary under 4GB, which is typically heavily fragmented with E820 types Reserved, ACPI data, 32-bit PCI hole etc. This patch does the following 1) Works only for "direct" mode of vboot 2) reserves space for 4K pages of EPT, after boot by parsing platform E820 table, for all types of VMs. Size comparison: w/o patch Size of DRAM Size of .bss 48 GB 0xe1bbc98 (~226 MB) 128 GB 0x222abc98 (~548 MB) w/ patch Size of DRAM Size of .bss 48 GB 0x1991c98 (~26 MB) 128 GB 0x1a81c98 (~28 MB) Tracked-On: #4563 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
/* this is for direct guest_boot method */
|
|
|
|
#include <types.h>
|
|
#include <e820.h>
|
|
#include <cpu.h>
|
|
#include <boot.h>
|
|
#include <direct_boot.h>
|
|
#include <mmu.h>
|
|
|
|
/* AP trampoline code buffer base address. */
|
|
static uint64_t ap_trampoline_buf;
|
|
|
|
static void init_direct_boot(void)
|
|
{
|
|
ap_trampoline_buf = e820_alloc_memory(CONFIG_LOW_RAM_SIZE, MEM_1M);
|
|
}
|
|
|
|
/* @post: return != 0UL */
|
|
static uint64_t get_direct_boot_ap_trampoline(void)
|
|
{
|
|
return ap_trampoline_buf;
|
|
}
|
|
|
|
static void* get_direct_boot_rsdp(void)
|
|
{
|
|
#ifdef CONFIG_MULTIBOOT2
|
|
struct acrn_multiboot_info *mbi = get_multiboot_info();
|
|
|
|
return mbi->mi_acpi_rsdp;
|
|
#else
|
|
return NULL;
|
|
#endif
|
|
}
|
|
|
|
static void init_direct_boot_irq(void)
|
|
{
|
|
CPU_IRQ_ENABLE();
|
|
}
|
|
|
|
static struct vboot_operations direct_boot_ops = {
|
|
.init = init_direct_boot,
|
|
.get_ap_trampoline = get_direct_boot_ap_trampoline,
|
|
.get_rsdp = get_direct_boot_rsdp,
|
|
.init_irq = init_direct_boot_irq,
|
|
};
|
|
|
|
struct vboot_operations* get_direct_boot_ops(void)
|
|
{
|
|
return &direct_boot_ops;
|
|
}
|