diff options
author | Sheng Yang <sheng@linux.intel.com> | 2010-12-21 01:18:48 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-01-07 10:03:49 -0500 |
commit | 2904ed8dd5a748c52caf4d8b09d3d9834b5932fa (patch) | |
tree | 93ebbdf8f44fd43519514b348d5e447113628351 | |
parent | cf7d7e5a1980d1116ee152d25dac382b112b9c17 (diff) |
apic: Move hypervisor detection of x2apic to hypervisor.h
Then we can reuse it for Xen later.
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: Avi Kivity <avi@redhat.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | arch/x86/include/asm/hypervisor.h | 9 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index ff2546ce7178..0c6f7af7fda8 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _ASM_X86_HYPERVISOR_H | 20 | #ifndef _ASM_X86_HYPERVISOR_H |
21 | #define _ASM_X86_HYPERVISOR_H | 21 | #define _ASM_X86_HYPERVISOR_H |
22 | 22 | ||
23 | #include <asm/kvm_para.h> | ||
24 | |||
23 | extern void init_hypervisor(struct cpuinfo_x86 *c); | 25 | extern void init_hypervisor(struct cpuinfo_x86 *c); |
24 | extern void init_hypervisor_platform(void); | 26 | extern void init_hypervisor_platform(void); |
25 | 27 | ||
@@ -47,4 +49,11 @@ extern const struct hypervisor_x86 x86_hyper_vmware; | |||
47 | extern const struct hypervisor_x86 x86_hyper_ms_hyperv; | 49 | extern const struct hypervisor_x86 x86_hyper_ms_hyperv; |
48 | extern const struct hypervisor_x86 x86_hyper_xen_hvm; | 50 | extern const struct hypervisor_x86 x86_hyper_xen_hvm; |
49 | 51 | ||
52 | static inline bool hypervisor_x2apic_available(void) | ||
53 | { | ||
54 | if (kvm_para_available()) | ||
55 | return true; | ||
56 | return false; | ||
57 | } | ||
58 | |||
50 | #endif | 59 | #endif |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 3f838d537392..8408f2d19819 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -50,8 +50,8 @@ | |||
50 | #include <asm/mtrr.h> | 50 | #include <asm/mtrr.h> |
51 | #include <asm/smp.h> | 51 | #include <asm/smp.h> |
52 | #include <asm/mce.h> | 52 | #include <asm/mce.h> |
53 | #include <asm/kvm_para.h> | ||
54 | #include <asm/tsc.h> | 53 | #include <asm/tsc.h> |
54 | #include <asm/hypervisor.h> | ||
55 | 55 | ||
56 | unsigned int num_processors; | 56 | unsigned int num_processors; |
57 | 57 | ||
@@ -1476,7 +1476,8 @@ void __init enable_IR_x2apic(void) | |||
1476 | /* IR is required if there is APIC ID > 255 even when running | 1476 | /* IR is required if there is APIC ID > 255 even when running |
1477 | * under KVM | 1477 | * under KVM |
1478 | */ | 1478 | */ |
1479 | if (max_physical_apicid > 255 || !kvm_para_available()) | 1479 | if (max_physical_apicid > 255 || |
1480 | !hypervisor_x2apic_available()) | ||
1480 | goto nox2apic; | 1481 | goto nox2apic; |
1481 | /* | 1482 | /* |
1482 | * without IR all CPUs can be addressed by IOAPIC/MSI | 1483 | * without IR all CPUs can be addressed by IOAPIC/MSI |