EFI: Allocate 2M aligned memory for hypervisor image

Hypervisor does memory alignment during initializing paging(init_paging)
although the starting address allocated by EFI stub doesn't meet the
requirement. As a result, HV might overwrite some memory belong to UEFI
BIOS. The patch introduces a new routine to fix the issue.

Tracked-On: #2349
Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
Reviewed-by: Zheng, Gen <gen.zheng@intel.com>
Reviewed-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
Chaohong guo
2019-01-16 13:53:26 +08:00
committed by Eddie Dong
parent 912be6c4dd
commit ad0f8bc3b1
3 changed files with 73 additions and 1 deletions

View File

@@ -363,7 +363,7 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *_table)
* instead.
*/
#ifdef CONFIG_RELOC
err = emalloc_reserved_mem(&hv_hpa, HV_RUNTIME_MEM_SIZE, MEM_ADDR_4GB);
err = emalloc_reserved_aligned(&hv_hpa, HV_RUNTIME_MEM_SIZE, 1 << 21, MEM_ADDR_4GB);
#else
err = emalloc_fixed_addr(&hv_hpa, HV_RUNTIME_MEM_SIZE, CONFIG_HV_RAM_START);
#endif