@@ -346,13 +346,18 @@ static void tlb_flush_page_async_work(CPUState *cpu, void *opaque)
tlb_flush_page(cpu, GPOINTER_TO_UINT(opaque));
}
-void tlb_flush_page_all(target_ulong addr)
+void tlb_flush_page_all(CPUState *this_cpu, target_ulong addr)
{
- CPUState *cpu;
+ CPUState *other_cpu;
- CPU_FOREACH(cpu) {
- async_run_on_cpu(cpu, tlb_flush_page_async_work,
- GUINT_TO_POINTER(addr));
+ CPU_FOREACH(other_cpu) {
+ if (other_cpu != this_cpu) {
+ async_wait_run_on_cpu(other_cpu, this_cpu,
+ tlb_flush_page_async_work,
+ GUINT_TO_POINTER(addr));
+ } else {
+ tlb_flush_page(current_cpu, addr);
+ }
}
}
@@ -191,7 +191,7 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr,
void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx,
uintptr_t retaddr);
-void tlb_flush_page_all(target_ulong addr);
+void tlb_flush_page_all(CPUState *this_cpu, target_ulong addr);
#else
static inline void tlb_flush_page(CPUState *cpu, target_ulong addr)
{
@@ -209,7 +209,7 @@ static inline void tlb_flush_page_by_mmuidx(CPUState *cpu, CPUState *target,
static inline void tlb_flush_by_mmuidx(CPUState *cpu, CPUState *target ...)
{
}
-static inline void tlb_flush_page_all(target_ulong addr)
+static inline void tlb_flush_page_all(CPUState *this_cpu, target_ulong addr)
{
}
#endif
@@ -554,13 +554,13 @@ static void tlbiasid_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
static void tlbimva_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t value)
{
- tlb_flush_page_all(value & TARGET_PAGE_MASK);
+ tlb_flush_page_all(ENV_GET_CPU(env), value & TARGET_PAGE_MASK);
}
static void tlbimvaa_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t value)
{
- tlb_flush_page_all(value & TARGET_PAGE_MASK);
+ tlb_flush_page_all(ENV_GET_CPU(env), value & TARGET_PAGE_MASK);
}
static const ARMCPRegInfo cp_reginfo[] = {
Secure tlb_flush_page_all() by waiting the queried flushes to be actually completed using async_wait_run_on_cpu(); Signed-off-by: Alvise Rigo <a.rigo@virtualopensystems.com> --- cputlb.c | 15 ++++++++++----- include/exec/exec-all.h | 4 ++-- target-arm/helper.c | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-)