From 86af3f249d2068cb3cda98ed4099b030e7177b06 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Thu, 15 Feb 2018 09:27:22 -0500 Subject: [PATCH] target-arm: Implement AArch32 ATS1H* operations Implement the AArch32 ATS1H* operations which perform Hyp mode stage 1 translations. Backports commit 14db7fe09a2c8d561ff37f98b328409906a560d7 from qemu --- qemu/target-arm/helper.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/qemu/target-arm/helper.c b/qemu/target-arm/helper.c index 9802d93e..fe696de1 100644 --- a/qemu/target-arm/helper.c +++ b/qemu/target-arm/helper.c @@ -1597,6 +1597,17 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) A32_BANKED_CURRENT_REG_SET(env, par, par64); } +static void ats1h_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + int access_type = ri->opc2 & 1; + uint64_t par64; + + par64 = do_ats_write(env, value, access_type, ARMMMUIdx_S2NS); + + A32_BANKED_CURRENT_REG_SET(env, par, par64); +} + static CPAccessResult at_s1e2_access(CPUARMState *env, const ARMCPRegInfo *ri) { if (arm_current_el(env) == 3 && !(env->cp15.scr_el3 & SCR_NS)) { @@ -2636,6 +2647,17 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { { "AT_S1E2W", 0,7,8, 1,4,1, ARM_CP_STATE_AA64, ARM_CP_NO_RAW, PL2_W, 0, NULL, 0, 0, {0, 0}, at_s1e2_access, NULL, ats_write64 }, + /* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE + * if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3 + * with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose + * to behave as if SCR.NS was 1. + */ + { "ATS1HR", 15,7,8, 0,4,0, 0, ARM_CP_NO_RAW, + PL2_W, 0, NULL, 0, 0, {0, 0}, + NULL, NULL, ats1h_write }, + { "ATS1HW", 15,7,8, 0,4,1, 0, ARM_CP_NO_RAW, + PL2_W, 0, NULL, 0, 0, {0, 0}, + NULL, NULL, ats1h_write }, /* ARMv7 requires bit 0 and 1 to reset to 1. ARMv8 defines the * reset values as IMPDEF. We choose to reset to 3 to comply with * both ARMv7 and ARMv8.