[PATCH 10/46] nios2: reserved_mem: Implement the new processing order for reserved memory

Oreoluwa Babatunde quic_obabatun at quicinc.com
Fri Jan 26 15:53:49 PST 2024


Call early_fdt_scan_reserved_mem() in place of
early_init_fdt_scan_reserved_mem() to carry out the first stage of the
reserved memory processing only.

The early_fdt_scan_reserved_mem() function is used to scan through the
DT and mark all the reserved memory regions as reserved or nomap as
needed, as well as allocate the memory required by the
dynamically-placed
reserved memory regions.

The second stage of the reserved memory processing is done by
fdt_init_reserved_mem(). This function is used to store the information
of the statically-placed reserved memory nodes in the reserved_mem
array as well as call the region specific initialization function on all
the stored reserved memory regions.

The call to fdt_init_reserved_mem() is placed right after
early_fdt_scan_reserved_mem() because memblock allocated memory should
be already writable at this point.

Signed-off-by: Oreoluwa Babatunde <quic_obabatun at quicinc.com>
---
 arch/nios2/kernel/setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c
index da122a5fa43b..c1d42861cc72 100644
--- a/arch/nios2/kernel/setup.c
+++ b/arch/nios2/kernel/setup.c
@@ -19,6 +19,7 @@
 #include <linux/memblock.h>
 #include <linux/initrd.h>
 #include <linux/of_fdt.h>
+#include <linux/of_reserved_mem.h>
 
 #include <asm/mmu_context.h>
 #include <asm/sections.h>
@@ -167,7 +168,8 @@ void __init setup_arch(char **cmdline_p)
 #endif /* CONFIG_BLK_DEV_INITRD */
 
 	early_init_fdt_reserve_self();
-	early_init_fdt_scan_reserved_mem();
+	early_fdt_scan_reserved_mem();
+	fdt_init_reserved_mem();
 
 	unflatten_and_copy_device_tree();
 
-- 
2.17.1




More information about the linux-arm-kernel mailing list