arch-arm: ELIsInHost, check VHE and SecEL2
authorAdrian Herrera <adrian.herrera@arm.com>
Fri, 29 Nov 2019 17:49:07 +0000 (17:49 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 15 Jan 2020 09:26:10 +0000 (09:26 +0000)
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>
src/arch/arm/utility.cc

index a82fec495c4ca4dac4b71e2e464b0159137b1217..e3d64fadf3000c0ca91865042689be5ff0fec9cb 100644 (file)
@@ -342,11 +342,9 @@ ELIs32(ThreadContext *tc, ExceptionLevel el)
 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)));
 }