ARM: nommu: define dummy TLB operations for nommu configurations
[linux-2.6.git] / arch / arm / include / asm / smp_plat.h
blob1c7b6f8101ae3d68977cb908a8d9624bc154ff26
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
8 #include <linux/cpumask.h>
9 #include <linux/err.h>
11 #include <asm/cputype.h>
14 * Return true if we are running on a SMP platform
16 static inline bool is_smp(void)
18 #ifndef CONFIG_SMP
19 return false;
20 #elif defined(CONFIG_SMP_ON_UP)
21 extern unsigned int smp_on_up;
22 return !!smp_on_up;
23 #else
24 return true;
25 #endif
28 /* all SMP configurations have the extended CPUID registers */
29 #ifndef CONFIG_MMU
30 #define tlb_ops_need_broadcast() 0
31 #else
32 static inline int tlb_ops_need_broadcast(void)
34 if (!is_smp())
35 return 0;
37 return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2;
39 #endif
41 #if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
42 #define cache_ops_need_broadcast() 0
43 #else
44 static inline int cache_ops_need_broadcast(void)
46 if (!is_smp())
47 return 0;
49 return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 1;
51 #endif
54 * Logical CPU mapping.
56 extern int __cpu_logical_map[];
57 #define cpu_logical_map(cpu) __cpu_logical_map[cpu]
59 * Retrieve logical cpu index corresponding to a given MPIDR[23:0]
60 * - mpidr: MPIDR[23:0] to be used for the look-up
62 * Returns the cpu logical index or -EINVAL on look-up error
64 static inline int get_logical_index(u32 mpidr)
66 int cpu;
67 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
68 if (cpu_logical_map(cpu) == mpidr)
69 return cpu;
70 return -EINVAL;
73 #endif