From: Andrew Jones <andrew.jones@linux.dev>
To: Jesse Taube <jesse@rivosinc.com>
Cc: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-kselftest@vger.kernel.org,
"Atish Patra" <atish.patra@linux.dev>,
"Anup Patel" <anup@brainfault.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Clément Léger" <cleger@rivosinc.com>,
"Himanshu Chauhan" <hchauhan@ventanamicro.com>,
"Charlie Jenkins" <charlie@rivosinc.com>
Subject: Re: [kvm-unit-tests PATCH 1/2] riscv: Allow SBI_CONSOLE with no uart in device tree
Date: Fri, 13 Jun 2025 09:52:48 +0200 [thread overview]
Message-ID: <20250613-68a39013932d854741a41c4c@orel> (raw)
In-Reply-To: <20250612200747.683635-1-jesse@rivosinc.com>
On Thu, Jun 12, 2025 at 01:07:47PM -0700, Jesse Taube wrote:
> 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@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
Doesn't this generate uart0_init_fdt/acpi defined but not used types of
warnings? We need to put everything unused under the #ifndef
CONFIG_SBI_CONSOLE, just as uart0_read/write already are. Alternatively,
we can keep everything out of the #ifndef and export
void sbi_puts(const char *s);
void uart0_puts(const char *s);
then just have a single use of the #ifdef,
void puts(const char *s)
{
#ifdef CONFIG_SBI_CONSOLE
sbi_puts(s);
#else
uart0_puts(s);
#endif
}
I think I like that better since it will ensure all code gets compile
tested all the time and allow an SBI console using unit test to also
access its uart if it has one, just because...
Thanks,
drew
> }
>
> #ifdef CONFIG_SBI_CONSOLE
> --
> 2.43.0
>
>
> --
> kvm-riscv mailing list
> kvm-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kvm-riscv
next prev parent reply other threads:[~2025-06-13 7:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 20:07 [kvm-unit-tests PATCH 1/2] riscv: Allow SBI_CONSOLE with no uart in device tree Jesse Taube
2025-06-13 7:52 ` Andrew Jones [this message]
2025-06-13 12:11 ` Jesse Taube
2025-06-13 13:29 ` Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250613-68a39013932d854741a41c4c@orel \
--to=andrew.jones@linux.dev \
--cc=anup@brainfault.org \
--cc=atish.patra@linux.dev \
--cc=charlie@rivosinc.com \
--cc=cleger@rivosinc.com \
--cc=hchauhan@ventanamicro.com \
--cc=jesse@rivosinc.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=palmer@dabbelt.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox