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

cem at kernel.org cem at kernel.org
Wed Mar 13 14:50:55 PDT 2024


From: Carlos Maiolino <cem at kernel.org>

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

Signed-off-by: Carlos Maiolino <cmaiolino at redhat.com>
Reviewed-by: Andrew Jones <ajones at ventanamicro.com>
---
 riscv/sbi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/riscv/sbi.c b/riscv/sbi.c
index 6be78dae..f33c19f4 100644
--- a/riscv/sbi.c
+++ b/riscv/sbi.c
@@ -56,6 +56,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();
 }
 
-- 
2.44.0




More information about the kvm-riscv mailing list