summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2020-02-07 14:04:26 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-02-07 14:04:26 +0000
commita7469a3c1edc7687d7d25967bc2c0280de202bca (patch)
tree7c888f29d92761ce4d5b701f4a090c2b0b9c1e95
parentc2ddb7cf963b3bea838266bfca62514dc9750a10 (diff)
downloadfocaccia-qemu-a7469a3c1edc7687d7d25967bc2c0280de202bca.tar.gz
focaccia-qemu-a7469a3c1edc7687d7d25967bc2c0280de202bca.zip
target/arm: check TGE and E2H flags for EL0 pauth traps
According to ARM ARM we should only trap from the EL1&0 regime.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-35-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--target/arm/pauth_helper.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
index e0c401c4a9..9746e32bf8 100644
--- a/target/arm/pauth_helper.c
+++ b/target/arm/pauth_helper.c
@@ -371,7 +371,10 @@ static void pauth_check_trap(CPUARMState *env, int el, uintptr_t ra)
     if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
         uint64_t hcr = arm_hcr_el2_eff(env);
         bool trap = !(hcr & HCR_API);
-        /* FIXME: ARMv8.1-VHE: trap only applies to EL1&0 regime.  */
+        if (el == 0) {
+            /* Trap only applies to EL1&0 regime.  */
+            trap &= (hcr & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE);
+        }
         /* FIXME: ARMv8.3-NV: HCR_NV trap takes precedence for ERETA[AB].  */
         if (trap) {
             pauth_trap(env, 2, ra);