xref: /linux/arch/arm/include/asm/smp_plat.h (revision eb50439b92b6298bf209a982f295ba9c0f7cb30b)
1e616c591SRussell King /*
2e616c591SRussell King  * ARM specific SMP header, this contains our implementation
3e616c591SRussell King  * details.
4e616c591SRussell King  */
5e616c591SRussell King #ifndef __ASMARM_SMP_PLAT_H
6e616c591SRussell King #define __ASMARM_SMP_PLAT_H
7e616c591SRussell King 
8e616c591SRussell King #include <asm/cputype.h>
9e616c591SRussell King 
10f00ec48fSRussell King /*
11f00ec48fSRussell King  * Return true if we are running on a SMP platform
12f00ec48fSRussell King  */
13f00ec48fSRussell King static inline bool is_smp(void)
14f00ec48fSRussell King {
15f00ec48fSRussell King #ifndef CONFIG_SMP
16f00ec48fSRussell King 	return false;
17f00ec48fSRussell King #elif defined(CONFIG_SMP_ON_UP)
18f00ec48fSRussell King 	extern unsigned int smp_on_up;
19f00ec48fSRussell King 	return !!smp_on_up;
20f00ec48fSRussell King #else
21f00ec48fSRussell King 	return true;
22f00ec48fSRussell King #endif
23f00ec48fSRussell King }
24f00ec48fSRussell King 
25e616c591SRussell King /* all SMP configurations have the extended CPUID registers */
26e616c591SRussell King static inline int tlb_ops_need_broadcast(void)
27e616c591SRussell King {
287511db9dSTony Lindgren 	if (!is_smp())
297511db9dSTony Lindgren 		return 0;
307511db9dSTony Lindgren 
31e616c591SRussell King 	return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2;
32e616c591SRussell King }
33e616c591SRussell King 
3485848dd7SCatalin Marinas #if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
3585848dd7SCatalin Marinas #define cache_ops_need_broadcast()	0
3685848dd7SCatalin Marinas #else
372ef7f3dbSRussell King static inline int cache_ops_need_broadcast(void)
382ef7f3dbSRussell King {
397511db9dSTony Lindgren 	if (!is_smp())
407511db9dSTony Lindgren 		return 0;
417511db9dSTony Lindgren 
422ef7f3dbSRussell King 	return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 1;
432ef7f3dbSRussell King }
4485848dd7SCatalin Marinas #endif
452ef7f3dbSRussell King 
46*eb50439bSWill Deacon /*
47*eb50439bSWill Deacon  * Logical CPU mapping.
48*eb50439bSWill Deacon  */
49*eb50439bSWill Deacon extern int __cpu_logical_map[];
50*eb50439bSWill Deacon #define cpu_logical_map(cpu)	__cpu_logical_map[cpu]
51*eb50439bSWill Deacon 
52e616c591SRussell King #endif
53