Skip to content

Commit

Permalink
target/loongarch: Rename MMU_IDX_*
Browse files Browse the repository at this point in the history
The expected form is MMU_FOO_IDX, not MMU_IDX_FOO.
Rename to match generic code.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Feb 2, 2024
1 parent 7619a0e commit 6761bdb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion target/loongarch/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch)
if (FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG)) {
return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV);
}
return MMU_IDX_DA;
return MMU_DA_IDX;
}

static void loongarch_la464_initfn(Object *obj)
Expand Down
8 changes: 4 additions & 4 deletions target/loongarch/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,15 @@ struct LoongArchCPUClass {
*/
#define MMU_PLV_KERNEL 0
#define MMU_PLV_USER 3
#define MMU_IDX_KERNEL MMU_PLV_KERNEL
#define MMU_IDX_USER MMU_PLV_USER
#define MMU_IDX_DA 4
#define MMU_KERNEL_IDX MMU_PLV_KERNEL
#define MMU_USER_IDX MMU_PLV_USER
#define MMU_DA_IDX 4

int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch);
static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch)
{
#ifdef CONFIG_USER_ONLY
return MMU_IDX_USER;
return MMU_USER_IDX;
#else
return loongarch_cpu_mmu_index(env_cpu(env), ifetch);
#endif
Expand Down
2 changes: 1 addition & 1 deletion target/loongarch/tcg/insn_trans/trans_privileged.c.inc
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ TRANS(iocsrwr_d, IOCSR, gen_iocsrwr, gen_helper_iocsrwr_d)

static void check_mmu_idx(DisasContext *ctx)
{
if (ctx->mem_idx != MMU_IDX_DA) {
if (ctx->mem_idx != MMU_DA_IDX) {
tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next + 4);
ctx->base.is_jmp = DISAS_EXIT;
}
Expand Down
4 changes: 2 additions & 2 deletions target/loongarch/tcg/tlb_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ static int get_physical_address(CPULoongArchState *env, hwaddr *physical,
int *prot, target_ulong address,
MMUAccessType access_type, int mmu_idx)
{
int user_mode = mmu_idx == MMU_IDX_USER;
int kernel_mode = mmu_idx == MMU_IDX_KERNEL;
int user_mode = mmu_idx == MMU_USER_IDX;
int kernel_mode = mmu_idx == MMU_KERNEL_IDX;
uint32_t plv, base_c, base_v;
int64_t addr_high;
uint8_t da = FIELD_EX64(env->CSR_CRMD, CSR_CRMD, DA);
Expand Down
2 changes: 1 addition & 1 deletion target/loongarch/tcg/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static void loongarch_tr_init_disas_context(DisasContextBase *dcbase,
if (ctx->base.tb->flags & HW_FLAGS_CRMD_PG) {
ctx->mem_idx = ctx->plv;
} else {
ctx->mem_idx = MMU_IDX_DA;
ctx->mem_idx = MMU_DA_IDX;
}

/* Bound the number of insns to execute to those left on the page. */
Expand Down

0 comments on commit 6761bdb

Please sign in to comment.