From 5698c2b52d756d5f11222559b75a038fea0cf52d Mon Sep 17 00:00:00 2001 From: Adrian Herrera Date: Fri, 29 Nov 2019 17:49:07 +0000 Subject: [PATCH] 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 --- src/arch/arm/utility.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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))); } -- 2.30.2