Skip to content

Commit a35fd28

Browse files
Yinghai LuH. Peter Anvin
authored andcommitted
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>
1 parent e8524b2 commit a35fd28

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎arch/x86/kernel/acpi/boot.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ static int __init
219219
acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
220220
{
221221
struct acpi_madt_local_x2apic *processor = NULL;
222+
int apic_id;
223+
u8 enabled;
222224

223225
processor = (struct acpi_madt_local_x2apic *)header;
224226

@@ -227,6 +229,8 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
227229

228230
acpi_table_print_madt_entry(header);
229231

232+
apic_id = processor->local_apic_id;
233+
enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
230234
#ifdef CONFIG_X86_X2APIC
231235
/*
232236
* 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)
235239
* to not preallocating memory for all NR_CPUS
236240
* when we use CPU hotplug.
237241
*/
238-
acpi_register_lapic(processor->local_apic_id, /* APIC ID */
239-
processor->lapic_flags & ACPI_MADT_ENABLED);
242+
if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled)
243+
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
244+
else
245+
acpi_register_lapic(apic_id, enabled);
240246
#else
241247
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
242248
#endif

‎arch/x86/mm/srat.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,19 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
6969
if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
7070
return;
7171
pxm = pa->proximity_domain;
72+
apic_id = pa->apic_id;
73+
if (!cpu_has_x2apic && (apic_id >= 0xff)) {
74+
printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n",
75+
pxm, apic_id);
76+
return;
77+
}
7278
node = setup_node(pxm);
7379
if (node < 0) {
7480
printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
7581
bad_srat();
7682
return;
7783
}
7884

79-
apic_id = pa->apic_id;
8085
if (apic_id >= MAX_LOCAL_APIC) {
8186
printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%04x -> Node %u skipped apicid that is too big\n", pxm, apic_id, node);
8287
return;

0 commit comments

Comments
 (0)