aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2009-03-30 17:55:30 -0400
committerLen Brown <len.brown@intel.com>2009-04-03 20:08:12 -0400
commit7237d3de78ff89ec2e18eae5fe962d063024fef5 (patch)
tree07d0196e9e3122546cc0366c686d363423bfe894 /arch/x86
parent8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff)
x86, ACPI: add support for x2apic ACPI extensions
All logical processors with APIC ID values of 255 and greater will have their APIC reported through Processor X2APIC structure (type-9 entry type) and all logical processors with APIC ID less than 255 will have their APIC reported through legacy Processor Local APIC (type-0 entry type) only. This is the same case even for NMI structure reporting. The Processor X2APIC Affinity structure provides the association between the X2APIC ID of a logical processor and the proximity domain to which the logical processor belongs. For OSPM, Procssor IDs outside the 0-254 range are to be declared as Device() objects in the ACPI namespace. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/acpi/boot.c63
-rw-r--r--arch/x86/mm/srat_64.c30
2 files changed, 89 insertions, 4 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 7678f10c4568..565e70c7ca93 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -260,6 +260,35 @@ static void __cpuinit acpi_register_lapic(int id, u8 enabled)
260} 260}
261 261
262static int __init 262static int __init
263acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
264{
265 struct acpi_madt_local_x2apic *processor = NULL;
266
267 processor = (struct acpi_madt_local_x2apic *)header;
268
269 if (BAD_MADT_ENTRY(processor, end))
270 return -EINVAL;
271
272 acpi_table_print_madt_entry(header);
273
274#ifdef CONFIG_X86_X2APIC
275 /*
276 * We need to register disabled CPU as well to permit
277 * counting disabled CPUs. This allows us to size
278 * cpus_possible_map more accurately, to permit
279 * to not preallocating memory for all NR_CPUS
280 * when we use CPU hotplug.
281 */
282 acpi_register_lapic(processor->local_apic_id, /* APIC ID */
283 processor->lapic_flags & ACPI_MADT_ENABLED);
284#else
285 printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
286#endif
287
288 return 0;
289}
290
291static int __init
263acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) 292acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
264{ 293{
265 struct acpi_madt_local_apic *processor = NULL; 294 struct acpi_madt_local_apic *processor = NULL;
@@ -319,6 +348,25 @@ acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
319} 348}
320 349
321static int __init 350static int __init
351acpi_parse_x2apic_nmi(struct acpi_subtable_header *header,
352 const unsigned long end)
353{
354 struct acpi_madt_local_x2apic_nmi *x2apic_nmi = NULL;
355
356 x2apic_nmi = (struct acpi_madt_local_x2apic_nmi *)header;
357
358 if (BAD_MADT_ENTRY(x2apic_nmi, end))
359 return -EINVAL;
360
361 acpi_table_print_madt_entry(header);
362
363 if (x2apic_nmi->lint != 1)
364 printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
365
366 return 0;
367}
368
369static int __init
322acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end) 370acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
323{ 371{
324 struct acpi_madt_local_apic_nmi *lapic_nmi = NULL; 372 struct acpi_madt_local_apic_nmi *lapic_nmi = NULL;
@@ -823,6 +871,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
823static int __init acpi_parse_madt_lapic_entries(void) 871static int __init acpi_parse_madt_lapic_entries(void)
824{ 872{
825 int count; 873 int count;
874 int x2count = 0;
826 875
827 if (!cpu_has_apic) 876 if (!cpu_has_apic)
828 return -ENODEV; 877 return -ENODEV;
@@ -846,22 +895,28 @@ static int __init acpi_parse_madt_lapic_entries(void)
846 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC, 895 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC,
847 acpi_parse_sapic, MAX_APICS); 896 acpi_parse_sapic, MAX_APICS);
848 897
849 if (!count) 898 if (!count) {
899 x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
900 acpi_parse_x2apic, MAX_APICS);
850 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC, 901 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
851 acpi_parse_lapic, MAX_APICS); 902 acpi_parse_lapic, MAX_APICS);
852 if (!count) { 903 }
904 if (!count && !x2count) {
853 printk(KERN_ERR PREFIX "No LAPIC entries present\n"); 905 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
854 /* TBD: Cleanup to allow fallback to MPS */ 906 /* TBD: Cleanup to allow fallback to MPS */
855 return -ENODEV; 907 return -ENODEV;
856 } else if (count < 0) { 908 } else if (count < 0 || x2count < 0) {
857 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n"); 909 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
858 /* TBD: Cleanup to allow fallback to MPS */ 910 /* TBD: Cleanup to allow fallback to MPS */
859 return count; 911 return count;
860 } 912 }
861 913
914 x2count =
915 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC_NMI,
916 acpi_parse_x2apic_nmi, 0);
862 count = 917 count =
863 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0); 918 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0);
864 if (count < 0) { 919 if (count < 0 || x2count < 0) {
865 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 920 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
866 /* TBD: Cleanup to allow fallback to MPS */ 921 /* TBD: Cleanup to allow fallback to MPS */
867 return count; 922 return count;
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 09737c8af074..13d56f5b1349 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -115,6 +115,36 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
115 reserve_early(phys, phys + length, "ACPI SLIT"); 115 reserve_early(phys, phys + length, "ACPI SLIT");
116} 116}
117 117
118/* Callback for Proximity Domain -> x2APIC mapping */
119void __init
120acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
121{
122 int pxm, node;
123 int apic_id;
124
125 if (srat_disabled())
126 return;
127 if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) {
128 bad_srat();
129 return;
130 }
131 if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
132 return;
133 pxm = pa->proximity_domain;
134 node = setup_node(pxm);
135 if (node < 0) {
136 printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
137 bad_srat();
138 return;
139 }
140
141 apic_id = pa->apic_id;
142 apicid_to_node[apic_id] = node;
143 acpi_numa = 1;
144 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n",
145 pxm, apic_id, node);
146}
147
118/* Callback for Proximity Domain -> LAPIC mapping */ 148/* Callback for Proximity Domain -> LAPIC mapping */
119void __init 149void __init
120acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) 150acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)