diff mbox series

[V2,3/6] riscv: Implement test for architecture ID register

Message ID 20240313084644.277426-4-cem@kernel.org
State Handled Elsewhere
Headers show
Series Add riscv tests to cover the base extension specs | expand

Commit Message

Carlos Maiolino March 13, 2024, 8:46 a.m. UTC
From: Carlos Maiolino <cem@kernel.org>

Probe the MARCHID register and compare it to the specified MARCHID
environment variable.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
---
V2:
	- Wrap commit message around 70 chars
	- Remove unneeded blank lines

 riscv/sbi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Andrew Jones March 13, 2024, 11:21 a.m. UTC | #1
On Wed, Mar 13, 2024 at 09:46:21AM +0100, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
> 
> Probe the MARCHID register and compare it to the specified MARCHID
> environment variable.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
> ---
> V2:
> 	- Wrap commit message around 70 chars
> 	- Remove unneeded blank lines
> 
>  riscv/sbi.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/riscv/sbi.c b/riscv/sbi.c
> index 519fcbe3..76f6111d 100644
> --- a/riscv/sbi.c
> +++ b/riscv/sbi.c
> @@ -52,6 +52,15 @@ 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 = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_PROBE_EXT,
> +				SBI_EXT_BASE_GET_MARCHID, 0, 0, 0, 0, 0);

This should be

 sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_GET_MARCHID, 0, ...)

> +		gen_report(&ret, expected);
> +	}
> +	report_prefix_pop();
> +
>  	report_prefix_pop();
>  }
>  
> -- 
> 2.44.0
>
diff mbox series

Patch

diff --git a/riscv/sbi.c b/riscv/sbi.c
index 519fcbe3..76f6111d 100644
--- a/riscv/sbi.c
+++ b/riscv/sbi.c
@@ -52,6 +52,15 @@  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 = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_PROBE_EXT,
+				SBI_EXT_BASE_GET_MARCHID, 0, 0, 0, 0, 0);
+		gen_report(&ret, expected);
+	}
+	report_prefix_pop();
+
 	report_prefix_pop();
 }