[PATCH 1/6] ARM: Add inline function smp_cpu() for early init testing

Will Deacon will.deacon at arm.com
Fri Sep 3 08:23:35 EDT 2010


Santosh,

> diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
> index 8db3512..82bc488 100644
> --- a/arch/arm/include/asm/smp_plat.h
> +++ b/arch/arm/include/asm/smp_plat.h
> @@ -39,4 +39,11 @@ static inline int cache_ops_need_broadcast(void)
>  #define UP(instr...)	_str(instr)
>  #endif
> 
> +static inline int smp_cpu(void)
> +{
> +        u32 mpidr;
> +        asm volatile("mrc p15, 0, %0, c0, c0, 5" : "=r" (mpidr));
> +        return (mpidr >> 31) ? !(mpidr >> 30) : 0;
> +}
> +
> Will this be called on UP machines ?? if yes, then mpidr register is not
> available on those

The multiprocessor affinity register (MPIDR) is defined as part of ARMv7.
ARM recommends that it returns 0 on UP systems. If bit 31 is set, then the
multiprocessing extensions are available.

The quirk (as discussed early) is that that 11MPCore has the CPUID register
at this location in the coprocessor space, with bit 31 set to 0. This means
that we have to check for it explicitly otherwise we will identify it as a
UP machine.

Will





More information about the linux-arm-kernel mailing list