Skip to content

Commit

Permalink
ARM: msm: platsmp: determine number of CPU cores at boot time
Browse files Browse the repository at this point in the history
Previously we just assumed there were CONFIG_NR_CPUS cpus present in
the system. Instead, figure out the number of cpus from the MIDR
register.

Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
[arnd: clarified patch title]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Jeff Ohlstein authored and Arnd Bergmann committed Jul 21, 2011
1 parent 620917d commit 41ff445
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions arch/arm/mach-msm/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <asm/hardware/gic.h>
#include <asm/cacheflush.h>
#include <asm/cputype.h>
#include <asm/mach-types.h>

#include <mach/msm_iomap.h>
Expand All @@ -40,6 +41,12 @@ volatile int pen_release = -1;

static DEFINE_SPINLOCK(boot_lock);

static inline int get_core_count(void)
{
/* 1 + the PART[1:0] field of MIDR */
return ((read_cpuid_id() >> 4) & 3) + 1;
}

void __cpuinit platform_secondary_init(unsigned int cpu)
{
/* Configure edge-triggered PPIs */
Expand Down Expand Up @@ -147,9 +154,9 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
*/
void __init smp_init_cpus(void)
{
unsigned int i;
unsigned int i, ncores = get_core_count();

for (i = 0; i < NR_CPUS; i++)
for (i = 0; i < ncores; i++)
set_cpu_possible(i, true);

set_smp_cross_call(gic_raise_softirq);
Expand Down

0 comments on commit 41ff445

Please sign in to comment.