From d76ab5e1c7db5f064700b9c3cb0924ccfd9017e5 Mon Sep 17 00:00:00 2001 From: Nikunj A Dadhania Date: Tue, 20 Sep 2016 22:05:01 +0530 Subject: target-ppc: tlbie/tlbivax should have global effect tlbie (BookS) and tlbivax (BookE) plus the H_CALLs(pseries) should have a global effect. Introduces TLB_NEED_GLOBAL_FLUSH flag. During lazy tlb flush, after taking care of pending local flushes, check broadcast flush(at context synchronizing event ptesync/tlbsync, etc) is needed. Depending on the bitmask state of the tlb_need_flush, tlb is flushed from other cpus if needed and the flags are cleared. Suggested-by: Benjamin Herrenschmidt Signed-off-by: Nikunj A Dadhania Reviewed-by: David Gibson [dwg: Use 'true' instead of '1' for call to check_tlb_flush()] Signed-off-by: David Gibson --- target-ppc/helper_regs.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'target-ppc/helper_regs.h') diff --git a/target-ppc/helper_regs.h b/target-ppc/helper_regs.h index dd85fc5cd0..bb9ce60436 100644 --- a/target-ppc/helper_regs.h +++ b/target-ppc/helper_regs.h @@ -161,6 +161,23 @@ static inline void check_tlb_flush(CPUPPCState *env, bool global) tlb_flush(cs, 1); env->tlb_need_flush &= ~TLB_NEED_LOCAL_FLUSH; } + + /* Propagate TLB invalidations to other CPUs when the guest uses broadcast + * TLB invalidation instructions. + */ + if (global && (env->tlb_need_flush & TLB_NEED_GLOBAL_FLUSH)) { + CPUState *other_cs; + CPU_FOREACH(other_cs) { + if (other_cs != cs) { + PowerPCCPU *cpu = POWERPC_CPU(other_cs); + CPUPPCState *other_env = &cpu->env; + + other_env->tlb_need_flush &= ~TLB_NEED_LOCAL_FLUSH; + tlb_flush(other_cs, 1); + } + } + env->tlb_need_flush &= ~TLB_NEED_GLOBAL_FLUSH; + } } #else static inline void check_tlb_flush(CPUPPCState *env, bool global) { } -- cgit v1.2.3