From patchwork Thu Mar 7 17:04:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 159898 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7679844jad; Thu, 7 Mar 2019 09:14:42 -0800 (PST) X-Google-Smtp-Source: APXvYqwwF6jLFbVZPKWL8tDbRlZLqGS6Jv+io6XJXa2a3bX9Pl5VBoifv5EJ12VFgdzTmrpLGgnV X-Received: by 2002:a81:2c89:: with SMTP id s131mr10555675yws.64.1551978881805; Thu, 07 Mar 2019 09:14:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551978881; cv=none; d=google.com; s=arc-20160816; b=f7Pg04Ee/j3wG9H2ZeO295on+f+3feV2PgO6TGcghJrC6I6ktyn7dNsNhnIrL31e+4 bwYc8iHzDGTJ5mCwi+3s2XLaMD8Jq1h192aUHlxeWlLIvCWQe8wHHjRFelxKOo0togPK UVII6mP2pnhzyzTb4ztnB16RNFT1//XWVUvXVOE+P2Y/MDpU70xS4plYM/MEyxrk0V5y 8ZZTOYPhZeX9fbZrehREYqgg7ggLBWJcNJE1X1LchJXbIz/C+qjK2Vh3vcxq1E2X72a2 Hv2pPhjsKTLE3muAQhnJdlYn8fSp71aj8K7FIRaeemvWsf+ThVvuqRhQtf9LTilSaMZn p2bg== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=RbkXrsv19E2YAEIvT8x8QaVcLAnqxFUL0bdiWTfxaWg=; b=q0enxFX+umMLagz6TwtNV+3Zw2ez9GjR+fyROQz5fYshEk/10ceArFXgH4Tuq7XTwI bH3sGTL9XKylF2kWzrRVz5V8l3I2B0pEyLae+RWJaWRvfTv8bwZpVSFGuO7FQkmr6iVB 6ILWMrpxIVhDYLcrLaiBxgHUzxAH8HZZDpVG0C1R5AshUq+sR6N4cc6QxZ25AzzdZ3RD 9a1LgdH2OYDK6KFrnqGPFgXwyf4k5dzVJPlV82jxc2W5f2clJOq2Dx6VblffNA2qoeYa XPrXv/upTS+x9IzLmcXEMDS//2gjgeW+twqYRvwV9UV+c52G181rpVk7riApH/+hIsdb Vlrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="XP/bbCZh"; 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=fail (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 d81si2850219ybh.23.2019.03.07.09.14.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Mar 2019 09:14:41 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b="XP/bbCZh"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:55709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wbR-000507-6n for patch@linaro.org; Thu, 07 Mar 2019 12:14:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wS8-0006Jh-T4 for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:05:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wRz-0004SC-VO for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:04:58 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:42311) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wRx-0004NI-23 for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:04:54 -0500 Received: by mail-pf1-x435.google.com with SMTP id n74so11893795pfi.9 for ; Thu, 07 Mar 2019 09:04:50 -0800 (PST) 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; bh=RbkXrsv19E2YAEIvT8x8QaVcLAnqxFUL0bdiWTfxaWg=; b=XP/bbCZhBKpwiI1u9+OkKJwH8X7a7RCOpNq6kNbzFytdiSGFBq5CUcQl4tVXVdNqrL d4cmreWaznwOLY7YVDAnOXDXP1RiXp+eTe4+RPyUfWl5GS3RkEOVUyIUfogfAPZBudUT GBj+JSRE9lDZiG/1FIhKLdotPlQuQyedXUGUqMaSV8we7DprBqB2So1/UFO/d3ut2r9J dNLN0RJ7fYoWTKdhlcQ8MeQleRGhM2b/GGOTde/7sR6S9fIp7VU7iqyxpi/pXpLfggFw K9CQZFutHJmQBmBXNr6Of12Hv4jNoUm10DiKl+LHV1AgF9u+Y7iA1P2A040zf0P9VaoN b45A== 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; bh=RbkXrsv19E2YAEIvT8x8QaVcLAnqxFUL0bdiWTfxaWg=; b=EoRURJ5Z0z8Nfj+wkO4YJtrm88OClHab65PHVDz5lHhkq2nQd0fQbvKcJtw7QM0uLT DS9oTn1JcGfuv8rSAMrHXtZUsKjKFCMLehM7+UBEJ5crd8f7ul/T08NSeW8eAepJg8sO 4uAAoEKAX42uZYzW7OeDWveDhth5KTuH/dpvksP+I91EnhApH0gWiGhSlRPqHkEhbglh 42NBIWd9Sridb+STv84YYPlNriXSeMxu2INtZhSDJdgV4GPUswmQmnPBcDwHT5LDspgo SO+HRJqugtisj3sf1w+EDHfccn1XG+mu/M7jjv21nwifrSGGj1aB9wtkuZmDODdxO8Z7 8eGw== X-Gm-Message-State: APjAAAVma9UXWXt/MqObUd31Amktzm+qIVP4kg3pDrAVdr5NoTj3Iot1 XKPIkts3mbOFHhwqNiWlDGiKGGRRwIs= X-Received: by 2002:a17:902:aa88:: with SMTP id d8mr13939285plr.61.1551978288852; Thu, 07 Mar 2019 09:04:48 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id r82sm10040562pfa.161.2019.03.07.09.04.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Mar 2019 09:04:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 09:04:23 -0800 Message-Id: <20190307170440.3113-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190307170440.3113-1-richard.henderson@linaro.org> References: <20190307170440.3113-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::435 Subject: [Qemu-devel] [PATCH v4 05/22] target/arm: Suppress tag check for sp+offset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" R0078 specifies that base register, or base register plus immediate offset, is unchecked when the base register is SP. Signed-off-by: Richard Henderson --- v2: Include writeback addresses as checked. --- target/arm/translate-a64.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) -- 2.17.2 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 6ec77fc67c..0d35c07504 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -340,11 +340,11 @@ static void gen_a64_set_pc(DisasContext *s, TCGv_i64 src) * This is always a fresh temporary, as we need to be able to * increment this independently of a dirty write-back address. */ -static TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr) +static TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr, bool check) { TCGv_i64 clean = new_tmp_a64(s); - if (s->mte_active) { + if (check && s->mte_active) { if (s->current_el >= 2) { /* FIXME: ARMv8.1-VHE S2 translation regime. */ gen_helper_mte_check1(clean, cpu_env, addr); @@ -2464,7 +2464,7 @@ static void gen_compare_and_swap(DisasContext *s, int rs, int rt, if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); tcg_gen_atomic_cmpxchg_i64(tcg_rs, clean_addr, tcg_rs, tcg_rt, memidx, size | MO_ALIGN | s->be_data); } @@ -2482,7 +2482,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); if (size == 2) { TCGv_i64 cmp = tcg_temp_new_i64(); @@ -2607,7 +2607,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); } - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); gen_store_exclusive(s, rs, rt, rt2, clean_addr, size, false); return; @@ -2616,7 +2616,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); s->is_ldex = true; gen_load_exclusive(s, rt, rt2, clean_addr, size, false); if (is_lasr) { @@ -2636,7 +2636,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) gen_check_sp_alignment(s); } tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); do_gpr_st(s, cpu_reg(s, rt), clean_addr, size, true, rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); return; @@ -2652,7 +2652,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, false, true, rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); @@ -2666,7 +2666,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); } - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); gen_store_exclusive(s, rs, rt, rt2, clean_addr, size, true); return; } @@ -2684,7 +2684,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); s->is_ldex = true; gen_load_exclusive(s, rt, rt2, clean_addr, size, true); if (is_lasr) { @@ -2874,7 +2874,7 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) if (!postindex) { tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); } - clean_addr = clean_data_tbi(s, dirty_addr); + clean_addr = clean_data_tbi(s, dirty_addr, wback || rn != 31); if (is_vector) { if (is_load) { @@ -3012,7 +3012,7 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, if (!post_index) { tcg_gen_addi_i64(dirty_addr, dirty_addr, imm9); } - clean_addr = clean_data_tbi(s, dirty_addr); + clean_addr = clean_data_tbi(s, dirty_addr, writeback || rn != 31); if (is_vector) { if (is_store) { @@ -3119,7 +3119,7 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, ext_and_shift_reg(tcg_rm, tcg_rm, opt, shift ? size : 0); tcg_gen_add_i64(dirty_addr, dirty_addr, tcg_rm); - clean_addr = clean_data_tbi(s, dirty_addr); + clean_addr = clean_data_tbi(s, dirty_addr, true); if (is_vector) { if (is_store) { @@ -3204,7 +3204,7 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, dirty_addr = read_cpu_reg_sp(s, rn, 1); offset = imm12 << size; tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); - clean_addr = clean_data_tbi(s, dirty_addr); + clean_addr = clean_data_tbi(s, dirty_addr, rn != 31); if (is_vector) { if (is_store) { @@ -3288,7 +3288,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn), rn != 31); tcg_rs = read_cpu_reg(s, rs, true); if (o3_opc == 1) { /* LDCLR */ @@ -3350,7 +3350,7 @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn, tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); /* Note that "clean" and "dirty" here refer to TBI not PAC. */ - clean_addr = clean_data_tbi(s, dirty_addr); + clean_addr = clean_data_tbi(s, dirty_addr, is_wback || rn != 31); tcg_rt = cpu_reg(s, rt); do_gpr_ld(s, tcg_rt, clean_addr, size, /* is_signed */ false, @@ -3510,7 +3510,7 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) elements = (is_q ? 16 : 8) / ebytes; tcg_rn = cpu_reg_sp(s, rn); - clean_addr = clean_data_tbi(s, tcg_rn); + clean_addr = clean_data_tbi(s, tcg_rn, is_postidx || rn != 31); tcg_ebytes = tcg_const_i64(ebytes); for (r = 0; r < rpt; r++) { @@ -3653,7 +3653,7 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) } tcg_rn = cpu_reg_sp(s, rn); - clean_addr = clean_data_tbi(s, tcg_rn); + clean_addr = clean_data_tbi(s, tcg_rn, is_postidx || rn != 31); tcg_ebytes = tcg_const_i64(ebytes); for (xs = 0; xs < selem; xs++) {