arch-arm: CNTHCTL trap to EL2 only if ARMv8.6-ECV implemented

In condGenericTimerCommonEL1SystemAccessTrapEL2 we were trapping
accesses to the EL1 virtual timer/counter registers to EL2, not
considering that this feature is part of ARMv8.6-ECV only
(not supported at the moment)

Change-Id: Ic03bcae436a105fb139a74126881b665ee08c912
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Adrian Herrera <adrian.herrera@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27408
Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2020-03-30 13:58:43 +01:00
parent ffad8a370a
commit 73dd2ee7a1
2 changed files with 10 additions and 2 deletions

View File

@@ -115,6 +115,7 @@ namespace ArmISA
EndBitUnion(AA64ISAR1)
BitUnion64(AA64MMFR0)
Bitfield<63, 60> ecv;
Bitfield<47, 44> exs;
Bitfield<43, 40> tgran4_2;
Bitfield<39, 36> tgran64_2;

View File

@@ -1086,6 +1086,7 @@ bool
condGenericTimerCommonEL1SystemAccessTrapEL2(const MiscRegIndex miscReg,
ThreadContext *tc)
{
const AA64MMFR0 mmfr0 = tc->readMiscRegNoEffect(MISCREG_ID_AA64MMFR0_EL1);
const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
const RegVal cnthctl_val = tc->readMiscReg(MISCREG_CNTHCTL_EL2);
const CNTHCTL cnthctl = cnthctl_val;
@@ -1096,13 +1097,19 @@ condGenericTimerCommonEL1SystemAccessTrapEL2(const MiscRegIndex miscReg,
return hcr.e2h ? !cnthctl_e2h.el1pcten : !cnthctl.el1pcten;
case MISCREG_CNTVCT:
case MISCREG_CNTVCT_EL0:
return hcr.e2h ? cnthctl_e2h.el1tvct : cnthctl.el1tvct;
if (!mmfr0.ecv)
return false;
else
return hcr.e2h ? cnthctl_e2h.el1tvct : cnthctl.el1tvct;
case MISCREG_CNTP_CTL ... MISCREG_CNTP_TVAL_S:
case MISCREG_CNTP_CTL_EL0 ... MISCREG_CNTP_TVAL_EL0:
return hcr.e2h ? !cnthctl_e2h.el1pten : false;
case MISCREG_CNTV_CTL ... MISCREG_CNTV_TVAL:
case MISCREG_CNTV_CTL_EL0 ... MISCREG_CNTV_TVAL_EL0:
return hcr.e2h ? cnthctl_e2h.el1tvt : cnthctl.el1tvt;
if (!mmfr0.ecv)
return false;
else
return hcr.e2h ? cnthctl_e2h.el1tvt : cnthctl.el1tvt;
default:
break;
}