mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
target/riscv: Set MMU_2STAGE_BIT in riscv_cpu_mmu_index
Incorporate the virt_enabled and MPV checks into the cpu_mmu_index function, so we don't have to keep doing it within tlb_fill and subroutines. This also elides a flush on changes to MPV. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn> Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Message-Id: <20230325105429.1142530-17-richard.henderson@linaro.org> Message-Id: <20230412114333.118895-17-richard.henderson@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
9de7b7b5c7
commit
696bacde95
2 changed files with 18 additions and 37 deletions
|
@ -1294,7 +1294,7 @@ static RISCVException write_mstatus(CPURISCVState *env, int csrno,
|
|||
val = legalize_mpp(env, get_field(mstatus, MSTATUS_MPP), val);
|
||||
|
||||
/* flush tlb on mstatus fields that affect VM */
|
||||
if ((val ^ mstatus) & (MSTATUS_MXR | MSTATUS_MPV)) {
|
||||
if ((val ^ mstatus) & MSTATUS_MXR) {
|
||||
tlb_flush(env_cpu(env));
|
||||
}
|
||||
mask = MSTATUS_SIE | MSTATUS_SPIE | MSTATUS_MIE | MSTATUS_MPIE |
|
||||
|
@ -1342,10 +1342,6 @@ static RISCVException write_mstatush(CPURISCVState *env, int csrno,
|
|||
uint64_t valh = (uint64_t)val << 32;
|
||||
uint64_t mask = MSTATUS_MPV | MSTATUS_GVA;
|
||||
|
||||
if ((valh ^ env->mstatus) & (MSTATUS_MPV)) {
|
||||
tlb_flush(env_cpu(env));
|
||||
}
|
||||
|
||||
env->mstatus = (env->mstatus & ~mask) | (valh & mask);
|
||||
|
||||
return RISCV_EXCP_NONE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue