diff options
author | Huacai Chen <chenhc@lemote.com> | 2014-06-25 23:41:25 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-07-30 15:44:46 -0400 |
commit | 0f3f506b275517250ee0169ec075d5382967f5f6 (patch) | |
tree | b1f3aa1113a17c7b77d763143ab6dd6d392abeaa /arch | |
parent | e5cd534a3125af4aaa2feb7de9f7700d0a8e91d1 (diff) |
MIPS: Support hard limit of cpu count (nr_cpu_ids)
On MIPS currently, only the soft limit of cpu count (maxcpus) has its
effect, this patch enable the hard limit (nr_cpus) as well. Processor
cores which greater than maxcpus and less than nr_cpus can be taken up
via cpu hotplug. The code is borrowed from X86.
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Reviewed-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/7183/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/kernel/setup.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index a842154d57dc..2f01201b158c 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -729,6 +729,25 @@ static void __init resource_init(void) | |||
729 | } | 729 | } |
730 | } | 730 | } |
731 | 731 | ||
732 | #ifdef CONFIG_SMP | ||
733 | static void __init prefill_possible_map(void) | ||
734 | { | ||
735 | int i, possible = num_possible_cpus(); | ||
736 | |||
737 | if (possible > nr_cpu_ids) | ||
738 | possible = nr_cpu_ids; | ||
739 | |||
740 | for (i = 0; i < possible; i++) | ||
741 | set_cpu_possible(i, true); | ||
742 | for (; i < NR_CPUS; i++) | ||
743 | set_cpu_possible(i, false); | ||
744 | |||
745 | nr_cpu_ids = possible; | ||
746 | } | ||
747 | #else | ||
748 | static inline void prefill_possible_map(void) {} | ||
749 | #endif | ||
750 | |||
732 | void __init setup_arch(char **cmdline_p) | 751 | void __init setup_arch(char **cmdline_p) |
733 | { | 752 | { |
734 | cpu_probe(); | 753 | cpu_probe(); |
@@ -752,6 +771,7 @@ void __init setup_arch(char **cmdline_p) | |||
752 | 771 | ||
753 | resource_init(); | 772 | resource_init(); |
754 | plat_smp_setup(); | 773 | plat_smp_setup(); |
774 | prefill_possible_map(); | ||
755 | 775 | ||
756 | cpu_cache_init(); | 776 | cpu_cache_init(); |
757 | } | 777 | } |