public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Yinghai Lu <yinghai@kernel.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	yinghai@kernel.org, suresh.b.siddha@intel.com,
	tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/apic] x86, acpi: Skip acpi x2apic entries if the x2apic feature is not present
Date: Fri, 23 Dec 2011 12:11:28 -0800	[thread overview]
Message-ID: <tip-a35fd28256e7736cc84af8931a16224f0bfaaf6c@git.kernel.org> (raw)
In-Reply-To: <20111222014632.540896503@sbsiddha-desk.sc.intel.com>

Commit-ID:  a35fd28256e7736cc84af8931a16224f0bfaaf6c
Gitweb:     http://git.kernel.org/tip/a35fd28256e7736cc84af8931a16224f0bfaaf6c
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Wed, 21 Dec 2011 17:45:16 -0800
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Fri, 23 Dec 2011 11:00:50 -0800

x86, acpi: Skip acpi x2apic entries if the x2apic feature is not present

If the x2apic feature is not present (either the cpu is not capable of it
or the user has disabled the feature using boot-parameter etc), ignore the
x2apic MADT and SRAT entries provided by the ACPI tables.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/20111222014632.540896503@sbsiddha-desk.sc.intel.com
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/acpi/boot.c |   10 ++++++++--
 arch/x86/mm/srat.c          |    7 ++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 4558f0d..ce664f3 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -219,6 +219,8 @@ static int __init
 acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
 {
 	struct acpi_madt_local_x2apic *processor = NULL;
+	int apic_id;
+	u8 enabled;
 
 	processor = (struct acpi_madt_local_x2apic *)header;
 
@@ -227,6 +229,8 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
 
 	acpi_table_print_madt_entry(header);
 
+	apic_id = processor->local_apic_id;
+	enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
 #ifdef CONFIG_X86_X2APIC
 	/*
 	 * We need to register disabled CPU as well to permit
@@ -235,8 +239,10 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
 	 * to not preallocating memory for all NR_CPUS
 	 * when we use CPU hotplug.
 	 */
-	acpi_register_lapic(processor->local_apic_id,	/* APIC ID */
-			    processor->lapic_flags & ACPI_MADT_ENABLED);
+	if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled)
+		printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
+	else
+		acpi_register_lapic(apic_id, enabled);
 #else
 	printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
 #endif
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 81dbfde..fd61b3f 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -69,6 +69,12 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
 	if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
 		return;
 	pxm = pa->proximity_domain;
+	apic_id = pa->apic_id;
+	if (!cpu_has_x2apic && (apic_id >= 0xff)) {
+		printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n",
+			 pxm, apic_id);
+		return;
+	}
 	node = setup_node(pxm);
 	if (node < 0) {
 		printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
@@ -76,7 +82,6 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
 		return;
 	}
 
-	apic_id = pa->apic_id;
 	if (apic_id >= MAX_LOCAL_APIC) {
 		printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%04x -> Node %u skipped apicid that is too big\n", pxm, apic_id, node);
 		return;

  reply	other threads:[~2011-12-23 20:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22  1:45 [patch 0/5] x86: allow pre-enabled x2apic mode to be disabled Suresh Siddha
2011-12-22  1:45 ` [patch 1/5] x86, apic: add probe() for apic_flat Suresh Siddha
2011-12-23 20:10   ` [tip:x86/apic] x86, apic: Add " tip-bot for Yinghai Lu
2011-12-22  1:45 ` [patch 2/5] x86, acpi: skip acpi x2apic entries if the x2apic feature is not present Suresh Siddha
2011-12-23 20:11   ` tip-bot for Yinghai Lu [this message]
2011-12-22  1:45 ` [patch 3/5] x86, x2apic: fallback to xapic when bios doesnt setup interrupt-remapping Suresh Siddha
2011-12-23 20:12   ` [tip:x86/apic] x86, x2apic: Fallback to xapic when BIOS doesn' t " tip-bot for Yinghai Lu
2011-12-22  1:45 ` [patch 4/5] x86, x2apic: allow "nox2apic" to disable x2apic mode setup by bios Suresh Siddha
2011-12-22  7:24   ` Yinghai Lu
2011-12-23 19:01     ` Suresh Siddha
2011-12-23 20:13     ` [tip:x86/apic] x86, x2apic: Allow "nox2apic" to disable x2apic mode setup by BIOS tip-bot for Yinghai Lu
2011-12-22  1:45 ` [patch 5/5] x86: skip cpus with apic-ids >= 255 in !x2apic_mode Suresh Siddha
2011-12-23 20:13   ` [tip:x86/apic] x86: Skip " tip-bot for Suresh Siddha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-a35fd28256e7736cc84af8931a16224f0bfaaf6c@git.kernel.org \
    --to=yinghai@kernel.org \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox