mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-01 21:23:59 +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>
51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
/*
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef E820_H
|
|
#define E820_H
|
|
#include <types.h>
|
|
|
|
/* E820 memory types */
|
|
#define E820_TYPE_RAM 1U /* EFI 1, 2, 3, 4, 5, 6, 7 */
|
|
#define E820_TYPE_RESERVED 2U
|
|
/* EFI 0, 11, 12, 13 (everything not used elsewhere) */
|
|
#define E820_TYPE_ACPI_RECLAIM 3U /* EFI 9 */
|
|
#define E820_TYPE_ACPI_NVS 4U /* EFI 10 */
|
|
#define E820_TYPE_UNUSABLE 5U /* EFI 8 */
|
|
|
|
#define E820_MAX_ENTRIES 32U
|
|
|
|
/** Defines a single entry in an E820 memory map. */
|
|
struct e820_entry {
|
|
/** The base address of the memory range. */
|
|
uint64_t baseaddr;
|
|
/** The length of the memory range. */
|
|
uint64_t length;
|
|
/** The type of memory region. */
|
|
uint32_t type;
|
|
} __packed;
|
|
|
|
struct mem_range {
|
|
uint64_t mem_bottom;
|
|
uint64_t mem_top;
|
|
uint64_t total_mem_size;
|
|
};
|
|
|
|
/* HV read multiboot header to get e820 entries info and calc total RAM info */
|
|
void init_e820(void);
|
|
|
|
uint64_t e820_alloc_memory(uint32_t size_arg, uint64_t max_addr);
|
|
/* get total number of the e820 entries */
|
|
uint32_t get_e820_entries_count(void);
|
|
|
|
/* get the e802 entiries */
|
|
const struct e820_entry *get_e820_entry(void);
|
|
|
|
/* get the e820 total memory info */
|
|
const struct mem_range *get_mem_range_info(void);
|
|
|
|
#endif
|