[kvm-unit-tests PATCH 1/2] riscv: Allow SBI_CONSOLE with no uart in device tree

Jesse Taube jesse at rivosinc.com
Thu Jun 12 13:07:47 PDT 2025


When CONFIG_SBI_CONSOLE is enabled and there is no uart defined in the
device tree kvm-unit-tests fails to start.

Only check if uart exists in device tree if SBI_CONSOLE is false.

Signed-off-by: Jesse Taube <jesse at rivosinc.com>
---
 lib/riscv/io.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/riscv/io.c b/lib/riscv/io.c
index fb40adb7..96a3c048 100644
--- a/lib/riscv/io.c
+++ b/lib/riscv/io.c
@@ -104,6 +104,7 @@ static void uart0_init_acpi(void)
 
 void io_init(void)
 {
+#ifndef CONFIG_SBI_CONSOLE
 	if (dt_available())
 		uart0_init_fdt();
 	else
@@ -114,6 +115,7 @@ void io_init(void)
 		       "Found uart at %p, but early base is %p.\n",
 		       uart0_base, UART_EARLY_BASE);
 	}
+#endif
 }
 
 #ifdef CONFIG_SBI_CONSOLE
-- 
2.43.0




More information about the kvm-riscv mailing list