From patchwork Sat Jun 18 04:03:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9185401 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 1AE9C6075F for ; Sat, 18 Jun 2016 04:10:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0233D27BFF for ; Sat, 18 Jun 2016 04:10:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA7B72835B; Sat, 18 Jun 2016 04:10:15 +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 95E7027BFF for ; Sat, 18 Jun 2016 04:10:15 +0000 (UTC) Received: from localhost ([::1]:32980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7aI-0008LU-Lp for patchwork-qemu-devel@patchwork.kernel.org; Sat, 18 Jun 2016 00:10:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7Vi-0003en-Mh for qemu-devel@nongnu.org; Sat, 18 Jun 2016 00:05:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bE7Vh-0005LY-Im for qemu-devel@nongnu.org; Sat, 18 Jun 2016 00:05:30 -0400 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:33230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7Vh-0005LT-Eq for qemu-devel@nongnu.org; Sat, 18 Jun 2016 00:05:29 -0400 Received: by mail-yw0-x242.google.com with SMTP id d137so4907668ywe.0 for ; Fri, 17 Jun 2016 21:05:29 -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=XVZdxtuuFGzRb6k+k87kKkuflgM2yaXb9OYFKjWQUHA=; b=BLRH7bsZS1mlMmcDTKGQ4e6N2ZfUxk8GnavOJemovxQyUURJkOdo/VV1W9RFOc513G poBGBiHAfqCkcFIH5hvYSrs5wh5BXMLZSLoRvYyuj69griq8LNTfodmiONIDrcUysns0 FWrPBWnH3w8jeIp+ybhTNikKjus4Yc36+rzNOrtmEBdY3PbCHbeDvMQKVqfryft6A5uz qJoiIaMeoKyTT8hQLCL5YUd36aLkvZaHa3COykANgQMBin/jk8FV5A8CqZPdVmuoeF4V cT30O9A4L1DqchXd13Xb+tsRGXOyZlgX0t5iX9fKrAUgYs5k9+b7Ut+4yEf9Ho+j6Tm/ Ck3g== 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=XVZdxtuuFGzRb6k+k87kKkuflgM2yaXb9OYFKjWQUHA=; b=iPMd6i+QiK2iEruZK0RkT5NMEUxFGbrTImi7pNj1wOnoMwhnxw8gBAjKSxWxqUpm6C Frow49pcuteyhDDMRk5zZFjQIYiX/qyXy/tDmIfLgK2NHJv7tFuLTlQdLO2+M1GSOAKd +ygv3T9eyMtmUNEurPCgTS5qao20rwxaKrxJQpk5Alo9DhQtvRk/I9C0kzns4IMIuibN /w+0pXvaKuKuklYB+lLLRTpBqoYRyW1Igb4wr2nQqi2utYFuf5aB9M/i3BG4OXiWaTU3 EzcCfY/OK41GLihXXipgRmYTVLHk5+2HHncKF7Opd7D3NjKvMKn3BHZgSmH6gMsJBEqV 2flA== X-Gm-Message-State: ALyK8tJnv6yqCqsLGo7KMAPn88ORlSuhx82XBfqefLvkWsiiXnw3VMIWMNy0oHR1Kto/ew== X-Received: by 10.37.218.1 with SMTP id n1mr2987052ybf.68.1466222729178; Fri, 17 Jun 2016 21:05:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 21:05:28 -0700 (PDT) From: Pranith Kumar To: Blue Swirl , Richard Henderson , qemu-devel@nongnu.org (open list:All patches CC here) Date: Sat, 18 Jun 2016 00:03:38 -0400 Message-Id: <20160618040343.19517-10-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 09/14] tcg/sparc: 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 Cc: Blue Swirl Signed-off-by: Richard Henderson Signed-off-by: Pranith Kumar --- tcg/sparc/tcg-target.inc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c index 9938a50..af8a300 100644 --- a/tcg/sparc/tcg-target.inc.c +++ b/tcg/sparc/tcg-target.inc.c @@ -249,6 +249,8 @@ static const int tcg_target_call_oarg_regs[] = { #define STWA (INSN_OP(3) | INSN_OP3(0x14)) #define STXA (INSN_OP(3) | INSN_OP3(0x1e)) +#define MEMBAR (INSN_OP(2) | INSN_OP3(0x28) | INSN_RS1(15) | (1 << 13)) + #ifndef ASI_PRIMARY_LITTLE #define ASI_PRIMARY_LITTLE 0x88 #endif @@ -825,6 +827,24 @@ static void tcg_out_call(TCGContext *s, tcg_insn_unit *dest) tcg_out_nop(s); } +static void tcg_out_mb(TCGContext *s, TCGArg a0) +{ + uint8_t bar_opcode; + switch (a0 & TCG_MO_ALL) { + case TCG_MO_LD_LD: + bar_opcode = 0x5; + break; + case TCG_MO_ST_ST: + bar_opcode = 0xa; + break; + default: + /* #StoreLoad | #LoadStore */ + bar_opcode = 0xf; + break; + } + tcg_out32(s, MEMBAR | bar_opcode); +} + #ifdef CONFIG_SOFTMMU static tcg_insn_unit *qemu_ld_trampoline[16]; static tcg_insn_unit *qemu_st_trampoline[16]; @@ -1450,6 +1470,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_arithc(s, a0, TCG_REG_G0, a1, const_args[1], c); break; + case INDEX_op_mb: + tcg_out_mb(s, a0); + 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. */ @@ -1551,6 +1575,7 @@ static const TCGTargetOpDef sparc_op_defs[] = { { INDEX_op_qemu_st_i32, { "sZ", "A" } }, { INDEX_op_qemu_st_i64, { "SZ", "A" } }, + { INDEX_op_mb, { } }, { -1 }, };