Hello Andreas Sandberg,
I'd like you to do a code review. Please visit
https://gem5-review.googlesource.com/c/public/gem5/+/13252
to review the following change.
Change subject: arch-arm: Add have_crypto System parameter
......................................................................
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 <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
---
M src/arch/arm/ArmSystem.py
M src/arch/arm/isa.cc
M src/arch/arm/isa.hh
M src/arch/arm/system.cc
M src/arch/arm/system.hh
5 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/src/arch/arm/ArmSystem.py b/src/arch/arm/ArmSystem.py
index ec44331..6cf0fd8 100644
--- a/src/arch/arm/ArmSystem.py
+++ b/src/arch/arm/ArmSystem.py
@@ -66,6 +66,8 @@
"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 "
diff --git a/src/arch/arm/isa.cc b/src/arch/arm/isa.cc
index 878ff70..22d275d 100644
--- a/src/arch/arm/isa.cc
+++ b/src/arch/arm/isa.cc
@@ -82,12 +82,14 @@
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 @@
// 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 @@
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
diff --git a/src/arch/arm/isa.hh b/src/arch/arm/isa.hh
index ae35d70..885190c 100644
--- a/src/arch/arm/isa.hh
+++ b/src/arch/arm/isa.hh
@@ -87,6 +87,7 @@
bool haveSecurity;
bool haveLPAE;
bool haveVirtualization;
+ bool haveCrypto;
bool haveLargeAsid64;
uint8_t physAddrRange;
diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc
index a540a63..21b02e9 100644
--- a/src/arch/arm/system.cc
+++ b/src/arch/arm/system.cc
@@ -61,6 +61,7 @@
_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 ?
diff --git a/src/arch/arm/system.hh b/src/arch/arm/system.hh
index e7696a4..2e236f7 100644
--- a/src/arch/arm/system.hh
+++ b/src/arch/arm/system.hh
@@ -89,6 +89,11 @@
const bool _haveVirtualization;
/**
+ * True if this system implements the Crypto Extension
+ */
+ const bool _haveCrypto;
+
+ /**
* Pointer to the Generic Timer wrapper.
*/
GenericTimer *_genericTimer;
@@ -177,6 +182,11 @@
*/
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)
{
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/13252
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I6eefb7e6f6354802a14ea639ad53b75f8e1e11c5
Gerrit-Change-Number: 13252
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev