mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-11 04:52:58 +00:00
HV: save efi_ctx into HV to use after init_paging()
efi_ctx is passed by EFI stub to hypervisor. The memory was allocated right after HV binary and marked as Efireserved. But HV is doing a 2MB alignment in init_paging() and might overwrite the efi_ctx struct or change the page table attribute. Now, EFI STUB uses Efiloaderdata type memory and the memory can be re-use by hypervisor/sos after boot time done. HV should save itself a copy if the content is still needed after init_paging(). Tracked-On: #2035 Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
This commit is contained in:
parent
3fee32c0bb
commit
b3b34fe2ad
@ -12,7 +12,7 @@
|
|||||||
#ifdef CONFIG_EFI_STUB
|
#ifdef CONFIG_EFI_STUB
|
||||||
static void efi_init(void);
|
static void efi_init(void);
|
||||||
|
|
||||||
struct efi_context* efi_ctx = NULL;
|
struct efi_context efi_ctx;
|
||||||
struct lapic_regs uefi_lapic_regs;
|
struct lapic_regs uefi_lapic_regs;
|
||||||
static int32_t efi_initialized;
|
static int32_t efi_initialized;
|
||||||
|
|
||||||
@ -52,9 +52,9 @@ int32_t uefi_sw_loader(struct acrn_vm *vm)
|
|||||||
* init bsp with boot_context.
|
* init bsp with boot_context.
|
||||||
*/
|
*/
|
||||||
memcpy_s(&(vcpu_regs->gprs), sizeof(struct acrn_gp_regs),
|
memcpy_s(&(vcpu_regs->gprs), sizeof(struct acrn_gp_regs),
|
||||||
&(efi_ctx->vcpu_regs.gprs), sizeof(struct acrn_gp_regs));
|
&(efi_ctx.vcpu_regs.gprs), sizeof(struct acrn_gp_regs));
|
||||||
|
|
||||||
vcpu_regs->rip = efi_ctx->vcpu_regs.rip;
|
vcpu_regs->rip = efi_ctx.vcpu_regs.rip;
|
||||||
set_vcpu_regs(vcpu, vcpu_regs);
|
set_vcpu_regs(vcpu, vcpu_regs);
|
||||||
|
|
||||||
/* defer irq enabling till vlapic is ready */
|
/* defer irq enabling till vlapic is ready */
|
||||||
@ -68,12 +68,12 @@ void *get_rsdp_from_uefi(void)
|
|||||||
if (!efi_initialized)
|
if (!efi_initialized)
|
||||||
efi_init();
|
efi_init();
|
||||||
|
|
||||||
return hpa2hva((uint64_t)efi_ctx->rsdp);
|
return hpa2hva((uint64_t)efi_ctx.rsdp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_ap_trampoline_buf(void)
|
void *get_ap_trampoline_buf(void)
|
||||||
{
|
{
|
||||||
return efi_ctx->ap_trampoline_buf;
|
return efi_ctx.ap_trampoline_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void efi_init(void)
|
static void efi_init(void)
|
||||||
@ -89,8 +89,7 @@ static void efi_init(void)
|
|||||||
if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES))
|
if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES))
|
||||||
ASSERT(0, "no multiboot drivers for uefi found");
|
ASSERT(0, "no multiboot drivers for uefi found");
|
||||||
|
|
||||||
efi_ctx = (struct efi_context *)hpa2hva((uint64_t)mbi->mi_drives_addr);
|
memcpy_s(&efi_ctx, sizeof(struct efi_context), hpa2hva((uint64_t)mbi->mi_drives_addr), sizeof(struct efi_context));
|
||||||
ASSERT(efi_ctx != NULL, "no uefi context found");
|
|
||||||
|
|
||||||
vm_sw_loader = uefi_sw_loader;
|
vm_sw_loader = uefi_sw_loader;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user