arch-arm: Add have_crypto System parameter
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 17 May 2018 16:07:16 +0000 (17:07 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 9 Oct 2018 09:12:48 +0000 (09:12 +0000)
This patch adds the have_crypto ArmSystem parameter for enabling crypto
extension. This is done by modifying the AArch32/AArch64 ID registers
at startup time.

Change-Id: I6eefb7e6f6354802a14ea639ad53b75f8e1e11c5
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/13252
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

src/arch/arm/ArmSystem.py
src/arch/arm/isa.cc
src/arch/arm/isa.hh
src/arch/arm/system.cc
src/arch/arm/system.hh

index 1e3a8cfcad15a8961da151634d3945ae9f4bc663..cd08d744939b2536b24a3bf747816ef5702bb570 100644 (file)
@@ -65,6 +65,8 @@ class ArmSystem(System):
         "True if Security Extensions are implemented")
     have_virtualization = Param.Bool(False,
         "True if Virtualization Extensions are implemented")
+    have_crypto = Param.Bool(False,
+        "True if Crypto Extensions is implemented")
     have_lpae = Param.Bool(True, "True if LPAE is implemented")
     highest_el_is_64 = Param.Bool(False,
         "True if the register width of the highest implemented exception level "
index 878ff70d7f9ece8bbfc9f171367230390e9ba4c1..22d275d52ab8a1e64ed64e0e03c3a5bdd8deffe6 100644 (file)
@@ -82,12 +82,14 @@ ISA::ISA(Params *p)
         highestELIs64 = system->highestELIs64();
         haveSecurity = system->haveSecurity();
         haveLPAE = system->haveLPAE();
+        haveCrypto = system->haveCrypto();
         haveVirtualization = system->haveVirtualization();
         haveLargeAsid64 = system->haveLargeAsid64();
         physAddrRange = system->physAddrRange();
     } else {
         highestELIs64 = true; // ArmSystem::highestELIs64 does the same
         haveSecurity = haveLPAE = haveVirtualization = false;
+        haveCrypto = false;
         haveLargeAsid64 = false;
         physAddrRange = 32;  // dummy value
     }
@@ -122,6 +124,10 @@ ISA::clear()
     // AArch32 or AArch64
     initID64(p);
 
+    miscRegs[MISCREG_ID_ISAR5] = insertBits(
+        miscRegs[MISCREG_ID_ISAR5], 19, 4,
+        haveCrypto ? 0x1112 : 0x0);
+
     if (FullSystem && system->highestELIs64()) {
         // Initialize AArch64 state
         clear64(p);
@@ -344,6 +350,10 @@ ISA::initID64(const ArmISAParams *p)
     miscRegs[MISCREG_ID_AA64MMFR0_EL1] = insertBits(
         miscRegs[MISCREG_ID_AA64MMFR0_EL1], 3, 0,
         encodePhysAddrRange64(physAddrRange));
+    // Crypto
+    miscRegs[MISCREG_ID_AA64ISAR0_EL1] = insertBits(
+        miscRegs[MISCREG_ID_AA64ISAR0_EL1], 19, 4,
+        haveCrypto ? 0x1112 : 0x0);
 }
 
 void
index ae35d704ccf3bc14cb4d99b76a486d3874484b42..885190c688d474d9408658d70b8bd26ec34a68f4 100644 (file)
@@ -87,6 +87,7 @@ namespace ArmISA
         bool haveSecurity;
         bool haveLPAE;
         bool haveVirtualization;
+        bool haveCrypto;
         bool haveLargeAsid64;
         uint8_t physAddrRange;
 
index a540a63c48685f4be1cfc48a5ebea250c7d60baf..21b02e9680408023a273cf539203bf536de2a64c 100644 (file)
@@ -61,6 +61,7 @@ ArmSystem::ArmSystem(Params *p)
       _haveSecurity(p->have_security),
       _haveLPAE(p->have_lpae),
       _haveVirtualization(p->have_virtualization),
+      _haveCrypto(p->have_crypto),
       _genericTimer(nullptr),
       _highestELIs64(p->highest_el_is_64),
       _resetAddr64(p->auto_reset_addr_64 ?
index e7696a4fd34efe81c3ba2210ae61174ecbc75c73..2e236f722e932f37e5f767297975c27bfc702c73 100644 (file)
@@ -88,6 +88,11 @@ class ArmSystem : public System
      */
     const bool _haveVirtualization;
 
+    /**
+     * True if this system implements the Crypto Extension
+     */
+    const bool _haveCrypto;
+
     /**
      * Pointer to the Generic Timer wrapper.
      */
@@ -177,6 +182,11 @@ class ArmSystem : public System
       */
     bool haveVirtualization() const { return _haveVirtualization; }
 
+    /** Returns true if this system implements the Crypto
+      * Extension
+      */
+    bool haveCrypto() const { return _haveCrypto; }
+
     /** Sets the pointer to the Generic Timer. */
     void setGenericTimer(GenericTimer *generic_timer)
     {