Message ID | 20240315133244.579425-5-ajones@ventanamicro.com |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | [kvm-unit-tests,1/2] riscv: sbi: Check and test spec version | expand |
On Fri, Mar 15, 2024 at 02:32:46PM +0100, Andrew Jones wrote: > The base extension tests are only valid for spec versions 0.2 and > later, so ensure we have that before proceeding. Also check the > spec version matches an expected value, as we do the other functions. > > Signed-off-by: Andrew Jones <ajones@ventanamicro.com> > --- > riscv/sbi.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) Looks good. Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> > > diff --git a/riscv/sbi.c b/riscv/sbi.c > index cd36290ce11e..707ce8dd1c57 100644 > --- a/riscv/sbi.c > +++ b/riscv/sbi.c > @@ -50,6 +50,19 @@ static void check_base(void) > > report_prefix_push("base"); > > + ret = __base_sbi_ecall(SBI_EXT_BASE_GET_SPEC_VERSION, 0); > + if (ret.error || ret.value < 2) { > + report_skip("SBI spec version 0.2 or higher required"); > + return; > + } > + > + report_prefix_push("spec_version"); > + if (env_or_skip("SPEC_VERSION")) { > + expected = strtol(getenv("SPEC_VERSION"), NULL, 0); > + gen_report(&ret, 0, expected); > + } > + report_prefix_pop(); > + > report_prefix_push("impl_id"); > if (env_or_skip("IMPL_ID")) { > expected = strtol(getenv("IMPL_ID"), NULL, 0); > -- > 2.44.0 >
diff --git a/riscv/sbi.c b/riscv/sbi.c index cd36290ce11e..707ce8dd1c57 100644 --- a/riscv/sbi.c +++ b/riscv/sbi.c @@ -50,6 +50,19 @@ static void check_base(void) report_prefix_push("base"); + ret = __base_sbi_ecall(SBI_EXT_BASE_GET_SPEC_VERSION, 0); + if (ret.error || ret.value < 2) { + report_skip("SBI spec version 0.2 or higher required"); + return; + } + + report_prefix_push("spec_version"); + if (env_or_skip("SPEC_VERSION")) { + expected = strtol(getenv("SPEC_VERSION"), NULL, 0); + gen_report(&ret, 0, expected); + } + report_prefix_pop(); + report_prefix_push("impl_id"); if (env_or_skip("IMPL_ID")) { expected = strtol(getenv("IMPL_ID"), NULL, 0);
The base extension tests are only valid for spec versions 0.2 and later, so ensure we have that before proceeding. Also check the spec version matches an expected value, as we do the other functions. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> --- riscv/sbi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)