From patchwork Sat Jun 18 04:03:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9185397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24C9C608A2 for ; Sat, 18 Jun 2016 04:06:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AC8527E33 for ; Sat, 18 Jun 2016 04:06:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3F242835B; Sat, 18 Jun 2016 04:06:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A19F42835D for ; Sat, 18 Jun 2016 04:06:05 +0000 (UTC) Received: from localhost ([::1]:32965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7WG-0003gU-PX for patchwork-qemu-devel@patchwork.kernel.org; Sat, 18 Jun 2016 00:06:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7Vg-0003dC-V8 for qemu-devel@nongnu.org; Sat, 18 Jun 2016 00:05:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bE7Vf-0005Kz-Mv for qemu-devel@nongnu.org; Sat, 18 Jun 2016 00:05:28 -0400 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:34427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7Vf-0005Kv-JK for qemu-devel@nongnu.org; Sat, 18 Jun 2016 00:05:27 -0400 Received: by mail-yw0-x242.google.com with SMTP id b75so10800006ywe.1 for ; Fri, 17 Jun 2016 21:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0V1lTjkkNCVB35XpyLNdVtwZ9IicJhoy6S3pF9LjPjM=; b=LcPJvAxRp30XkibQsPY0jhVBR36s8FrD7rXkhPu21eBUAf1MFcCMMD/x93oBTwly+V BLGjaIxEg8Rp4VoeAdzstdw90GTB5wHCHsNVDYGG0DQM4cfn1tEBZtKflgzAm5IWpJNC R/x5Y8l9bGnOLKim+WK+4MS8jqcd/Bsybl3HDfdmyvRdGTxdpJ+iMlU5Y9ff7c0C8tiZ 5VoVBDEJVbAGtFaQNSZJ/3lUrCyyomIVpJ+qUoVMv6m8DwJ7GGoGCWk2i43VHK2xAzYM dHG+336GRIJjdD2Xj2Xq5AcYfwcPe7Oe0RLAvOj0/vP6D6kz/RTx69dNQghpmg3rDnP3 eQ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0V1lTjkkNCVB35XpyLNdVtwZ9IicJhoy6S3pF9LjPjM=; b=fDt4P23fjzA1RMMNkeqkG4lKx1CfOUMS60tzqy5CHfTBlJGWRx58B2LEKzalew6k56 gkvOn5Go1/dPDowIwslMmRBha073veY7XQtCCokXe9DA3vqVqxZy4qktRVPFyuKHW3TA eGnlsDfRQu7s7rlnev0T2zJlaJmNErNZOTzlugyxsGEw2TG8IB66Y0QJsd9BzXWxWAOU yMWokH2V7DqIXRpBTJAwc5EWbuy0qO3ZNNHno/FjrvoUSToDlq3DW+1/abSAN3Vnds6t u5vwrnieHpS6lwl+v7LBmad+S/I+wr3DyY1Y4hWIrBjSTyTdtOrJFA0c+YgSXDhQd7VA J3Ig== X-Gm-Message-State: ALyK8tJLH6R73/GJ2KPHd6HIRTtTY5Ia+SpIuxCGdKv5aV5iuD6GR2z2z8DSvv2zLFngMw== X-Received: by 10.13.198.5 with SMTP id i5mr3090610ywd.263.1466222727304; Fri, 17 Jun 2016 21:05:27 -0700 (PDT) Received: from evgadesktop.attlocal.net (108-232-152-155.lightspeed.tukrga.sbcglobal.net. [108.232.152.155]) by smtp.gmail.com with ESMTPSA id q7sm19517992ywg.16.2016.06.17.21.05.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 21:05:26 -0700 (PDT) From: Pranith Kumar To: "Vassili Karpov (malc)" , Richard Henderson , qemu-devel@nongnu.org (open list:All patches CC here) Date: Sat, 18 Jun 2016 00:03:36 -0400 Message-Id: <20160618040343.19517-8-bobby.prani@gmail.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160618040343.19517-1-bobby.prani@gmail.com> References: <20160618040343.19517-1-bobby.prani@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::242 Subject: [Qemu-devel] [RFC v3 PATCH 07/14] tcg/ppc: Add support for fence 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: serge.fdrv@gmail.com, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Richard Henderson Signed-off-by: Pranith Kumar --- tcg/ppc/tcg-target.inc.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index da10052..766848e 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) @@ -1237,6 +1241,21 @@ 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) +{ + switch (a0 & TCG_MO_ALL) { + case TCG_MO_LD_LD: + tcg_out32(s, LWSYNC); + break; + case TCG_MO_ST_ST: + tcg_out32(s, EIEIO); + break; + default: + tcg_out32(s, HWSYNC); + break; + } +} + #ifdef __powerpc64__ void ppc_tb_set_jmp_target(uintptr_t jmp_addr, uintptr_t addr) { @@ -2439,6 +2458,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. */ @@ -2586,6 +2609,7 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_qemu_st_i64, { "S", "S", "S", "S" } }, #endif + { INDEX_op_mb, { } }, { -1 }, };