diff options
author | Suzuki K Poulose <suzuki.poulose@arm.com> | 2016-07-21 06:15:27 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2016-07-21 11:48:37 -0400 |
commit | e75118a7b581b19b08282c7819c1ec6f68b91b79 (patch) | |
tree | b2f9b83d8f4627a243c20001ec064e27aad10a01 | |
parent | 9113c2aa05e9848cd4f1154abee17d4f265f012d (diff) |
arm64: Honor nosmp kernel command line option
Passing "nosmp" should boot the kernel with a single processor, without
provision to enable secondary CPUs even if they are present. "nosmp" is
implemented by setting maxcpus=0. At the moment we still mark the secondary
CPUs present even with nosmp, which allows the userspace to bring them
up. This patch corrects the smp_prepare_cpus() to honor the maxcpus == 0.
Commit 44dbcc93ab67145 ("arm64: Fix behavior of maxcpus=N") fixed the
behavior for maxcpus >= 1, but broke maxcpus = 0.
Fixes: 44dbcc93ab67 ("arm64: Fix behavior of maxcpus=N")
Cc: <stable@vger.kernel.org> # 4.7+
Cc: Will Deacon <will.deacon@arm.com>
Cc: James Morse <james.morse@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
[catalin.marinas@arm.com: updated code comment]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm64/kernel/smp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 298dd745651e..490db85dec23 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c | |||
@@ -693,6 +693,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
693 | smp_store_cpu_info(smp_processor_id()); | 693 | smp_store_cpu_info(smp_processor_id()); |
694 | 694 | ||
695 | /* | 695 | /* |
696 | * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set | ||
697 | * secondary CPUs present. | ||
698 | */ | ||
699 | if (max_cpus == 0) | ||
700 | return; | ||
701 | |||
702 | /* | ||
696 | * Initialise the present map (which describes the set of CPUs | 703 | * Initialise the present map (which describes the set of CPUs |
697 | * actually populated at the present time) and release the | 704 | * actually populated at the present time) and release the |
698 | * secondaries from the bootloader. | 705 | * secondaries from the bootloader. |