linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] riscv: Add BUG_ON() for no cpu nodes in devicetree
@ 2023-06-30 10:59 Song Shuai
  2023-06-30 18:39 ` Conor Dooley
  0 siblings, 1 reply; 3+ messages in thread
From: Song Shuai @ 2023-06-30 10:59 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou, conor.dooley, ajones, sunilvl,
	heiko.stuebner, apatel, suagrfillet, evan, greentime.hu,
	leyfoon.tan
  Cc: linux-riscv, linux-kernel

When only the ACPI tables are passed to kernel, the tiny devictree created
by EFI Stub doesn't provide cpu nodes.

While if append the "acpi=off" to kernel cmdline to disable ACPI for kernel
the BUG_ON() in of_parse_and_init_cpus() indicates there's no boot cpu
found in the devicetree, not there're no cpu nodes in the devicetree.

Add BUG_ON() in the first place of of_parse_and_init_cpus() to make it clear.

Signed-off-by: Song Shuai <suagrfillet@gmail.com>
---
Changes since V1:
https://lore.kernel.org/linux-riscv/20230629105839.1160895-1-suagrfillet@gmail.com/
- revise the commit-msg and move the BUG_ON into of_parse_and_init_cpus() as Conor suggests

---
 arch/riscv/kernel/smpboot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
index 6ca2b5309aab..04d33afbdf55 100644
--- a/arch/riscv/kernel/smpboot.c
+++ b/arch/riscv/kernel/smpboot.c
@@ -147,6 +147,8 @@ static void __init of_parse_and_init_cpus(void)
 	int cpuid = 1;
 	int rc;
 
+	BUG_ON(!of_get_next_cpu_node(NULL));
+
 	cpu_set_ops(0);
 
 	for_each_of_cpu_node(dn) {
-- 
2.20.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-11 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 10:59 [PATCH V2] riscv: Add BUG_ON() for no cpu nodes in devicetree Song Shuai
2023-06-30 18:39 ` Conor Dooley
2023-07-11 22:58   ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).