This is a note to let you know that I've just added the patch titled LoongArch: Call early_init_fdt_scan_reserved_mem() earlier to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: loongarch-call-early_init_fdt_scan_reserved_mem-earlier.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9fa304b9f8ec440e614af6d35826110c633c4074 Mon Sep 17 00:00:00 2001 From: Huacai Chen <chenhuacai@xxxxxxxxxxx> Date: Fri, 23 Feb 2024 14:36:31 +0800 Subject: LoongArch: Call early_init_fdt_scan_reserved_mem() earlier From: Huacai Chen <chenhuacai@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxx Fixes: 88d4d957edc707e ("LoongArch: Add FDT booting support from efi system table") Signed-off-by: Oreoluwa Babatunde <quic_obabatun@xxxxxxxxxxx> Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/loongarch/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -367,6 +367,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 @@ -400,8 +402,6 @@ static void __init arch_mem_init(char ** 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 Patches currently in stable-queue which might be from chenhuacai@xxxxxxxxxxx are queue-6.6/loongarch-update-cpu_sibling_map-when-disabling-nonboot-cpus.patch queue-6.6/loongarch-select-have_arch_seccomp-to-use-the-common.patch queue-6.6/loongarch-vdso-disable-ubsan-instrumentation.patch queue-6.6/loongarch-change-acpi_core_pic-nr_cpus-to-acpi_core_.patch queue-6.6/loongarch-disable-irq-before-init_fn-for-nonboot-cpus.patch queue-6.6/loongarch-select-arch_enable_thp_migration-instead-o.patch queue-6.6/loongarch-call-early_init_fdt_scan_reserved_mem-earlier.patch