Skip to content

Commit

Permalink
target/hppa: Do not use hardcoded value for tlb_flush_*()
Browse files Browse the repository at this point in the history
Avoid using hardcoded values when calling the tlb_flush*() functions.
Instead, define and use HPPA_MMU_FLUSH_MASK (keeping the current
behavior, which doesn't flush the physical address MMU).

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
  • Loading branch information
hdeller committed Aug 25, 2023
1 parent c01e5df commit 88b7ad1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions target/hppa/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@

#define TARGET_INSN_START_EXTRA_WORDS 1

/* No need to flush MMU_PHYS_IDX */
#define HPPA_MMU_FLUSH_MASK \
(1 << MMU_KERNEL_IDX | 1 << MMU_PL1_IDX | \
1 << MMU_PL2_IDX | 1 << MMU_USER_IDX)

/* Hardware exceptions, interrupts, faults, and traps. */
#define EXCP_HPMC 1 /* high priority machine check */
#define EXCP_POWER_FAIL 2
Expand Down
2 changes: 1 addition & 1 deletion target/hppa/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw)
/* If PSW_P changes, it affects how we translate addresses. */
if ((psw ^ old_psw) & PSW_P) {
#ifndef CONFIG_USER_ONLY
tlb_flush_by_mmuidx(env_cpu(env), 0xf);
tlb_flush_by_mmuidx(env_cpu(env), HPPA_MMU_FLUSH_MASK);
#endif
}
}
Expand Down
7 changes: 3 additions & 4 deletions target/hppa/mem_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ static void hppa_flush_tlb_ent(CPUHPPAState *env, hppa_tlb_entry *ent)
trace_hppa_tlb_flush_ent(env, ent, ent->va_b, ent->va_e, ent->pa);

for (i = 0; i < n; ++i, addr += TARGET_PAGE_SIZE) {
/* Do not flush MMU_PHYS_IDX. */
tlb_flush_page_by_mmuidx(cs, addr, 0xf);
tlb_flush_page_by_mmuidx(cs, addr, HPPA_MMU_FLUSH_MASK);
}

memset(ent, 0, sizeof(*ent));
Expand Down Expand Up @@ -335,13 +334,13 @@ void HELPER(ptlbe)(CPUHPPAState *env)
{
trace_hppa_tlb_ptlbe(env);
memset(env->tlb, 0, sizeof(env->tlb));
tlb_flush_by_mmuidx(env_cpu(env), 0xf);
tlb_flush_by_mmuidx(env_cpu(env), HPPA_MMU_FLUSH_MASK);
}

void cpu_hppa_change_prot_id(CPUHPPAState *env)
{
if (env->psw & PSW_P) {
tlb_flush_by_mmuidx(env_cpu(env), 0xf);
tlb_flush_by_mmuidx(env_cpu(env), HPPA_MMU_FLUSH_MASK);
}
}

Expand Down

0 comments on commit 88b7ad1

Please sign in to comment.