HV: Make AP trampoline code relocatable

V3->V4: Updated function/variable names for accurancy
V2->V3: Changed a few function/variable names to make it less confusing
V1->V2: removed the unneccesary cache flushing

- For UEFI boot, allocate memory for trampoline code in ACRN EFI,
  and pass the pointer to HV through efi_ctx
- For other boot, scan E820 to allocate memory in HV run time
- update_trampoline_code_refs() updates all the references that need the
  absolute PA with the actual load address

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>
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 Jack Ren
parent ceb3076b69
commit fe6397d9d8
6 changed files with 79 additions and 18 deletions

View File

@@ -157,11 +157,17 @@ int cpu_find_logical_id(uint32_t lapic_id);
/**********************************/
extern const uint8_t _ld_cpu_secondary_reset_load[];
extern uint8_t _ld_cpu_secondary_reset_start[];
extern uint8_t _ld_cpu_secondary_reset_end[];
extern const uint64_t _ld_cpu_secondary_reset_size;
extern uint8_t _ld_bss_start[];
extern uint8_t _ld_bss_end[];
extern uint8_t _ld_cpu_data_start[];
extern uint8_t _ld_cpu_data_start[];
extern uint8_t _ld_cpu_data_end[];
extern uint8_t CPU_Boot_Page_Tables_Start[];
extern uint8_t CPU_Boot_Page_Tables_ptr[];
extern uint8_t cpu_secondary_pdpt_addr[];
extern uint8_t cpu_secondary_gdt_ptr[];
extern uint8_t ap_long_mode_jump_ref[];
extern int ibrs_type;

View File

@@ -39,6 +39,7 @@ typedef struct {
struct efi_ctx {
uint64_t rip;
void *rsdp;
void *ap_trampoline_buf;
dt_addr_t gdt;
dt_addr_t idt;
uint16_t tr_sel;
@@ -74,5 +75,6 @@ struct efi_ctx {
}__attribute__((packed));
void *get_rsdp_from_uefi(void);
void *get_ap_trampoline_buf(void);
#endif /* UEFI_H*/