arch-arm: Introduce ARMv8.1 Virtual Timer System Registers
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 17 May 2018 16:19:53 +0000 (17:19 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 16 Jul 2018 08:18:56 +0000 (08:18 +0000)
Adding CNTHV_CTL_EL2, CNTHV_CVAL_EL2, CNTHV_TVAL_EL2 System Registers
into the decode tree. They are currently implemented as a generic timer
and produces a warning if accessed.

Change-Id: I1a23035d67f95eeac49d890283e9a0d58426d504
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/11592
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/arch/arm/isa.cc
src/arch/arm/miscregs.cc
src/arch/arm/miscregs.hh

index 9b17927e0ce18f79c0e13febf8ab7060e104c1eb..c701cc3a75beca9f95537177296adf4e51e6dc07 100644 (file)
@@ -644,6 +644,9 @@ ISA::readMiscReg(int misc_reg, ThreadContext *tc)
         return 0; // bits [63:0] RES0 (reserved for future use)
 
       // Generic Timer registers
+      case MISCREG_CNTHV_CTL_EL2:
+      case MISCREG_CNTHV_CVAL_EL2:
+      case MISCREG_CNTHV_TVAL_EL2:
       case MISCREG_CNTFRQ ... MISCREG_CNTHP_CTL:
       case MISCREG_CNTPCT ... MISCREG_CNTHP_CVAL:
       case MISCREG_CNTKCTL_EL1 ... MISCREG_CNTV_CVAL_EL0:
@@ -1913,6 +1916,9 @@ ISA::setMiscReg(int misc_reg, const MiscReg &val, ThreadContext *tc)
             break;
 
           // Generic Timer registers
+          case MISCREG_CNTHV_CTL_EL2:
+          case MISCREG_CNTHV_CVAL_EL2:
+          case MISCREG_CNTHV_TVAL_EL2:
           case MISCREG_CNTFRQ ... MISCREG_CNTHP_CTL:
           case MISCREG_CNTPCT ... MISCREG_CNTHP_CVAL:
           case MISCREG_CNTKCTL_EL1 ... MISCREG_CNTV_CVAL_EL0:
index cab5a70d2496d77421974f462bf431bc6081cc1f..bbd5347e5aecdc3bd810fedb9da88b1779e54d67 100644 (file)
@@ -2331,6 +2331,16 @@ decodeAArch64SysReg(unsigned op0, unsigned op1,
                         return MISCREG_CNTHP_CVAL_EL2;
                     }
                     break;
+                  case 3:
+                    switch (op2) {
+                      case 0:
+                        return MISCREG_CNTHV_TVAL_EL2;
+                      case 1:
+                        return MISCREG_CNTHV_CTL_EL2;
+                      case 2:
+                        return MISCREG_CNTHV_CVAL_EL2;
+                    }
+                    break;
                 }
                 break;
               case 7:
@@ -4018,6 +4028,12 @@ ISA::initializeMiscRegMetadata()
       .allPrivileges().exceptUserMode().writes(0);
     InitReg(MISCREG_CONTEXTIDR_EL2)
       .mon().hyp();
+    InitReg(MISCREG_CNTHV_CTL_EL2)
+      .mon().hyp();
+    InitReg(MISCREG_CNTHV_CVAL_EL2)
+      .mon().hyp();
+    InitReg(MISCREG_CNTHV_TVAL_EL2)
+      .mon().hyp();
 
     // Dummy registers
     InitReg(MISCREG_NOP)
index 4567964b3d0fef9eb4adc8d30f106108e3be9431..c1d5efa107d07a41c02c22ed856c7cf6c7f78c89 100644 (file)
@@ -668,14 +668,14 @@ namespace ArmISA
 
         // Introduced in ARMv8.1
         MISCREG_TTBR1_EL2,              // 600
+        MISCREG_CNTHV_CTL_EL2,          // 601
+        MISCREG_CNTHV_CVAL_EL2,         // 602
+        MISCREG_CNTHV_TVAL_EL2,         // 603
 
         // These MISCREG_FREESLOT are available Misc Register
         // slots for future registers to be implemented.
-        MISCREG_FREESLOT_1,             // 601
-        MISCREG_FREESLOT_2,             // 602
-        MISCREG_FREESLOT_3,             // 603
-        MISCREG_FREESLOT_4,             // 604
-        MISCREG_FREESLOT_5,             // 605
+        MISCREG_FREESLOT_1,             // 604
+        MISCREG_FREESLOT_2,             // 605
 
         // NUM_PHYS_MISCREGS specifies the number of actual physical
         // registers, not considering the following pseudo-registers
@@ -1385,11 +1385,11 @@ namespace ArmISA
         "contextidr_el2",
 
         "ttbr1_el2",
+        "cnthv_ctl_el2",
+        "cnthv_cval_el2",
+        "cnthv_tval_el2",
         "freeslot1",
         "freeslot2",
-        "freeslot3",
-        "freeslot4",
-        "freeslot5",
 
         "num_phys_regs",