From patchwork Tue Aug 15 14:57:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9902019 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 DC8A560244 for ; Tue, 15 Aug 2017 15:00:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF6A628882 for ; Tue, 15 Aug 2017 15:00:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C49CF28893; Tue, 15 Aug 2017 15:00:50 +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_SIGNED, 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 39CBE28882 for ; Tue, 15 Aug 2017 15:00:49 +0000 (UTC) Received: from localhost ([::1]:39247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhdKq-0007XN-UH for patchwork-qemu-devel@patchwork.kernel.org; Tue, 15 Aug 2017 11:00:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhdHX-0005Is-Ty for qemu-devel@nongnu.org; Tue, 15 Aug 2017 10:57:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhdHW-0004L0-L8 for qemu-devel@nongnu.org; Tue, 15 Aug 2017 10:57:24 -0400 Received: from mail-pg0-x236.google.com ([2607:f8b0:400e:c05::236]:38147) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dhdHW-0004KW-FT for qemu-devel@nongnu.org; Tue, 15 Aug 2017 10:57:22 -0400 Received: by mail-pg0-x236.google.com with SMTP id l64so7001247pge.5 for ; Tue, 15 Aug 2017 07:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SgAaEYM18OE+mUpjVkYzlZyVnbr8ndjZmIY5W1zNvyI=; b=ZoFcqDuet/QGi2nRgJNNHLha7S3eqMac5sj5ziUv5J3cp6pdhpxQPweKEV5STN4jV5 OEQf8PD4f/mfeUG/3ceWg7a9L7DhNzIa7t10rp+gmUPR6NW0q9fC6b9fGx9xu2J7bWKs 4W1OPJMDNKW/IRXczKvGirPC7gTpCwoDWZP0I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SgAaEYM18OE+mUpjVkYzlZyVnbr8ndjZmIY5W1zNvyI=; b=fbh4fcQ0jY9MvZ+H0QoghBPSl3PIryIi+jJfdhgSULHSlkBp7JsgmWnQvEEUGcTSrd y1C06xp9Dvka6NGaOzDbfttY8MX8a/Ds0BoA6UsYRgRIbHb0tnB2S20a2LdWpBJzPl+L cNJBcJFWL68bBzQ8zEM8IqBEf3o6DOSP9Ebna5t6KlTxcImszxmsGzIzFj4TUa5H90YF n+PF5w0YzNT1s2ubV6P41nb6IXkoBlyEq070FrOc/SnbeByxXXyr2QYc1vMD64S+98PJ Es5vlqlKhpLkRTRCAtWHRx+l1vD3GnPwnPLb3rrMGTl2lJjR1YmcmREJ4boMtP4Uy7ok 3RRw== X-Gm-Message-State: AHYfb5hc9DSjNJwDRyzFyxG13LOE9bsKvgY47XGSwHoJdum0RU3Y6D1/ F+ZZ4hnRCX+XtGi+iDJFlw== X-Received: by 10.84.167.230 with SMTP id i35mr31743455plg.181.1502809041202; Tue, 15 Aug 2017 07:57:21 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id n11sm20626318pfg.15.2017.08.15.07.57.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2017 07:57:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 15 Aug 2017 07:57:14 -0700 Message-Id: <20170815145714.17635-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170815145714.17635-1-richard.henderson@linaro.org> References: <20170815145714.17635-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::236 Subject: [Qemu-devel] [PATCH v2 for-2.10 3/3] target/arm: Require alignment for load exclusive 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: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Alistair Francis Acording to the ARM ARM exclusive loads require the same allignment as exclusive stores. Let's update the memops used for the load to match that of the store. This adds the alignment requirement to the memops. Reviewed-by: Edgar E. Iglesias Signed-off-by: Alistair Francis [rth: Require 16-byte alignment for 64-bit LDXP.] Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index eac545e4f2..2200e25be0 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1861,7 +1861,7 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, g_assert(size >= 2); if (size == 2) { /* The pair must be single-copy atomic for the doubleword. */ - memop |= MO_64; + memop |= MO_64 | MO_ALIGN; tcg_gen_qemu_ld_i64(cpu_exclusive_val, addr, idx, memop); if (s->be_data == MO_LE) { tcg_gen_extract_i64(cpu_reg(s, rt), cpu_exclusive_val, 0, 32); @@ -1871,10 +1871,11 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, tcg_gen_extract_i64(cpu_reg(s, rt2), cpu_exclusive_val, 0, 32); } } else { - /* The pair must be single-copy atomic for *each* doubleword, - but not the entire quadword. */ + /* The pair must be single-copy atomic for *each* doubleword, not + the entire quadword, however it must be quadword aligned. */ memop |= MO_64; - tcg_gen_qemu_ld_i64(cpu_exclusive_val, addr, idx, memop); + tcg_gen_qemu_ld_i64(cpu_exclusive_val, addr, idx, + memop | MO_ALIGN_16); TCGv_i64 addr2 = tcg_temp_new_i64(); tcg_gen_addi_i64(addr2, addr, 8); @@ -1885,7 +1886,7 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, tcg_gen_mov_i64(cpu_reg(s, rt2), cpu_exclusive_high); } } else { - memop |= size; + memop |= size | MO_ALIGN; tcg_gen_qemu_ld_i64(cpu_exclusive_val, addr, idx, memop); tcg_gen_mov_i64(cpu_reg(s, rt), cpu_exclusive_val); }