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:
Zide Chen
2018-05-02 23:39:57 -07:00
committed by lijinxia
parent 40c8c4d3c3
commit 2a1a6ad0af
10 changed files with 24 additions and 21 deletions

View File

@@ -74,15 +74,9 @@ config MEM_LOGLEVEL_DEFAULT
int "Default loglevel in memory"
default 4
config LOW_RAM_START
hex "Address of the beginning of low RAM region"
default 0x00001000 if PLATFORM_SBL
default 0x00008000 if PLATFORM_UEFI
config LOW_RAM_SIZE
hex "Size of the low RAM region"
default 0x000cf000 if PLATFORM_SBL
default 0x00010000 if PLATFORM_UEFI
default 0x00010000
config RAM_START
hex "Address of the RAM region assigned to the hypervisor"

View File

@@ -26,6 +26,8 @@ volatile uint32_t up_count = 0;
/* physical cpu active bitmap, support up to 64 cpus */
uint64_t pcpu_active_bitmap = 0;
uint64_t trampline_start16_paddr;
/* TODO: add more capability per requirement */
/*APICv features*/
#define VAPIC_FEATURE_VIRT_ACCESS (1 << 0)

View File

@@ -674,9 +674,8 @@ uint64_t e820_alloc_low_memory(uint32_t size)
* This API assume that the trusty memory is remapped to guest physical address
* of 511G to 511G + 16MB
*
* FIXME: here using hard code GUEST_INIT_PAGE_TABLE_START as guest init page
* table gpa start, and it will occupy at most GUEST_INIT_PT_PAGE_NUM pages.
* Some check here:
* FIXME: here the guest init page table will occupy at most
* GUEST_INIT_PT_PAGE_NUM pages. Some check here:
* - guest page table space should not override trampline code area
* (it's a little tricky here, as under current identical mapping, HV & SOS
* share same memory under 1M; under uefi boot mode, the defered AP startup
@@ -688,7 +687,7 @@ uint64_t e820_alloc_low_memory(uint32_t size)
* after guest realmode/32bit no paging mode got supported.
******************************************************************/
#define GUEST_INIT_PAGE_TABLE_SKIP_SIZE 0x8000UL
#define GUEST_INIT_PAGE_TABLE_START (CONFIG_LOW_RAM_START + \
#define GUEST_INIT_PAGE_TABLE_START (trampline_start16_paddr + \
GUEST_INIT_PAGE_TABLE_SKIP_SIZE)
#define GUEST_INIT_PT_PAGE_NUM 7
#define RSDP_F_ADDR 0xE0000
@@ -794,7 +793,7 @@ uint64_t create_guest_initial_paging(struct vm *vm)
******************************************************************/
#define GUEST_INIT_GDT_SKIP_SIZE 0x8000UL
#define GUEST_INIT_GDT_START (CONFIG_LOW_RAM_START + \
#define GUEST_INIT_GDT_START (trampline_start16_paddr + \
GUEST_INIT_GDT_SKIP_SIZE)
/* The GDT defined below compatible with linux kernel */