cpu: Introduce a wrapper for tlb_flush() that can be used in common code

Commit 1f5c00cfdb8114c ("qom/cpu: move tlb_flush to cpu_common_reset")
moved the call to tlb_flush() from the target-specific reset handlers
into the common code qom/cpu.c file, and protected the call with
"#ifdef CONFIG_SOFTMMU" to avoid that it is called for linux-user
only targets. But since qom/cpu.c is common code, CONFIG_SOFTMMU is
*never* defined here, so the tlb_flush() was simply never executed
anymore. Fix it by introducing a wrapper for tlb_flush() in a file
that is re-compiled for each target, i.e. in translate-all.c.

Backports commit 2cd53943115be5118b5b2d4b80ee0a39c94c4f73 from qemu
This commit is contained in:
Thomas Huth 2018-03-03 21:22:27 -05:00 committed by Lioncash
parent f944cf4255
commit cf5d583ef0
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
17 changed files with 26 additions and 3 deletions

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_aarch64
#define tcg_exec_init tcg_exec_init_aarch64
#define tcg_find_helper tcg_find_helper_aarch64
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_aarch64
#define tcg_func_start tcg_func_start_aarch64
#define tcg_gen_abs_i32 tcg_gen_abs_i32_aarch64
#define tcg_gen_add2_i32 tcg_gen_add2_i32_aarch64

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_aarch64eb
#define tcg_exec_init tcg_exec_init_aarch64eb
#define tcg_find_helper tcg_find_helper_aarch64eb
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_aarch64eb
#define tcg_func_start tcg_func_start_aarch64eb
#define tcg_gen_abs_i32 tcg_gen_abs_i32_aarch64eb
#define tcg_gen_add2_i32 tcg_gen_add2_i32_aarch64eb

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_arm
#define tcg_exec_init tcg_exec_init_arm
#define tcg_find_helper tcg_find_helper_arm
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_arm
#define tcg_func_start tcg_func_start_arm
#define tcg_gen_abs_i32 tcg_gen_abs_i32_arm
#define tcg_gen_add2_i32 tcg_gen_add2_i32_arm

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_armeb
#define tcg_exec_init tcg_exec_init_armeb
#define tcg_find_helper tcg_find_helper_armeb
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_armeb
#define tcg_func_start tcg_func_start_armeb
#define tcg_gen_abs_i32 tcg_gen_abs_i32_armeb
#define tcg_gen_add2_i32 tcg_gen_add2_i32_armeb

View file

@ -2984,6 +2984,7 @@ symbols = (
'tcg_exec_all',
'tcg_exec_init',
'tcg_find_helper',
'tcg_flush_softmmu_tlb',
'tcg_func_start',
'tcg_gen_abs_i32',
'tcg_gen_add2_i32',

View file

@ -14,6 +14,8 @@ struct uc_struct;
#include "qemu/fprintf-fn.h"
#include "qemu/typedefs.h"
void tcg_flush_softmmu_tlb(CPUState *cs);
#if !defined(CONFIG_USER_ONLY)
enum device_endian {

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_m68k
#define tcg_exec_init tcg_exec_init_m68k
#define tcg_find_helper tcg_find_helper_m68k
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_m68k
#define tcg_func_start tcg_func_start_m68k
#define tcg_gen_abs_i32 tcg_gen_abs_i32_m68k
#define tcg_gen_add2_i32 tcg_gen_add2_i32_m68k

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_mips
#define tcg_exec_init tcg_exec_init_mips
#define tcg_find_helper tcg_find_helper_mips
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_mips
#define tcg_func_start tcg_func_start_mips
#define tcg_gen_abs_i32 tcg_gen_abs_i32_mips
#define tcg_gen_add2_i32 tcg_gen_add2_i32_mips

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_mips64
#define tcg_exec_init tcg_exec_init_mips64
#define tcg_find_helper tcg_find_helper_mips64
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_mips64
#define tcg_func_start tcg_func_start_mips64
#define tcg_gen_abs_i32 tcg_gen_abs_i32_mips64
#define tcg_gen_add2_i32 tcg_gen_add2_i32_mips64

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_mips64el
#define tcg_exec_init tcg_exec_init_mips64el
#define tcg_find_helper tcg_find_helper_mips64el
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_mips64el
#define tcg_func_start tcg_func_start_mips64el
#define tcg_gen_abs_i32 tcg_gen_abs_i32_mips64el
#define tcg_gen_add2_i32 tcg_gen_add2_i32_mips64el

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_mipsel
#define tcg_exec_init tcg_exec_init_mipsel
#define tcg_find_helper tcg_find_helper_mipsel
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_mipsel
#define tcg_func_start tcg_func_start_mipsel
#define tcg_gen_abs_i32 tcg_gen_abs_i32_mipsel
#define tcg_gen_add2_i32 tcg_gen_add2_i32_mipsel

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_powerpc
#define tcg_exec_init tcg_exec_init_powerpc
#define tcg_find_helper tcg_find_helper_powerpc
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_powerpc
#define tcg_func_start tcg_func_start_powerpc
#define tcg_gen_abs_i32 tcg_gen_abs_i32_powerpc
#define tcg_gen_add2_i32 tcg_gen_add2_i32_powerpc

View file

@ -178,9 +178,8 @@ static void cpu_common_reset(CPUState *cpu)
//if (tcg_enabled(cpu->uc)) {
cpu_tb_jmp_cache_clear(cpu);
#ifdef CONFIG_SOFTMMU
tlb_flush(cpu);
#endif
// Ditto: should also be uncommented
//tcg_flush_softmmu_tlb(cpu);
//}
}

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_sparc
#define tcg_exec_init tcg_exec_init_sparc
#define tcg_find_helper tcg_find_helper_sparc
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_sparc
#define tcg_func_start tcg_func_start_sparc
#define tcg_gen_abs_i32 tcg_gen_abs_i32_sparc
#define tcg_gen_add2_i32 tcg_gen_add2_i32_sparc

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_sparc64
#define tcg_exec_init tcg_exec_init_sparc64
#define tcg_find_helper tcg_find_helper_sparc64
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_sparc64
#define tcg_func_start tcg_func_start_sparc64
#define tcg_gen_abs_i32 tcg_gen_abs_i32_sparc64
#define tcg_gen_add2_i32 tcg_gen_add2_i32_sparc64

View file

@ -2227,3 +2227,11 @@ int page_unprotect(struct uc_struct *uc, target_ulong address, uintptr_t pc)
return 0;
}
#endif /* CONFIG_USER_ONLY */
/* This is a wrapper for common code that can not use CONFIG_SOFTMMU */
void tcg_flush_softmmu_tlb(CPUState *cs)
{
#ifdef CONFIG_SOFTMMU
tlb_flush(cs);
#endif
}

View file

@ -2978,6 +2978,7 @@
#define tcg_exec_all tcg_exec_all_x86_64
#define tcg_exec_init tcg_exec_init_x86_64
#define tcg_find_helper tcg_find_helper_x86_64
#define tcg_flush_softmmu_tlb tcg_flush_softmmu_tlb_x86_64
#define tcg_func_start tcg_func_start_x86_64
#define tcg_gen_abs_i32 tcg_gen_abs_i32_x86_64
#define tcg_gen_add2_i32 tcg_gen_add2_i32_x86_64