Skip to content

Commit 9fa304b

Browse files
committed
LoongArch: Call early_init_fdt_scan_reserved_mem() earlier
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: 88d4d95 ("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>
1 parent 752cd08 commit 9fa304b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/loongarch/kernel/setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ void __init platform_init(void)
357357
acpi_gbl_use_default_register_widths = false;
358358
acpi_boot_table_init();
359359
#endif
360+
361+
early_init_fdt_scan_reserved_mem();
360362
unflatten_and_copy_device_tree();
361363

362364
#ifdef CONFIG_NUMA
@@ -390,8 +392,6 @@ static void __init arch_mem_init(char **cmdline_p)
390392

391393
check_kernel_sections_mem();
392394

393-
early_init_fdt_scan_reserved_mem();
394-
395395
/*
396396
* In order to reduce the possibility of kernel panic when failed to
397397
* get IO TLB memory under CONFIG_SWIOTLB, it is better to allocate

0 commit comments

Comments
 (0)