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,
"Clément Léger" <cleger@rivosinc.com>,
"Charlie Jenkins" <charlie@rivosinc.com>,
"James Raphael Tiovalen" <jamestiotio@gmail.com>,
"Sean Christopherson" <seanjc@google.com>,
"Cade Richard" <cade.richard@gmail.com>
Subject: Re: [kvm-unit-tests PATCH v2 2/2] riscv: lib: Add sbi-exit-code to configure and environment
Date: Wed, 9 Jul 2025 12:11:22 +0200 [thread overview]
Message-ID: <20250709-93076fafcec83e14102193dc@orel> (raw)
In-Reply-To: <20250708154811.1888319-2-jesse@rivosinc.com>
On Tue, Jul 08, 2025 at 08:48:11AM -0700, Jesse Taube wrote:
> Add --[enable|disable]-sbi-exit-code to configure script.
> With the default value as disabled.
> Add a check for SBI_EXIT_CODE in the environment, so that passing
> of the test status is configurable from both the
> environment and the configure script
>
> Signed-off-by: Jesse Taube <jesse@rivosinc.com>
> ---
> configure | 11 +++++++++++
> lib/riscv/io.c | 4 +++-
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 20bf5042..7c949bdc 100755
> --- a/configure
> +++ b/configure
> @@ -67,6 +67,7 @@ earlycon=
> console=
> efi=
> efi_direct=
> +sbi_exit_code=0
> target_cpu=
>
> # Enable -Werror by default for git repositories only (i.e. developer builds)
> @@ -141,6 +142,9 @@ usage() {
> system and run from the UEFI shell. Ignored when efi isn't enabled
> and defaults to enabled when efi is enabled for riscv64.
> (arm64 and riscv64 only)
> + --[enable|disable]-sbi-exit-code
> + Enable or disable sending pass/fail exit code to SBI SRST.
> + (disabled by default, riscv only)
> EOF
> exit 1
> }
> @@ -236,6 +240,12 @@ while [[ $optno -le $argc ]]; do
> --disable-efi-direct)
> efi_direct=n
> ;;
> + --enable-sbi-exit-code)
> + sbi_exit_code=1
> + ;;
> + --disable-sbi-exit-code)
> + sbi_exit_code=0
> + ;;
> --enable-werror)
> werror=-Werror
> ;;
> @@ -551,6 +561,7 @@ EOF
> elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then
> echo "#define CONFIG_UART_EARLY_BASE ${uart_early_addr}" >> lib/config.h
> [ "$console" = "sbi" ] && echo "#define CONFIG_SBI_CONSOLE" >> lib/config.h
> + echo "#define CONFIG_SBI_EXIT_CODE ${sbi_exit_code}" >> lib/config.h
> echo >> lib/config.h
> fi
> echo "#endif" >> lib/config.h
> diff --git a/lib/riscv/io.c b/lib/riscv/io.c
> index b1163404..c46845de 100644
> --- a/lib/riscv/io.c
> +++ b/lib/riscv/io.c
> @@ -6,6 +6,7 @@
> * Copyright (C) 2023, Ventana Micro Systems Inc., Andrew Jones <ajones@ventanamicro.com>
> */
> #include <libcflat.h>
> +#include <argv.h>
> #include <bitops.h>
> #include <config.h>
> #include <devicetree.h>
> @@ -163,7 +164,8 @@ void halt(int code);
> void exit(int code)
> {
> printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1);
> - sbi_shutdown(code == 0);
> +
> + sbi_shutdown(GET_CONFIG_OR_ENV(SBI_EXIT_CODE) ? code == 0 : true);
> halt(code);
> __builtin_unreachable();
> }
> --
> 2.43.0
>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
--
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv
WARNING: multiple messages have this Message-ID (diff)
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,
"Clément Léger" <cleger@rivosinc.com>,
"Charlie Jenkins" <charlie@rivosinc.com>,
"James Raphael Tiovalen" <jamestiotio@gmail.com>,
"Sean Christopherson" <seanjc@google.com>,
"Cade Richard" <cade.richard@gmail.com>
Subject: Re: [kvm-unit-tests PATCH v2 2/2] riscv: lib: Add sbi-exit-code to configure and environment
Date: Wed, 9 Jul 2025 12:11:22 +0200 [thread overview]
Message-ID: <20250709-93076fafcec83e14102193dc@orel> (raw)
In-Reply-To: <20250708154811.1888319-2-jesse@rivosinc.com>
On Tue, Jul 08, 2025 at 08:48:11AM -0700, Jesse Taube wrote:
> Add --[enable|disable]-sbi-exit-code to configure script.
> With the default value as disabled.
> Add a check for SBI_EXIT_CODE in the environment, so that passing
> of the test status is configurable from both the
> environment and the configure script
>
> Signed-off-by: Jesse Taube <jesse@rivosinc.com>
> ---
> configure | 11 +++++++++++
> lib/riscv/io.c | 4 +++-
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 20bf5042..7c949bdc 100755
> --- a/configure
> +++ b/configure
> @@ -67,6 +67,7 @@ earlycon=
> console=
> efi=
> efi_direct=
> +sbi_exit_code=0
> target_cpu=
>
> # Enable -Werror by default for git repositories only (i.e. developer builds)
> @@ -141,6 +142,9 @@ usage() {
> system and run from the UEFI shell. Ignored when efi isn't enabled
> and defaults to enabled when efi is enabled for riscv64.
> (arm64 and riscv64 only)
> + --[enable|disable]-sbi-exit-code
> + Enable or disable sending pass/fail exit code to SBI SRST.
> + (disabled by default, riscv only)
> EOF
> exit 1
> }
> @@ -236,6 +240,12 @@ while [[ $optno -le $argc ]]; do
> --disable-efi-direct)
> efi_direct=n
> ;;
> + --enable-sbi-exit-code)
> + sbi_exit_code=1
> + ;;
> + --disable-sbi-exit-code)
> + sbi_exit_code=0
> + ;;
> --enable-werror)
> werror=-Werror
> ;;
> @@ -551,6 +561,7 @@ EOF
> elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then
> echo "#define CONFIG_UART_EARLY_BASE ${uart_early_addr}" >> lib/config.h
> [ "$console" = "sbi" ] && echo "#define CONFIG_SBI_CONSOLE" >> lib/config.h
> + echo "#define CONFIG_SBI_EXIT_CODE ${sbi_exit_code}" >> lib/config.h
> echo >> lib/config.h
> fi
> echo "#endif" >> lib/config.h
> diff --git a/lib/riscv/io.c b/lib/riscv/io.c
> index b1163404..c46845de 100644
> --- a/lib/riscv/io.c
> +++ b/lib/riscv/io.c
> @@ -6,6 +6,7 @@
> * Copyright (C) 2023, Ventana Micro Systems Inc., Andrew Jones <ajones@ventanamicro.com>
> */
> #include <libcflat.h>
> +#include <argv.h>
> #include <bitops.h>
> #include <config.h>
> #include <devicetree.h>
> @@ -163,7 +164,8 @@ void halt(int code);
> void exit(int code)
> {
> printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1);
> - sbi_shutdown(code == 0);
> +
> + sbi_shutdown(GET_CONFIG_OR_ENV(SBI_EXIT_CODE) ? code == 0 : true);
> halt(code);
> __builtin_unreachable();
> }
> --
> 2.43.0
>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
next prev parent reply other threads:[~2025-07-09 12:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 15:48 [kvm-unit-tests PATCH v2 1/2] lib: Add STR_IS_Y and STR_IS_N for checking env vars Jesse Taube
2025-07-08 15:48 ` Jesse Taube
2025-07-08 15:48 ` [kvm-unit-tests PATCH v2 2/2] riscv: lib: Add sbi-exit-code to configure and environment Jesse Taube
2025-07-08 15:48 ` Jesse Taube
2025-07-09 10:11 ` Andrew Jones [this message]
2025-07-09 10:11 ` Andrew Jones
2025-07-09 10:09 ` [kvm-unit-tests PATCH v2 1/2] lib: Add STR_IS_Y and STR_IS_N for checking env vars Andrew Jones
2025-07-09 10:09 ` Andrew Jones
2025-07-09 10:14 ` Andrew Jones
2025-07-09 10:14 ` 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=20250709-93076fafcec83e14102193dc@orel \
--to=andrew.jones@linux.dev \
--cc=cade.richard@gmail.com \
--cc=charlie@rivosinc.com \
--cc=cleger@rivosinc.com \
--cc=jamestiotio@gmail.com \
--cc=jesse@rivosinc.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.