target/arm: fix handling of HCR.FB
authorRémi Denis-Courmont <remi.denis.courmont@huawei.com>
Mon, 2 Nov 2020 16:52:15 +0000 (16:52 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 2 Nov 2020 16:52:15 +0000 (16:52 +0000)
HCR should be applied when NS is set, not when it is cleared.

Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/helper.c

index 97bb6b8c01b409743e7611dd3306ceae5fb62ae9..dc51175bf05a5c5e1b5f55c5439ab333297e544e 100644 (file)
@@ -731,13 +731,12 @@ static void tlbimvaa_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
 
 /*
  * Non-IS variants of TLB operations are upgraded to
- * IS versions if we are at NS EL1 and HCR_EL2.FB is set to
+ * IS versions if we are at EL1 and HCR_EL2.FB is effectively set to
  * force broadcast of these operations.
  */
 static bool tlb_force_broadcast(CPUARMState *env)
 {
-    return (env->cp15.hcr_el2 & HCR_FB) &&
-        arm_current_el(env) == 1 && arm_is_secure_below_el3(env);
+    return arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_FB);
 }
 
 static void tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri,