mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 17:27:53 +00:00
hv: Other preparation for trampoline code relocation
- For UEFI boot, allocate memory for trampoline code in ACRN EFI, and pass the pointer to HV through efi_ctx - Correct LOW_RAM_SIZE and LOW_RAM_START in Kconfig and bsp_cfg.h - use trampline_start16_paddr instead of the hardcoded CONFIG_LOW_RAM_START for initial guest GDT and page tables Signed-off-by: Zheng, Gen <gen.zheng@intel.com> Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Signed-off-by: Zide Chen <zide.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com> Acked-by: Xu, Anthony <anthony.xu@intel.com>
This commit is contained in:
@@ -17,8 +17,7 @@
|
||||
#define HEAP_SIZE 0x100000
|
||||
#define CONSOLE_LOGLEVEL_DEFAULT 3
|
||||
#define MEM_LOGLEVEL_DEFAULT 5
|
||||
#define CONFIG_LOW_RAM_START 0x00001000
|
||||
#define CONFIG_LOW_RAM_SIZE 0x000CF000
|
||||
#define CONFIG_LOW_RAM_SIZE 0x00010000
|
||||
#define CONFIG_RAM_START 0x6E000000
|
||||
#define CONFIG_RAM_SIZE 0x02000000 /* 32M */
|
||||
#define CONFIG_MTRR_ENABLED 1
|
||||
|
@@ -190,12 +190,6 @@ again:
|
||||
mmap[j].mm_type = E820_RAM;
|
||||
j++;
|
||||
|
||||
/* reserve secondary memory region(0x1000 ~ 0x10000) for hv */
|
||||
err = __emalloc(CONFIG_LOW_RAM_SIZE, CONFIG_LOW_RAM_START,
|
||||
&addr, EfiReservedMemoryType);
|
||||
if (err != EFI_SUCCESS)
|
||||
goto out;
|
||||
|
||||
mbi->mi_flags |= MULTIBOOT_INFO_HAS_MMAP | MULTIBOOT_INFO_HAS_CMDLINE;
|
||||
mbi->mi_mmap_length = j*sizeof(struct multiboot_mmap);
|
||||
|
||||
@@ -227,6 +221,13 @@ switch_to_guest_mode(EFI_HANDLE image)
|
||||
|
||||
efi_ctx = (struct efi_ctx *)(UINTN)addr;
|
||||
|
||||
/* reserve secondary memory region for hv */
|
||||
err = emalloc_for_low_mem(&addr, CONFIG_LOW_RAM_SIZE);
|
||||
if (err != EFI_SUCCESS)
|
||||
goto out;
|
||||
|
||||
efi_ctx->ap_trampline_buf = (void *)addr;
|
||||
|
||||
config_table = sys_table->ConfigurationTable;
|
||||
|
||||
for (i = 0; i < sys_table->NumberOfTableEntries; i++) {
|
||||
|
@@ -95,6 +95,7 @@ struct e820_entry {
|
||||
struct efi_ctx {
|
||||
uint64_t rip;
|
||||
VOID *rsdp;
|
||||
VOID *ap_trampline_buf;
|
||||
dt_addr_t gdt;
|
||||
dt_addr_t idt;
|
||||
uint16_t tr_sel;
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#define HEAP_SIZE 0x100000
|
||||
#define CONSOLE_LOGLEVEL_DEFAULT 3
|
||||
#define MEM_LOGLEVEL_DEFAULT 5
|
||||
#define CONFIG_LOW_RAM_START 0x00008000
|
||||
#define CONFIG_LOW_RAM_SIZE 0x00010000
|
||||
#define CONFIG_RAM_START 0x20000000
|
||||
#define CONFIG_RAM_SIZE 0x02000000 /* 32M */
|
||||
|
@@ -97,6 +97,11 @@ void *get_rsdp_from_uefi(void)
|
||||
return HPA2HVA(efi_ctx->rsdp);
|
||||
}
|
||||
|
||||
void *get_ap_trampline_buf(void)
|
||||
{
|
||||
return efi_ctx->ap_trampline_buf;
|
||||
}
|
||||
|
||||
static void efi_init(void)
|
||||
{
|
||||
struct multiboot_info *mbi = NULL;
|
||||
|
Reference in New Issue
Block a user