From patchwork Fri Sep 6 11:12:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 825929 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp744020wrb; Fri, 6 Sep 2024 04:14:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUgzsAU62dtKbDDUdjamqiJ0aJVzGrwKEAl6yq4L7PWPHkIbD6+0YfB7oV2MqyhHe4h+CWdww==@linaro.org X-Google-Smtp-Source: AGHT+IFDfRHBbsrSy5dqNAyhDsOi9SZ+YeH7XQ6u5UR41lkVZl0Ij3OXzR0wW1ExA9bx8JQZJ61Z X-Received: by 2002:a05:6830:3687:b0:704:7b8c:ba0c with SMTP id 46e09a7af769-710cc26fb63mr2341624a34.30.1725621269291; Fri, 06 Sep 2024 04:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725621269; cv=none; d=google.com; s=arc-20240605; b=cUiSDQkmGT4gtrSU078MOR6T1XI7nmpcbBC4N+z96pQtKq2iM7q9WxUUr2B/vr5a/3 4hQihLTE+VXIwphAuBxiMKzGGB/s1B6SMpfxB3WfmXY7Jc30W8c7KaeqYsApYpW3pDuX GcguEMkLUbxMxcIWVIi0ohi9lq1zsl5mJLX4h50L+igBm5az256hzP3olef/MSZzzYlS H9AsOk5SPcZKUFrKrZO115hGDt0RPn1JXP3zCQ1O6a8BUwqc24TYguRhAuWeooszekNe m98aBhZe/6D+Us1gYkIcN063K6r7yEMDjzA0Zo4VdPU/xJMmygTaH1A/KMQIn6kz8702 IriQ== 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=pHRHu3t2m8pF3KKfDjBkPJDQ/CHwLGw/RJF2VgvmDAg=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=j/vZhtz5/FdeYHnKH7B9iLA4RNxmkEa7ww3klgMP4eUobznsvkiS6lonQ2nwWjjJKX cVeZXZUR07OVvb88Aw5KuKqOmNjeW6uhSvlQnpEfhEbYt8uv//UhX+okWkv8w2NSeCqZ jJWL4jaCQ7dHkZ7Wa9hyn+P01GR/d21uifOVSBhFzR01Og5eu6xZSuqKY6myXf/fmF1U p1/FWaAO4LSpQBybVyQXOTPVrv1RcYG6i1pFNwAbstN1pyBUlahSb0wEbQX+xePOTMGP U6CKuDfegFpZ1zPU9ipN/4FeiOzJCg3s0j45yyYp7JqBjVOjDpljJX83BEpdYGGhnEn8 4nXA==; 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-45809c98adbsi26561861cf.610.2024.09.06.04.14.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Sep 2024 04:14:29 -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 1smWuJ-0000ZR-Lb; Fri, 06 Sep 2024 07:13:39 -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 1smWuH-0000Sl-Ep; Fri, 06 Sep 2024 07:13:37 -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 1smWuF-0007ft-LE; Fri, 06 Sep 2024 07:13:37 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id C6FC58C475; Fri, 6 Sep 2024 14:12:06 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id D3D3E1336DF; Fri, 6 Sep 2024 14:13:24 +0300 (MSK) Received: (nullmailer pid 353555 invoked by uid 1000); Fri, 06 Sep 2024 11:13:24 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-9.0.3 05/69] target/arm: LDAPR should honour SCTLR_ELx.nAA Date: Fri, 6 Sep 2024 14:12:14 +0300 Message-Id: <20240906111324.353230-5-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 2666d52711..922a16e5d4 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -3428,7 +3428,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); /*