xref: /openbmc/linux/arch/arm/include/asm/smp_plat.h (revision 95e9fd10)
1 /*
2  * ARM specific SMP header, this contains our implementation
3  * details.
4  */
5 #ifndef __ASMARM_SMP_PLAT_H
6 #define __ASMARM_SMP_PLAT_H
7 
8 #include <asm/cputype.h>
9 
10 /*
11  * Return true if we are running on a SMP platform
12  */
13 static inline bool is_smp(void)
14 {
15 #ifndef CONFIG_SMP
16 	return false;
17 #elif defined(CONFIG_SMP_ON_UP)
18 	extern unsigned int smp_on_up;
19 	return !!smp_on_up;
20 #else
21 	return true;
22 #endif
23 }
24 
25 /* all SMP configurations have the extended CPUID registers */
26 static inline int tlb_ops_need_broadcast(void)
27 {
28 	if (!is_smp())
29 		return 0;
30 
31 	return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2;
32 }
33 
34 #if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
35 #define cache_ops_need_broadcast()	0
36 #else
37 static inline int cache_ops_need_broadcast(void)
38 {
39 	if (!is_smp())
40 		return 0;
41 
42 	return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 1;
43 }
44 #endif
45 
46 /*
47  * Logical CPU mapping.
48  */
49 extern int __cpu_logical_map[];
50 #define cpu_logical_map(cpu)	__cpu_logical_map[cpu]
51 
52 #endif
53