From: Adrian Herrera Date: Fri, 29 Nov 2019 17:49:07 +0000 (+0000) Subject: arch-arm: ELIsInHost, check VHE and SecEL2 X-Git-Tag: v19.0.0.0~108 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5698c2b52d756d5f11222559b75a038fea0cf52d;p=gem5.git arch-arm: ELIsInHost, check VHE and SecEL2 This patch modifies ELIsInHost to correctly check for VHE and Secure EL2 implementation. Change-Id: I947dddfc6761794493fef3d59b3b35754d07ed6b Reviewed-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24046 Reviewed-by: Ciro Santilli Maintainer: Giacomo Travaglini Tested-by: kokoro --- diff --git a/src/arch/arm/utility.cc b/src/arch/arm/utility.cc index a82fec495..e3d64fadf 100644 --- a/src/arch/arm/utility.cc +++ b/src/arch/arm/utility.cc @@ -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))); }