From: Richard Henderson <[email protected]> Allow the bit to be set in TCR2; extract the bit in aa64_va_parameters.
Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Richard Henderson <[email protected]> Message-id: [email protected] Signed-off-by: Peter Maydell <[email protected]> --- target/arm/internals.h | 1 + target/arm/helper.c | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index f539bbe58e1..a65386aaed3 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1391,6 +1391,7 @@ typedef struct ARMVAParameters { bool hd : 1; ARMGranuleSize gran : 2; bool pie : 1; + bool aie : 1; } ARMVAParameters; /** diff --git a/target/arm/helper.c b/target/arm/helper.c index e4d16514409..8c0b8889dbf 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6098,6 +6098,9 @@ static void tcr2_el1_write(CPUARMState *env, const ARMCPRegInfo *ri, if (cpu_isar_feature(aa64_s1pie, cpu)) { valid_mask |= TCR2_PIE; } + if (cpu_isar_feature(aa64_aie, cpu)) { + valid_mask |= TCR2_AIE; + } value &= valid_mask; raw_write(env, ri, value); } @@ -6111,7 +6114,10 @@ static void tcr2_el2_write(CPUARMState *env, const ARMCPRegInfo *ri, if (cpu_isar_feature(aa64_s1pie, cpu)) { valid_mask |= TCR2_PIE; } - if (cpu_isar_feature(aa64_mec, env_archcpu(env))) { + if (cpu_isar_feature(aa64_aie, cpu)) { + valid_mask |= TCR2_AIE; + } + if (cpu_isar_feature(aa64_mec, cpu)) { valid_mask |= TCR2_AMEC0 | TCR2_AMEC1; } value &= valid_mask; @@ -9666,6 +9672,7 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, { uint64_t tcr = regime_tcr(env, mmu_idx); bool epd, hpd, tsz_oob, ds, ha, hd, pie = false; + bool aie = false; int select, tsz, tbi, max_tsz, min_tsz, ps, sh; ARMGranuleSize gran; ARMCPU *cpu = env_archcpu(env); @@ -9688,10 +9695,12 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, if (r_el == 3) { pie = (extract64(tcr, 35, 1) && cpu_isar_feature(aa64_s1pie, cpu)); - } else { - pie = ((env->cp15.tcr2_el[2] & TCR2_PIE) - && (!arm_feature(env, ARM_FEATURE_EL3) - || (env->cp15.scr_el3 & SCR_TCR2EN))); + aie = (extract64(tcr, 37, 1) + && cpu_isar_feature(aa64_aie, cpu)); + } else if (!arm_feature(env, ARM_FEATURE_EL3) + || (env->cp15.scr_el3 & SCR_TCR2EN)) { + pie = env->cp15.tcr2_el[2] & TCR2_PIE; + aie = env->cp15.tcr2_el[2] & TCR2_AIE; } } epd = false; @@ -9733,10 +9742,12 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, epd = true; } - pie = ((env->cp15.tcr2_el[r_el] & TCR2_PIE) - && (!arm_feature(env, ARM_FEATURE_EL3) - || (env->cp15.scr_el3 & SCR_TCR2EN)) - && (r_el == 2 || (arm_hcrx_el2_eff(env) & HCRX_TCR2EN))); + if ((!arm_feature(env, ARM_FEATURE_EL3) + || (env->cp15.scr_el3 & SCR_TCR2EN)) + && (r_el == 2 || (arm_hcrx_el2_eff(env) & HCRX_TCR2EN))) { + pie = env->cp15.tcr2_el[r_el] & TCR2_PIE; + aie = env->cp15.tcr2_el[r_el] & TCR2_AIE; + } } hpd |= pie; @@ -9818,6 +9829,7 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, .hd = ha && hd, .gran = gran, .pie = pie, + .aie = aie, }; } -- 2.43.0
