From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7oas-0003XT-Hc for qemu-devel@nongnu.org; Tue, 31 May 2016 14:40:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7oan-0001c6-Jy for qemu-devel@nongnu.org; Tue, 31 May 2016 14:40:46 -0400 Received: from mail-yw0-x244.google.com ([2607:f8b0:4002:c05::244]:34148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7oan-0001c2-Ea for qemu-devel@nongnu.org; Tue, 31 May 2016 14:40:41 -0400 Received: by mail-yw0-x244.google.com with SMTP id j74so20095572ywg.1 for ; Tue, 31 May 2016 11:40:41 -0700 (PDT) From: Pranith Kumar Date: Tue, 31 May 2016 14:39:28 -0400 Message-Id: <20160531183928.29406-14-bobby.prani@gmail.com> In-Reply-To: <20160531183928.29406-1-bobby.prani@gmail.com> References: <20160531183928.29406-1-bobby.prani@gmail.com> Subject: [Qemu-devel] [RFC v2 PATCH 13/13] tcg: Generate fences only for SMP MTTCG guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , "open list:All patches CC here" Cc: alex.bennee@linaro.org, serge.fdrv@linaro.org We need to generate fence instructions only for SMP MTTCG guests. This patch enforces that. Signed-off-by: Pranith Kumar --- tcg/tcg-op.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index a6f01a7..eeb0d0c 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -36,6 +36,8 @@ extern TCGv_i32 TCGV_HIGH_link_error(TCGv_i64); #define TCGV_HIGH TCGV_HIGH_link_error #endif +extern int smp_cpus; + /* Note that this is optimized for sequential allocation during translate. Up to and including filling in the forward link immediately. We'll do proper termination of the end of the list after we finish translation. */ @@ -145,8 +147,9 @@ void tcg_gen_op6(TCGContext *ctx, TCGOpcode opc, TCGArg a1, TCGArg a2, void tcg_gen_mb(TCGArg a) { - /* ??? Enable only when MTTCG is enabled. */ - tcg_gen_op1(&tcg_ctx, INDEX_op_mb, 0); + if (qemu_tcg_mttcg_enabled() && smp_cpus > 1) { + tcg_gen_op1(&tcg_ctx, INDEX_op_mb, 0); + } } /* 32 bit ops */ -- 2.8.3