From patchwork Fri Sep 6 06:53:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 825917 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp662392wrb; Thu, 5 Sep 2024 23:57:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUPGYWK605/pY+TqDrXDRt8fYr2OdqSR3Ppi1qYOJ6pZsgfQ2JA7JOEmIlYhxXxU+DvqU4vqw==@linaro.org X-Google-Smtp-Source: AGHT+IG/ZEB8y01bZJPrHDrM9M4DkEYJ3skxGJMOkeT0C5Hl7JdqLNlYdR0VyEeaImfyv5ccSFvO X-Received: by 2002:ac8:5803:0:b0:456:811c:4ecd with SMTP id d75a77b69052e-4580c675320mr17830241cf.4.1725605873649; Thu, 05 Sep 2024 23:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725605873; cv=none; d=google.com; s=arc-20240605; b=dK6lL8BIlk+x1s+FdgWnkpfoOCJJJg3VoTl2zHX7UL5B20ritjna9KYcNc4iFWLz5k SamXN1jqNSjXfqpTnAi/WhOQCvFF8oc9WXpUGdeG0bPuAY8YPxIbcUP4fhiyhqjkEFGX VD6swgfK2Cma+pr/31n3Pwke9v+Ts/Zp5jRv6FBt8Yr/xS8fcNwFzeq3J1yLPZlbyHrG V/8Wq74/REV+kO9t4kgZ+yS1beYMYNMn9tIDZLUUbXgE2d9fD+d4fu9Zz5tHXQdQOMIe n+AuPGA2Vb/MozGDwWySv3OKwUAQxUtaAgLmh4oGH5GhgoAv3EJCjwI3ybTlmJJ9DLLX JHeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from; bh=HfUXDUjhSlDWC/BsDi3/W+0CxfJE3H7SOIced/nj8cs=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=jeejLxsewg69cS7syDY7yD5al8595RKoKYcpNN+cLJ1fDQtNwjo053Tkyh9nzuhoE8 CO7vdoUrIcH4vUVaOEjzZDuBq7umBWGFre3c69ZesBB7pw2JQxMmL1HgVzfK6Ot6dlwj iE+kFepAP/MqlAmR7Q27vg4h6nilOPQFaykkDLelpjEXgEQFm4EMebbcE3b0BOwpsDN2 KDrAEU51/0GUBysaecqfEivXR1aWOJoUYTIJVzCOzULWXVWvozvreD/AwaHrGhmz3uJ9 YxStZTC7Knue+Sw6uXfra9JW6F5nb3bq9CHkmvCmSzOFw8lDN8Uy4wElii1at9CBlS3Y h0xg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45809c8f588si21094251cf.467.2024.09.05.23.57.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Sep 2024 23:57:53 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smSro-0004JI-Vs; Fri, 06 Sep 2024 02:54:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smSrm-00049t-LQ; Fri, 06 Sep 2024 02:54:46 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smSrk-0002z0-Ui; Fri, 06 Sep 2024 02:54:46 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id BB8E08C238; Fri, 6 Sep 2024 09:53:11 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 849F01333F0; Fri, 6 Sep 2024 09:54:29 +0300 (MSK) Received: (nullmailer pid 43321 invoked by uid 1000); Fri, 06 Sep 2024 06:54:29 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-8.2.7 03/53] target/arm: LDAPR should honour SCTLR_ELx.nAA Date: Fri, 6 Sep 2024 09:53:33 +0300 Message-Id: <20240906065429.42415-3-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell In commit c1a1f80518d360b when we added the FEAT_LSE2 relaxations to the alignment requirements for atomic and ordered loads and stores, we didn't quite get it right for LDAPR/LDAPRH/LDAPRB with no immediate offset. These instructions were handled in the old decoder as part of disas_ldst_atomic(), but unlike all the other insns that function decoded (LDADD, LDCLR, etc) these insns are "ordered", not "atomic", so they should be using check_ordered_align() rather than check_atomic_align(). Commit c1a1f80518d360b used check_atomic_align() regardless for everything in disas_ldst_atomic(). We then carried that incorrect check over in the decodetree conversion, where LDAPR/LDAPRH/LDAPRB are now handled by trans_LDAPR(). The effect is that when FEAT_LSE2 is implemented, these instructions don't honour the SCTLR_ELx.nAA bit and will generate alignment faults when they should not. (The LDAPR insns with an immediate offset were in disas_ldst_ldapr_stlr() and then in trans_LDAPR_i() and trans_STLR_i(), and have always used the correct check_ordered_align().) Use check_ordered_align() in trans_LDAPR(). Cc: qemu-stable@nongnu.org Fixes: c1a1f80518d360b ("target/arm: Relax ordered/atomic alignment checks for LSE2") Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20240709134504.3500007-3-peter.maydell@linaro.org (cherry picked from commit 25489b521b61b874c4c6583956db0012a3674e3a) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index f2d05c589c..2fccd836b7 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -3306,7 +3306,7 @@ static bool trans_LDAPR(DisasContext *s, arg_LDAPR *a) if (a->rn == 31) { gen_check_sp_alignment(s); } - mop = check_atomic_align(s, a->rn, a->sz); + mop = check_ordered_align(s, a->rn, 0, false, a->sz); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, a->rn), false, a->rn != 31, mop); /*