aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/kernel/smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arc/kernel/smp.c')
-rw-r--r--arch/arc/kernel/smp.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index efe8b4200a67..21d86c36692b 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -24,6 +24,7 @@
24#include <linux/reboot.h> 24#include <linux/reboot.h>
25#include <linux/irqdomain.h> 25#include <linux/irqdomain.h>
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/of_fdt.h>
27 28
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/setup.h> 30#include <asm/setup.h>
@@ -47,6 +48,42 @@ void __init smp_prepare_boot_cpu(void)
47{ 48{
48} 49}
49 50
51static int __init arc_get_cpu_map(const char *name, struct cpumask *cpumask)
52{
53 unsigned long dt_root = of_get_flat_dt_root();
54 const char *buf;
55
56 buf = of_get_flat_dt_prop(dt_root, name, NULL);
57 if (!buf)
58 return -EINVAL;
59
60 if (cpulist_parse(buf, cpumask))
61 return -EINVAL;
62
63 return 0;
64}
65
66/*
67 * Read from DeviceTree and setup cpu possible mask. If there is no
68 * "possible-cpus" property in DeviceTree pretend all [0..NR_CPUS-1] exist.
69 */
70static void __init arc_init_cpu_possible(void)
71{
72 struct cpumask cpumask;
73
74 if (arc_get_cpu_map("possible-cpus", &cpumask)) {
75 pr_warn("Failed to get possible-cpus from dtb, pretending all %u cpus exist\n",
76 NR_CPUS);
77
78 cpumask_setall(&cpumask);
79 }
80
81 if (!cpumask_test_cpu(0, &cpumask))
82 panic("Master cpu (cpu[0]) is missed in cpu possible mask!");
83
84 init_cpu_possible(&cpumask);
85}
86
50/* 87/*
51 * Called from setup_arch() before calling setup_processor() 88 * Called from setup_arch() before calling setup_processor()
52 * 89 *
@@ -58,10 +95,7 @@ void __init smp_prepare_boot_cpu(void)
58 */ 95 */
59void __init smp_init_cpus(void) 96void __init smp_init_cpus(void)
60{ 97{
61 unsigned int i; 98 arc_init_cpu_possible();
62
63 for (i = 0; i < NR_CPUS; i++)
64 set_cpu_possible(i, true);
65 99
66 if (plat_smp_ops.init_early_smp) 100 if (plat_smp_ops.init_early_smp)
67 plat_smp_ops.init_early_smp(); 101 plat_smp_ops.init_early_smp();
@@ -70,16 +104,12 @@ void __init smp_init_cpus(void)
70/* called from init ( ) => process 1 */ 104/* called from init ( ) => process 1 */
71void __init smp_prepare_cpus(unsigned int max_cpus) 105void __init smp_prepare_cpus(unsigned int max_cpus)
72{ 106{
73 int i;
74
75 /* 107 /*
76 * if platform didn't set the present map already, do it now 108 * if platform didn't set the present map already, do it now
77 * boot cpu is set to present already by init/main.c 109 * boot cpu is set to present already by init/main.c
78 */ 110 */
79 if (num_present_cpus() <= 1) { 111 if (num_present_cpus() <= 1)
80 for (i = 0; i < max_cpus; i++) 112 init_cpu_present(cpu_possible_mask);
81 set_cpu_present(i, true);
82 }
83} 113}
84 114
85void __init smp_cpus_done(unsigned int max_cpus) 115void __init smp_cpus_done(unsigned int max_cpus)