mirror of https://gitee.com/openkylin/linux.git
ARC: setup cpu possible mask according to possible-cpus dts property
As we have option in u-boot to set CPU mask for running linux, we want to pass information to kernel about CPU cores should be brought up. So we patch kernel dtb in u-boot to set possible-cpus property. This also allows us to have correctly setuped MCIP debug mask. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
This commit is contained in:
parent
f3205de98d
commit
a29a252754
|
@ -24,6 +24,7 @@
|
|||
#include <linux/reboot.h>
|
||||
#include <linux/irqdomain.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/of_fdt.h>
|
||||
|
||||
#include <asm/processor.h>
|
||||
#include <asm/setup.h>
|
||||
|
@ -47,6 +48,42 @@ void __init smp_prepare_boot_cpu(void)
|
|||
{
|
||||
}
|
||||
|
||||
static int __init arc_get_cpu_map(const char *name, struct cpumask *cpumask)
|
||||
{
|
||||
unsigned long dt_root = of_get_flat_dt_root();
|
||||
const char *buf;
|
||||
|
||||
buf = of_get_flat_dt_prop(dt_root, name, NULL);
|
||||
if (!buf)
|
||||
return -EINVAL;
|
||||
|
||||
if (cpulist_parse(buf, cpumask))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read from DeviceTree and setup cpu possible mask. If there is no
|
||||
* "possible-cpus" property in DeviceTree pretend all [0..NR_CPUS-1] exist.
|
||||
*/
|
||||
static void __init arc_init_cpu_possible(void)
|
||||
{
|
||||
struct cpumask cpumask;
|
||||
|
||||
if (arc_get_cpu_map("possible-cpus", &cpumask)) {
|
||||
pr_warn("Failed to get possible-cpus from dtb, pretending all %u cpus exist\n",
|
||||
NR_CPUS);
|
||||
|
||||
cpumask_setall(&cpumask);
|
||||
}
|
||||
|
||||
if (!cpumask_test_cpu(0, &cpumask))
|
||||
panic("Master cpu (cpu[0]) is missed in cpu possible mask!");
|
||||
|
||||
init_cpu_possible(&cpumask);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called from setup_arch() before calling setup_processor()
|
||||
*
|
||||
|
@ -58,10 +95,7 @@ void __init smp_prepare_boot_cpu(void)
|
|||
*/
|
||||
void __init smp_init_cpus(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < NR_CPUS; i++)
|
||||
set_cpu_possible(i, true);
|
||||
arc_init_cpu_possible();
|
||||
|
||||
if (plat_smp_ops.init_early_smp)
|
||||
plat_smp_ops.init_early_smp();
|
||||
|
@ -70,16 +104,12 @@ void __init smp_init_cpus(void)
|
|||
/* called from init ( ) => process 1 */
|
||||
void __init smp_prepare_cpus(unsigned int max_cpus)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* if platform didn't set the present map already, do it now
|
||||
* boot cpu is set to present already by init/main.c
|
||||
*/
|
||||
if (num_present_cpus() <= 1) {
|
||||
for (i = 0; i < max_cpus; i++)
|
||||
set_cpu_present(i, true);
|
||||
}
|
||||
if (num_present_cpus() <= 1)
|
||||
init_cpu_present(cpu_possible_mask);
|
||||
}
|
||||
|
||||
void __init smp_cpus_done(unsigned int max_cpus)
|
||||
|
|
Loading…
Reference in New Issue