Skip to content

Commit de164a7

Browse files
groeckrobherring
authored andcommitted
nios2: Only use built-in devicetree blob if configured to do so
Starting with commit 7b937cc ("of: Create of_root if no dtb provided by firmware"), attempts to boot nios2 images with an external devicetree blob result in a crash. Kernel panic - not syncing: early_init_dt_alloc_memory_arch: Failed to allocate 72 bytes align=0x40 For nios2, a built-in devicetree blob always overrides devicetree blobs provided by ROMMON/BIOS. This includes the new dummy devicetree blob. Result is that the dummy devicetree blob is used even if an external devicetree blob is provided. Since the dummy devicetree blob does not include any memory information, memory allocations fail, resulting in the crash. To fix the problem, only use the built-in devicetree blob if CONFIG_NIOS2_DTB_SOURCE_BOOL is enabled. Fixes: 7b937cc ("of: Create of_root if no dtb provided by firmware") Cc: Frank Rowand <[email protected]> Cc: Stephen Boyd <[email protected]> Cc: Rob Herring <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 500b420 commit de164a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/nios2/kernel/prom.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
void __init early_init_devtree(void *params)
2323
{
24-
__be32 *dtb = (u32 *)__dtb_start;
24+
__be32 __maybe_unused *dtb = (u32 *)__dtb_start;
25+
2526
#if defined(CONFIG_NIOS2_DTB_AT_PHYS_ADDR)
2627
if (be32_to_cpup((__be32 *)CONFIG_NIOS2_DTB_PHYS_ADDR) ==
2728
OF_DT_HEADER) {
@@ -30,8 +31,11 @@ void __init early_init_devtree(void *params)
3031
return;
3132
}
3233
#endif
34+
35+
#ifdef CONFIG_NIOS2_DTB_SOURCE_BOOL
3336
if (be32_to_cpu((__be32) *dtb) == OF_DT_HEADER)
3437
params = (void *)__dtb_start;
38+
#endif
3539

3640
early_init_dt_scan(params);
3741
}

0 commit comments

Comments
 (0)