target/riscv: Replace cpu_mmu_index with riscv_env_mmu_index

Use the target-specific function name in preference
to the generic name.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-01-29 10:28:52 +10:00
parent 7f6f2ebbaa
commit d9996d0904
3 changed files with 9 additions and 8 deletions

View File

@ -106,7 +106,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc,
#else #else
flags = FIELD_DP32(flags, TB_FLAGS, PRIV, env->priv); flags = FIELD_DP32(flags, TB_FLAGS, PRIV, env->priv);
flags |= cpu_mmu_index(env, 0); flags |= riscv_env_mmu_index(env, 0);
fs = get_field(env->mstatus, MSTATUS_FS); fs = get_field(env->mstatus, MSTATUS_FS);
vs = get_field(env->mstatus, MSTATUS_VS); vs = get_field(env->mstatus, MSTATUS_VS);
@ -1200,7 +1200,7 @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
CPURISCVState *env = &cpu->env; CPURISCVState *env = &cpu->env;
hwaddr phys_addr; hwaddr phys_addr;
int prot; int prot;
int mmu_idx = cpu_mmu_index(&cpu->env, false); int mmu_idx = riscv_env_mmu_index(&cpu->env, false);
if (get_physical_address(env, &phys_addr, &prot, addr, NULL, 0, mmu_idx, if (get_physical_address(env, &phys_addr, &prot, addr, NULL, 0, mmu_idx,
true, env->virt_enabled, true)) { true, env->virt_enabled, true)) {

View File

@ -157,7 +157,7 @@ void helper_cbo_zero(CPURISCVState *env, target_ulong address)
{ {
RISCVCPU *cpu = env_archcpu(env); RISCVCPU *cpu = env_archcpu(env);
uint16_t cbozlen = cpu->cfg.cboz_blocksize; uint16_t cbozlen = cpu->cfg.cboz_blocksize;
int mmu_idx = cpu_mmu_index(env, false); int mmu_idx = riscv_env_mmu_index(env, false);
uintptr_t ra = GETPC(); uintptr_t ra = GETPC();
void *mem; void *mem;
@ -205,7 +205,7 @@ static void check_zicbom_access(CPURISCVState *env,
uintptr_t ra) uintptr_t ra)
{ {
RISCVCPU *cpu = env_archcpu(env); RISCVCPU *cpu = env_archcpu(env);
int mmu_idx = cpu_mmu_index(env, false); int mmu_idx = riscv_env_mmu_index(env, false);
uint16_t cbomlen = cpu->cfg.cbom_blocksize; uint16_t cbomlen = cpu->cfg.cbom_blocksize;
void *phost; void *phost;
int ret; int ret;

View File

@ -113,14 +113,15 @@ static void probe_pages(CPURISCVState *env, target_ulong addr,
{ {
target_ulong pagelen = -(addr | TARGET_PAGE_MASK); target_ulong pagelen = -(addr | TARGET_PAGE_MASK);
target_ulong curlen = MIN(pagelen, len); target_ulong curlen = MIN(pagelen, len);
int mmu_index = riscv_env_mmu_index(env, false);
probe_access(env, adjust_addr(env, addr), curlen, access_type, probe_access(env, adjust_addr(env, addr), curlen, access_type,
cpu_mmu_index(env, false), ra); mmu_index, ra);
if (len > curlen) { if (len > curlen) {
addr += curlen; addr += curlen;
curlen = len - curlen; curlen = len - curlen;
probe_access(env, adjust_addr(env, addr), curlen, access_type, probe_access(env, adjust_addr(env, addr), curlen, access_type,
cpu_mmu_index(env, false), ra); mmu_index, ra);
} }
} }
@ -464,6 +465,7 @@ vext_ldff(void *vd, void *v0, target_ulong base,
uint32_t esz = 1 << log2_esz; uint32_t esz = 1 << log2_esz;
uint32_t vma = vext_vma(desc); uint32_t vma = vext_vma(desc);
target_ulong addr, offset, remain; target_ulong addr, offset, remain;
int mmu_index = riscv_env_mmu_index(env, false);
/* probe every access */ /* probe every access */
for (i = env->vstart; i < env->vl; i++) { for (i = env->vstart; i < env->vl; i++) {
@ -478,8 +480,7 @@ vext_ldff(void *vd, void *v0, target_ulong base,
remain = nf << log2_esz; remain = nf << log2_esz;
while (remain > 0) { while (remain > 0) {
offset = -(addr | TARGET_PAGE_MASK); offset = -(addr | TARGET_PAGE_MASK);
host = tlb_vaddr_to_host(env, addr, MMU_DATA_LOAD, host = tlb_vaddr_to_host(env, addr, MMU_DATA_LOAD, mmu_index);
cpu_mmu_index(env, false));
if (host) { if (host) {
#ifdef CONFIG_USER_ONLY #ifdef CONFIG_USER_ONLY
if (!page_check_range(addr, offset, PAGE_READ)) { if (!page_check_range(addr, offset, PAGE_READ)) {