2009-09-27 23:55:43 +04:00
|
|
|
/*
|
|
|
|
* ARM specific SMP header, this contains our implementation
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
#ifndef __ASMARM_SMP_PLAT_H
|
|
|
|
#define __ASMARM_SMP_PLAT_H
|
|
|
|
|
2011-11-17 21:36:24 +04:00
|
|
|
#include <linux/cpumask.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
|
2009-09-27 23:55:43 +04:00
|
|
|
#include <asm/cputype.h>
|
|
|
|
|
2010-09-04 13:47:48 +04:00
|
|
|
/*
|
|
|
|
* Return true if we are running on a SMP platform
|
|
|
|
*/
|
|
|
|
static inline bool is_smp(void)
|
|
|
|
{
|
|
|
|
#ifndef CONFIG_SMP
|
|
|
|
return false;
|
|
|
|
#elif defined(CONFIG_SMP_ON_UP)
|
|
|
|
extern unsigned int smp_on_up;
|
|
|
|
return !!smp_on_up;
|
|
|
|
#else
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-09-27 23:55:43 +04:00
|
|
|
/* all SMP configurations have the extended CPUID registers */
|
|
|
|
static inline int tlb_ops_need_broadcast(void)
|
|
|
|
{
|
2010-10-05 19:40:13 +04:00
|
|
|
if (!is_smp())
|
|
|
|
return 0;
|
|
|
|
|
2009-09-27 23:55:43 +04:00
|
|
|
return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2;
|
|
|
|
}
|
|
|
|
|
2010-09-13 18:58:37 +04:00
|
|
|
#if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
|
|
|
|
#define cache_ops_need_broadcast() 0
|
|
|
|
#else
|
2009-11-05 16:29:36 +03:00
|
|
|
static inline int cache_ops_need_broadcast(void)
|
|
|
|
{
|
2010-10-05 19:40:13 +04:00
|
|
|
if (!is_smp())
|
|
|
|
return 0;
|
|
|
|
|
2009-11-05 16:29:36 +03:00
|
|
|
return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 1;
|
|
|
|
}
|
2010-09-13 18:58:37 +04:00
|
|
|
#endif
|
2009-11-05 16:29:36 +03:00
|
|
|
|
2012-01-20 15:01:12 +04:00
|
|
|
/*
|
|
|
|
* Logical CPU mapping.
|
|
|
|
*/
|
|
|
|
extern int __cpu_logical_map[];
|
|
|
|
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
|
2011-11-17 21:36:24 +04:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
}
|
2012-01-20 15:01:12 +04:00
|
|
|
|
2009-09-27 23:55:43 +04:00
|
|
|
#endif
|