From 63ef1236decada0ad05b5c3bef1cee9454b221bf Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Sun, 29 Jul 2018 18:17:01 +0800 Subject: [PATCH] move global x2apic_enabled into arch dir the x2apic_enabled should be x86 specific field. Signed-off-by: Jason Chen CJ Acked-by: Xu, Anthony --- hypervisor/arch/x86/cpu.c | 3 +++ hypervisor/arch/x86/cpuid.c | 2 ++ hypervisor/common/hv_main.c | 2 -- hypervisor/include/arch/x86/guest/vm.h | 1 - 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 59f6d3464..7fe31d52f 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -27,6 +27,9 @@ volatile uint16_t up_count = 0U; /* physical cpu active bitmap, support up to 64 cpus */ uint64_t pcpu_active_bitmap = 0UL; +/* X2APIC mode is disabled by default. */ +bool x2apic_enabled = false; + /* TODO: add more capability per requirement */ /* APICv features */ #define VAPIC_FEATURE_VIRT_ACCESS (1U << 0) diff --git a/hypervisor/arch/x86/cpuid.c b/hypervisor/arch/x86/cpuid.c index 73848a089..075211031 100644 --- a/hypervisor/arch/x86/cpuid.c +++ b/hypervisor/arch/x86/cpuid.c @@ -6,6 +6,8 @@ #include +extern bool x2apic_enabled; + static inline struct vcpuid_entry *find_vcpuid_entry(struct vcpu *vcpu, uint32_t leaf_arg, uint32_t subleaf) { diff --git a/hypervisor/common/hv_main.c b/hypervisor/common/hv_main.c index fa81f9a22..15f1d9d05 100644 --- a/hypervisor/common/hv_main.c +++ b/hypervisor/common/hv_main.c @@ -8,8 +8,6 @@ #include #include -bool x2apic_enabled; - static void run_vcpu_pre_work(struct vcpu *vcpu) { uint64_t *pending_pre_work = &vcpu->pending_pre_work; diff --git a/hypervisor/include/arch/x86/guest/vm.h b/hypervisor/include/arch/x86/guest/vm.h index 139837bd7..cfe280175 100644 --- a/hypervisor/include/arch/x86/guest/vm.h +++ b/hypervisor/include/arch/x86/guest/vm.h @@ -190,6 +190,5 @@ struct vm *get_vm_from_vmid(uint16_t vm_id); extern struct list_head vm_list; extern spinlock_t vm_list_lock; -extern bool x2apic_enabled; #endif /* VM_H_ */