From ea672c5b0775651516e74ed4140e3180a52b8c8e Mon Sep 17 00:00:00 2001 From: Yonghua Huang Date: Tue, 18 Dec 2018 18:55:46 +0800 Subject: [PATCH] hv: update coding style for tampoline.c - add API get trampoline_start16_paddr() instead of exporting this global variable. - other minor update. Tracked-On: #2095 Signed-off-by: Yonghua Huang Acked-by: Eddie Dong --- hypervisor/arch/x86/pm.c | 2 +- hypervisor/arch/x86/trampoline.c | 7 ++++++- hypervisor/include/arch/x86/trampoline.h | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hypervisor/arch/x86/pm.c b/hypervisor/arch/x86/pm.c index 775b03ed1..279cc7e6f 100644 --- a/hypervisor/arch/x86/pm.c +++ b/hypervisor/arch/x86/pm.c @@ -131,7 +131,7 @@ void host_enter_s3(struct pm_s_state_data *sstate_data, uint32_t pm1a_cnt_val, u stac(); /* set ACRN wakeup vec instead */ - *(sstate_data->wake_vector_32) = (uint32_t)trampoline_start16_paddr; + *(sstate_data->wake_vector_32) = (uint32_t)get_trampoline_start16_paddr(); clac(); /* offline all APs */ diff --git a/hypervisor/arch/x86/trampoline.c b/hypervisor/arch/x86/trampoline.c index c827e73d2..944e7870e 100644 --- a/hypervisor/arch/x86/trampoline.c +++ b/hypervisor/arch/x86/trampoline.c @@ -9,7 +9,7 @@ #include #include -uint64_t trampoline_start16_paddr; +static uint64_t trampoline_start16_paddr; /* * Because trampoline code is relocated in different way, if HV code @@ -50,6 +50,11 @@ void write_trampoline_stack_sym(uint16_t pcpu_id) clflush(hva); } +uint64_t get_trampoline_start16_paddr(void) +{ + return trampoline_start16_paddr; +} + static void update_trampoline_code_refs(uint64_t dest_pa) { void *ptr; diff --git a/hypervisor/include/arch/x86/trampoline.h b/hypervisor/include/arch/x86/trampoline.h index cdc52ad3c..c210467fe 100644 --- a/hypervisor/include/arch/x86/trampoline.h +++ b/hypervisor/include/arch/x86/trampoline.h @@ -10,6 +10,7 @@ extern uint64_t read_trampoline_sym(const void *sym); extern void write_trampoline_sym(const void *sym, uint64_t val); extern void write_trampoline_stack_sym(uint16_t pcpu_id); extern uint64_t prepare_trampoline(void); +extern uint64_t get_trampoline_start16_paddr(void); /* external symbols that are helpful for relocation */ extern const uint8_t ld_trampoline_load; @@ -23,7 +24,4 @@ extern uint8_t cpu_boot_page_tables_ptr; extern uint8_t trampoline_pdpt_addr; extern uint8_t trampoline_gdt_ptr; extern uint8_t trampoline_start64_fixup; - -extern uint64_t trampoline_start16_paddr; - #endif /* TRAMPOLINE_H */