riscv: Separate memory init from paging init
authorAtish Patra <atish.patra@wdc.com>
Thu, 19 Nov 2020 00:38:27 +0000 (16:38 -0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Thu, 14 Jan 2021 23:08:56 +0000 (15:08 -0800)
Currently, we perform some memory init functions in paging init. But,
that will be an issue for NUMA support where DT needs to be flattened
before numa initialization and memblock_present can only be called
after numa initialization.

Move memory initialization related functions to a separate function.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/pgtable.h
arch/riscv/kernel/setup.c
arch/riscv/mm/init.c

index 41a72861987ccc9a0406b4926bd21e8e2c728ebb..4dd56ea4a68796a5f39a9ad836e8953fdacec808 100644 (file)
@@ -469,6 +469,7 @@ extern void *dtb_early_va;
 extern uintptr_t dtb_early_pa;
 void setup_bootmem(void);
 void paging_init(void);
+void misc_mem_init(void);
 
 #define FIRST_USER_ADDRESS  0
 
index a43a954ef5298eb8669a6a852d450b8beb739622..9cd81d4df031726744f0b9f68ecabcf9ae5afecb 100644 (file)
@@ -250,6 +250,7 @@ void __init setup_arch(char **cmdline_p)
        else
                pr_err("No DTB found in kernel mappings\n");
 #endif
+       misc_mem_init();
 
        sbi_init();
 
index 77bd23f47a7247a888e3d403389288c0bdcf11a6..62716b43660bcc6e1c901aee18b2bf3f173f3699 100644 (file)
@@ -649,8 +649,12 @@ void mark_rodata_ro(void)
 void __init paging_init(void)
 {
        setup_vm_final();
-       sparse_init();
        setup_zero_page();
+}
+
+void __init misc_mem_init(void)
+{
+       sparse_init();
        zone_sizes_init();
 }