target/arm: Rename ARMMMUIdx_S1NSE* to ARMMMUIdx_Stage1_E*
This is part of a reorganization to the set of mmu_idx. The EL1&0 regime is the only one that uses 2-stage translation. Spelling out Stage avoids confusion with Secure. Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200206105448.4726-12-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
97fa935001
commit
2859d7b590
@ -2923,8 +2923,8 @@ typedef enum ARMMMUIdx {
|
|||||||
/* Indexes below here don't have TLBs and are used only for AT system
|
/* Indexes below here don't have TLBs and are used only for AT system
|
||||||
* instructions or for the first stage of an S12 page table walk.
|
* instructions or for the first stage of an S12 page table walk.
|
||||||
*/
|
*/
|
||||||
ARMMMUIdx_S1NSE0 = 0 | ARM_MMU_IDX_NOTLB,
|
ARMMMUIdx_Stage1_E0 = 0 | ARM_MMU_IDX_NOTLB,
|
||||||
ARMMMUIdx_S1NSE1 = 1 | ARM_MMU_IDX_NOTLB,
|
ARMMMUIdx_Stage1_E1 = 1 | ARM_MMU_IDX_NOTLB,
|
||||||
} ARMMMUIdx;
|
} ARMMMUIdx;
|
||||||
|
|
||||||
/* Bit macros for the core-mmu-index values for each index,
|
/* Bit macros for the core-mmu-index values for each index,
|
||||||
|
@ -3041,7 +3041,8 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
|
|||||||
bool take_exc = false;
|
bool take_exc = false;
|
||||||
|
|
||||||
if (fi.s1ptw && current_el == 1 && !arm_is_secure(env)
|
if (fi.s1ptw && current_el == 1 && !arm_is_secure(env)
|
||||||
&& (mmu_idx == ARMMMUIdx_S1NSE1 || mmu_idx == ARMMMUIdx_S1NSE0)) {
|
&& (mmu_idx == ARMMMUIdx_Stage1_E1 ||
|
||||||
|
mmu_idx == ARMMMUIdx_Stage1_E0)) {
|
||||||
/*
|
/*
|
||||||
* Synchronous stage 2 fault on an access made as part of the
|
* Synchronous stage 2 fault on an access made as part of the
|
||||||
* translation table walk for AT S1E0* or AT S1E1* insn
|
* translation table walk for AT S1E0* or AT S1E1* insn
|
||||||
@ -3189,10 +3190,10 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
|
|||||||
mmu_idx = ARMMMUIdx_S1E3;
|
mmu_idx = ARMMMUIdx_S1E3;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
mmu_idx = ARMMMUIdx_S1NSE1;
|
mmu_idx = ARMMMUIdx_Stage1_E1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
mmu_idx = secure ? ARMMMUIdx_S1SE1 : ARMMMUIdx_S1NSE1;
|
mmu_idx = secure ? ARMMMUIdx_S1SE1 : ARMMMUIdx_Stage1_E1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
@ -3205,10 +3206,10 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
|
|||||||
mmu_idx = ARMMMUIdx_S1SE0;
|
mmu_idx = ARMMMUIdx_S1SE0;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
mmu_idx = ARMMMUIdx_S1NSE0;
|
mmu_idx = ARMMMUIdx_Stage1_E0;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
mmu_idx = secure ? ARMMMUIdx_S1SE0 : ARMMMUIdx_S1NSE0;
|
mmu_idx = secure ? ARMMMUIdx_S1SE0 : ARMMMUIdx_Stage1_E0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
@ -3262,7 +3263,7 @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
|
|||||||
case 0:
|
case 0:
|
||||||
switch (ri->opc1) {
|
switch (ri->opc1) {
|
||||||
case 0: /* AT S1E1R, AT S1E1W */
|
case 0: /* AT S1E1R, AT S1E1W */
|
||||||
mmu_idx = secure ? ARMMMUIdx_S1SE1 : ARMMMUIdx_S1NSE1;
|
mmu_idx = secure ? ARMMMUIdx_S1SE1 : ARMMMUIdx_Stage1_E1;
|
||||||
break;
|
break;
|
||||||
case 4: /* AT S1E2R, AT S1E2W */
|
case 4: /* AT S1E2R, AT S1E2W */
|
||||||
mmu_idx = ARMMMUIdx_S1E2;
|
mmu_idx = ARMMMUIdx_S1E2;
|
||||||
@ -3275,7 +3276,7 @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: /* AT S1E0R, AT S1E0W */
|
case 2: /* AT S1E0R, AT S1E0W */
|
||||||
mmu_idx = secure ? ARMMMUIdx_S1SE0 : ARMMMUIdx_S1NSE0;
|
mmu_idx = secure ? ARMMMUIdx_S1SE0 : ARMMMUIdx_Stage1_E0;
|
||||||
break;
|
break;
|
||||||
case 4: /* AT S12E1R, AT S12E1W */
|
case 4: /* AT S12E1R, AT S12E1W */
|
||||||
mmu_idx = secure ? ARMMMUIdx_S1SE1 : ARMMMUIdx_E10_1;
|
mmu_idx = secure ? ARMMMUIdx_S1SE1 : ARMMMUIdx_E10_1;
|
||||||
@ -8717,8 +8718,8 @@ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx)
|
|||||||
case ARMMMUIdx_S1SE0:
|
case ARMMMUIdx_S1SE0:
|
||||||
return arm_el_is_aa64(env, 3) ? 1 : 3;
|
return arm_el_is_aa64(env, 3) ? 1 : 3;
|
||||||
case ARMMMUIdx_S1SE1:
|
case ARMMMUIdx_S1SE1:
|
||||||
case ARMMMUIdx_S1NSE0:
|
case ARMMMUIdx_Stage1_E0:
|
||||||
case ARMMMUIdx_S1NSE1:
|
case ARMMMUIdx_Stage1_E1:
|
||||||
case ARMMMUIdx_MPrivNegPri:
|
case ARMMMUIdx_MPrivNegPri:
|
||||||
case ARMMMUIdx_MUserNegPri:
|
case ARMMMUIdx_MUserNegPri:
|
||||||
case ARMMMUIdx_MPriv:
|
case ARMMMUIdx_MPriv:
|
||||||
@ -8776,7 +8777,7 @@ static inline bool regime_translation_disabled(CPUARMState *env,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((env->cp15.hcr_el2 & HCR_DC) &&
|
if ((env->cp15.hcr_el2 & HCR_DC) &&
|
||||||
(mmu_idx == ARMMMUIdx_S1NSE0 || mmu_idx == ARMMMUIdx_S1NSE1)) {
|
(mmu_idx == ARMMMUIdx_Stage1_E0 || mmu_idx == ARMMMUIdx_Stage1_E1)) {
|
||||||
/* HCR.DC means SCTLR_EL1.M behaves as 0 */
|
/* HCR.DC means SCTLR_EL1.M behaves as 0 */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -8821,7 +8822,7 @@ static inline TCR *regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx)
|
|||||||
static inline ARMMMUIdx stage_1_mmu_idx(ARMMMUIdx mmu_idx)
|
static inline ARMMMUIdx stage_1_mmu_idx(ARMMMUIdx mmu_idx)
|
||||||
{
|
{
|
||||||
if (mmu_idx == ARMMMUIdx_E10_0 || mmu_idx == ARMMMUIdx_E10_1) {
|
if (mmu_idx == ARMMMUIdx_E10_0 || mmu_idx == ARMMMUIdx_E10_1) {
|
||||||
mmu_idx += (ARMMMUIdx_S1NSE0 - ARMMMUIdx_E10_0);
|
mmu_idx += (ARMMMUIdx_Stage1_E0 - ARMMMUIdx_E10_0);
|
||||||
}
|
}
|
||||||
return mmu_idx;
|
return mmu_idx;
|
||||||
}
|
}
|
||||||
@ -8856,7 +8857,7 @@ static inline bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx)
|
|||||||
{
|
{
|
||||||
switch (mmu_idx) {
|
switch (mmu_idx) {
|
||||||
case ARMMMUIdx_S1SE0:
|
case ARMMMUIdx_S1SE0:
|
||||||
case ARMMMUIdx_S1NSE0:
|
case ARMMMUIdx_Stage1_E0:
|
||||||
case ARMMMUIdx_MUser:
|
case ARMMMUIdx_MUser:
|
||||||
case ARMMMUIdx_MSUser:
|
case ARMMMUIdx_MSUser:
|
||||||
case ARMMMUIdx_MUserNegPri:
|
case ARMMMUIdx_MUserNegPri:
|
||||||
@ -9087,7 +9088,7 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
|
|||||||
hwaddr addr, MemTxAttrs txattrs,
|
hwaddr addr, MemTxAttrs txattrs,
|
||||||
ARMMMUFaultInfo *fi)
|
ARMMMUFaultInfo *fi)
|
||||||
{
|
{
|
||||||
if ((mmu_idx == ARMMMUIdx_S1NSE0 || mmu_idx == ARMMMUIdx_S1NSE1) &&
|
if ((mmu_idx == ARMMMUIdx_Stage1_E0 || mmu_idx == ARMMMUIdx_Stage1_E1) &&
|
||||||
!regime_translation_disabled(env, ARMMMUIdx_Stage2)) {
|
!regime_translation_disabled(env, ARMMMUIdx_Stage2)) {
|
||||||
target_ulong s2size;
|
target_ulong s2size;
|
||||||
hwaddr s2pa;
|
hwaddr s2pa;
|
||||||
|
@ -810,8 +810,8 @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx)
|
|||||||
switch (mmu_idx) {
|
switch (mmu_idx) {
|
||||||
case ARMMMUIdx_E10_0:
|
case ARMMMUIdx_E10_0:
|
||||||
case ARMMMUIdx_E10_1:
|
case ARMMMUIdx_E10_1:
|
||||||
case ARMMMUIdx_S1NSE0:
|
case ARMMMUIdx_Stage1_E0:
|
||||||
case ARMMMUIdx_S1NSE1:
|
case ARMMMUIdx_Stage1_E1:
|
||||||
case ARMMMUIdx_S1E2:
|
case ARMMMUIdx_S1E2:
|
||||||
case ARMMMUIdx_Stage2:
|
case ARMMMUIdx_Stage2:
|
||||||
case ARMMMUIdx_MPrivNegPri:
|
case ARMMMUIdx_MPrivNegPri:
|
||||||
@ -975,7 +975,7 @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env);
|
|||||||
#ifdef CONFIG_USER_ONLY
|
#ifdef CONFIG_USER_ONLY
|
||||||
static inline ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env)
|
static inline ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env)
|
||||||
{
|
{
|
||||||
return ARMMMUIdx_S1NSE0;
|
return ARMMMUIdx_Stage1_E0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env);
|
ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env);
|
||||||
|
Loading…
Reference in New Issue
Block a user