Skip to contentSkip to conversation

target/arm: MTE privileged system mode assembly

PATCH In review Rémi Denis-Courmont 1 participant 1 message Mar 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 target/arm: MTE privileged system mode assembly

From: Rémi Denis-Courmont <[email protected]>

This adds all remaining MTE instructions for EL1, EL2 and EL3 on a processor with ID_AA64PFR1_EL1.MTE == 1.

---
 target/arm/cpu64.c         |  8 +++---
 target/arm/helper.c        | 19 ++++++++++++++
 target/arm/translate-a64.c | 52 +++++++++++++++++++++++++++++++++++---
 3 files changed, 71 insertions(+), 8 deletions(-)
target/arm/cpu64.c +3 -5
index a72dfd3d98..749eb93872 100644
@@ -665,13 +665,11 @@ static void aarch64_max_initfn(Object *obj)
 
         t = cpu->isar.id_aa64pfr1;
         t = FIELD_DP64(t, ID_AA64PFR1, BT, 1);
-#ifdef CONFIG_USER_ONLY
-        /* All MTE instructions and processor states are supported for user
-         * mode. This corresponds to feature field value 1 (field value 2
-         * implies MemTag memory support).
+        /* All MTE instructions and processor states are supported. This
+         * corresponds to feature field value 1 (field value 2 implies MemTag
+         * memory support).
          */
         t = FIELD_DP64(t, ID_AA64PFR1, MTE, 1);
-#endif
         cpu->isar.id_aa64pfr1 = t;
 
         t = cpu->isar.id_aa64mmfr1;
target/arm/helper.c +19 -0
index dd64fcb4ef..630dc04302 100644
@@ -6906,10 +6906,29 @@ static const ARMCPRegInfo mte_reginfo[] = {
       .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 5,
       .access = PL0_W, .type = ARM_CP_NOP,
       .accessfn = aa64_cacheop_poc_access },
+    { .name = "RGSR_EL1", .state = ARM_CP_STATE_AA64,
+      .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 5,
+      .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, rgsr_el1) },
+    { .name = "GCR_EL1", .state = ARM_CP_STATE_AA64,
+      .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 6,
+      .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, gcr_el1) },
     { .name = "TCO", .state = ARM_CP_STATE_AA64,
       .opc0 = 3, .opc1 = 3, .crn = 4, .crm = 2, .opc2 = 7,
       .access = PL0_RW, .type = ARM_CP_NO_RAW,
       .readfn = tco_read, .writefn = tco_write },
+    { .name = "TFSR_EL1", .state = ARM_CP_STATE_AA64,
+      .opc0 = 3, .opc1 = 0, .crn = 6, .crm = 5, .opc2 = 0,
+      .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, tfsr_el[1]) },
+    { .name = "TFSR_EL2", .state = ARM_CP_STATE_AA64,
+      .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 5, .opc2 = 0,
+      .access = PL2_RW, .type = ARM_CP_ALIAS,
+      .fieldoffset = offsetof(CPUARMState, tfsr_el[1]) },
+    { .name = "TFSR_EL3", .state = ARM_CP_STATE_AA64,
+      .opc0 = 3, .opc1 = 6, .crn = 6, .crm = 5, .opc2 = 0,
+      .access = PL3_RW, .fieldoffset = offsetof(CPUARMState, tfsr_el[3]) },
+    { .name = "TFSRE0_EL1", .state = ARM_CP_STATE_AA64,
+      .opc0 = 3, .opc1 = 0, .crn = 6, .crm = 6, .opc2 = 1,
+      .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, tfsre0_el1) },
     REGINFO_SENTINEL
 };
 #endif
target/arm/translate-a64.c +49 -3

64 lines not on this page · raw message

Signature · 1 line
2.25.1