tests/tcg/aarch64/system/rme_gdi.c: Very basic test of GDI
Simply tests GDI's prerequisites; that if GDI is enabled then so are FEAT_RME and FEAT_RME_GPC2. Signed-off-by: Jim MacArthur <jim.macarthur@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260421-jmac-feat_rme_gdi-v3-4-ecd20c77eae1@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Jim MacArthur committed
May 5, 2026 at 09:25 UTC
a0293c69f739af6e1c9a7235823800d107ed6755
1 file changed
+46
tests/tcg/aarch64/system/rme_gdi.c
new
+46
@@ -0,0 +1,46 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
2
+/*
3
+ *
4
+ * FEAT_RME_GDI Feature presence and enabled bits test
5
+ *
6
+ * Copyright (c) 2026 Linaro Ltd
7
+ *
8
+ */
9
+
10
+#include <stdint.h>
11
+#include <minilib.h>
12
+
13
+#define ID_AA64PFR0_EL1 "S3_0_C0_C4_0"
14
+#define ID_AA64MMFR4_EL1 "S3_0_C0_C7_4"
15
+
16
+int main()
17
+{
18
+ uint64_t mmfr4;
19
+ uint64_t pfr0;
20
+ int rme_status;
21
+ int rmegdi_status;
22
+
23
+ asm("mrs %[pfr0], " ID_AA64PFR0_EL1 "\n\t"
24
+ : [pfr0] "=r" (pfr0));
25
+
26
+ /* rme_status is 1 for RME, 2 for RME + GPC2, 3 for RME+GPC3 */
27
+ rme_status = (pfr0 >> 52) & 0xF;
28
+
29
+ asm("mrs %[mmfr4], " ID_AA64MMFR4_EL1 "\n\t"
30
+ : [mmfr4] "=r" (mmfr4));
31
+
32
+ rmegdi_status = ((mmfr4 >> 28) & 0xF);
33
+
34
+ if (rmegdi_status < 1) {
35
+ ml_printf("SKIP: GDI not implemented\n");
36
+ return 0;
37
+ }
38
+
39
+ /* Check FEAT_RME and FEAT_RME_GPC2 also present */
40
+ if (rme_status < 2) {
41
+ ml_printf("FAIL: GDI is %d, but RME is %d; RME should be >= 2\n",
42
+ rmegdi_status, rme_status);
43
+ return 1;
44
+ }
45
+ return 0;
46
+}