1
0
Fork 0
remarkable-linux/arch/nios2
Tobias Klauser c1dcea1236 nios2: reserve boot memory for device tree
commit 921d701e6f 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:

> 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_params is copied to dt, which results in corrupted
> fdt since the memory overlaps. Looks like the initial_boot_params memory
> is not reserved and (re-)allocated by early_init_dt_alloc_memory_arch().

Reported-by: Guenter Roeck <linux@roeck-us.net>
Reference: http://lkml.kernel.org/r/20170226210338.GA19476@roeck-us.net
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-12 12:41:14 +02:00
..
boot nios2: dts: 10m50: Add tx-threshold parameter 2016-09-27 12:55:50 +02:00
configs nios2: add Max10 defconfig 2015-09-08 18:16:02 +08:00
include nios2: use of_property_read_bool 2016-10-06 18:19:16 +08:00
kernel nios2: reserve boot memory for device tree 2017-04-12 12:41:14 +02:00
lib nios2: memset: use the right constraint modifier for the %4 output operand 2016-04-27 16:35:55 +08:00
mm dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
platform nios2: Remove unnecessary of_platform_populate with default match table 2016-06-23 15:00:31 -05:00
Kconfig lib/GCD.c: use binary GCD algorithm instead of Euclidean 2016-05-20 17:58:30 -07:00
Kconfig.debug nios2: add early printk support 2015-02-10 23:21:08 +08:00
Makefile nios2: Add order-only DTC dependency to %.dtb target 2016-05-19 09:15:00 +08:00