From patchwork Mon Jun 26 18:49:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 696474 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp3384900wrm; Mon, 26 Jun 2023 12:00:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4hn2GRUvnYU3LmtJ9sdMCRDWNdrJBmq1HDrJ6UNwKbj4TbVfryCSgw6jJpi7jWUFETf/Pd X-Received: by 2002:a05:620a:6590:b0:763:cf57:17c1 with SMTP id qd16-20020a05620a659000b00763cf5717c1mr14702957qkn.28.1687806021128; Mon, 26 Jun 2023 12:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687806021; cv=none; d=google.com; s=arc-20160816; b=qWA7NF7zlN8uq5fFPJqIbCZwU6DFCmYSgZAOPitSq9XWkSG6ywop1jAA+yKu2sQhmx vFQV2gOeAus8ENnDVhjzEwWncLebszaHY9ga/elA0PnnN11QiHhw4lkW3QcdIfU1ASCw 9ICQoeWiXWjgUD8wEMQ4crSEOSufWQCilW/Ue6YAEsgXiovi6aWLQ9pSxSEmYmCjuXaK 4Ui9JYGjSweCp3NpA5voRCOvnlc/oXwHKqp/SzA9eTWFGJWxZHVBjPQW1TtjkT5LV01N Hcy8Ecf8l+LnCpmo/sfbwe6sXntONyDV6a2PQdmqy388yvqorFyO0A90ziwE8sbPb+n7 ZBAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=ivTsw3wJ2jOwRuVhd5UJhHVwMfRunkD2I7WXmzeCBwE=; fh=0Xp2JyaTaNttgD8GBymZGxc1xOSx5UTRsLJ5GvGrdK8=; b=NGOxtYWCWEPqvEjkyX+qZnJ8WnjJATCkFk+4YR+FXLv8ULB2n0xIyYzE+1B4FpQQFx SU7klTCPcq7ZAWOPWQQDt0c7HoOR4kHQ8XOKWVH+dTygVTx3IBcn43Qky163Rr308Irf X9QioA5nptdVINx4m0mCyuoGyIiIlxuKjSlGWvdDAckPhv8/z4zdzI+cbXvciKdwaQ+S FQ4ChHH6hoCKOMA7WyxJ9WATOvyR/vg5jxIiqbf4DxZDz90J+u66POTL2yn3DkqyC+rp /LXWg2te2D8deJZEoelSz0tUB9a+JGwK2XABDgU1R+Ie+Pb8QfzWB1Q67JzSSh9Lnfam ILpA== 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 ox13-20020a05620a828d00b007653a71006dsi2171597qkn.81.2023.06.26.12.00.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Jun 2023 12:00:21 -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 1qDrNI-00052F-9m; Mon, 26 Jun 2023 14:55:44 -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 1qDrLS-0001rO-BH; Mon, 26 Jun 2023 14:53:53 -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 1qDrLQ-0005TJ-8F; Mon, 26 Jun 2023 14:53:49 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id E1220EF3F; Mon, 26 Jun 2023 21:50:28 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 89E91F7CE; Mon, 26 Jun 2023 21:50:26 +0300 (MSK) Received: (nullmailer pid 1574079 invoked by uid 1000); Mon, 26 Jun 2023 18:50:16 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org, qemu-stable@nongnu.org Cc: Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-8.0.3 40/54] target/arm: Return correct result for LDG when ATA=0 Date: Mon, 26 Jun 2023 21:49:47 +0300 Message-Id: <20230626185002.1573836-40-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 The LDG instruction loads the tag from a memory address (identified by [Xn + offset]), and then merges that tag into the destination register Xt. We implemented this correctly for the case when allocation tags are enabled, but didn't get it right when ATA=0: instead of merging the tag bits into Xt, we merged them into the memory address [Xn + offset] and then set Xt to that. Merge the tag bits into the old Xt value, as they should be. Cc: qemu-stable@nongnu.org Fixes: c15294c1e36a7dd9b25 ("target/arm: Implement LDG, STG, ST2G instructions") Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell (cherry picked from commit 7e2788471f9e079fff696a694721a7d41a451839) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 3cb5128135..2fb27087f5 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -4091,9 +4091,13 @@ static void disas_ldst_tag(DisasContext *s, uint32_t insn) if (s->ata) { gen_helper_ldg(tcg_rt, cpu_env, addr, tcg_rt); } else { + /* + * Tag access disabled: we must check for aborts on the load + * load from [rn+offset], and then insert a 0 tag into rt. + */ clean_addr = clean_data_tbi(s, addr); gen_probe_access(s, clean_addr, MMU_DATA_LOAD, MO_8); - gen_address_with_allocation_tag0(tcg_rt, addr); + gen_address_with_allocation_tag0(tcg_rt, tcg_rt); } } else { tcg_rt = cpu_reg_sp(s, rt);