mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 14:43:58 +08:00
7fa22bd546
If an ARM system has multiple cpus in the same socket and the kernel is booted with maxcpus=1, secondary cpus are possible but not present due to how platform_smp_prepare_cpus() is called. Since most typical ARM processors don't actually support physical hotplug, initialize the present map to be equal to the possible map in generic ARM SMP code. Also, always call platform_smp_prepare_cpus() as long as max_cpus is non-zero (0 means no SMP) to allow platform code to do any SMP setup. After applying this patch it's possible to boot an ARM system with maxcpus=1 on the command line and then hotplug in secondary cpus via sysfs. This is more in line with how x86 does things. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Kukjin Kim <kgene.kim@samsung.com> Cc: David Brown <davidb@codeaurora.org> Cc: Tony Lindgren <tony@atomide.com> Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Cc: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
/*
|
|
* SMP support for R-Mobile / SH-Mobile
|
|
*
|
|
* Copyright (C) 2010 Magnus Damm
|
|
* Copyright (C) 2011 Paul Mundt
|
|
*
|
|
* Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/device.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/io.h>
|
|
#include <asm/hardware/gic.h>
|
|
#include <asm/localtimer.h>
|
|
#include <asm/mach-types.h>
|
|
#include <mach/common.h>
|
|
|
|
static unsigned int __init shmobile_smp_get_core_count(void)
|
|
{
|
|
if (machine_is_ag5evm())
|
|
return sh73a0_get_core_count();
|
|
|
|
return 1;
|
|
}
|
|
|
|
static void __init shmobile_smp_prepare_cpus(void)
|
|
{
|
|
if (machine_is_ag5evm())
|
|
sh73a0_smp_prepare_cpus();
|
|
}
|
|
|
|
void __cpuinit platform_secondary_init(unsigned int cpu)
|
|
{
|
|
trace_hardirqs_off();
|
|
|
|
if (machine_is_ag5evm())
|
|
sh73a0_secondary_init(cpu);
|
|
}
|
|
|
|
int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
|
|
{
|
|
if (machine_is_ag5evm())
|
|
return sh73a0_boot_secondary(cpu);
|
|
|
|
return -ENOSYS;
|
|
}
|
|
|
|
void __init smp_init_cpus(void)
|
|
{
|
|
unsigned int ncores = shmobile_smp_get_core_count();
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < ncores; i++)
|
|
set_cpu_possible(i, true);
|
|
|
|
set_smp_cross_call(gic_raise_softirq);
|
|
}
|
|
|
|
void __init platform_smp_prepare_cpus(unsigned int max_cpus)
|
|
{
|
|
shmobile_smp_prepare_cpus();
|
|
}
|