From 90b342bd530718e3ebd954db18782ed49380757c Mon Sep 17 00:00:00 2001 From: "Yang, Yu-chu" Date: Thu, 12 Jul 2018 13:14:13 -0700 Subject: [PATCH] HV: prototyping non-static function Includes header file of non-static function, and declare the in-file use function static. Signed-off-by: Yang, Yu-chu Acked-by: Anthony Xu --- hypervisor/arch/x86/debug/reboot.c | 1 + hypervisor/arch/x86/ept.c | 2 +- hypervisor/arch/x86/guest/pm.c | 3 ++- hypervisor/arch/x86/guest/vioapic.c | 2 +- hypervisor/arch/x86/guest/vlapic.c | 5 +++-- hypervisor/arch/x86/guest/vmsr.c | 2 +- hypervisor/arch/x86/guest/vpic.c | 2 +- hypervisor/arch/x86/ioapic.c | 4 ++-- hypervisor/arch/x86/irq.c | 2 +- hypervisor/arch/x86/notify.c | 2 +- hypervisor/arch/x86/vmx.c | 2 +- hypervisor/boot/acpi.c | 2 +- hypervisor/common/hypercall.c | 2 +- hypervisor/debug/vuart.c | 2 +- hypervisor/include/arch/x86/cpu.h | 3 +++ hypervisor/include/arch/x86/irq.h | 1 + hypervisor/lib/crypto/hkdf.c | 1 + hypervisor/lib/string.c | 2 +- 18 files changed, 24 insertions(+), 16 deletions(-) diff --git a/hypervisor/arch/x86/debug/reboot.c b/hypervisor/arch/x86/debug/reboot.c index 8ac200204..bc0dfaf77 100644 --- a/hypervisor/arch/x86/debug/reboot.c +++ b/hypervisor/arch/x86/debug/reboot.c @@ -3,6 +3,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ #include +#include int warm_reboot(void) { diff --git a/hypervisor/arch/x86/ept.c b/hypervisor/arch/x86/ept.c index e9bcfa49a..66bfa3b7c 100644 --- a/hypervisor/arch/x86/ept.c +++ b/hypervisor/arch/x86/ept.c @@ -44,7 +44,7 @@ static uint64_t find_next_table(uint32_t table_offset, void *table_base) return sub_table_addr; } -void free_ept_mem(void *pml4_addr) +static void free_ept_mem(void *pml4_addr) { void *pdpt_addr; void *pde_addr; diff --git a/hypervisor/arch/x86/guest/pm.c b/hypervisor/arch/x86/guest/pm.c index 418650041..5ad6238a7 100644 --- a/hypervisor/arch/x86/guest/pm.c +++ b/hypervisor/arch/x86/guest/pm.c @@ -189,7 +189,8 @@ static void pm1ab_io_write(__unused struct vm_io_handler *hdlr, io_write(v, addr, width); } -void register_gas_io_handler(struct vm *vm, struct acpi_generic_address *gas) +static void +register_gas_io_handler(struct vm *vm, struct acpi_generic_address *gas) { uint8_t io_len[5] = {0, 1, 2, 4, 8}; struct vm_io_range gas_io; diff --git a/hypervisor/arch/x86/guest/vioapic.c b/hypervisor/arch/x86/guest/vioapic.c index 9763a29b6..b88084fd7 100644 --- a/hypervisor/arch/x86/guest/vioapic.c +++ b/hypervisor/arch/x86/guest/vioapic.c @@ -62,7 +62,7 @@ static inline const char *pinstate_str(bool asserted) return (asserted) ? "asserted" : "deasserted"; } -struct vioapic * +static struct vioapic * vm_ioapic(struct vm *vm) { return (struct vioapic *)vm->arch_vm.virt_ioapic; diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index 60ae8b618..a971b3d24 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -35,6 +35,7 @@ #include "instr_emul.h" #include "vlapic_priv.h" +#include "vlapic.h" #define VLAPIC_VERBOS 0 #define PRIO(x) ((x) >> 4) @@ -1709,7 +1710,7 @@ vlapic_enabled(struct vlapic *vlapic) } } -void +static void vlapic_set_tmr(struct vlapic *vlapic, uint32_t vector, bool level) { struct lapic_regs *lapic; @@ -1739,7 +1740,7 @@ vlapic_apicv_batch_set_tmr(struct vlapic *vlapic) } } -void +static void vlapic_apicv_set_tmr(struct vlapic *vlapic, uint32_t vector, bool level) { if (vlapic->ops.apicv_set_tmr != NULL) { diff --git a/hypervisor/arch/x86/guest/vmsr.c b/hypervisor/arch/x86/guest/vmsr.c index 1c9bf3b32..9ebf66d00 100644 --- a/hypervisor/arch/x86/guest/vmsr.c +++ b/hypervisor/arch/x86/guest/vmsr.c @@ -51,7 +51,7 @@ static void enable_msr_interception(uint8_t *bitmap, uint32_t msr) } /* not used now just leave it for some cases it may be used as API*/ -void disable_msr_interception(uint8_t *bitmap, uint32_t msr) +static void disable_msr_interception(uint8_t *bitmap, uint32_t msr) { uint8_t *read_map; uint8_t *write_map; diff --git a/hypervisor/arch/x86/guest/vpic.c b/hypervisor/arch/x86/guest/vpic.c index caf72f260..8610963bc 100644 --- a/hypervisor/arch/x86/guest/vpic.c +++ b/hypervisor/arch/x86/guest/vpic.c @@ -929,7 +929,7 @@ static void vpic_elc_io_write(__unused struct vm_io_handler *hdlr, } } -void vpic_register_io_handler(struct vm *vm) +static void vpic_register_io_handler(struct vm *vm) { struct vm_io_range master_range = { .flags = IO_ATTR_RW, diff --git a/hypervisor/arch/x86/ioapic.c b/hypervisor/arch/x86/ioapic.c index 387c0962c..147dd7cae 100644 --- a/hypervisor/arch/x86/ioapic.c +++ b/hypervisor/arch/x86/ioapic.c @@ -407,7 +407,7 @@ void setup_ioapic_irq(void) ASSERT(nr_gsi <= NR_MAX_GSI, "GSI table overflow"); } -void dump_ioapic(void) +static void dump_ioapic(void) { uint32_t irq; @@ -457,7 +457,7 @@ void resume_ioapic(void) } #ifdef HV_DEBUG -void get_rte_info(struct ioapic_rte *rte, bool *mask, bool *irr, +static void get_rte_info(struct ioapic_rte *rte, bool *mask, bool *irr, bool *phys, uint32_t *delmode, bool *level, uint32_t *vector, uint32_t *dest) { *mask = ((rte->lo_32 & IOAPIC_RTE_INTMASK) == IOAPIC_RTE_INTMSET); diff --git a/hypervisor/arch/x86/irq.c b/hypervisor/arch/x86/irq.c index 247f95167..acdf910f4 100644 --- a/hypervisor/arch/x86/irq.c +++ b/hypervisor/arch/x86/irq.c @@ -398,7 +398,7 @@ void dispatch_exception(struct intr_excp_ctx *ctx) cpu_dead(pcpu_id); } -void handle_spurious_interrupt(uint32_t vector) +static void handle_spurious_interrupt(uint32_t vector) { send_lapic_eoi(); diff --git a/hypervisor/arch/x86/notify.c b/hypervisor/arch/x86/notify.c index a618e67db..0ba426d15 100644 --- a/hypervisor/arch/x86/notify.c +++ b/hypervisor/arch/x86/notify.c @@ -61,7 +61,7 @@ void setup_notification(void) dev_to_vector(notification_node)); } -void cleanup_notification(void) +static void cleanup_notification(void) { if (notification_node != NULL) unregister_handler_common(notification_node); diff --git a/hypervisor/arch/x86/vmx.c b/hypervisor/arch/x86/vmx.c index c17673f92..222010c78 100644 --- a/hypervisor/arch/x86/vmx.c +++ b/hypervisor/arch/x86/vmx.c @@ -246,7 +246,7 @@ void exec_vmwrite64(unsigned int field_full, uint64_t value) asm volatile ("movw %%cs, %%ax" : "=a"(sel)); \ } -uint32_t get_cs_access_rights(void) +static uint32_t get_cs_access_rights(void) { uint32_t usable_ar; uint16_t sel_value; diff --git a/hypervisor/boot/acpi.c b/hypervisor/boot/acpi.c index c2905d3f7..74dcdf631 100644 --- a/hypervisor/boot/acpi.c +++ b/hypervisor/boot/acpi.c @@ -175,7 +175,7 @@ probe_table(uint64_t address, const char *sig) return 1; } -void *get_acpi_tbl(const char *sig) +static void *get_acpi_tbl(const char *sig) { struct acpi_table_rsdp *rsdp; struct acpi_table_rsdt *rsdt; diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index 8c2f45b52..048b265eb 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -403,7 +403,7 @@ int64_t hcall_notify_req_finish(uint64_t vmid, uint64_t vcpu_id) return 0; } -int64_t _set_vm_memmap(struct vm *vm, struct vm *target_vm, +static int64_t _set_vm_memmap(struct vm *vm, struct vm *target_vm, struct vm_set_memmap *memmap) { uint64_t hpa, base_paddr; diff --git a/hypervisor/debug/vuart.c b/hypervisor/debug/vuart.c index 9fcd52db6..636dbed3c 100644 --- a/hypervisor/debug/vuart.c +++ b/hypervisor/debug/vuart.c @@ -309,7 +309,7 @@ done: return reg; } -void vuart_register_io_handler(struct vm *vm) +static void vuart_register_io_handler(struct vm *vm) { struct vm_io_range range = { .flags = IO_ATTR_RW, diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index 142452d13..a13b0470c 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -242,6 +242,7 @@ struct stack_canary { uint8_t reserved[40]; uint64_t canary; }; +void __stack_chk_fail(void); #endif extern struct cpuinfo_x86 boot_cpu_data; @@ -263,6 +264,8 @@ bool is_vapic_intr_delivery_supported(void); bool is_vapic_virt_reg_supported(void); bool cpu_has_cap(uint32_t bit); void load_cpu_state_data(void); +void bsp_boot_init(void); +void cpu_secondary_init(void); void start_cpus(); void stop_cpus(); diff --git a/hypervisor/include/arch/x86/irq.h b/hypervisor/include/arch/x86/irq.h index 523d8c43b..f23bd80ee 100644 --- a/hypervisor/include/arch/x86/irq.h +++ b/hypervisor/include/arch/x86/irq.h @@ -72,6 +72,7 @@ int quick_handler_nolock(struct irq_desc *desc, void *handler_data); int init_default_irqs(uint16_t cpu); +void dispatch_exception(struct intr_excp_ctx *ctx); void dispatch_interrupt(struct intr_excp_ctx *ctx); void setup_notification(void); diff --git a/hypervisor/lib/crypto/hkdf.c b/hypervisor/lib/crypto/hkdf.c index a441a88d7..91e7e6f25 100644 --- a/hypervisor/lib/crypto/hkdf.c +++ b/hypervisor/lib/crypto/hkdf.c @@ -5,6 +5,7 @@ */ #include +#include int hkdf_sha256(uint8_t *out_key, size_t out_len, const uint8_t *secret, size_t secret_len, diff --git a/hypervisor/lib/string.c b/hypervisor/lib/string.c index af81af037..2c9f3af56 100644 --- a/hypervisor/lib/string.c +++ b/hypervisor/lib/string.c @@ -364,7 +364,7 @@ size_t strnlen_s(const char *str, size_t maxlen) return count; } -char hexdigit(int decimal_val) +static char hexdigit(int decimal_val) { static const char hexdigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };