target/arm: Split out alle1_tlbmask
No functional change, but unify code sequences. Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200206105448.4726-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
b7e0730de3
commit
90c19cdf1d
@ -3972,34 +3972,31 @@ static void tlbi_aa64_vmalle1_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
tlb_flush_by_mmuidx(cs, mask);
|
||||
}
|
||||
|
||||
static void tlbi_aa64_alle1_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
static int alle1_tlbmask(CPUARMState *env)
|
||||
{
|
||||
/* Note that the 'ALL' scope must invalidate both stage 1 and
|
||||
/*
|
||||
* Note that the 'ALL' scope must invalidate both stage 1 and
|
||||
* stage 2 translations, whereas most other scopes only invalidate
|
||||
* stage 1 translations.
|
||||
*/
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
CPUState *cs = CPU(cpu);
|
||||
|
||||
if (arm_is_secure_below_el3(env)) {
|
||||
tlb_flush_by_mmuidx(cs,
|
||||
ARMMMUIdxBit_S1SE1 |
|
||||
ARMMMUIdxBit_S1SE0);
|
||||
return ARMMMUIdxBit_S1SE1 | ARMMMUIdxBit_S1SE0;
|
||||
} else if (arm_feature(env, ARM_FEATURE_EL2)) {
|
||||
return ARMMMUIdxBit_S12NSE1 | ARMMMUIdxBit_S12NSE0 | ARMMMUIdxBit_S2NS;
|
||||
} else {
|
||||
if (arm_feature(env, ARM_FEATURE_EL2)) {
|
||||
tlb_flush_by_mmuidx(cs,
|
||||
ARMMMUIdxBit_S12NSE1 |
|
||||
ARMMMUIdxBit_S12NSE0 |
|
||||
ARMMMUIdxBit_S2NS);
|
||||
} else {
|
||||
tlb_flush_by_mmuidx(cs,
|
||||
ARMMMUIdxBit_S12NSE1 |
|
||||
ARMMMUIdxBit_S12NSE0);
|
||||
}
|
||||
return ARMMMUIdxBit_S12NSE1 | ARMMMUIdxBit_S12NSE0;
|
||||
}
|
||||
}
|
||||
|
||||
static void tlbi_aa64_alle1_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
{
|
||||
CPUState *cs = env_cpu(env);
|
||||
int mask = alle1_tlbmask(env);
|
||||
|
||||
tlb_flush_by_mmuidx(cs, mask);
|
||||
}
|
||||
|
||||
static void tlbi_aa64_alle2_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
{
|
||||
@ -4021,28 +4018,10 @@ static void tlbi_aa64_alle3_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
static void tlbi_aa64_alle1is_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
{
|
||||
/* Note that the 'ALL' scope must invalidate both stage 1 and
|
||||
* stage 2 translations, whereas most other scopes only invalidate
|
||||
* stage 1 translations.
|
||||
*/
|
||||
CPUState *cs = env_cpu(env);
|
||||
bool sec = arm_is_secure_below_el3(env);
|
||||
bool has_el2 = arm_feature(env, ARM_FEATURE_EL2);
|
||||
int mask = alle1_tlbmask(env);
|
||||
|
||||
if (sec) {
|
||||
tlb_flush_by_mmuidx_all_cpus_synced(cs,
|
||||
ARMMMUIdxBit_S1SE1 |
|
||||
ARMMMUIdxBit_S1SE0);
|
||||
} else if (has_el2) {
|
||||
tlb_flush_by_mmuidx_all_cpus_synced(cs,
|
||||
ARMMMUIdxBit_S12NSE1 |
|
||||
ARMMMUIdxBit_S12NSE0 |
|
||||
ARMMMUIdxBit_S2NS);
|
||||
} else {
|
||||
tlb_flush_by_mmuidx_all_cpus_synced(cs,
|
||||
ARMMMUIdxBit_S12NSE1 |
|
||||
ARMMMUIdxBit_S12NSE0);
|
||||
}
|
||||
tlb_flush_by_mmuidx_all_cpus_synced(cs, mask);
|
||||
}
|
||||
|
||||
static void tlbi_aa64_alle2is_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
@ -4092,20 +4071,11 @@ static void tlbi_aa64_vae3_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
static void tlbi_aa64_vae1is_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
{
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
CPUState *cs = CPU(cpu);
|
||||
bool sec = arm_is_secure_below_el3(env);
|
||||
CPUState *cs = env_cpu(env);
|
||||
int mask = vae1_tlbmask(env);
|
||||
uint64_t pageaddr = sextract64(value << 12, 0, 56);
|
||||
|
||||
if (sec) {
|
||||
tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr,
|
||||
ARMMMUIdxBit_S1SE1 |
|
||||
ARMMMUIdxBit_S1SE0);
|
||||
} else {
|
||||
tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr,
|
||||
ARMMMUIdxBit_S12NSE1 |
|
||||
ARMMMUIdxBit_S12NSE0);
|
||||
}
|
||||
tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr, mask);
|
||||
}
|
||||
|
||||
static void tlbi_aa64_vae1_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
@ -4116,8 +4086,8 @@ static void tlbi_aa64_vae1_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
* since we don't support flush-for-specific-ASID-only or
|
||||
* flush-last-level-only.
|
||||
*/
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
CPUState *cs = CPU(cpu);
|
||||
CPUState *cs = env_cpu(env);
|
||||
int mask = vae1_tlbmask(env);
|
||||
uint64_t pageaddr = sextract64(value << 12, 0, 56);
|
||||
|
||||
if (tlb_force_broadcast(env)) {
|
||||
@ -4125,15 +4095,7 @@ static void tlbi_aa64_vae1_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
return;
|
||||
}
|
||||
|
||||
if (arm_is_secure_below_el3(env)) {
|
||||
tlb_flush_page_by_mmuidx(cs, pageaddr,
|
||||
ARMMMUIdxBit_S1SE1 |
|
||||
ARMMMUIdxBit_S1SE0);
|
||||
} else {
|
||||
tlb_flush_page_by_mmuidx(cs, pageaddr,
|
||||
ARMMMUIdxBit_S12NSE1 |
|
||||
ARMMMUIdxBit_S12NSE0);
|
||||
}
|
||||
tlb_flush_page_by_mmuidx(cs, pageaddr, mask);
|
||||
}
|
||||
|
||||
static void tlbi_aa64_vae2is_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
|
Loading…
Reference in New Issue
Block a user