From c457067e471f1de2548f14eb185eaed3b4bd02c4 Mon Sep 17 00:00:00 2001 From: Greg Bellows Date: Mon, 12 Feb 2018 10:13:24 -0500 Subject: [PATCH] target-arm: Merge EL3 CP15 register lists Merge of the v8_el2_cp_reginfo and el3_cp_reginfo ARMCPRegInfo lists. Previously, some EL3 registers were restricted to the ARMv8 list under the impression that they were not needed on ARMv7. However, this is not the case as the ARMv7/32-bit variants rely on the ARMv8/64-bit variants to handle migration and reset. For this reason they must always exist. Backports commit 60fb1a87b47b14e4ea67043aa56f353e77fbd70a from qemu --- qemu/target-arm/helper.c | 44 ++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/qemu/target-arm/helper.c b/qemu/target-arm/helper.c index 2fd2349c..b889a91c 100644 --- a/qemu/target-arm/helper.c +++ b/qemu/target-arm/helper.c @@ -2062,7 +2062,23 @@ static const ARMCPRegInfo v8_el2_cp_reginfo[] = { REGINFO_SENTINEL }; -static const ARMCPRegInfo v8_el3_cp_reginfo[] = { +static const ARMCPRegInfo el3_cp_reginfo[] = { + { "SCR_EL3", 0,1,1, 3,6,0, ARM_CP_STATE_AA64,0, + PL3_RW, 0, NULL, 0, offsetof(CPUARMState, cp15.scr_el3), {0, 0}, + NULL, NULL, scr_write }, + { "SCR", 15,1,1, 0,0,0, 0,ARM_CP_NO_MIGRATE, + PL3_RW, 0, NULL, 0, offsetoflow32(CPUARMState, cp15.scr_el3), {0, 0}, + NULL, NULL, scr_write, NULL, NULL, arm_cp_reset_ignore }, + { "SDER32_EL3", 0,1,1, 3,6,1, ARM_CP_STATE_AA64,0, + PL3_RW, 0, NULL, 0, offsetof(CPUARMState, cp15.sder) }, + { "SDER", 15,1,1, 0,0,1, 0,0, + PL3_RW, 0, NULL, 0, offsetoflow32(CPUARMState, cp15.sder) }, + /* TODO: Implement NSACR trapping of secure EL1 accesses to EL3 */ + { "NSACR", 15,1,1, 0,0,2, 0,0, + PL3_W | PL1_R, 0, NULL, 0, offsetof(CPUARMState, cp15.nsacr) }, + { "MVBAR", 15,12,0, 0,0,1, 0,0, + PL3_RW, 0, NULL, 0, offsetof(CPUARMState, cp15.mvbar), {0, 0}, + NULL, NULL, vbar_write }, { "SCTLR_EL3", 0,1,0, 3,6,0, ARM_CP_STATE_AA64,0, PL3_RW, 0, NULL, 0, offsetof(CPUARMState, cp15.sctlr_el[3]), {0, 0}, NULL, NULL, sctlr_write, NULL, raw_write, }, @@ -2086,29 +2102,6 @@ static const ARMCPRegInfo v8_el3_cp_reginfo[] = { REGINFO_SENTINEL }; -static const ARMCPRegInfo el3_cp_reginfo[] = { - { "SCR_EL3", 0,1,1, 3,6,0, ARM_CP_STATE_AA64, - 0, PL3_RW, 0, NULL, 0, offsetof(CPUARMState, cp15.scr_el3), {0, 0}, - NULL, NULL, scr_write }, - { "SCR", 15,1,1, 0,0,0, 0, - ARM_CP_NO_MIGRATE, PL3_RW, 0, NULL, 0, offsetoflow32(CPUARMState, cp15.scr_el3), {0, 0}, - NULL, NULL, scr_write, NULL, NULL, arm_cp_reset_ignore }, - { "SDER32_EL3", 0,1,1, 3,6,1, ARM_CP_STATE_AA64,0, - PL3_RW, 0, NULL, 0, - offsetof(CPUARMState, cp15.sder) }, - { "SDER", 15,1,1, 0,0,1, 0,0, - PL3_RW, 0, NULL, 0, - offsetoflow32(CPUARMState, cp15.sder) }, - /* TODO: Implement NSACR trapping of secure EL1 accesses to EL3 */ - { "NSACR", 15,1,1, 0,0,2, 0,0, - PL3_W | PL1_R, 0, NULL, 0, - offsetof(CPUARMState, cp15.nsacr) }, - { "MVBAR", 15,12,0, 0,0,1, 0,0, - PL3_RW, 0, NULL, 0, offsetof(CPUARMState, cp15.mvbar), {0, 0}, - NULL, NULL, vbar_write }, - REGINFO_SENTINEL -}; - static CPAccessResult ctr_el0_access(CPUARMState *env, const ARMCPRegInfo *ri) { /* Only accessible in EL0 if SCTLR.UCT is set (and only in AArch64, @@ -2626,9 +2619,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) } } if (arm_feature(env, ARM_FEATURE_EL3)) { - if (arm_feature(env, ARM_FEATURE_V8)) { - define_arm_cp_regs(cpu, v8_el3_cp_reginfo); - } define_arm_cp_regs(cpu, el3_cp_reginfo); } if (arm_feature(env, ARM_FEATURE_MPU)) {