From patchwork Sat Jun 18 04:03:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9185415 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 0DD856075F for ; Sat, 18 Jun 2016 04:18:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE68B27E33 for ; Sat, 18 Jun 2016 04:18:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFD162835D; Sat, 18 Jun 2016 04:18:44 +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 6156E27E33 for ; Sat, 18 Jun 2016 04:18:44 +0000 (UTC) Received: from localhost ([::1]:33030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7iV-0000vl-Iu for patchwork-qemu-devel@patchwork.kernel.org; Sat, 18 Jun 2016 00:18:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7W7-00041k-Tm for qemu-devel@nongnu.org; Sat, 18 Jun 2016 00:05:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bE7W3-0005Pp-M7 for qemu-devel@nongnu.org; Sat, 18 Jun 2016 00:05:54 -0400 Received: from mail-yw0-x244.google.com ([2607:f8b0:4002:c05::244]:35901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE7Vk-0005Mw-VE; Sat, 18 Jun 2016 00:05:33 -0400 Received: by mail-yw0-x244.google.com with SMTP id w195so10780278ywd.3; Fri, 17 Jun 2016 21:05:32 -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=IeskbTnnZFI33w8YztYnKUdHGvwGRb8S1dtITSiNuXg=; b=di6Q5MRQSr/5FNp9CIn9AV9hnAsDovD2c1hWPQQdoPx6RwnuOMHUsjjpI3GLhCzkvq 5Uz9IAzyMZXll46k82l6PgMDNE3b/8o+0l2WNO0UHR18Q0WW/jdo4fGPvyhqb1kSflno Lw4wdU+BkG4FJvC1NotL7AFN1IBqC6eOUk7UfMysy68mnqqp8m14OPLmD5ikhbLAgl1o L2OxRQmkNSaEn2G4cNZtUjz+VNZLdSzIr4oil4Ks74f4odmMwzrvM4mZv+Gg8938V0uE fsXe2tdElEis08huukO3w6uQhz8z/WlNU5/57FwV0/f/rGnFvBwUWMEWBkloo6Y4C9vK 87nQ== 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=IeskbTnnZFI33w8YztYnKUdHGvwGRb8S1dtITSiNuXg=; b=kz2IizG4TxWldON360p+xIX0riEDyJmDfn3/QLJEhMe79mCi5AtLXuyR67ol3AN0+w MphbWXucOrYbjM6DPNvBXK9mN6N/3f7CVrdfqkUgtkdyG/BIjp8dLAoPkNhEevAeZcIm 0+MB4S3D4nG4I46OAebqZyYY6D++C1CxGRxxfQZvub2WNBfR8zXXYxABKJo4l4DoX3BI sfP4n2zY9Qj9QuquufeQrImeIGKLokjL3BhLNoyoPt+3a/uJ6d7cuaghRxpBv0FrsiWR y9/m+OeVP26cErmT1NIGGNFoIJGBy1m7UJCPw2zU0RYniG6MQw8lH1D1Mij5o5v4Cuzo 0VnQ== X-Gm-Message-State: ALyK8tJOiw50r4i7ZQyJALysyuhaA4/lNzOs/sqaoCWpbm/ng5awf+ulrpZFnGRUKt/xFw== X-Received: by 10.129.125.139 with SMTP id y133mr2848879ywc.151.1466222732674; Fri, 17 Jun 2016 21:05:32 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 21:05:32 -0700 (PDT) From: Pranith Kumar To: Peter Maydell , qemu-arm@nongnu.org (open list:ARM), qemu-devel@nongnu.org (open list:All patches CC here) Date: Sat, 18 Jun 2016 00:03:42 -0400 Message-Id: <20160618040343.19517-14-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::244 Subject: [Qemu-devel] [RFC v3 PATCH 13/14] aarch64: Generate fences for aarch64 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, rth@twiddle.net 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: Pranith Kumar --- target-arm/translate-a64.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index ce8141a..fa24bf2 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -1250,7 +1250,7 @@ static void handle_sync(DisasContext *s, uint32_t insn, return; case 4: /* DSB */ case 5: /* DMB */ - /* We don't emulate caches so barriers are no-ops */ + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); return; case 6: /* ISB */ /* We need to break the TB after this insn to execute @@ -1855,23 +1855,31 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) } tcg_addr = read_cpu_reg_sp(s, rn, 1); - /* Note that since TCG is single threaded load-acquire/store-release - * semantics require no extra if (is_lasr) { ... } handling. - */ - if (is_excl) { if (!is_store) { s->is_ldex = true; gen_load_exclusive(s, rt, rt2, tcg_addr, size, is_pair); + if (is_lasr) { + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_ACQ); + } } else { + if (is_lasr) { + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_REL); + } gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, is_pair); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); if (is_store) { + if (is_lasr) { + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_REL); + } do_gpr_st(s, tcg_rt, tcg_addr, size); } else { do_gpr_ld(s, tcg_rt, tcg_addr, size, false, false); + if (is_lasr) { + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_ACQ); + } } } }