summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2019-04-24 14:48:00 -0700
committerPalmer Dabbelt <palmer@sifive.com>2019-05-16 20:42:04 -0700
commit8b4302a442afffef6bb955202d27c69f1e7e2fbf (patch)
treeb6d341086bac79df7975e8d83dc083a538e65045
parentab3d26500547369c24a6c1c31725fd2841a57d0c (diff)
downloadlinux-8b4302a442afffef6bb955202d27c69f1e7e2fbf.tar.bz2
RISC-V: Support nr_cpus command line option.
If nr_cpus command line option is set, maximum possible cpu should be set to that value. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
-rw-r--r--arch/riscv/kernel/smpboot.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
index a8ad200581aa..7a0b62252524 100644
--- a/arch/riscv/kernel/smpboot.c
+++ b/arch/riscv/kernel/smpboot.c
@@ -84,11 +84,19 @@ void __init setup_smp(void)
}
cpuid_to_hartid_map(cpuid) = hart;
- set_cpu_possible(cpuid, true);
cpuid++;
}
BUG_ON(!found_boot_cpu);
+
+ if (cpuid > nr_cpu_ids)
+ pr_warn("Total number of cpus [%d] is greater than nr_cpus option value [%d]\n",
+ cpuid, nr_cpu_ids);
+
+ for (cpuid = 1; cpuid < nr_cpu_ids; cpuid++) {
+ if (cpuid_to_hartid_map(cpuid) != INVALID_HARTID)
+ set_cpu_possible(cpuid, true);
+ }
}
int __cpu_up(unsigned int cpu, struct task_struct *tidle)