2 * ARM specific SMP header, this contains our implementation
5 #ifndef __ASMARM_SMP_PLAT_H
6 #define __ASMARM_SMP_PLAT_H
8 #include <linux/cpumask.h>
12 #include <asm/cputype.h>
15 * Return true if we are running on a SMP platform
17 static inline bool is_smp(void)
21 #elif defined(CONFIG_SMP_ON_UP)
22 extern unsigned int smp_on_up
;
30 * smp_cpuid_part() - return part id for a given cpu
31 * @cpu: logical cpu id.
33 * Return: part id of logical cpu passed as argument.
35 static inline unsigned int smp_cpuid_part(int cpu
)
37 struct cpuinfo_arm
*cpu_info
= &per_cpu(cpu_data
, cpu
);
39 return is_smp() ? cpu_info
->cpuid
& ARM_CPU_PART_MASK
:
43 /* all SMP configurations have the extended CPUID registers */
45 #define tlb_ops_need_broadcast() 0
47 static inline int tlb_ops_need_broadcast(void)
52 return ((read_cpuid_ext(CPUID_EXT_MMFR3
) >> 12) & 0xf) < 2;
56 #if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
57 #define cache_ops_need_broadcast() 0
59 static inline int cache_ops_need_broadcast(void)
64 return ((read_cpuid_ext(CPUID_EXT_MMFR3
) >> 12) & 0xf) < 1;
69 * Logical CPU mapping.
71 extern u32 __cpu_logical_map
[];
72 #define cpu_logical_map(cpu) __cpu_logical_map[cpu]
74 * Retrieve logical cpu index corresponding to a given MPIDR[23:0]
75 * - mpidr: MPIDR[23:0] to be used for the look-up
77 * Returns the cpu logical index or -EINVAL on look-up error
79 static inline int get_logical_index(u32 mpidr
)
82 for (cpu
= 0; cpu
< nr_cpu_ids
; cpu
++)
83 if (cpu_logical_map(cpu
) == mpidr
)
89 * NOTE ! Assembly code relies on the following
90 * structure memory layout in order to carry out load
91 * multiple from its base address. For more
92 * information check arch/arm/kernel/sleep.S
95 u32 mask
; /* used by sleep.S */
96 u32 shift_aff
[3]; /* used by sleep.S */
100 extern struct mpidr_hash mpidr_hash
;
102 static inline u32
mpidr_hash_size(void)
104 return 1 << mpidr_hash
.bits
;
107 extern int platform_can_secondary_boot(void);
108 extern int platform_can_cpu_hotplug(void);
110 #ifdef CONFIG_HOTPLUG_CPU
111 extern int platform_can_hotplug_cpu(unsigned int cpu
);
113 static inline int platform_can_hotplug_cpu(unsigned int cpu
)