diff mbox series

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

Message ID 20190503175041.7949-6-fancer.lancer@gmail.com (mailing list archive)
State Accepted
Headers show
Series mips: Post-bootmem-memblock transition fixes | expand

Commit Message

Serge Semin May 3, 2019, 5:50 p.m. UTC
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@gmail.com>

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

Comments

Paul Burton May 6, 2019, 7:12 p.m. UTC | #1
Hello,

Serge Semin wrote:
> 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@gmail.com>

Applied to mips-next.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]
diff mbox series

Patch

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));