From nobody Sun Nov 9 16:00:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551157928990872.0917563435348; Mon, 25 Feb 2019 21:12:08 -0800 (PST) Received: from localhost ([127.0.0.1]:49035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyV2E-0001v0-10 for importer@patchew.org; Tue, 26 Feb 2019 00:12:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyUkq-00050B-0p for qemu-devel@nongnu.org; Mon, 25 Feb 2019 23:54:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyUko-0002TQ-Jl for qemu-devel@nongnu.org; Mon, 25 Feb 2019 23:54:07 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:47779) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyUko-0002MN-4l; Mon, 25 Feb 2019 23:54:06 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 447mfL2Bv5z9sNr; Tue, 26 Feb 2019 15:53:13 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1551156794; bh=OHh0yz2hoLX1J8aIRA+4Za+NJitB4EMqcRppb8dLvEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIlsnQmEQanPSaVFPYzJjw6EKQRGzjZlQkM+YG0s0zwA4+WM+Fb7ovNGe4jxA8YB3 ZAKxO2tO31nxuek8L+S6LbMcldtaUva4kawtADNnqxUSAwcP3hHnpoCfZJatJxr0UH ByFvgHJD1ylkHj3udIrlJjHUy4io4ZlTd+K4xF5E= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 15:52:38 +1100 Message-Id: <20190226045304.25618-25-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226045304.25618-1-david@gibson.dropbear.id.au> References: <20190226045304.25618-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 24/50] target/ppc: Fix synchronization of mttcg with broadcast TLB flushes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, gkurz@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt Let's use the generic helper tlb_flush_all_cpus_synced() instead of iterating the CPUs ourselves. We do lose the optimization of clearing the "other" CPUs "need flush" flags but this shouldn't be a problem in practice. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190215170029.15641-9-clg@kaod.org> Signed-off-by: David Gibson --- target/ppc/helper_regs.h | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/target/ppc/helper_regs.h b/target/ppc/helper_regs.h index 5efd18049e..a2205e1044 100644 --- a/target/ppc/helper_regs.h +++ b/target/ppc/helper_regs.h @@ -174,26 +174,19 @@ static inline int hreg_store_msr(CPUPPCState *env, ta= rget_ulong value, static inline void check_tlb_flush(CPUPPCState *env, bool global) { CPUState *cs =3D CPU(ppc_env_get_cpu(env)); - if (env->tlb_need_flush & TLB_NEED_LOCAL_FLUSH) { - tlb_flush(cs); - env->tlb_need_flush &=3D ~TLB_NEED_LOCAL_FLUSH; - } =20 - /* Propagate TLB invalidations to other CPUs when the guest uses broad= cast - * TLB invalidation instructions. - */ + /* Handle global flushes first */ if (global && (env->tlb_need_flush & TLB_NEED_GLOBAL_FLUSH)) { - CPUState *other_cs; - CPU_FOREACH(other_cs) { - if (other_cs !=3D cs) { - PowerPCCPU *cpu =3D POWERPC_CPU(other_cs); - CPUPPCState *other_env =3D &cpu->env; - - other_env->tlb_need_flush &=3D ~TLB_NEED_LOCAL_FLUSH; - tlb_flush(other_cs); - } - } env->tlb_need_flush &=3D ~TLB_NEED_GLOBAL_FLUSH; + env->tlb_need_flush &=3D ~TLB_NEED_LOCAL_FLUSH; + tlb_flush_all_cpus_synced(cs); + return; + } + + /* Then handle local ones */ + if (env->tlb_need_flush & TLB_NEED_LOCAL_FLUSH) { + env->tlb_need_flush &=3D ~TLB_NEED_LOCAL_FLUSH; + tlb_flush(cs); } } #else --=20 2.20.1