diff mbox series

[07/11] target/arm: Update arm_mmu_idx_el for PAN

Message ID 20191203225333.17055-8-richard.henderson@linaro.org
State Superseded
Headers show
Series target/arm: Implement ARMv8.1-PAN + ARMv8.2-ATS1E1 | expand

Commit Message

Richard Henderson Dec. 3, 2019, 10:53 p.m. UTC
Examine the PAN bit for EL1, EL2, and Secure EL1 to
determine if it applies.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/helper.c | 9 +++++++++
 1 file changed, 9 insertions(+)

-- 
2.17.1

Comments

Peter Maydell Dec. 6, 2019, 7:10 p.m. UTC | #1
On Tue, 3 Dec 2019 at 22:53, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> Examine the PAN bit for EL1, EL2, and Secure EL1 to

> determine if it applies.

>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  target/arm/helper.c | 9 +++++++++

>  1 file changed, 9 insertions(+)

>

> diff --git a/target/arm/helper.c b/target/arm/helper.c

> index 512be5c644..6c65dd799e 100644

> --- a/target/arm/helper.c

> +++ b/target/arm/helper.c

> @@ -11770,13 +11770,22 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el)

>          return ARMMMUIdx_EL10_0;

>      case 1:

>          if (arm_is_secure_below_el3(env)) {

> +            if (env->pstate & PSTATE_PAN) {

> +                return ARMMMUIdx_SE1_PAN;

> +            }

>              return ARMMMUIdx_SE1;

>          }

> +        if (env->pstate & PSTATE_PAN) {

> +            return ARMMMUIdx_EL10_1_PAN;

> +        }

>          return ARMMMUIdx_EL10_1;

>      case 2:

>          /* TODO: ARMv8.4-SecEL2 */

>          /* Note that TGE does not apply at EL2.  */

>          if ((env->cp15.hcr_el2 & HCR_E2H) && arm_el_is_aa64(env, 2)) {

> +            if (env->pstate & PSTATE_PAN) {

> +                return ARMMMUIdx_EL20_2_PAN;

> +            }

>              return ARMMMUIdx_EL20_2;

>          }

>          return ARMMMUIdx_E2;

> --


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


thanks
-- PMM
diff mbox series

Patch

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 512be5c644..6c65dd799e 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11770,13 +11770,22 @@  ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el)
         return ARMMMUIdx_EL10_0;
     case 1:
         if (arm_is_secure_below_el3(env)) {
+            if (env->pstate & PSTATE_PAN) {
+                return ARMMMUIdx_SE1_PAN;
+            }
             return ARMMMUIdx_SE1;
         }
+        if (env->pstate & PSTATE_PAN) {
+            return ARMMMUIdx_EL10_1_PAN;
+        }
         return ARMMMUIdx_EL10_1;
     case 2:
         /* TODO: ARMv8.4-SecEL2 */
         /* Note that TGE does not apply at EL2.  */
         if ((env->cp15.hcr_el2 & HCR_E2H) && arm_el_is_aa64(env, 2)) {
+            if (env->pstate & PSTATE_PAN) {
+                return ARMMMUIdx_EL20_2_PAN;
+            }
             return ARMMMUIdx_EL20_2;
         }
         return ARMMMUIdx_E2;