arch-arm: Add have_crypto System parameter

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>
This commit is contained in:
Giacomo Travaglini
2018-05-17 17:07:16 +01:00
parent 8cbb531823
commit 34975af097
5 changed files with 24 additions and 0 deletions

View 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 "

View 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

View File

@@ -87,6 +87,7 @@ namespace ArmISA
bool haveSecurity;
bool haveLPAE;
bool haveVirtualization;
bool haveCrypto;
bool haveLargeAsid64;
uint8_t physAddrRange;

View 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 ?

View 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)
{