Add riscv tests to cover the base extension specs
Subsystems (2)
v3 cover Add riscv tests to cover the base extension specs
From: Carlos Maiolino <[email protected]>
Hi,
This is a new version of this series to create tests to cover functions of the riscv's SBI base implementation spec. The series also includes a a few helpers to reduce code duplication.
This new version includes updates related to Drew reviews, and extra massage on the patches due to moving the __base_sbi_ecall() wrapper to the beginninng of the series.
Detailed updates are specified on a patch-basis
Carlos Maiolino (6):
riscv: Add a wrapper to call sbi_ecall for base extension
riscv: Add test to probe SBI Extension
riscv: Factor out environment variable check and report generation
riscv: Implement test for architecture ID register
riscv: Enable gen_report() to print the wrong value in case of failure
riscv: Test for specific SBI implementation ID
riscv/sbi.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 70 insertions(+), 12 deletions(-)
Signature · 1 line
2.44.0
PATCH v3 1/6 riscv: Add a wrapper to call sbi_ecall for base extension
From: Carlos Maiolino <[email protected]>
All SBI extension functions accepts at most one argument, so create a wrapper around sbi_ecall() to avoid needing to pass in arguments 1 to 5 all the time, also, the wrapper can specify SBI_EXT_BASE directly.
---
V3:
- Move to the beginning of the series
- Don't mark __base_sbi_ecall() as inline
V2:
- This patch was introduced in V2
riscv/sbi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
riscv/sbi.c +7 -1
@@ -14,7 +14,13 @@ static void help(void)puts ("An environ must be provided where expected values are given.\n" ); } +static struct sbiret __base_sbi_ecall (int fid,unsigned long arg0) +{ +return sbi_ecall (SBI_EXT_BASE , fid, arg0,0 ,0 ,0 ,0 ,0 ); +} +int main (int argc,char **argv) + {struct sbiret ret;long expected;
@@ -32,7 +38,7 @@ int main(int argc, char **argv) } expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); - ret =sbi_ecall (SBI_EXT_BASE ,SBI_EXT_BASE_GET_MVENDORID ,0 ,0 ,0 ,0 ,0 ,0 ); + ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 );report (!ret.error,"mvendorid: no error" );report (ret.value == expected,"mvendorid" );
Signature · 1 line
2.44.0
PATCH 1/6 riscv: Add a wrapper to call sbi_ecall for base extension
Quoted 22 lines · cem at kernel.org
From: Carlos Maiolino <[email protected]>
All SBI extension functions accepts at most one argument, so create a wrapper around
sbi_ecall()to avoid needing to pass in arguments 1 to 5 all the time, also, the wrapper can specifySBI_EXT_BASEdirectly.Signed-off-by Carlos Maiolino <[email protected]>---
V3:
- Move to the beginning of the series
- Don't mark__base_sbi_ecall()as inline
V2:
- This patch was introduced in V2riscv/sbi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)riscv/sbi.c +0
-0
riscv/sbi.c static void help(void) · line 23
Quoted 10 lines
riscv/sbi.c +6
-0@@ -14,7 +14,13 @@ static void help(void)puts ("An environ must be provided where expected values are given.\n" ); } +static struct sbiret __base_sbi_ecall (int fid,unsigned long arg0) +{ +return sbi_ecall (SBI_EXT_BASE , fid, arg0,0 ,0 ,0 ,0 ,0 ); +} +int main (int argc,char **argv) +
stray blank line
Quoted 15 lines
riscv/sbi.c +1
-1{struct sbiret ret;long expected;@@ -32,7 +38,7 @@ int main(int argc, char **argv) } expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); - ret =sbi_ecall (SBI_EXT_BASE ,SBI_EXT_BASE_GET_MVENDORID ,0 ,0 ,0 ,0 ,0 ,0 ); + ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 );report (!ret.error,"mvendorid: no error" );report (ret.value == expected,"mvendorid" );Signature · 1 line
2.44.0
PATCH v3 2/6 riscv: Add test to probe SBI Extension
In reply to [email protected]From: Carlos Maiolino <[email protected]>
Factor out vendor id test to a new helper, and add a new test for probing the SBI extension.
Compare the retrieved value against an environment variable, as the implementation can return any non-zero value.
---
V3:
- Adapt patch to use __base_sbi_ecall
riscv/sbi.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-)
riscv/sbi.c +32 -12
@@ -19,29 +19,49 @@ static struct sbiret __base_sbi_ecall(int fid, unsigned long arg0)return sbi_ecall (SBI_EXT_BASE , fid, arg0,0 ,0 ,0 ,0 ,0 ); } -int main (int argc,char **argv) - +static void check_base (void ) {struct sbiret ret;long expected; -if (argc >1 && !strcmp (argv[1 ],"-h" )) { -help (); -exit (0 ); - } - -report_prefix_push ("sbi" ); +report_prefix_push ("base" );if (!getenv ("MVENDORID" )) {report_skip ("mvendorid: missing MVENDORID environment variable" ); - goto done; +return ; } + +report_prefix_push ("mvendorid" ); expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 ); -report (!ret.error,"mvendorid: no error" ); -report (ret.value == expected,"mvendorid" ); -done: +report (!ret.error,"no sbi.error" ); +report (ret.value == expected,"expected sbi.value" ); +report_prefix_pop (); + +report_prefix_push ("probe_ext" ); + expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; + + ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 ); + +report (!ret.error,"no sbi.error" ); +report (ret.value == expected,"expected sbi.value" ); +report_prefix_pop (); + +report_prefix_pop (); +} + +int main (int argc,char **argv) +{ + +if (argc >1 && !strcmp (argv[1 ],"-h" )) { +help (); +exit (0 ); + } + +report_prefix_push ("sbi" ); +check_base (); +return report_summary (); }
Signature · 1 line
2.44.0
PATCH 2/6 riscv: Add test to probe SBI Extension
Quoted 20 lines · cem at kernel.org
From: Carlos Maiolino <[email protected]>
Factor out vendor id test to a new helper, and add a new test for probing the SBI extension.
Compare the retrieved value against an environment variable, as the implementation can return any non-zero value.Signed-off-by Carlos Maiolino <[email protected]>---
V3:
- Adapt patch to use__base_sbi_ecallriscv/sbi.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-)riscv/sbi.c +0
-0
riscv/sbi.c static struct sbiret __base_sbi_ecall(int fid, unsigned long arg0) · line 23
Quoted 5 lines
riscv/sbi.c +0
-2@@ -19,29 +19,49 @@ static struct sbiret __base_sbi_ecall(int fid, unsigned long arg0)return sbi_ecall (SBI_EXT_BASE , fid, arg0,0 ,0 ,0 ,0 ,0 ); } -int main (int argc,char **argv) -
The last patch's stray blank line is removed here, so OK, but better to not add it in the first place.
Quoted 25 lines
riscv/sbi.c +5
-9+static void check_base (void ) {struct sbiret ret;long expected; -if (argc >1 && !strcmp (argv[1 ],"-h" )) { -help (); -exit (0 ); - } - -report_prefix_push ("sbi" ); +report_prefix_push ("base" );if (!getenv ("MVENDORID" )) {report_skip ("mvendorid: missing MVENDORID environment variable" ); - goto done; +return ; } + +report_prefix_push ("mvendorid" ); expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 ); -report (!ret.error,"mvendorid: no error" ); -report (ret.value == expected,"mvendorid" );
riscv/sbi.c static struct sbiret __base_sbi_ecall(int fid, unsigned long arg0) · line 46
Quoted 10 lines
riscv/sbi.c +8
-1-done: +report (!ret.error,"no sbi.error" ); +report (ret.value == expected,"expected sbi.value" ); +report_prefix_pop (); + +report_prefix_push ("probe_ext" ); + expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; + + ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 );
The arg shouldn't be zero for this test. Before, you probed for the base extension itself.
Quoted 24 lines
riscv/sbi.c +19
-0+ +report (!ret.error,"no sbi.error" ); +report (ret.value == expected,"expected sbi.value" ); +report_prefix_pop (); + +report_prefix_pop (); +} + +int main (int argc,char **argv) +{ + +if (argc >1 && !strcmp (argv[1 ],"-h" )) { +help (); +exit (0 ); + } + +report_prefix_push ("sbi" ); +check_base (); +return report_summary (); }Signature · 1 line
2.44.0
Thanks,
drew
PATCH v3 3/6 riscv: Factor out environment variable check and report generation
In reply to [email protected]From: Carlos Maiolino <[email protected]>
We do check Environment variables and generate reports all the time, so use a couple of helpers for that
---
V3:
- Adapt to use __base_sbi_ecall()
riscv/sbi.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-)
riscv/sbi.c +23 -15
@@ -19,6 +19,23 @@ static struct sbiret __base_sbi_ecall(int fid, unsigned long arg0)return sbi_ecall (SBI_EXT_BASE , fid, arg0,0 ,0 ,0 ,0 ,0 ); } +static bool env_or_skip (const char *env) +{ + +if (!getenv (env)) { +report_skip ("missing %s environment variable" , env); +return false; + } + +return true; +} + +static void gen_report (struct sbiret *ret,long expected) +{ +report (!ret->error,"no sbi.error" ); +report (ret->value == expected,"expected sbi.value" ); +} +static void check_base (void ) {struct sbiret ret;
@@ -26,27 +43,18 @@ static void check_base(void)report_prefix_push ("base" ); -if (!getenv ("MVENDORID" )) { -report_skip ("mvendorid: missing MVENDORID environment variable" ); -return ; - } -report_prefix_push ("mvendorid" ); - expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); - - ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 ); - -report (!ret.error,"no sbi.error" ); -report (ret.value == expected,"expected sbi.value" ); +if (env_or_skip ("MVENDORID" )) { + expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); + ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 ); +gen_report (&ret, expected); + }report_prefix_pop ();report_prefix_push ("probe_ext" ); expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; - ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 ); - -report (!ret.error,"no sbi.error" ); -report (ret.value == expected,"expected sbi.value" ); +gen_report (&ret, expected);report_prefix_pop ();report_prefix_pop ();
Signature · 1 line
2.44.0
PATCH 3/6 riscv: Factor out environment variable check and report generation
Quoted 18 lines · cem at kernel.org
From: Carlos Maiolino <[email protected]>
We do check Environment variables and generate reports all the time, so use a couple of helpers for that
Signed-off-by Carlos Maiolino <[email protected]>---
V3:
- Adapt to use__base_sbi_ecall()riscv/sbi.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-)riscv/sbi.c +0
-0
riscv/sbi.c static struct sbiret __base_sbi_ecall(int fid, unsigned long arg0) · line 24
Quoted 6 lines
riscv/sbi.c +3
-0@@ -19,6 +19,23 @@ static struct sbiret __base_sbi_ecall(int fid, unsigned long arg0)return sbi_ecall (SBI_EXT_BASE , fid, arg0,0 ,0 ,0 ,0 ,0 ); } +static bool env_or_skip (const char *env) +{ +
stray blank line here (might want to check your editor settings...)
Quoted 54 lines
riscv/sbi.c +20
-15+if (!getenv (env)) { +report_skip ("missing %s environment variable" , env); +return false; + } + +return true; +} + +static void gen_report (struct sbiret *ret,long expected) +{ +report (!ret->error,"no sbi.error" ); +report (ret->value == expected,"expected sbi.value" ); +} +static void check_base (void ) {struct sbiret ret;@@ -26,27 +43,18 @@ static void check_base(void)report_prefix_push ("base" ); -if (!getenv ("MVENDORID" )) { -report_skip ("mvendorid: missing MVENDORID environment variable" ); -return ; - } -report_prefix_push ("mvendorid" ); - expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); - - ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 ); - -report (!ret.error,"no sbi.error" ); -report (ret.value == expected,"expected sbi.value" ); +if (env_or_skip ("MVENDORID" )) { + expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); + ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 ); +gen_report (&ret, expected); + }report_prefix_pop ();report_prefix_push ("probe_ext" ); expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; - ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 ); - -report (!ret.error,"no sbi.error" ); -report (ret.value == expected,"expected sbi.value" ); +gen_report (&ret, expected);report_prefix_pop ();report_prefix_pop ();Signature · 1 line
2.44.0
With the fixups it'll need after fixing the last patch and the removal of the blank line,
PATCH v3 4/6 riscv: Implement test for architecture ID register
In reply to [email protected]From: Carlos Maiolino <[email protected]>
Probe the MARCHID register and compare it to the specified MARCHID environment variable.
---
V3:
- Adapt to use __base_sbi_ecall (which also fixes the wrong paramenters)
V2:
- Wrap commit message around 70 chars
- Remove unneeded blank lines
riscv/sbi.c | 8 ++++++++ 1 file changed, 8 insertions(+)
riscv/sbi.c +8 -0
@@ -57,6 +57,14 @@ static void check_base(void)gen_report (&ret, expected);report_prefix_pop (); +report_prefix_push ("marchid" ); +if (env_or_skip ("MARCHID" )) { + expected =strtol (getenv ("MARCHID" ),NULL ,0 ); + ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MARCHID ,0 ); +gen_report (&ret, expected); + } +report_prefix_pop (); +report_prefix_pop (); }
Signature · 1 line
2.44.0
PATCH 4/6 riscv: Implement test for architecture ID register
Quoted 38 lines · cem at kernel.org
From: Carlos Maiolino <[email protected]>
Probe the MARCHID register and compare it to the specified MARCHID environment variable.
Signed-off-by Carlos Maiolino <[email protected]>---
V3:
- Adapt to use__base_sbi_ecall(which also fixes the wrong paramenters)
V2:
- Wrap commit message around 70 chars
- Remove unneeded blank linesriscv/sbi.c | 8 ++++++++ 1 file changed, 8 insertions(+)riscv/sbi.c +8
-0@@ -57,6 +57,14 @@ static void check_base(void)gen_report (&ret, expected);report_prefix_pop (); +report_prefix_push ("marchid" ); +if (env_or_skip ("MARCHID" )) { + expected =strtol (getenv ("MARCHID" ),NULL ,0 ); + ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MARCHID ,0 ); +gen_report (&ret, expected); + } +report_prefix_pop (); +report_prefix_pop (); }Signature · 1 line
2.44.0
PATCH v3 5/6 riscv: Enable gen_report() to print the wrong value in case of failure
In reply to [email protected]From: Carlos Maiolino <[email protected]>
If the test fails because the expected value doesn't match, it's useful to know what value was actually printed.
---
V3:
- Include expected error check in gen_report()
- Implement Drew's suggestion on cleaning up the function a bit
- Update patch to use __base_sbi_ecall()
V2:
- Reduce subject to fit 70 chars
- Use report_info() to output expected vs received values, leaving only necessary information for parsers on report()
riscv/sbi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
riscv/sbi.c +14 -6
@@ -30,10 +30,18 @@ static bool env_or_skip(const char *env)return true; } -static void gen_report (struct sbiret *ret,long expected) +static void gen_report (struct sbiret *ret, +long expected_error,long expected_value) { -report (!ret->error,"no sbi.error" ); -report (ret->value == expected,"expected sbi.value" ); +bool check_error = ret->error == expected_error; +bool check_value = ret->value == expected_value; + +if (!check_error || !check_value) +report_info ("expected (error: %ld, value: %ld), received: (error: %ld, value %ld)\n" , + expected_error, expected_value, ret->error, ret->value); + +report (check_error,"expected sbi.error" ); +report (check_value,"expected sbi.value" ); }static void check_base (void )
@@ -47,21 +55,21 @@ static void check_base(void)if (env_or_skip ("MVENDORID" )) { expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 ); -gen_report (&ret, expected); +gen_report (&ret,0 , expected); }report_prefix_pop ();report_prefix_push ("probe_ext" ); expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 ); -gen_report (&ret, expected); +gen_report (&ret,0 , expected);report_prefix_pop ();report_prefix_push ("marchid" );if (env_or_skip ("MARCHID" )) { expected =strtol (getenv ("MARCHID" ),NULL ,0 ); ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MARCHID ,0 ); -gen_report (&ret, expected); +gen_report (&ret,0 , expected); }report_prefix_pop ();
Signature · 1 line
2.44.0
PATCH 5/6 riscv: Enable gen_report() to print the wrong value in case of failure
Quoted 73 lines · cem at kernel.org
From: Carlos Maiolino <[email protected]>
If the test fails because the expected value doesn't match, it's useful to know what value was actually printed.
Signed-off-by Carlos Maiolino <[email protected]>---
V3:
- Include expected error check ingen_report()
- Implement Drew's suggestion on cleaning up the function a bit
- Update patch to use__base_sbi_ecall()
V2:
- Reduce subject to fit 70 chars
- Usereport_info()to output expected vs received values, leaving only necessary information for parsers onreport()riscv/sbi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)riscv/sbi.c +14
-6@@ -30,10 +30,18 @@ static bool env_or_skip(const char *env)return true; } -static void gen_report (struct sbiret *ret,long expected) +static void gen_report (struct sbiret *ret, +long expected_error,long expected_value) { -report (!ret->error,"no sbi.error" ); -report (ret->value == expected,"expected sbi.value" ); +bool check_error = ret->error == expected_error; +bool check_value = ret->value == expected_value; + +if (!check_error || !check_value) +report_info ("expected (error: %ld, value: %ld), received: (error: %ld, value %ld)\n" , + expected_error, expected_value, ret->error, ret->value); + +report (check_error,"expected sbi.error" ); +report (check_value,"expected sbi.value" ); }static void check_base (void )@@ -47,21 +55,21 @@ static void check_base(void)if (env_or_skip ("MVENDORID" )) { expected =strtol (getenv ("MVENDORID" ),NULL ,0 ); ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MVENDORID ,0 ); -gen_report (&ret, expected); +gen_report (&ret,0 , expected); }report_prefix_pop ();report_prefix_push ("probe_ext" ); expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 ); -gen_report (&ret, expected); +gen_report (&ret,0 , expected);report_prefix_pop ();report_prefix_push ("marchid" );if (env_or_skip ("MARCHID" )) { expected =strtol (getenv ("MARCHID" ),NULL ,0 ); ret =__base_sbi_ecall (SBI_EXT_BASE_GET_MARCHID ,0 ); -gen_report (&ret, expected); +gen_report (&ret,0 , expected); }report_prefix_pop ();Signature · 1 line
2.44.0
PATCH v3 6/6 riscv: Test for specific SBI implementation ID
In reply to [email protected]From: Carlos Maiolino <[email protected]>
Retrieve the ID from the SBI, and test it against IMPL_ID enviroment variable.
---
V3:
- Update to use __base_sbi_ecall (also fixes the correct paramenters)
- Rename env var to IMPL_ID to match the other tests
V2:
- Update commit description to fit 70 chars
- Move sbi_ecall() after expected assignment to make consistent with other tests
riscv/sbi.c | 8 ++++++++ 1 file changed, 8 insertions(+)
riscv/sbi.c +8 -0
@@ -59,6 +59,14 @@ static void check_base(void) }report_prefix_pop (); +report_prefix_push ("impl_id" ); +if (env_or_skip ("IMPL_ID" )) { + expected =strtol (getenv ("IMPL_ID" ),NULL ,0 ); + ret =sbi_ecall (SBI_EXT_BASE ,SBI_EXT_BASE_GET_IMP_ID ,0 ,0 ,0 ,0 ,0 ,0 ); +gen_report (&ret,0 , expected); + } +report_prefix_pop (); +report_prefix_push ("probe_ext" ); expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 );
Signature · 1 line
2.44.0
PATCH 6/6 riscv: Test for specific SBI implementation ID
Quoted 23 lines · cem at kernel.org
From: Carlos Maiolino <[email protected]>
Retrieve the ID from the SBI, and test it against
IMPL_IDenviroment variable.Signed-off-by Carlos Maiolino <[email protected]>---
V3:
- Update to use__base_sbi_ecall(also fixes the correct paramenters)
- Rename env var toIMPL_IDto match the other tests
V2:
- Update commit description to fit 70 chars
- Movesbi_ecall()after expected assignment to make consistent with other testsriscv/sbi.c | 8 ++++++++ 1 file changed, 8 insertions(+)riscv/sbi.c +0
-0
riscv/sbi.c static void check_base(void) · line 65
Quoted 7 lines
riscv/sbi.c +4
-0@@ -59,6 +59,14 @@ static void check_base(void) }report_prefix_pop (); +report_prefix_push ("impl_id" ); +if (env_or_skip ("IMPL_ID" )) { + expected =strtol (getenv ("IMPL_ID" ),NULL ,0 ); + ret =sbi_ecall (SBI_EXT_BASE ,SBI_EXT_BASE_GET_IMP_ID ,0 ,0 ,0 ,0 ,0 ,0 );
commit message says you switched to __base_sbi_ecall(), but you didn't :-)
Quoted 10 lines
riscv/sbi.c +4
-0+gen_report (&ret,0 , expected); + } +report_prefix_pop (); +report_prefix_push ("probe_ext" ); expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 );Signature · 1 line
2.44.0
Thanks,
drew
PATCH v3 6/6 riscv: Test for specific SBI implementation ID
Quoted 27 lines · Andrew Jones
Quoted 26 lines · cem at kernel.org
From: Carlos Maiolino <[email protected]>
Retrieve the ID from the SBI, and test it against
IMPL_IDenviroment variable.Signed-off-by Carlos Maiolino <[email protected]>---
V3:
- Update to use__base_sbi_ecall(also fixes the correct paramenters)
- Rename env var toIMPL_IDto match the other tests
V2:
- Update commit description to fit 70 chars
- Movesbi_ecall()after expected assignment to make consistent with other testsriscv/sbi.c | 8 ++++++++ 1 file changed, 8 insertions(+)riscv/sbi.c +0
-0@@ -59,6 +59,14 @@ static void check_base(void) }report_prefix_pop ();
Quoted 6 lines
riscv/sbi.c static void check_base(void) · line 65
Quoted 4 lines
riscv/sbi.c +4
-0+report_prefix_push ("impl_id" ); +if (env_or_skip ("IMPL_ID" )) { + expected =strtol (getenv ("IMPL_ID" ),NULL ,0 ); + ret =sbi_ecall (SBI_EXT_BASE ,SBI_EXT_BASE_GET_IMP_ID ,0 ,0 ,0 ,0 ,0 ,0 );commit message says you switched to
__base_sbi_ecall(), but you didn't :-)
Sigh... my apologies, had a short time to update these patches and overlooked it, I'll fix it and send a decent version tonight.
Thanks for the reviews
Carlos
Quoted 14 lines
Quoted 11 lines
riscv/sbi.c +4
-1+gen_report (&ret,0 , expected); + } +report_prefix_pop (); +report_prefix_push ("probe_ext" ); expected =getenv ("PROBE_EXT" ) ?strtol (getenv ("PROBE_EXT" ),NULL ,0 ) :1 ; ret =__base_sbi_ecall (SBI_EXT_BASE_PROBE_EXT ,0 ); --2.44.0
Thanks,
drew