diff options
-rw-r--r-- | arch/x86/include/asm/mpspec.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 50 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 8 |
3 files changed, 22 insertions, 38 deletions
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h index 626cf70082d7..3142a94c7b4b 100644 --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h | |||
@@ -94,7 +94,7 @@ static inline void early_reserve_e820_mpc_new(void) { } | |||
94 | #define default_get_smp_config x86_init_uint_noop | 94 | #define default_get_smp_config x86_init_uint_noop |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | void generic_processor_info(int apicid, int version); | 97 | int generic_processor_info(int apicid, int version); |
98 | #ifdef CONFIG_ACPI | 98 | #ifdef CONFIG_ACPI |
99 | extern void mp_register_ioapic(int id, u32 address, u32 gsi_base); | 99 | extern void mp_register_ioapic(int id, u32 address, u32 gsi_base); |
100 | extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, | 100 | extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index f6dbb2f5e39f..1f7c0746611f 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -189,24 +189,31 @@ static int __init acpi_parse_madt(struct acpi_table_header *table) | |||
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
191 | 191 | ||
192 | static void acpi_register_lapic(int id, u8 enabled) | 192 | /** |
193 | * acpi_register_lapic - register a local apic and generates a logic cpu number | ||
194 | * @id: local apic id to register | ||
195 | * @enabled: this cpu is enabled or not | ||
196 | * | ||
197 | * Returns the logic cpu number which maps to the local apic | ||
198 | */ | ||
199 | static int acpi_register_lapic(int id, u8 enabled) | ||
193 | { | 200 | { |
194 | unsigned int ver = 0; | 201 | unsigned int ver = 0; |
195 | 202 | ||
196 | if (id >= MAX_LOCAL_APIC) { | 203 | if (id >= MAX_LOCAL_APIC) { |
197 | printk(KERN_INFO PREFIX "skipped apicid that is too big\n"); | 204 | printk(KERN_INFO PREFIX "skipped apicid that is too big\n"); |
198 | return; | 205 | return -EINVAL; |
199 | } | 206 | } |
200 | 207 | ||
201 | if (!enabled) { | 208 | if (!enabled) { |
202 | ++disabled_cpus; | 209 | ++disabled_cpus; |
203 | return; | 210 | return -EINVAL; |
204 | } | 211 | } |
205 | 212 | ||
206 | if (boot_cpu_physical_apicid != -1U) | 213 | if (boot_cpu_physical_apicid != -1U) |
207 | ver = apic_version[boot_cpu_physical_apicid]; | 214 | ver = apic_version[boot_cpu_physical_apicid]; |
208 | 215 | ||
209 | generic_processor_info(id, ver); | 216 | return generic_processor_info(id, ver); |
210 | } | 217 | } |
211 | 218 | ||
212 | static int __init | 219 | static int __init |
@@ -616,44 +623,19 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) | |||
616 | 623 | ||
617 | static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) | 624 | static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) |
618 | { | 625 | { |
619 | cpumask_var_t tmp_map, new_map; | ||
620 | int cpu; | 626 | int cpu; |
621 | int retval = -ENOMEM; | ||
622 | |||
623 | if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL)) | ||
624 | goto out; | ||
625 | 627 | ||
626 | if (!alloc_cpumask_var(&new_map, GFP_KERNEL)) | 628 | cpu = acpi_register_lapic(physid, ACPI_MADT_ENABLED); |
627 | goto free_tmp_map; | 629 | if (cpu < 0) { |
628 | 630 | pr_info(PREFIX "Unable to map lapic to logical cpu number\n"); | |
629 | cpumask_copy(tmp_map, cpu_present_mask); | 631 | return cpu; |
630 | acpi_register_lapic(physid, ACPI_MADT_ENABLED); | ||
631 | |||
632 | /* | ||
633 | * If acpi_register_lapic successfully generates a new logical cpu | ||
634 | * number, then the following will get us exactly what was mapped | ||
635 | */ | ||
636 | cpumask_andnot(new_map, cpu_present_mask, tmp_map); | ||
637 | if (cpumask_empty(new_map)) { | ||
638 | printk ("Unable to map lapic to logical cpu number\n"); | ||
639 | retval = -EINVAL; | ||
640 | goto free_new_map; | ||
641 | } | 632 | } |
642 | 633 | ||
643 | acpi_processor_set_pdc(handle); | 634 | acpi_processor_set_pdc(handle); |
644 | |||
645 | cpu = cpumask_first(new_map); | ||
646 | acpi_map_cpu2node(handle, cpu, physid); | 635 | acpi_map_cpu2node(handle, cpu, physid); |
647 | 636 | ||
648 | *pcpu = cpu; | 637 | *pcpu = cpu; |
649 | retval = 0; | 638 | return 0; |
650 | |||
651 | free_new_map: | ||
652 | free_cpumask_var(new_map); | ||
653 | free_tmp_map: | ||
654 | free_cpumask_var(tmp_map); | ||
655 | out: | ||
656 | return retval; | ||
657 | } | 639 | } |
658 | 640 | ||
659 | /* wrapper to silence section mismatch warning */ | 641 | /* wrapper to silence section mismatch warning */ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index a7eb82d9b012..ed165d657380 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -2107,7 +2107,7 @@ void disconnect_bsp_APIC(int virt_wire_setup) | |||
2107 | apic_write(APIC_LVT1, value); | 2107 | apic_write(APIC_LVT1, value); |
2108 | } | 2108 | } |
2109 | 2109 | ||
2110 | void generic_processor_info(int apicid, int version) | 2110 | int generic_processor_info(int apicid, int version) |
2111 | { | 2111 | { |
2112 | int cpu, max = nr_cpu_ids; | 2112 | int cpu, max = nr_cpu_ids; |
2113 | bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid, | 2113 | bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid, |
@@ -2127,7 +2127,7 @@ void generic_processor_info(int apicid, int version) | |||
2127 | " Processor %d/0x%x ignored.\n", max, thiscpu, apicid); | 2127 | " Processor %d/0x%x ignored.\n", max, thiscpu, apicid); |
2128 | 2128 | ||
2129 | disabled_cpus++; | 2129 | disabled_cpus++; |
2130 | return; | 2130 | return -ENODEV; |
2131 | } | 2131 | } |
2132 | 2132 | ||
2133 | if (num_processors >= nr_cpu_ids) { | 2133 | if (num_processors >= nr_cpu_ids) { |
@@ -2138,7 +2138,7 @@ void generic_processor_info(int apicid, int version) | |||
2138 | " Processor %d/0x%x ignored.\n", max, thiscpu, apicid); | 2138 | " Processor %d/0x%x ignored.\n", max, thiscpu, apicid); |
2139 | 2139 | ||
2140 | disabled_cpus++; | 2140 | disabled_cpus++; |
2141 | return; | 2141 | return -EINVAL; |
2142 | } | 2142 | } |
2143 | 2143 | ||
2144 | num_processors++; | 2144 | num_processors++; |
@@ -2183,6 +2183,8 @@ void generic_processor_info(int apicid, int version) | |||
2183 | #endif | 2183 | #endif |
2184 | set_cpu_possible(cpu, true); | 2184 | set_cpu_possible(cpu, true); |
2185 | set_cpu_present(cpu, true); | 2185 | set_cpu_present(cpu, true); |
2186 | |||
2187 | return cpu; | ||
2186 | } | 2188 | } |
2187 | 2189 | ||
2188 | int hard_smp_processor_id(void) | 2190 | int hard_smp_processor_id(void) |