public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] apic: Move hypervisor detection of x2apic to hypervisor.h
@ 2010-12-21  6:18 Sheng Yang
  2010-12-21  6:18 ` [PATCH 2/2 v2] xen: HVM X2APIC support Sheng Yang
  2010-12-21 17:15 ` [PATCH 1/2] apic: Move hypervisor detection of x2apic to hypervisor.h Jeremy Fitzhardinge
  0 siblings, 2 replies; 21+ messages in thread
From: Sheng Yang @ 2010-12-21  6:18 UTC (permalink / raw)
  To: H. Peter Anvin, Ingo Molnar; +Cc: linux-kernel, Jeremy Fitzhardinge, Sheng Yang

Then we can reuse it for Xen later.

Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
 arch/x86/include/asm/hypervisor.h |    9 +++++++++
 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 ff2546c..0c6f7af 100644
--- a/arch/x86/include/asm/hypervisor.h
+++ b/arch/x86/include/asm/hypervisor.h
@@ -20,6 +20,8 @@
 #ifndef _ASM_X86_HYPERVISOR_H
 #define _ASM_X86_HYPERVISOR_H
 
+#include <asm/kvm_para.h>
+
 extern void init_hypervisor(struct cpuinfo_x86 *c);
 extern void init_hypervisor_platform(void);
 
@@ -47,4 +49,11 @@ extern const struct hypervisor_x86 x86_hyper_vmware;
 extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
 extern const struct hypervisor_x86 x86_hyper_xen_hvm;
 
+static inline bool hypervisor_x2apic_available(void)
+{
+	if (kvm_para_available())
+		return true;
+	return false;
+}
+
 #endif
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 3f838d5..8408f2d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -50,8 +50,8 @@
 #include <asm/mtrr.h>
 #include <asm/smp.h>
 #include <asm/mce.h>
-#include <asm/kvm_para.h>
 #include <asm/tsc.h>
+#include <asm/hypervisor.h>
 
 unsigned int num_processors;
 
@@ -1476,7 +1476,8 @@ void __init enable_IR_x2apic(void)
 		/* IR is required if there is APIC ID > 255 even when running
 		 * under KVM
 		 */
-		if (max_physical_apicid > 255 || !kvm_para_available())
+		if (max_physical_apicid > 255 ||
+		    !hypervisor_x2apic_available())
 			goto nox2apic;
 		/*
 		 * without IR all CPUs can be addressed by IOAPIC/MSI
-- 
1.7.0.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH 1/2] apic: Move hypervisor detection of x2apic to hypervisor.h
@ 2010-12-08  6:03 Sheng Yang
  2010-12-08  6:04 ` [PATCH 2/2 v2] xen: HVM X2APIC support Sheng Yang
  0 siblings, 1 reply; 21+ messages in thread
From: Sheng Yang @ 2010-12-08  6:03 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: Stefano Stabellini, konrad.wilk, xen-devel, linux-kernel,
	Sheng Yang


Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
 arch/x86/include/asm/hypervisor.h |    9 +++++++++
 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 ff2546c..0c6f7af 100644
--- a/arch/x86/include/asm/hypervisor.h
+++ b/arch/x86/include/asm/hypervisor.h
@@ -20,6 +20,8 @@
 #ifndef _ASM_X86_HYPERVISOR_H
 #define _ASM_X86_HYPERVISOR_H
 
+#include <asm/kvm_para.h>
+
 extern void init_hypervisor(struct cpuinfo_x86 *c);
 extern void init_hypervisor_platform(void);
 
@@ -47,4 +49,11 @@ extern const struct hypervisor_x86 x86_hyper_vmware;
 extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
 extern const struct hypervisor_x86 x86_hyper_xen_hvm;
 
+static inline bool hypervisor_x2apic_available(void)
+{
+	if (kvm_para_available())
+		return true;
+	return false;
+}
+
 #endif
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 3f838d5..8408f2d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -50,8 +50,8 @@
 #include <asm/mtrr.h>
 #include <asm/smp.h>
 #include <asm/mce.h>
-#include <asm/kvm_para.h>
 #include <asm/tsc.h>
+#include <asm/hypervisor.h>
 
 unsigned int num_processors;
 
@@ -1476,7 +1476,8 @@ void __init enable_IR_x2apic(void)
 		/* IR is required if there is APIC ID > 255 even when running
 		 * under KVM
 		 */
-		if (max_physical_apicid > 255 || !kvm_para_available())
+		if (max_physical_apicid > 255 ||
+		    !hypervisor_x2apic_available())
 			goto nox2apic;
 		/*
 		 * without IR all CPUs can be addressed by IOAPIC/MSI
-- 
1.7.0.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2011-01-10  2:31 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21  6:18 [PATCH 1/2] apic: Move hypervisor detection of x2apic to hypervisor.h Sheng Yang
2010-12-21  6:18 ` [PATCH 2/2 v2] xen: HVM X2APIC support Sheng Yang
2011-01-05  7:47   ` Sheng Yang
2011-01-05 14:56     ` Ian Campbell
2011-01-06  1:20       ` Sheng Yang
2011-01-06  9:10         ` Ian Campbell
2011-01-06  9:23           ` Sheng Yang
2011-01-06  9:35             ` Ian Campbell
2011-01-06 10:05               ` Sheng Yang
2011-01-06 15:00                 ` Konrad Rzeszutek Wilk
2011-01-10  2:34                   ` Sheng Yang
2010-12-21 17:15 ` [PATCH 1/2] apic: Move hypervisor detection of x2apic to hypervisor.h Jeremy Fitzhardinge
2010-12-21 18:15   ` Avi Kivity
2010-12-31  2:05     ` Sheng Yang
2011-01-04  8:57     ` Sheng Yang
2011-01-04  9:24       ` Ingo Molnar
2011-01-05  1:51         ` Sheng Yang
2011-01-05  7:40           ` Jeremy Fitzhardinge
2011-01-05 15:46             ` Konrad Rzeszutek Wilk
  -- strict thread matches above, loose matches on Subject: below --
2010-12-08  6:03 Sheng Yang
2010-12-08  6:04 ` [PATCH 2/2 v2] xen: HVM X2APIC support Sheng Yang
2010-12-17  8:20   ` Sheng Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox