[kvm-unit-tests PATCH 5/7] riscv: Decouple SBI console from UART init
Andrew Jones
andrew.jones at linux.dev
Wed Sep 30 03:24:38 PDT 2026
On Thu, Sep 24, 2026 at 11:39:43AM +0800, Xiang W wrote:
> CONFIG_SBI_CONSOLE already routes puts() through SBI DBCN, but console
> setup still went through the UART init path. uart0_init_fdt() could skip
> a missing UART, while uart0_init_acpi() aborted, so EFI/ACPI guests
> with no described UART could not print.
>
> Split the SBI console out of the UART driver. When CONFIG_SBI_CONSOLE is
> set, io_init() is a no-op and puts() issues SBI_EXT_DBCN_CONSOLE_WRITE
> directly. The UART probe and MMIO path are compiled only when SBI
> console is disabled, so ACPI and DT boots no longer depend on an MMIO
> UART for output.
It seems like we should have an SBI console fallback to a UART, since
the purpose of these tests are currently mainly to test SBI. Note, at
least ACPI systems that conform to the server platform spec must have
a UART.
>
> Signed-off-by: Xiang W <wangxiang at iscas.ac.cn>
> ---
> lib/riscv/io.c | 50 +++++++++++++++++++++-----------------------------
> 1 file changed, 21 insertions(+), 29 deletions(-)
>
> diff --git a/lib/riscv/io.c b/lib/riscv/io.c
> index b1163404..6656cd32 100644
> --- a/lib/riscv/io.c
> +++ b/lib/riscv/io.c
> @@ -14,6 +14,26 @@
> #include <asm/setup.h>
> #include <asm/spinlock.h>
>
> +static struct spinlock uart_lock;
In any case, we should probably rename this to console_lock.
Thanks,
drew
More information about the kvm-riscv
mailing list