From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNn7x-000090-J5 for qemu-devel@nongnu.org; Thu, 14 Jul 2016 16:20:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNn7v-0001bN-7d for qemu-devel@nongnu.org; Thu, 14 Jul 2016 16:20:57 -0400 Received: from mail-yw0-x243.google.com ([2607:f8b0:4002:c05::243]:33253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNn7v-0001bJ-3H for qemu-devel@nongnu.org; Thu, 14 Jul 2016 16:20:55 -0400 Received: by mail-yw0-x243.google.com with SMTP id i12so5519275ywa.0 for ; Thu, 14 Jul 2016 13:20:55 -0700 (PDT) From: Pranith Kumar Date: Thu, 14 Jul 2016 16:20:19 -0400 Message-Id: <20160714202026.9727-8-bobby.prani@gmail.com> In-Reply-To: <20160714202026.9727-1-bobby.prani@gmail.com> References: <20160714202026.9727-1-bobby.prani@gmail.com> Subject: [Qemu-devel] [PATCH v4 07/14] tcg/ppc: Add support for fence List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Vassili Karpov (malc)" , Richard Henderson , "open list:All patches CC here" Cc: alex.bennee@linaro.org, serge.fdrv@gmail.com, pbonzini@redhat.com, peter.maydell@linaro.org Signed-off-by: Pranith Kumar Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.inc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index eaf1bd9..1547d8f 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -469,6 +469,10 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type, #define STHX XO31(407) #define STWX XO31(151) +#define EIEIO XO31(854) +#define HWSYNC XO31(598) +#define LWSYNC (HWSYNC | (1u << 21)) + #define SPR(a, b) ((((a)<<5)|(b))<<11) #define LR SPR(8, 0) #define CTR SPR(9, 0) @@ -1243,6 +1247,19 @@ static void tcg_out_brcond2 (TCGContext *s, const TCGArg *args, tcg_out_bc(s, BC | BI(7, CR_EQ) | BO_COND_TRUE, arg_label(args[5])); } +static void tcg_out_mb(TCGContext *s, TCGArg a0) +{ + if (a0 & TCG_MO_LD_LD) { + tcg_out32(s, LWSYNC); + return; + } + if (a0 & TCG_MO_ST_ST) { + tcg_out32(s, EIEIO); + return; + } + tcg_out32(s, HWSYNC); +} + #ifdef __powerpc64__ void ppc_tb_set_jmp_target(uintptr_t jmp_addr, uintptr_t addr) { @@ -2449,6 +2466,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, tcg_out32(s, MULHD | TAB(args[0], args[1], args[2])); break; + case INDEX_op_mb: + tcg_out_mb(s, args[0]); + break; + case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ @@ -2596,6 +2617,7 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_qemu_st_i64, { "S", "S", "S", "S" } }, #endif + { INDEX_op_mb, { } }, { -1 }, }; -- 2.9.0