[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240321193336.1708790-1-linux@roeck-us.net>
Date: Thu, 21 Mar 2024 12:33:36 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Dinh Nguyen <dinguyen@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Guenter Roeck <linux@...ck-us.net>,
Frank Rowand <frowand.list@...il.com>,
Stephen Boyd <sboyd@...nel.org>,
Rob Herring <robh@...nel.org>
Subject: [PATCH] nios2: Only use built-in devicetree blob if configured to do so
Starting with commit 7b937cc243e5 ("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: 7b937cc243e5 ("of: Create of_root if no dtb provided by firmware")
Cc: Frank Rowand <frowand.list@...il.com>
Cc: Stephen Boyd <sboyd@...nel.org>
Cc: Rob Herring <robh@...nel.org>
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
arch/nios2/kernel/prom.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/nios2/kernel/prom.c b/arch/nios2/kernel/prom.c
index 8d98af5c7201..a7cd76b322e3 100644
--- a/arch/nios2/kernel/prom.c
+++ b/arch/nios2/kernel/prom.c
@@ -30,8 +30,11 @@ void __init early_init_devtree(void *params)
return;
}
#endif
+
+#ifdef CONFIG_NIOS2_DTB_SOURCE_BOOL
if (be32_to_cpu((__be32) *dtb) == OF_DT_HEADER)
params = (void *)__dtb_start;
+#endif
early_init_dt_scan(params);
}
--
2.39.2
Powered by blists - more mailing lists