LOCAL / sched: fix build error for smp_plat.h
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 29 Jan 2015 09:18:13 +0000 (18:18 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:41:31 +0000 (13:41 +0900)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
arch/arm64/include/asm/smp_plat.h

index 8dcd61e..31a9b0b 100644 (file)
@@ -19,6 +19,9 @@
 #ifndef __ASM_SMP_PLAT_H
 #define __ASM_SMP_PLAT_H
 
+#include <linux/cpumask.h>
+#include <linux/err.h>
+
 #include <asm/types.h>
 
 struct mpidr_hash {
@@ -39,6 +42,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[23:0]
+ *  - mpidr: MPIDR[23:0] to be used for the look-up
+ *
+ * Returns the cpu logical index or -EINVAL on look-up error
+ */
+static inline int get_logical_index(u32 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);