@@ -96,6 +96,7 @@ extern unsigned long mips_machtype;
extern void add_memory_region(phys_addr_t start, phys_addr_t size, long type);
extern void detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_addr_t sz_max);
+extern void mips_memblock_add(phys_addr_t start, phys_addr_t size);
extern void prom_init(void);
extern void prom_free_prom_memory(void);
@@ -149,6 +149,11 @@ void __init detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_add
add_memory_region(start, size, BOOT_MEM_RAM);
}
+void __init __weak mips_memblock_add(phys_addr_t start, phys_addr_t size)
+{
+ memblock_add(start, size);
+}
+
/*
* Manage initrd
*/
@@ -400,7 +405,7 @@ static int __init early_parse_mem(char *p)
if (*p == '@')
start = memparse(p + 1, &p);
- add_memory_region(start, size, BOOT_MEM_RAM);
+ mips_memblock_add(start, size);
return 0;
}
@@ -426,7 +431,7 @@ static int __init early_parse_memmap(char *p)
if (*p == '@') {
start_at = memparse(p+1, &p);
- add_memory_region(start_at, mem_size, BOOT_MEM_RAM);
+ mips_memblock_add(start_at, mem_size);
} else if (*p == '#') {
pr_err("\"memmap=nn#ss\" (force ACPI data) invalid on MIPS\n");
return -EINVAL;
@@ -257,6 +257,14 @@ void __init mem_init(void)
mem_init_print_info(NULL);
}
+void __init mips_memblock_add(phys_addr_t start, phys_addr_t size)
+{
+ u64 node_id;
+
+ node_id = (start >> 44) & 3;
+ memblock_add_node(start, size, node_id);
+}
+
/* All PCI device belongs to logical Node-0 */
int pcibus_to_node(struct pci_bus *bus)
{
Commit a94e4f24ec83 ("MIPS: init: Drop boot_mem_map") left add_memory_region() for historical reason. Machine cannot start normally when use "mem=" on the Loongson64 platform because parsing "mem=" calls memblock_add() by add_memory_region(). Loongson64 always enable NUMA and need memblock_add_node(). Replace add_memory_rigion(start, size, BOOT_MEM_RAM) with a weak function which named mips_memblock_add. For Loongson64, override mips_memblock_add at loongson64/numa.c. "memmap=" is similar to "mem=", replace it too. Signed-off-by: Jinyang He <hejinyang@loongson.cn> --- arch/mips/include/asm/bootinfo.h | 1 + arch/mips/kernel/setup.c | 9 +++++++-- arch/mips/loongson64/numa.c | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)