diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index b921d5f74..daa5e43a4 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -388,8 +388,8 @@ void bsp_boot_init(void) start_tsc = rdtsc(); /* Clear BSS */ - (void)memset(&_ld_bss_start, 0U, - (size_t)(&_ld_bss_end - &_ld_bss_start)); + (void)memset(&ld_bss_start, 0U, + (size_t)(&ld_bss_end - &ld_bss_start)); bitmap_set_nolock(BOOT_CPU_ID, &pcpu_active_bitmap); diff --git a/hypervisor/arch/x86/cpu_primary.S b/hypervisor/arch/x86/cpu_primary.S index 8e0de09a7..d018b8a80 100644 --- a/hypervisor/arch/x86/cpu_primary.S +++ b/hypervisor/arch/x86/cpu_primary.S @@ -131,7 +131,7 @@ cpu_primary_start_64: primary_start_long_mode: /* Initialize temporary stack pointer */ - lea _ld_bss_end(%rip), %rsp + lea ld_bss_end(%rip), %rsp /*0x1000 = CPU_PAGE_SIZE*/ add $0x1000,%rsp /* 16 = CPU_STACK_ALIGN */ @@ -142,7 +142,7 @@ primary_start_long_mode: * Notes: this includes the fixup to IDT tables and temporary * page tables */ - call _relocate + call relocate /* Load temportary GDT pointer value */ lea cpu_primary32_gdt_ptr(%rip), %rbx @@ -172,7 +172,7 @@ after: /* * Fix up the IDT desciptors - * The relocation delta in IDT tables has been fixed in _relocate() + * The relocation delta in IDT tables has been fixed in relocate() */ leal HOST_IDT(%rip), %edx movl $HOST_IDT_ENTRIES, %ecx diff --git a/hypervisor/arch/x86/guest/vlapic_priv.h b/hypervisor/arch/x86/guest/vlapic_priv.h index 363076f9d..0a1a48edd 100644 --- a/hypervisor/arch/x86/guest/vlapic_priv.h +++ b/hypervisor/arch/x86/guest/vlapic_priv.h @@ -27,8 +27,8 @@ * $FreeBSD$ */ -#ifndef _VLAPIC_PRIV_H_ -#define _VLAPIC_PRIV_H_ +#ifndef VLAPIC_PRIV_H +#define VLAPIC_PRIV_H /* * APIC Register: Offset Description @@ -82,4 +82,4 @@ #define APIC_OFFSET_TIMER_DCR 0x3E0U /* Timer's Divide Configuration */ -#endif /* _VLAPIC_PRIV_H_ */ +#endif /* VLAPIC_PRIV_H */ diff --git a/hypervisor/arch/x86/mmu.c b/hypervisor/arch/x86/mmu.c index b29cb9f47..79a2109e8 100644 --- a/hypervisor/arch/x86/mmu.c +++ b/hypervisor/arch/x86/mmu.c @@ -59,7 +59,7 @@ static uint16_t vmx_vpid_nr = VMX_MIN_NR_VPID; struct invept_desc { uint64_t eptp; - uint64_t _res; + uint64_t res; }; static inline void local_invvpid(uint64_t type, uint16_t vpid, uint64_t gva) diff --git a/hypervisor/arch/x86/pagetable.c b/hypervisor/arch/x86/pagetable.c index f0de8b168..1996d766c 100644 --- a/hypervisor/arch/x86/pagetable.c +++ b/hypervisor/arch/x86/pagetable.c @@ -56,7 +56,7 @@ static int split_large_page(uint64_t *pte, return 0; } -static inline void __modify_or_del_pte(uint64_t *pte, +static inline void local_modify_or_del_pte(uint64_t *pte, uint64_t prot_set, uint64_t prot_clr, uint32_t type) { if (type == MR_MODIFY) { @@ -111,7 +111,7 @@ static int modify_or_del_pte(uint64_t *pde, return -EFAULT; } - __modify_or_del_pte(pte, prot_set, prot_clr, type); + local_modify_or_del_pte(pte, prot_set, prot_clr, type); vaddr += PTE_SIZE; if (vaddr >= vaddr_end) { break; @@ -156,7 +156,7 @@ static int modify_or_del_pde(uint64_t *pdpte, return ret; } } else { - __modify_or_del_pte(pde, + local_modify_or_del_pte(pde, prot_set, prot_clr, type); if (vaddr_next < vaddr_end) { vaddr = vaddr_next; @@ -211,7 +211,7 @@ static int modify_or_del_pdpte(uint64_t *pml4e, return ret; } } else { - __modify_or_del_pte(pdpte, + local_modify_or_del_pte(pdpte, prot_set, prot_clr, type); if (vaddr_next < vaddr_end) { vaddr = vaddr_next; diff --git a/hypervisor/arch/x86/pm.c b/hypervisor/arch/x86/pm.c index 3a450d507..0528c7f9b 100644 --- a/hypervisor/arch/x86/pm.c +++ b/hypervisor/arch/x86/pm.c @@ -123,7 +123,7 @@ int enter_s3(struct vm *vm, uint32_t pm1a_cnt_val, suspend_iommu(); suspend_lapic(); - __enter_s3(vm, pm1a_cnt_val, pm1b_cnt_val); + asm_enter_s3(vm, pm1a_cnt_val, pm1b_cnt_val); /* release the lock aquired in trampoline code */ spinlock_release(&trampoline_spinlock); diff --git a/hypervisor/arch/x86/trampoline.S b/hypervisor/arch/x86/trampoline.S index 0a98e121e..f119c462d 100644 --- a/hypervisor/arch/x86/trampoline.S +++ b/hypervisor/arch/x86/trampoline.S @@ -38,7 +38,7 @@ */ .extern cpu_secondary_init - .extern _ld_bss_end + .extern ld_bss_end .extern HOST_GDTR .section .trampoline_reset,"ax" diff --git a/hypervisor/arch/x86/virq.c b/hypervisor/arch/x86/virq.c index 8f67f33b7..f69013f16 100644 --- a/hypervisor/arch/x86/virq.c +++ b/hypervisor/arch/x86/virq.c @@ -248,7 +248,7 @@ int vcpu_queue_exception(struct vcpu *vcpu, uint32_t vector, return 0; } -static void _vcpu_inject_exception(struct vcpu *vcpu, uint32_t vector) +static void vcpu_inject_exception(struct vcpu *vcpu, uint32_t vector) { if ((exception_type[vector] & EXCEPTION_ERROR_CODE_VALID) != 0U) { exec_vmwrite32(VMX_ENTRY_EXCEPTION_ERROR_CODE, @@ -266,7 +266,7 @@ static int vcpu_inject_hi_exception(struct vcpu *vcpu) uint32_t vector = vcpu->arch_vcpu.exception_info.exception; if (vector == IDT_MC || vector == IDT_BP || vector == IDT_DB) { - _vcpu_inject_exception(vcpu, vector); + vcpu_inject_exception(vcpu, vector); return 1; } @@ -279,7 +279,7 @@ static int vcpu_inject_lo_exception(struct vcpu *vcpu) /* high priority exception already be injected */ if (vector <= NR_MAX_VECTOR) { - _vcpu_inject_exception(vcpu, vector); + vcpu_inject_exception(vcpu, vector); return 1; } diff --git a/hypervisor/arch/x86/wakeup.S b/hypervisor/arch/x86/wakeup.S index c7d56e475..b90f39efc 100644 --- a/hypervisor/arch/x86/wakeup.S +++ b/hypervisor/arch/x86/wakeup.S @@ -30,8 +30,8 @@ .extern do_acpi_s3 .extern trampoline_spinlock - .global __enter_s3 -__enter_s3: + .global asm_enter_s3 +asm_enter_s3: /* * 0U=0x0=CPU_CONTEXT_OFFSET_RAX * 8U=0x8=CPU_CONTEXT_OFFSET_RCX diff --git a/hypervisor/boot/include/reloc.h b/hypervisor/boot/include/reloc.h index a9365852a..f868173d6 100644 --- a/hypervisor/boot/include/reloc.h +++ b/hypervisor/boot/include/reloc.h @@ -6,7 +6,7 @@ #ifndef RELOCATE_H #define RELOCATE_H -extern void _relocate(void); +extern void relocate(void); extern uint64_t get_hv_image_delta(void); extern uint64_t get_hv_image_base(void); extern uint64_t read_trampoline_sym(void *sym); @@ -15,10 +15,10 @@ extern uint64_t prepare_trampoline(void); /* external symbols that are helpful for relocation */ extern uint8_t _DYNAMIC[1]; -extern const uint8_t _ld_trampoline_load; -extern uint8_t _ld_trampoline_start; -extern uint8_t _ld_trampoline_end; -extern const uint64_t _ld_trampoline_size; +extern const uint8_t ld_trampoline_load; +extern uint8_t ld_trampoline_start; +extern uint8_t ld_trampoline_end; +extern const uint64_t ld_trampoline_size; extern uint8_t cpu_primary_start_32; extern uint8_t cpu_primary_start_64; diff --git a/hypervisor/boot/reloc.c b/hypervisor/boot/reloc.c index 6bb6fc50a..330061e41 100644 --- a/hypervisor/boot/reloc.c +++ b/hypervisor/boot/reloc.c @@ -70,7 +70,7 @@ static uint64_t trampoline_relo_addr(void *addr) return (uint64_t)addr - get_hv_image_delta(); } -void _relocate(void) +void relocate(void) { #ifdef CONFIG_RELOC struct Elf64_Dyn *dyn; @@ -108,7 +108,7 @@ void _relocate(void) * Need to subtract the relocation delta to get the correct * absolute addresses */ - trampoline_end = (uint64_t)(&_ld_trampoline_end) - delta; + trampoline_end = (uint64_t)(&ld_trampoline_end) - delta; primary_32_start = (uint64_t)(&cpu_primary_start_32) - delta; primary_32_end = (uint64_t)(&cpu_primary_start_64) - delta; @@ -214,7 +214,7 @@ uint64_t prepare_trampoline(void) { uint64_t size, dest_pa; - size = (uint64_t)(&_ld_trampoline_end - &_ld_trampoline_start); + size = (uint64_t)(&ld_trampoline_end - &ld_trampoline_start); #ifndef CONFIG_EFI_STUB dest_pa = e820_alloc_low_memory(CONFIG_LOW_RAM_SIZE); #else @@ -224,7 +224,7 @@ uint64_t prepare_trampoline(void) pr_dbg("trampoline code: %llx size %x", dest_pa, size); /* Copy segment for AP initialization code below 1MB */ - (void)memcpy_s(hpa2hva(dest_pa), (size_t)size, &_ld_trampoline_load, + (void)memcpy_s(hpa2hva(dest_pa), (size_t)size, &ld_trampoline_load, (size_t)size); update_trampoline_code_refs(dest_pa); trampoline_start16_paddr = dest_pa; diff --git a/hypervisor/bsp/ld/link_ram.ld.in b/hypervisor/bsp/ld/link_ram.ld.in index ceddf4704..ef6cfd77d 100644 --- a/hypervisor/bsp/ld/link_ram.ld.in +++ b/hypervisor/bsp/ld/link_ram.ld.in @@ -46,20 +46,20 @@ SECTIONS } > ram . = ALIGN(4) ; - _ld_trampoline_load = .; + ld_trampoline_load = .; - .trampoline : AT (_ld_trampoline_load) + .trampoline : AT (ld_trampoline_load) { - _ld_trampoline_start = .; + ld_trampoline_start = .; *(.trampoline_reset); . = ALIGN(4); - _ld_trampoline_end = .; + ld_trampoline_end = .; } > lowram - _ld_trampoline_size = _ld_trampoline_end - _ld_trampoline_start; + ld_trampoline_size = ld_trampoline_end - ld_trampoline_start; - .data (_ld_trampoline_load + _ld_trampoline_size): + .data (ld_trampoline_load + ld_trampoline_size): { *(.data) ; *(.data*) ; @@ -79,12 +79,12 @@ SECTIONS .bss (NOLOAD): { . = ALIGN(4) ; - _ld_bss_start = . ; + ld_bss_start = . ; *(.bss) ; *(.bss*) ; *(COMMON) ; . = ALIGN(4) ; - _ld_bss_end = . ; + ld_bss_end = . ; } > ram _ld_ram_size = LENGTH(ram) ; diff --git a/hypervisor/include/arch/x86/apicreg.h b/hypervisor/include/arch/x86/apicreg.h index a7a985be5..229a7311f 100644 --- a/hypervisor/include/arch/x86/apicreg.h +++ b/hypervisor/include/arch/x86/apicreg.h @@ -26,8 +26,8 @@ * $FreeBSD$ */ -#ifndef _APICREG_H_ -#define _APICREG_H_ +#ifndef APICREG_H +#define APICREG_H /* * Local && I/O APIC definitions. @@ -432,4 +432,4 @@ union ioapic_rte { #define IOAPIC_RTE_INTVEC 0x000000ffUL /*R/W: INT vector field*/ -#endif /* _APICREG_H_ */ +#endif /* APICREG_H */ diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index a44f252da..ca5f80e95 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -216,8 +216,8 @@ enum cpu_reg_name { /**********************************/ /* EXTERNAL VARIABLES */ /**********************************/ -extern uint8_t _ld_bss_start; -extern uint8_t _ld_bss_end; +extern uint8_t ld_bss_start; +extern uint8_t ld_bss_end; /* In trampoline range, hold the jump target which trampline will jump to */ extern uint64_t main_entry[1]; diff --git a/hypervisor/include/arch/x86/cpufeatures.h b/hypervisor/include/arch/x86/cpufeatures.h index 734ccd793..7d3b21d2d 100644 --- a/hypervisor/include/arch/x86/cpufeatures.h +++ b/hypervisor/include/arch/x86/cpufeatures.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __X86_CPUFEATURES_H__ -#define __X86_CPUFEATURES_H__ +#ifndef CPUFEATURES_H +#define CPUFEATURES_H /* Intel-defined CPU features, CPUID level 0x00000001 (ECX)*/ #define X86_FEATURE_SSE3 ((FEAT_1_ECX << 5U) + 0U) @@ -83,4 +83,4 @@ #define X86_FEATURE_PAGE1GB ((FEAT_8000_0001_EDX << 5U) + 26U) #define X86_FEATURE_LM ((FEAT_8000_0001_EDX << 5U) + 29U) -#endif /*__X86_CPUFEATURES_H__*/ +#endif /* CPUFEATURES_H */ diff --git a/hypervisor/include/arch/x86/guest/gpr.h b/hypervisor/include/arch/x86/guest/gpr.h deleted file mode 100644 index d9847d2f6..000000000 --- a/hypervisor/include/arch/x86/guest/gpr.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (C) 2018 Intel Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _VGPR_H_ -#define _VGPR_H_ - -#endif diff --git a/hypervisor/include/arch/x86/guest/ucode.h b/hypervisor/include/arch/x86/guest/ucode.h index fbb08314d..9a192dcd7 100644 --- a/hypervisor/include/arch/x86/guest/ucode.h +++ b/hypervisor/include/arch/x86/guest/ucode.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef _ARCH_X86_UCODE_H -#define _ARCH_X86_UCODE_H +#ifndef UCODE_H +#define UCODE_H struct ucode_header { uint32_t header_ver; @@ -23,4 +23,4 @@ struct ucode_header { void acrn_update_ucode(struct vcpu *vcpu, uint64_t v); uint64_t get_microcode_version(void); -#endif +#endif /* UCODE_H */ diff --git a/hypervisor/include/arch/x86/guest/vcpu.h b/hypervisor/include/arch/x86/guest/vcpu.h index 2341675d4..9180ba697 100644 --- a/hypervisor/include/arch/x86/guest/vcpu.h +++ b/hypervisor/include/arch/x86/guest/vcpu.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef _VCPU_H_ -#define _VCPU_H_ +#ifndef VCPU_H +#define VCPU_H #define ACRN_VCPU_MMIO_COMPLETE (0U) @@ -47,7 +47,6 @@ #ifndef ASSEMBLER #include -#include enum vcpu_state { VCPU_INIT, @@ -239,7 +238,7 @@ struct vcpu { uint64_t guest_msrs[IDX_MAX_MSR]; #ifdef CONFIG_MTRR_ENABLED struct mtrr_state mtrr; -#endif +#endif /* CONFIG_MTRR_ENABLED */ uint64_t reg_cached; uint64_t reg_updated; } __aligned(CPU_PAGE_SIZE); @@ -303,6 +302,6 @@ int prepare_vcpu(struct vm *vm, uint16_t pcpu_id); void request_vcpu_pre_work(struct vcpu *vcpu, uint16_t pre_work_id); void vcpu_dumpreg(void *data); -#endif +#endif /* ASSEMBLER */ -#endif +#endif /* VCPU_H */ diff --git a/hypervisor/include/arch/x86/guest/vioapic.h b/hypervisor/include/arch/x86/guest/vioapic.h index f7517deca..271fe1264 100644 --- a/hypervisor/include/arch/x86/guest/vioapic.h +++ b/hypervisor/include/arch/x86/guest/vioapic.h @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef _VIOAPIC_H_ -#define _VIOAPIC_H_ +#ifndef VIOAPIC_H +#define VIOAPIC_H #include @@ -65,4 +65,4 @@ int vioapic_mmio_access_handler(struct vcpu *vcpu, void get_vioapic_info(char *str_arg, size_t str_max, uint16_t vmid); #endif /* HV_DEBUG */ -#endif +#endif /* VIOAPIC_H */ diff --git a/hypervisor/include/arch/x86/guest/vlapic.h b/hypervisor/include/arch/x86/guest/vlapic.h index 9842c7817..3b609d250 100644 --- a/hypervisor/include/arch/x86/guest/vlapic.h +++ b/hypervisor/include/arch/x86/guest/vlapic.h @@ -27,8 +27,8 @@ * $FreeBSD$ */ -#ifndef _VLAPIC_H_ -#define _VLAPIC_H_ +#ifndef VLAPIC_H +#define VLAPIC_H /* * 16 priority levels with at most one vector injected per level. @@ -186,4 +186,4 @@ int apic_write_vmexit_handler(struct vcpu *vcpu); int veoi_vmexit_handler(struct vcpu *vcpu); int tpr_below_threshold_vmexit_handler(__unused struct vcpu *vcpu); void calcvdest(struct vm *vm, uint64_t *dmask, uint32_t dest, bool phys); -#endif /* _VLAPIC_H_ */ +#endif /* VLAPIC_H */ diff --git a/hypervisor/include/arch/x86/guest/vm.h b/hypervisor/include/arch/x86/guest/vm.h index 10211207e..d6721b4ba 100644 --- a/hypervisor/include/arch/x86/guest/vm.h +++ b/hypervisor/include/arch/x86/guest/vm.h @@ -146,13 +146,6 @@ struct vm { * when vm is active. So no lock needed */ - struct _vm_shared_memory *shared_memory_area; - - struct { - struct _vm_virtual_device_node *head; - struct _vm_virtual_device_node *tail; - } virtual_device_list; - unsigned char GUID[16]; struct secure_world_control sworld_control; diff --git a/hypervisor/include/arch/x86/guest/vm0_boot.h b/hypervisor/include/arch/x86/guest/vm0_boot.h index baa293246..03b20b38b 100644 --- a/hypervisor/include/arch/x86/guest/vm0_boot.h +++ b/hypervisor/include/arch/x86/guest/vm0_boot.h @@ -26,7 +26,6 @@ #define BOOT_CTX_EFER_HIGH_OFFSET 204 #define SIZE_OF_BOOT_CTX 296 #else -#include #define BOOT_CTX_CR0_OFFSET 176U #define BOOT_CTX_CR3_OFFSET 192U #define BOOT_CTX_CR4_OFFSET 184U diff --git a/hypervisor/include/arch/x86/guest/vpic.h b/hypervisor/include/arch/x86/guest/vpic.h index a2c121fbd..c7255747d 100644 --- a/hypervisor/include/arch/x86/guest/vpic.h +++ b/hypervisor/include/arch/x86/guest/vpic.h @@ -27,8 +27,8 @@ * $FreeBSD$ */ -#ifndef _VPIC_H_ -#define _VPIC_H_ +#ifndef VPIC_H +#define VPIC_H #define ICU_IMR_OFFSET 1U @@ -129,4 +129,4 @@ void vpic_get_irq_trigger(struct vm *vm, uint32_t irq, enum vpic_trigger *trigger); uint32_t vpic_pincount(void); -#endif /* _VPIC_H_ */ +#endif /* VPIC_H */ diff --git a/hypervisor/include/arch/x86/host_pm.h b/hypervisor/include/arch/x86/host_pm.h index 6dd75c8ba..c12e73786 100644 --- a/hypervisor/include/arch/x86/host_pm.h +++ b/hypervisor/include/arch/x86/host_pm.h @@ -11,10 +11,9 @@ extern uint8_t host_enter_s3_success; -int enter_s3(struct vm *vm, uint32_t pm1a_cnt_val, - uint32_t pm1b_cnt_val); -extern void __enter_s3(struct vm *vm, uint32_t pm1a_cnt_val, +int enter_s3(struct vm *vm, uint32_t pm1a_cnt_val, uint32_t pm1b_cnt_val); +extern void asm_enter_s3(struct vm *vm, uint32_t pm1a_cnt_val, uint32_t pm1b_cnt_val); extern void restore_s3_context(void); -#endif /* ARCH_X86_PM_H */ +#endif /* HOST_PM_H */ diff --git a/hypervisor/include/common/schedule.h b/hypervisor/include/common/schedule.h index 109d9577d..946b43447 100644 --- a/hypervisor/include/common/schedule.h +++ b/hypervisor/include/common/schedule.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef _HV_CORE_SCHEDULE_ -#define _HV_CORE_SCHEDULE_ +#ifndef SCHEDULE_H +#define SCHEDULE_H #define NEED_RESCHEDULE (1U) #define NEED_OFFLINE (2U) @@ -39,5 +39,5 @@ int need_offline(uint16_t pcpu_id); void schedule(void); void vcpu_thread(struct vcpu *vcpu); -#endif +#endif /* SCHEDULE_H */ diff --git a/hypervisor/include/debug/vuart.h b/hypervisor/include/debug/vuart.h index 31fba6518..f6e076ee0 100644 --- a/hypervisor/include/debug/vuart.h +++ b/hypervisor/include/debug/vuart.h @@ -27,8 +27,8 @@ * $FreeBSD$ */ -#ifndef _VUART_H_ -#define _VUART_H_ +#ifndef VUART_H +#define VUART_H #define RX_BUF_SIZE 256U #define TX_BUF_SIZE 8192U @@ -83,6 +83,6 @@ static inline struct acrn_vuart *vuart_console_active(void) } static inline void vuart_console_tx_chars(__unused struct acrn_vuart *vu) {} static inline void vuart_console_rx_chars(__unused struct acrn_vuart *vu) {} -#endif /*HV_DEBUG*/ +#endif /* HV_DEBUG */ -#endif +#endif /* VUART_H */ diff --git a/hypervisor/include/lib/mem_mgt.h b/hypervisor/include/lib/mem_mgt.h index c176398b7..e846aacc1 100644 --- a/hypervisor/include/lib/mem_mgt.h +++ b/hypervisor/include/lib/mem_mgt.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __MEM_MGT_H__ -#define __MEM_MGT_H__ +#ifndef MEM_MGT_H +#define MEM_MGT_H /* Macros */ #define BITMAP_WORD_SIZE 32U @@ -28,4 +28,4 @@ void *alloc_page(void); void *alloc_pages(unsigned int page_num); void free(void *ptr); -#endif /* MEM_MGT_H_ */ +#endif /* MEM_MGT_H */