diff options
author | Huacai Chen <chenhuacai@loongson.cn> | 2024-02-23 14:36:31 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-03-01 13:41:44 +0100 |
commit | 37d06795aeaf36385c91d66569822416de74a008 (patch) | |
tree | e6cd4b10bbc349c8194c1aca9ef4feae25273bbd /arch/loongarch | |
parent | 1cf50463b36aa9fc1f9ef7b9e75b82c5340be0e9 (diff) | |
download | linux-stable-37d06795aeaf36385c91d66569822416de74a008.tar.gz linux-stable-37d06795aeaf36385c91d66569822416de74a008.tar.bz2 linux-stable-37d06795aeaf36385c91d66569822416de74a008.zip |
LoongArch: Call early_init_fdt_scan_reserved_mem() earlier
commit 9fa304b9f8ec440e614af6d35826110c633c4074 upstream.
The unflatten_and_copy_device_tree() function contains a call to
memblock_alloc(). This means that memblock is allocating memory before
any of the reserved memory regions are set aside in the arch_mem_init()
function which calls early_init_fdt_scan_reserved_mem(). Therefore,
there is a possibility for memblock to allocate from any of the
reserved memory regions.
Hence, move the call to early_init_fdt_scan_reserved_mem() to be earlier
in the init sequence, so that the reserved memory regions are set aside
before any allocations are done using memblock.
Cc: stable@vger.kernel.org
Fixes: 88d4d957edc707e ("LoongArch: Add FDT booting support from efi system table")
Signed-off-by: Oreoluwa Babatunde <quic_obabatun@quicinc.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/loongarch')
-rw-r--r-- | arch/loongarch/kernel/setup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c index d183a745fb85..b7c14a124227 100644 --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -366,6 +366,8 @@ void __init platform_init(void) acpi_gbl_use_default_register_widths = false; acpi_boot_table_init(); #endif + + early_init_fdt_scan_reserved_mem(); unflatten_and_copy_device_tree(); #ifdef CONFIG_NUMA @@ -399,8 +401,6 @@ static void __init arch_mem_init(char **cmdline_p) check_kernel_sections_mem(); - early_init_fdt_scan_reserved_mem(); - /* * In order to reduce the possibility of kernel panic when failed to * get IO TLB memory under CONFIG_SWIOTLB, it is better to allocate |