aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Daney <david.daney@cavium.com>2017-09-28 13:34:04 -0400
committerJames Hogan <jhogan@kernel.org>2017-11-07 13:32:10 -0500
commit7820b84be844d8d863122b1323f2a4bc2441b783 (patch)
tree0eb0d2281e2ba7dbf37ecb4d7d90ea5ee8c61be2
parent239e14d1952942bd902dcd09d93c80e7f2a76637 (diff)
MIPS: Allow __cpu_number_map to be larger than NR_CPUS
In systems where the CPU id space is sparse, this allows a smaller NR_CPUS to be chosen, thus keeping internal data structures smaller. Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: Carlos Munoz <cmunoz@caviumnetworks.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/17388/ [jhogan@kernel.org: Add depends on SMP to fix "warning: symbol value '' invalid for MIPS_NR_CPU_NR_MAP"] Signed-off-by: James Hogan <jhogan@kernel.org>
-rw-r--r--arch/mips/Kconfig12
-rw-r--r--arch/mips/include/asm/smp.h2
-rw-r--r--arch/mips/kernel/smp.c2
3 files changed, 13 insertions, 3 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index cb7fcc4216fd..b6af63fb8544 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -915,7 +915,8 @@ config CAVIUM_OCTEON_SOC
915 select USE_OF 915 select USE_OF
916 select ARCH_SPARSEMEM_ENABLE 916 select ARCH_SPARSEMEM_ENABLE
917 select SYS_SUPPORTS_SMP 917 select SYS_SUPPORTS_SMP
918 select NR_CPUS_DEFAULT_16 918 select NR_CPUS_DEFAULT_64
919 select MIPS_NR_CPU_NR_MAP_1024
919 select BUILTIN_DTB 920 select BUILTIN_DTB
920 select MTD_COMPLEX_MAPPINGS 921 select MTD_COMPLEX_MAPPINGS
921 select SYS_SUPPORTS_RELOCATABLE 922 select SYS_SUPPORTS_RELOCATABLE
@@ -2725,6 +2726,15 @@ config NR_CPUS
2725config MIPS_PERF_SHARED_TC_COUNTERS 2726config MIPS_PERF_SHARED_TC_COUNTERS
2726 bool 2727 bool
2727 2728
2729config MIPS_NR_CPU_NR_MAP_1024
2730 bool
2731
2732config MIPS_NR_CPU_NR_MAP
2733 int
2734 depends on SMP
2735 default 1024 if MIPS_NR_CPU_NR_MAP_1024
2736 default NR_CPUS if !MIPS_NR_CPU_NR_MAP_1024
2737
2728# 2738#
2729# Timer Interrupt Frequency Configuration 2739# Timer Interrupt Frequency Configuration
2730# 2740#
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 9e494f8d9c03..88ebd83b3bf9 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -29,7 +29,7 @@ extern cpumask_t cpu_foreign_map[];
29 29
30/* Map from cpu id to sequential logical cpu number. This will only 30/* Map from cpu id to sequential logical cpu number. This will only
31 not be idempotent when cpus failed to come on-line. */ 31 not be idempotent when cpus failed to come on-line. */
32extern int __cpu_number_map[NR_CPUS]; 32extern int __cpu_number_map[CONFIG_MIPS_NR_CPU_NR_MAP];
33#define cpu_number_map(cpu) __cpu_number_map[cpu] 33#define cpu_number_map(cpu) __cpu_number_map[cpu]
34 34
35/* The reverse map from sequential logical cpu number to cpu id. */ 35/* The reverse map from sequential logical cpu number to cpu id. */
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index bbe19b64def5..5576888e4a2a 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -48,7 +48,7 @@
48#include <asm/setup.h> 48#include <asm/setup.h>
49#include <asm/maar.h> 49#include <asm/maar.h>
50 50
51int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ 51int __cpu_number_map[CONFIG_MIPS_NR_CPU_NR_MAP]; /* Map physical to logical */
52EXPORT_SYMBOL(__cpu_number_map); 52EXPORT_SYMBOL(__cpu_number_map);
53 53
54int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ 54int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */