Patch "nios2: reserve boot memory for device tree" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
nios2: reserve boot memory for device tree
to the 4.9-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:
nios2-reserve-boot-memory-for-device-tree.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
921d701e6f31e1ffaca3560416af1aa04edb4c4fMon Sep 17 00:00:00 2001
From: Tobias Klauser <[email protected]>
Date: Sun, 2 Apr 2017 20:08:04 -0700
Subject: nios2: reserve boot memory for device tree
From: Tobias Klauser <[email protected]>
commit 921d701e6f31e1ffaca3560416af1aa04edb4c4f upstream.
Make sure to reserve the boot memory for the flattened device tree. Otherwise it might get overwritten, e.g. when initial_boot_params is copied, leading to a corrupted FDT and a boot hang/crash:
bootconsole [early0] enabled
Early console on uart16650 initialized at 0xf8001600
OF: fdt: Error -11 processing FDT
Kernel panic - not syncing: setup_cpuinfo: No CPU found in devicetree! ---[ end Kernel panic - not syncing: setup_cpuinfo: No CPU found in devicetree!
Guenter Roeck says:
Quoted 8 lines
I think I found the problem. In
unflatten_and_copy_device_tree(), with added debug information:OF: fdt: initial_boot_params=c861e400, dt=c861f000 size=28874 (
0x70ca)... and then
initial_boot_paramsis copied to dt, which results in corrupted fdt since the memory overlaps. Looks like theinitial_boot_paramsmemory is not reserved and (re-)allocated byearly_init_dt_alloc_memory_arch().
Reference: http://lkml.kernel.org/r/[email protected]
--- arch/nios2/kernel/prom.c | 7 +++++++ arch/nios2/kernel/setup.c | 3 +++ 2 files changed, 10 insertions(+)
arch/nios2/kernel/prom.c +7 -0
@@ -48,6 +48,13 @@ void * __init early_init_dt_alloc_memoryreturn alloc_bootmem_align (size, align); } +int __init early_init_dt_reserve_memory_arch (phys_addr_t base,phys_addr_t size, +bool nomap) +{ +reserve_bootmem (base, size,BOOTMEM_DEFAULT ); +return 0 ; +} +void __init early_init_devtree (void *params) {__be32 *dtb = (u32 *)__dtb_start;
arch/nios2/kernel/setup.c +3 -0
@@ -195,6 +195,9 @@ void __init setup_arch(char **cmdline_p) }#endif /* CONFIG_BLK_DEV_INITRD */ +early_init_fdt_reserve_self (); +early_init_fdt_scan_reserved_mem (); +unflatten_and_copy_device_tree ();setup_cpuinfo ();
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/nios2-reserve-boot-memory-for-device-tree.patch