diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-01-22 17:08:54 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-01-22 17:08:54 +0800 |
commit | efab1adba28d9ebbfa86808375fc085c4e84e746 (patch) | |
tree | c82080ef077c5ea9e50a8308404c599710d6301f /arch/arm64/include/asm/smp_plat.h | |
parent | 039b7fca24dba50c09e60b23494ba3c4d19aac7d (diff) | |
parent | eb7d99ea962fa62f487246462a2777ac918c8895 (diff) |
Merge remote-tracking branch 'v4.1/topic/PSCI' into linux-linaro-lsk-v4.1lsk-v4.1-16.01
Diffstat (limited to 'arch/arm64/include/asm/smp_plat.h')
-rw-r--r-- | arch/arm64/include/asm/smp_plat.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h index 8dcd61e32176..7abf7570c00f 100644 --- a/arch/arm64/include/asm/smp_plat.h +++ b/arch/arm64/include/asm/smp_plat.h @@ -19,6 +19,8 @@ #ifndef __ASM_SMP_PLAT_H #define __ASM_SMP_PLAT_H +#include <linux/cpumask.h> + #include <asm/types.h> struct mpidr_hash { @@ -39,6 +41,20 @@ static inline u32 mpidr_hash_size(void) */ extern u64 __cpu_logical_map[NR_CPUS]; #define cpu_logical_map(cpu) __cpu_logical_map[cpu] +/* + * Retrieve logical cpu index corresponding to a given MPIDR.Aff* + * - mpidr: MPIDR.Aff* bits to be used for the look-up + * + * Returns the cpu logical index or -EINVAL on look-up error + */ +static inline int get_logical_index(u64 mpidr) +{ + int cpu; + for (cpu = 0; cpu < nr_cpu_ids; cpu++) + if (cpu_logical_map(cpu) == mpidr) + return cpu; + return -EINVAL; +} void __init do_post_cpus_up_work(void); |