diff options
author | Huacai Chen <chenhc@lemote.com> | 2014-06-25 23:41:28 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-07-30 15:46:19 -0400 |
commit | c46173183657bbdbe0d54a981c28807581648422 (patch) | |
tree | 554d75cfc577d82c043b3e2fca17819abd63033b /arch/mips/loongson/common | |
parent | 140e39c1e3d29f50e161f55cca60f60b80408c2a (diff) |
MIPS: Add NUMA support for Loongson-3
Multiple Loongson-3A chips can be interconnected with HT0-bus. This is
a CC-NUMA system that every chip (node) has its own local memory and
cache coherency is maintained by hardware. The 64-bit physical memory
address format is as follows:
0x-0000-YZZZ-ZZZZ-ZZZZ
The high 16 bits should be 0, which means the real physical address
supported by Loongson-3 is 48-bit. The "Y" bits is the base address of
each node, which can be also considered as the node-id. The "Z" bits is
the address offset within a node, which means every node has a 44 bits
address space.
Macros XPHYSADDR and MAX_PHYSMEM_BITS are modified unconditionally,
because many other MIPS CPUs have also extended their address spaces.
Signed-off-by: Huacai Chen <chenhc@lemote.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/7187/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/loongson/common')
-rw-r--r-- | arch/mips/loongson/common/env.c | 7 | ||||
-rw-r--r-- | arch/mips/loongson/common/init.c | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c index dc592412f764..33a13b9e436c 100644 --- a/arch/mips/loongson/common/env.c +++ b/arch/mips/loongson/common/env.c | |||
@@ -80,17 +80,24 @@ void __init prom_init_env(void) | |||
80 | cpu_clock_freq = ecpu->cpu_clock_freq; | 80 | cpu_clock_freq = ecpu->cpu_clock_freq; |
81 | loongson_sysconf.cputype = ecpu->cputype; | 81 | loongson_sysconf.cputype = ecpu->cputype; |
82 | if (ecpu->cputype == Loongson_3A) { | 82 | if (ecpu->cputype == Loongson_3A) { |
83 | loongson_sysconf.cores_per_node = 4; | ||
84 | loongson_sysconf.cores_per_package = 4; | ||
83 | loongson_chipcfg[0] = 0x900000001fe00180; | 85 | loongson_chipcfg[0] = 0x900000001fe00180; |
84 | loongson_chipcfg[1] = 0x900010001fe00180; | 86 | loongson_chipcfg[1] = 0x900010001fe00180; |
85 | loongson_chipcfg[2] = 0x900020001fe00180; | 87 | loongson_chipcfg[2] = 0x900020001fe00180; |
86 | loongson_chipcfg[3] = 0x900030001fe00180; | 88 | loongson_chipcfg[3] = 0x900030001fe00180; |
87 | } else { | 89 | } else { |
90 | loongson_sysconf.cores_per_node = 1; | ||
91 | loongson_sysconf.cores_per_package = 1; | ||
88 | loongson_chipcfg[0] = 0x900000001fe00180; | 92 | loongson_chipcfg[0] = 0x900000001fe00180; |
89 | } | 93 | } |
90 | 94 | ||
91 | loongson_sysconf.nr_cpus = ecpu->nr_cpus; | 95 | loongson_sysconf.nr_cpus = ecpu->nr_cpus; |
92 | if (ecpu->nr_cpus > NR_CPUS || ecpu->nr_cpus == 0) | 96 | if (ecpu->nr_cpus > NR_CPUS || ecpu->nr_cpus == 0) |
93 | loongson_sysconf.nr_cpus = NR_CPUS; | 97 | loongson_sysconf.nr_cpus = NR_CPUS; |
98 | loongson_sysconf.nr_nodes = (loongson_sysconf.nr_cpus + | ||
99 | loongson_sysconf.cores_per_node - 1) / | ||
100 | loongson_sysconf.cores_per_node; | ||
94 | 101 | ||
95 | loongson_sysconf.pci_mem_start_addr = eirq_source->pci_mem_start_addr; | 102 | loongson_sysconf.pci_mem_start_addr = eirq_source->pci_mem_start_addr; |
96 | loongson_sysconf.pci_mem_end_addr = eirq_source->pci_mem_end_addr; | 103 | loongson_sysconf.pci_mem_end_addr = eirq_source->pci_mem_end_addr; |
diff --git a/arch/mips/loongson/common/init.c b/arch/mips/loongson/common/init.c index f37fe5413b73..f6af3aba4c86 100644 --- a/arch/mips/loongson/common/init.c +++ b/arch/mips/loongson/common/init.c | |||
@@ -30,7 +30,11 @@ void __init prom_init(void) | |||
30 | set_io_port_base((unsigned long) | 30 | set_io_port_base((unsigned long) |
31 | ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE)); | 31 | ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE)); |
32 | 32 | ||
33 | #ifdef CONFIG_NUMA | ||
34 | prom_init_numa_memory(); | ||
35 | #else | ||
33 | prom_init_memory(); | 36 | prom_init_memory(); |
37 | #endif | ||
34 | 38 | ||
35 | /*init the uart base address */ | 39 | /*init the uart base address */ |
36 | prom_init_uart_base(); | 40 | prom_init_uart_base(); |