From patchwork Mon Jun 26 18:58:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 696483 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp3391808wrm; Mon, 26 Jun 2023 12:15:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42gNiND36UpdtNzdJDVfNAD7DDJjfcPpg7AFsLmENFK7ckmx1enMvk7LcLdAttrErFFDYV X-Received: by 2002:a05:6214:401d:b0:635:d5c5:15d2 with SMTP id kd29-20020a056214401d00b00635d5c515d2mr7232777qvb.18.1687806953637; Mon, 26 Jun 2023 12:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687806953; cv=none; d=google.com; s=arc-20160816; b=Vioms4Jw9F/qZf2JjVy8Zu9p6+zu4ivVL7/w0iGk3itJfXyX/C1GvS0PoWVEHMBOx6 7kkWSsvDOLRw1YUf8ku3K3nkRf3ruuOTjjWa4lGyso+9qYhDPgWn6jUZksw6s4hragUw CqWdxYPIRvwitLOHBVikUcG2CzocuH0/gp5VFw3gmaEs/R13PjFWTRUNlJQ9LdNlxet/ xUmGEP6WXCy+UpCvL9t8tKY2VAUR5DS2U4qtI/P4ufOTUYrQQ/O71M5tHfR6ZbPqUYFF GLPotkutFvy10+Jbt5SF9xQVatJfEh6ne0LHpAgbZAwzEg2WS8n5mpWyrbfcXdmojOUI poLg== 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=gOwyi3v41yaY9FMB03KFlGMRdNwlN1ulHodlb1zTIf0=; fh=0Xp2JyaTaNttgD8GBymZGxc1xOSx5UTRsLJ5GvGrdK8=; b=C1D9IzyVDjP1wPF9NQwR2AHVjb2z1IhBCzewvVPnztqOz4T+3BrRuHInISI8N3LwLn 2lF25d/dMlPuwvdcK8ukjI+gnfQ7RuoQAqUICylCmYL5/r/xLHVhw3vj+xuRZaKnHmv8 7acAXcWRjeXXT/3tf85AJsXA0i+M7e5wvMyLCjRAFeSPlx4BUF4L4uOqKUfRLuqOy1M0 rpHxcY7Hd/HYAIiKJyzf1L9kA5H5Q+zWj4vqmUbJ/Sy0VzoLymWogVcbFjeBv6LrsERU eGVE7LKoUuaKcJiKFdRE37oLmJhLCnnsAsDjzoGJoUUQWsja9J+tL9uVDuUQbNwcW7Kn a1hA== 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 4-20020a0562140d0400b0063001e0134dsi2395535qvh.43.2023.06.26.12.15.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Jun 2023 12:15: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 1qDrTH-0000WC-Ke; Mon, 26 Jun 2023 15:01:55 -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 1qDrTD-0000NU-A2; Mon, 26 Jun 2023 15:01:51 -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 1qDrTB-0007oS-JZ; Mon, 26 Jun 2023 15:01:51 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id C9E84EFC1; Mon, 26 Jun 2023 21:59:13 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 5C1C9F7FD; Mon, 26 Jun 2023 21:59:12 +0300 (MSK) Received: (nullmailer pid 1575373 invoked by uid 1000); Mon, 26 Jun 2023 18:59:05 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org, qemu-stable@nongnu.org Cc: Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-7.2.4 32/43] target/arm: Return correct result for LDG when ATA=0 Date: Mon, 26 Jun 2023 21:58:50 +0300 Message-Id: <20230626185902.1575177-32-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/translate-a64.c b/target/arm/translate-a64.c index 3c356d238f..f0b8db7ce5 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4190,9 +4190,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);