linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: BUG_ON() for no cpu nodes in setup_smp
@ 2023-06-29 10:58 Song Shuai
  2023-06-29 12:33 ` Conor Dooley
  0 siblings, 1 reply; 4+ messages in thread
From: Song Shuai @ 2023-06-29 10:58 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 booting with ACPI tables, the tiny devictree created by
EFI Stub doesn't provide cpu nodes.

In setup_smp(), of_parse_and_init_cpus() will bug on !found_boot_cpu
if acpi_disabled. That's unclear, so bug for no cpu nodes before
of_parse_and_init_cpus().

Signed-off-by: Song Shuai <suagrfillet@gmail.com>
---
 arch/riscv/kernel/smpboot.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
index 6ca2b5309aab..243a7b533ad7 100644
--- a/arch/riscv/kernel/smpboot.c
+++ b/arch/riscv/kernel/smpboot.c
@@ -187,8 +187,13 @@ static void __init of_parse_and_init_cpus(void)
 
 void __init setup_smp(void)
 {
-	if (acpi_disabled)
+	if (acpi_disabled) {
+		/* When booting with ACPI tables, the devictree created by EFI Stub
+		 * doesn't provide cpu nodes. So BUG here for any acpi_disabled.
+		 */
+		BUG_ON(!of_get_next_cpu_node(NULL));
 		of_parse_and_init_cpus();
+	}
 	else
 		acpi_parse_and_init_cpus();
 }
-- 
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] 4+ messages in thread

end of thread, other threads:[~2023-06-30  6:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-29 10:58 [PATCH] riscv: BUG_ON() for no cpu nodes in setup_smp Song Shuai
2023-06-29 12:33 ` Conor Dooley
2023-06-30  3:02   ` Song Shuai
2023-06-30  6:33     ` Conor Dooley

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).