This patch modifies ELIsInHost to correctly check for VHE
and Secure EL2 implementation.
Change-Id: I947dddfc6761794493fef3d59b3b35754d07ed6b
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24046
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
bool
ELIsInHost(ThreadContext *tc, ExceptionLevel el)
{
- if (!ArmSystem::haveVirtualization(tc)) {
- return false;
- }
- HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
- return (!isSecureBelowEL3(tc) && !ELIs32(tc, EL2) && hcr.e2h == 1 &&
+ const HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
+ return ((IsSecureEL2Enabled(tc) || !isSecureBelowEL3(tc)) &&
+ HaveVirtHostExt(tc) && !ELIs32(tc, EL2) && hcr.e2h == 1 &&
(el == EL2 || (el == EL0 && hcr.tge == 1)));
}