[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/57] target/loongarch: Populate CPUClass.mmu_index
From: |
Richard Henderson |
Subject: |
[PULL 11/57] target/loongarch: Populate CPUClass.mmu_index |
Date: |
Fri, 2 Feb 2024 15:49:50 +1000 |
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/loongarch/cpu.h | 6 ++----
target/loongarch/cpu.c | 11 +++++++++++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index 0fa5e0ca93..5dfcfeb3a4 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -408,15 +408,13 @@ struct LoongArchCPUClass {
#define MMU_IDX_USER MMU_PLV_USER
#define MMU_IDX_DA 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;
#else
- if (FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG)) {
- return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV);
- }
- return MMU_IDX_DA;
+ return loongarch_cpu_mmu_index(env_cpu(env), ifetch);
#endif
}
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index fb8dde7def..cbecc63213 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -375,6 +375,16 @@ static bool loongarch_cpu_has_work(CPUState *cs)
#endif
}
+int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch)
+{
+ CPULoongArchState *env = cpu_env(cs);
+
+ if (FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG)) {
+ return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV);
+ }
+ return MMU_IDX_DA;
+}
+
static void loongarch_la464_initfn(Object *obj)
{
LoongArchCPU *cpu = LOONGARCH_CPU(obj);
@@ -779,6 +789,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void
*data)
cc->class_by_name = loongarch_cpu_class_by_name;
cc->has_work = loongarch_cpu_has_work;
+ cc->mmu_index = loongarch_cpu_mmu_index;
cc->dump_state = loongarch_cpu_dump_state;
cc->set_pc = loongarch_cpu_set_pc;
cc->get_pc = loongarch_cpu_get_pc;
--
2.34.1
- [PATCH] linux-user/aarch64: Add padding before __kernel_rt_sigreturn, (continued)
- [PATCH] linux-user/aarch64: Add padding before __kernel_rt_sigreturn, Richard Henderson, 2024/02/02
- [PULL 02/57] target/alpha: Split out alpha_env_mmu_index, Richard Henderson, 2024/02/02
- [PULL 03/57] target/alpha: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 04/57] target/arm: Split out arm_env_mmu_index, Richard Henderson, 2024/02/02
- [PULL 05/57] target/arm: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 06/57] target/avr: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 07/57] target/cris: Cache mem_index in DisasContext, Richard Henderson, 2024/02/02
- [PULL 08/57] target/cris: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 09/57] target/hppa: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 10/57] target/i386: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 11/57] target/loongarch: Populate CPUClass.mmu_index,
Richard Henderson <=
- [PULL 12/57] target/loongarch: Rename MMU_IDX_*, Richard Henderson, 2024/02/02
- [PULL 13/57] target/m68k: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 14/57] target/microblaze: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 15/57] target/mips: Pass ptw_mmu_idx down from mips_cpu_tlb_fill, Richard Henderson, 2024/02/02
- [PULL 19/57] target/openrisc: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 20/57] target/ppc: Split out ppc_env_mmu_index, Richard Henderson, 2024/02/02
- [PULL 21/57] target/ppc: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 22/57] target/riscv: Rename riscv_cpu_mmu_index to riscv_env_mmu_index, Richard Henderson, 2024/02/02
- [PULL 18/57] target/nios2: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 17/57] target/mips: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02