[tip:x86/apic] x86: enable x2apic early at the first possible point

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Author:     Yinghai Lu <yinghai@xxxxxxxxxx>
AuthorDate: Thu, 19 Feb 2009 13:50:07 -0800
Commit:     Ingo Molnar <mingo@xxxxxxx>
CommitDate: Fri, 20 Feb 2009 10:40:46 +0100

x86: enable x2apic early at the first possible point

Impact: fix early crash on x2apic systems

otherwise will get panic from early_acpi_boot_init()
also make disable_x2apic global, so could use it it x2_apic_xxx.c
and can get warning if preenabled system using nox2apic.

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Suresh Siddha <suresh.b.siddha@xxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>


---
 arch/x86/kernel/apic/apic.c           |    3 +--
 arch/x86/kernel/apic/x2apic_cluster.c |    5 ++++-
 arch/x86/kernel/apic/x2apic_phys.c    |    5 ++++-
 arch/x86/kernel/apic/x2apic_uv_x.c    |    4 +++-
 drivers/pci/dmar.c                    |    3 ++-
 5 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index d7588a9..f8173b4 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -115,11 +115,10 @@ __setup("apicpmtimer", setup_apicpmtimer);
 int x2apic;
 /* x2apic enabled before OS handover */
 static int x2apic_preenabled;
-static int disable_x2apic;
+int disable_x2apic;
 static __init int setup_nox2apic(char *str)
 {
 	disable_x2apic = 1;
-	setup_clear_cpu_cap(X86_FEATURE_X2APIC);
 	return 0;
 }
 early_param("nox2apic", setup_nox2apic);
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index 3f7df23..377614a 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -14,8 +14,11 @@ DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid);
 
 static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
-	if (cpu_has_x2apic)
+	if (cpu_has_x2apic && !disable_x2apic) {
+		x2apic = 1;
+		enable_x2apic();
 		return 1;
+	}
 
 	return 0;
 }
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
index d2d52eb..b4a8701 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -21,8 +21,11 @@ early_param("x2apic_phys", set_x2apic_phys_mode);
 
 static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
-	if (cpu_has_x2apic && x2apic_phys)
+	if (cpu_has_x2apic && !disable_x2apic && x2apic_phys) {
+		x2apic = 1;
+		enable_x2apic();
 		return 1;
+	}
 
 	return 0;
 }
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 20b4ad0..df79523 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -41,8 +41,10 @@ static int uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 			uv_system_type = UV_LEGACY_APIC;
 		else if (!strcmp(oem_table_id, "UVX"))
 			uv_system_type = UV_X2APIC;
-		else if (!strcmp(oem_table_id, "UVH")) {
+		else if (!strcmp(oem_table_id, "UVH") && !disable_x2apic) {
 			uv_system_type = UV_NON_UNIQUE_APIC;
+			x2apic = 1;
+			enable_x2apic();
 			return 1;
 		}
 	}
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index 519f5f9..5c01eda 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -472,7 +472,8 @@ void __init detect_intel_iommu(void)
 		 * is added, we will not need this any more.
 		 */
 		dmar = (struct acpi_table_dmar *) dmar_tbl;
-		if (ret && cpu_has_x2apic && dmar->flags & 0x1)
+		if (ret && cpu_has_x2apic && !disable_x2apic &&
+			 dmar->flags & 0x1)
 			printk(KERN_INFO
 			       "Queued invalidation will be enabled to support "
 			       "x2apic and Intr-remapping.\n");
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux