[PATCH] MIPS: Loongson64: Fix cmdline parsing "mem=" and "memmap="

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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(-)

diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index 147c932..66fef4c 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -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);
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index bf5f5ac..ef84b4d 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -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;
diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index ea8bb1b..d8ecdf2 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -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)
 {
-- 
2.1.0




[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux