From patchwork Fri Apr 16 18:31:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 422557 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp633661jaf; Fri, 16 Apr 2021 11:41:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUVIkcp2UTOejDoQ9jk3OIVEBomX1M0Pfor8f8aXDp3OopvVkIKDAohJTbHdGtMsFvi2SK X-Received: by 2002:a02:3712:: with SMTP id r18mr5282178jar.11.1618598464069; Fri, 16 Apr 2021 11:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618598464; cv=none; d=google.com; s=arc-20160816; b=aV4g7lOX21yWYpURn9gZLq9UGSEwHGUFTDWFk9a2HbpCjzMoY67pLmtSgiWeDezfmn ie8SLeRdN3rTJE9HIX2ZXwiGlDmiNCjN59DKDgBfWqshC9t9kJg2Gfp4yMAIHSsBKYFI uau6PXZDzIjlNFDQeG8NXkn9BCFQPVpJiOM6aVyE1hVATL4xblYZhQCw+l8c7EmjDUG/ m1QeOg5ydWrTVYYSdO9ePsjOJSajKt7lLPiaFCsB8Nm/MUneuUFZ4QrD7qICqLjk8kFt aGoupyI88+uXdaxaCutuYmlfwDLEJc/3VvEXgkRqs6aiYuYZbiq6o1KkurdZi05JtPJj BAMA== 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=1NtJeZCZXJQVsZg4wkjWgi0tGTthzJlM6W10jtA+8DA=; b=mjt4XcsjpKAMdbZs0lWoO/wsZ/IaPOLQh0Uy7RqeTQFoX087USbMlmUTWg6pgxdPtl BQgX6pJx2kX1fMO+E0xHrnLrjR76HEVY2yWEWDUllnW1SrDGKRM+9wsZH0rekpPiL13C ZYNIWuY/Kvi4dpk066FXYnZUm8Wz7Th7Gkiw3V/SIPJnPNZJw9CieBQZAoZXLXOyn2M4 /KkiPB8R1NGw0KPmYy0SdWrXCQl19UdO/vFJ9KcF/BTisJbElnnqxyr3AltvEMKW4jXv srhcMKB6Gvz7JxIh/rew7ybY5IiNZKBCJfZ0DHOl16DZ9I+XTO9/5ScQZnXUl6pDAKmq iOHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PrRBuiSs; 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=pass (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 v15si3997483jal.37.2021.04.16.11.41.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Apr 2021 11:41:04 -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=pass header.i=@linaro.org header.s=google header.b=PrRBuiSs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXTOp-0004qJ-Hf for patch@linaro.org; Fri, 16 Apr 2021 14:41:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXTFT-0000rH-C4 for qemu-devel@nongnu.org; Fri, 16 Apr 2021 14:31:23 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:42554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXTFO-0003mH-2W for qemu-devel@nongnu.org; Fri, 16 Apr 2021 14:31:22 -0400 Received: by mail-pf1-x42e.google.com with SMTP id w8so15426501pfn.9 for ; Fri, 16 Apr 2021 11:31:17 -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=1NtJeZCZXJQVsZg4wkjWgi0tGTthzJlM6W10jtA+8DA=; b=PrRBuiSsFoG/gXJHsn2xvFk27mF53yOWkk7C/lze+EwBxaZXwcJEWpzpkya4qZU6oy T7oE+9Ud9Sp8fE48GlN6VWtpEwuUOVnNUdUBte0LasroWG/69ZRr5GaYZj8rZzMmKXi9 KB5Ds1DpVrcrXfQY0Jyy8t3X5atmnN6aMqqCN7CQKAJ3DosfKPLrIJeqr2H//MdnOpXK cgO+aPZyMTs++Y8zHEiVVM0QgZerngNcWuWMWmdxo1q5uOZQzf4or9BTtdim5OP+oe32 GviuM6BNyj84Nd6XpppwSPc332mbJTonSQ12ugR1sLLtrd+uLQ9UpoK+0+IY5XFOHNns nURg== 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=1NtJeZCZXJQVsZg4wkjWgi0tGTthzJlM6W10jtA+8DA=; b=NR+kyQjJ5+V1krFrEhrhXHAqvcRCd8HJljWDuiYS7nK9BIHNAco6XTp0k63ROkBgWC bLKrhF07PkahnkrwEkoIZhvnxLc1fOJVpVbo/s0g02F9gWPZSxH1REVmu7jXqy+tJeo6 P8F5jSGaROmv1mSDo2YUW05rSZhJBbkYbHEP8YBoG6WuXAzLilyE5KUgDarBFttmu1rH cH6BgZzAq9mYvQ48lKXlLXm8ECUovfso1JZaGEjadjcqKQCdmgZ0z6znSjPIRemfClTB Q8LGA6Tdp5JLR29ktaE2UnVw3PKciSrPz/KMPqj6pDTCD6DpiMWQZF4nRKvAbV84qMMl pwYw== X-Gm-Message-State: AOAM532v3+0YGg1cABbg4ZAV+11KAp6n5AERt72hU1fcWqStvlCIdF+c IytMru3ERJACqQZXm8LqOxFFIK/HIVL/OA== X-Received: by 2002:a63:4644:: with SMTP id v4mr394897pgk.316.1618597876798; Fri, 16 Apr 2021 11:31:16 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id p18sm3057307pju.3.2021.04.16.11.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 11:31:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 9/9] target/arm: Remove log2_esize parameter to gen_mte_checkN Date: Fri, 16 Apr 2021 11:31:06 -0700 Message-Id: <20210416183106.1516563-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210416183106.1516563-1-richard.henderson@linaro.org> References: <20210416183106.1516563-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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=unavailable 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: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The log2_esize parameter is not used except trivially. Drop the parameter and the deferral to gen_mte_check1. This fixes a bug in that the parameters as documented in the header file were the reverse from those in the implementation. Which meant that translate-sve.c was passing the parameters in the wrong order. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/translate-a64.h | 2 +- target/arm/translate-a64.c | 15 +++++++-------- target/arm/translate-sve.c | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 3668b671dd..868d355048 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -44,7 +44,7 @@ TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr); TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, bool tag_checked, int log2_size); TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, - bool tag_checked, int count, int log2_esize); + bool tag_checked, int size); /* We should have at some point before trying to access an FP register * done the necessary access check, so assert that diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a68d5dd5d1..f35a5e8174 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -295,9 +295,9 @@ TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, * For MTE, check multiple logical sequential accesses. */ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, - bool tag_checked, int log2_esize, int total_size) + bool tag_checked, int size) { - if (tag_checked && s->mte_active[0] && total_size != (1 << log2_esize)) { + if (tag_checked && s->mte_active[0]) { TCGv_i32 tcg_desc; TCGv_i64 ret; int desc = 0; @@ -306,7 +306,7 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, total_size - 1); + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, size - 1); tcg_desc = tcg_const_i32(desc); ret = new_tmp_a64(s); @@ -315,7 +315,7 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, return ret; } - return gen_mte_check1(s, addr, is_write, tag_checked, log2_esize); + return clean_data_tbi(s, addr); } typedef struct DisasCompare64 { @@ -2965,8 +2965,7 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) } clean_addr = gen_mte_checkN(s, dirty_addr, !is_load, - (wback || rn != 31) && !set_tag, - size, 2 << size); + (wback || rn != 31) && !set_tag, 2 << size); if (is_vector) { if (is_load) { @@ -3713,7 +3712,7 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) * promote consecutive little-endian elements below. */ clean_addr = gen_mte_checkN(s, tcg_rn, is_store, is_postidx || rn != 31, - size, total); + total); /* * Consecutive little-endian elements from a single register @@ -3866,7 +3865,7 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) tcg_rn = cpu_reg_sp(s, rn); clean_addr = gen_mte_checkN(s, tcg_rn, !is_load, is_postidx || rn != 31, - scale, total); + total); tcg_ebytes = tcg_const_i64(1 << scale); for (xs = 0; xs < selem; xs++) { diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 5179c1f836..584c4d047c 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4264,7 +4264,7 @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) dirty_addr = tcg_temp_new_i64(); tcg_gen_addi_i64(dirty_addr, cpu_reg_sp(s, rn), imm); - clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len, MO_8); + clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len); tcg_temp_free_i64(dirty_addr); /* @@ -4352,7 +4352,7 @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) dirty_addr = tcg_temp_new_i64(); tcg_gen_addi_i64(dirty_addr, cpu_reg_sp(s, rn), imm); - clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len, MO_8); + clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len); tcg_temp_free_i64(dirty_addr); /* Note that unpredicated load/store of vector/predicate registers