]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
riscv: Separate memory init from paging init
authorAtish Patra <atish.patra@wdc.com>
Thu, 19 Nov 2020 00:38:27 +0000 (16:38 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Nov 2022 08:57:14 +0000 (09:57 +0100)
[ Upstream commit cbd34f4bb37d62d8a027f54205bff07e73340da4 ]

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>
Stable-dep-of: 50e63dd8ed92 ("riscv: fix reserved memory setup")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/include/asm/pgtable.h
arch/riscv/kernel/setup.c
arch/riscv/mm/init.c

index 73e8b5e5bb6544e6c59684106f15146cf6b0fdac..b16304fdf44898fd6aa96cc1f7c012e21f544a69 100644 (file)
@@ -470,6 +470,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 cc85858f7fe8e62f52b4cbadff682c60992a01b2..57e1ab036edfa84ef1b4be63671e4c9b19490b4c 100644 (file)
@@ -96,6 +96,7 @@ void __init setup_arch(char **cmdline_p)
        else
                pr_err("No DTB found in kernel mappings\n");
 #endif
+       misc_mem_init();
 
 #ifdef CONFIG_SWIOTLB
        swiotlb_init(1);
index 56314e82f05129c0b1dcda079c960127dc23b23e..b6ab6a18dc1a2e3880d9f5f56f19fa312621d77d 100644 (file)
@@ -669,8 +669,12 @@ static void __init resource_init(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();
        resource_init();
 }