Since enabled cpus were allocated logic cpu id to them and mapped to the APIC id when boot, we can get the cpu id in the ACPI driver, the cpu is a new added cpu if cpu id is -1, then we can hot-add it later.
Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/acpi.h | 1 + drivers/acpi/processor_core.c | 24 ++++++------------------ 2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index c40148b..3d37c0e 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -82,6 +82,7 @@ extern int acpi_strict; */ extern volatile int arm_cpu_to_apicid[NR_CPUS]; extern int boot_cpu_apic_id; +#define cpu_physical_id(cpu) arm_cpu_to_apicid[cpu]
struct acpi_arm_root { phys_addr_t phys_address; diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index ef225e5..39ac781 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -190,6 +190,9 @@ exit:
int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) { +#ifdef CONFIG_SMP + int i; +#endif int apic_id = -1;
apic_id = map_mat_entry(handle, type, acpi_id); @@ -222,23 +225,10 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) return apic_id; }
-#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) - - /* - * BOZO: need to abstract this out to have it make sense -- - * it's not that ARM has no equivalent, it's that apic_id is - * arch-specific - */ - -#else - #ifdef CONFIG_SMP - { - int i; - for_each_possible_cpu(i) { - if (cpu_physical_id(i) == apic_id) - return i; - } + for_each_possible_cpu(i) { + if (cpu_physical_id(i) == apic_id) + return i; } #else /* In UP kernel, only processor 0 is valid */ @@ -246,8 +236,6 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) return apic_id; #endif
-#endif /* defined(CONFIG_ARM) || defined(CONFIG_ARM64) */ - return -1; } EXPORT_SYMBOL_GPL(acpi_get_cpuid);