[PATCH v2 5/5] mips: Manually call fdt_init_reserved_mem() method

From: Serge Semin
Date: Fri May 03 2019 - 13:52:19 EST


Since memblock-patchset was introduced the reserved-memory nodes are
supported being declared in dt-files. So these nodes are actually parsed
during the arch setup procedure when the early_init_fdt_scan_reserved_mem()
method is called. But due to the arch-specific boot mem_map container
utilization we need to manually call the fdt_init_reserved_mem() method
after all the available and reserved memory has been moved to memblock.
The first function call performed before bootmem_init() by the
early_init_fdt_scan_reserved_mem() routine fails due to the lack of any
memblock memory regions to allocate from at that stage.

Signed-off-by: Serge Semin <fancer.lancer@xxxxxxxxx>

---
Changelog v2
- Discard forcible selection of OF_RESERVED_MEM config
---
arch/mips/kernel/setup.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index fbd216b4e929..ab349d2381c3 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -27,6 +27,7 @@
#include <linux/dma-contiguous.h>
#include <linux/decompress/generic.h>
#include <linux/of_fdt.h>
+#include <linux/of_reserved_mem.h>

#include <asm/addrspace.h>
#include <asm/bootinfo.h>
@@ -825,6 +826,8 @@ static void __init arch_mem_init(char **cmdline_p)
memblock_reserve(__pa_symbol(&__nosave_begin),
__pa_symbol(&__nosave_end) - __pa_symbol(&__nosave_begin));

+ fdt_init_reserved_mem();
+
memblock_dump_all();

early_memtest(PFN_PHYS(min_low_pfn), PFN_PHYS(max_low_pfn));
--
2.21.0