eb50439b92
It turns out that the logical CPU mapping is useful even when !CONFIG_SMP for manipulation of devices like interrupt and power controllers when running a UP kernel on a CPU other than 0. This can happen when kexecing a UP image from an SMP kernel. In the future, multi-cluster systems running AMP configurations will require something similar for mapping cluster IDs, so it makes sense to decouple this logic in preparation for this support. Acked-by: Yang Bai <hamo.by@gmail.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Reported-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
53 lines
978 B
C
53 lines
978 B
C
/*
|
|
* ARM specific SMP header, this contains our implementation
|
|
* details.
|
|
*/
|
|
#ifndef __ASMARM_SMP_PLAT_H
|
|
#define __ASMARM_SMP_PLAT_H
|
|
|
|
#include <asm/cputype.h>
|
|
|
|
/*
|
|
* 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
|
|
}
|
|
|
|
/* all SMP configurations have the extended CPUID registers */
|
|
static inline int tlb_ops_need_broadcast(void)
|
|
{
|
|
if (!is_smp())
|
|
return 0;
|
|
|
|
return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2;
|
|
}
|
|
|
|
#if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
|
|
#define cache_ops_need_broadcast() 0
|
|
#else
|
|
static inline int cache_ops_need_broadcast(void)
|
|
{
|
|
if (!is_smp())
|
|
return 0;
|
|
|
|
return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 1;
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* Logical CPU mapping.
|
|
*/
|
|
extern int __cpu_logical_map[];
|
|
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
|
|
|
|
#endif
|