diff mbox series

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

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

Commit Message

Carlos Maiolino Feb. 29, 2024, 12:42 p.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>
---
 riscv/sbi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Andrew Jones March 1, 2024, 8:31 a.m. UTC | #1
On Thu, Feb 29, 2024 at 01:42:09PM +0100, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
> 
> Probe the MARCHID register and compare it to the specified MARCHID environment
> variable

Please keep commit message lines to around 70 chars long (same comment
applies to other patches as well)

> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
>  riscv/sbi.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/riscv/sbi.c b/riscv/sbi.c
> index 636f907a..fa28d7c8 100644
> --- a/riscv/sbi.c
> +++ b/riscv/sbi.c
> @@ -60,6 +60,17 @@ static void check_base(void)
>  	}
>  	report_prefix_pop();
>  
> +	report_prefix_push("marchid");
> +	if (env_is_defined("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);

nit: no need for the two blank lines

> +	}
> +	report_prefix_pop();
> +
>  	report_prefix_pop();
>  }

With the rename of env_is_defined to include 'skip' somehow, then I like
the looks of this pattern.

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>

Thanks,
drew
diff mbox series

Patch

diff --git a/riscv/sbi.c b/riscv/sbi.c
index 636f907a..fa28d7c8 100644
--- a/riscv/sbi.c
+++ b/riscv/sbi.c
@@ -60,6 +60,17 @@  static void check_base(void)
 	}
 	report_prefix_pop();
 
+	report_prefix_push("marchid");
+	if (env_is_defined("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();
 }