From patchwork Fri Apr 16 18:59:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 422574 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp655188jaf; Fri, 16 Apr 2021 12:13:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylr5yclXxkTnR83x/0rLiUlnMwlHmFqMYFkwqPbuFqHJpn+GYPiDIXfJ8q6gBczCuTOU9+ X-Received: by 2002:a05:6e02:12c4:: with SMTP id i4mr8373733ilm.79.1618600432803; Fri, 16 Apr 2021 12:13:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618600432; cv=none; d=google.com; s=arc-20160816; b=jzEZ3yY3Lyf3pcU7PBWYucnuECbA4cVrZ9Dj+sA+s2DneNpbXFQciUCBpBoOxAou0b DX9Uny6jSlcTYiPgOQJMBs2/dLWO2oPZVjL7kcGCiOjCnNhSKm3wPC1FIFqIZwmXd45C 3O1/WEjTP1qdIIj/3d5xu2Q7H+kSFLR4YEYmq9fJdDkZvCm+8jzwJVfKz8hoBWFI2n8f uQq9SUyS/Cl9ly6WRRm9Hfq2uPSsyHrEow/zANuVtfVR/3CkQB1kvYoMDnwjCXSwzT7P cjJNPCLlO6XQoiKJKE00PgKEB7cdJiMeaVSm57brxQFfOXWGAIQMQ2llj6R7GqEwtzMM NdIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4YmyrCHsuRewu4q7IzToC9sV4YEHbKzZOaqHia3EHmw=; b=m8h/jYzcjj8xQwakZgqlrMmgHFVHSbZSpbOF3c/pkDgeGWitBJvHxGBaXqBpApGiQL uhBcJrDsjJ3odupMlsHbMO2DrZCAo+xcJmNYTO5+8Thhwv7reoPNNEkq2mAk0ckcEnYU Sg6kNzVtlP2q6VpJJJuCdEdGUk7RdVd8Cox50Bvbe4Lp8H9aeIeABFr14v97ghoyNTxg eTGnGYK/aogoFfoah6ds5z2GaEz61Nr2+luGACipaSQ8RoClbXt9CJ9f9oNZapHgP6y3 sCcgpxHrFbCs/x8yailiWAWR0PP/XByN03CuaLjAzzMuqsmCDJfk3iTR5D3wIaBLpkGB Y4Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IwAjoN70; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g19si1135868jat.91.2021.04.16.12.13.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Apr 2021 12:13:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IwAjoN70; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXTua-00032k-8S for patch@linaro.org; Fri, 16 Apr 2021 15:13:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXTi6-000440-UD for qemu-devel@nongnu.org; Fri, 16 Apr 2021 15:00:59 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:53815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXThb-0004TZ-VB for qemu-devel@nongnu.org; Fri, 16 Apr 2021 15:00:57 -0400 Received: by mail-pj1-x1033.google.com with SMTP id nk8so1353253pjb.3 for ; Fri, 16 Apr 2021 12:00:27 -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 :mime-version:content-transfer-encoding; bh=4YmyrCHsuRewu4q7IzToC9sV4YEHbKzZOaqHia3EHmw=; b=IwAjoN70hRWeh3MYx/1PnYv+cGIuW9RRGf5UqDkUYjqI6Uwyh+naFo570QuneTnhvD KObAhv6AyqucCb7hiJ+MMf/dNAtf8azE1hUPKZvkzcXAUnoRJWOTbctpQIT38UHjhlgj T+1FwJJsrjv5kUW5BKOBOkRFHfXioLYgIya6RmKJ9jYTGBzHAa/JjdgHfm1X00qzoAsf 865dAbSifzHBq0G9r+onnMDtP4zH2cerRJ6G3exNYedOq9e5AlzOOexp0MRl7KXrsQ0P R/KFMOsMA8nSO/YPDoscw9KujsA26lhTyKnStch7dm2j8PkK675swKJduuGfUH77jPdO 8Ltw== 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:mime-version:content-transfer-encoding; bh=4YmyrCHsuRewu4q7IzToC9sV4YEHbKzZOaqHia3EHmw=; b=hQxN4agdRr5sTG05mvb+irjn/4+hfqqqO6Y4GiHq4Cj1Yv5C6aRcey8WWO21O34oHm wgXk6RIxG7/XD//D8TNCkrKHDfEXsl8MQzrciFT2+aAModGUFoOzVoTUJjjzvKZmr6bD 3sMpemduL9NB4HpIm/vHBNcxnchr8+T1xEkCYD6qocw6CNceNz8NiC54PAo9gkHjJ0Vd MqNs4FlV1OwfJhhGSNmuZ4toLl6EuQXVD/E1NOrV+70E0yypOwUmQIBEGUkgQlU+mW9h 4k0C5+Z/g9NUKTsWRwsEdEI3+2u7QbeMwEiIiwmIh7bKe/bQbcHSQG4Uysxo4nWSTLmM 482g== X-Gm-Message-State: AOAM5316My+NeqG2jlrW3iX5DiYNN/X4+BSqmCWxLdlR7iuPScXlTq4f UKJoeo7emPoRa9j56dZ+ikDxqOVrZrFFrw== X-Received: by 2002:a17:90a:6396:: with SMTP id f22mr11221502pjj.91.1618599626461; Fri, 16 Apr 2021 12:00:26 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id d7sm1988337pfv.197.2021.04.16.12.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 12:00:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 26/30] target/arm: Enforce alignment for aa64 load-acq/store-rel Date: Fri, 16 Apr 2021 11:59:55 -0700 Message-Id: <20210416185959.1520974-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210416185959.1520974-1-richard.henderson@linaro.org> References: <20210416185959.1520974-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b90d6880e7..ac60dcf760 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2699,7 +2699,8 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, size); - do_gpr_st(s, cpu_reg(s, rt), clean_addr, size, true, rt, + /* TODO: ARMv8.4-LSE SCTLR.nAA */ + do_gpr_st(s, cpu_reg(s, rt), clean_addr, size | MO_ALIGN, true, rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); return; @@ -2716,8 +2717,9 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) } clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), false, rn != 31, size); - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, true, rt, - disas_ldst_compute_iss_sf(size, false, 0), is_lasr); + /* TODO: ARMv8.4-LSE SCTLR.nAA */ + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size | MO_ALIGN, false, true, + rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); return; @@ -3505,15 +3507,18 @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) int size = extract32(insn, 30, 2); TCGv_i64 clean_addr, dirty_addr; bool is_store = false; - bool is_signed = false; bool extend = false; bool iss_sf; + MemOp mop; if (!dc_isar_feature(aa64_rcpc_8_4, s)) { unallocated_encoding(s); return; } + /* TODO: ARMv8.4-LSE SCTLR.nAA */ + mop = size | MO_ALIGN; + switch (opc) { case 0: /* STLURB */ is_store = true; @@ -3525,21 +3530,21 @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) unallocated_encoding(s); return; } - is_signed = true; + mop |= MO_SIGN; break; case 3: /* LDAPURS* 32-bit variant */ if (size > 1) { unallocated_encoding(s); return; } - is_signed = true; + mop |= MO_SIGN; extend = true; /* zero-extend 32->64 after signed load */ break; default: g_assert_not_reached(); } - iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); + iss_sf = disas_ldst_compute_iss_sf(size, (mop & MO_SIGN) != 0, opc); if (rn == 31) { gen_check_sp_alignment(s); @@ -3552,13 +3557,13 @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) if (is_store) { /* Store-Release semantics */ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); - do_gpr_st(s, cpu_reg(s, rt), clean_addr, size, true, rt, iss_sf, true); + do_gpr_st(s, cpu_reg(s, rt), clean_addr, mop, true, rt, iss_sf, true); } else { /* * Load-AcquirePC semantics; we implement as the slightly more * restrictive Load-Acquire. */ - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size + is_signed * MO_SIGN, + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, mop, extend, true, rt, iss_sf, true); tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); }