From patchwork Thu Jan 10 12:49:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155153 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1857538jaa; Thu, 10 Jan 2019 04:50:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN4VExEm2hjSpwElUqUmFjgzbA6z3gsfoe6Z0PiCpwn4AcLvO9W1hTArP7JcMfWbDhrBuyTt X-Received: by 2002:a1c:5656:: with SMTP id k83mr9926386wmb.125.1547124636106; Thu, 10 Jan 2019 04:50:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547124636; cv=none; d=google.com; s=arc-20160816; b=AfXU9e/N8zaBnTGyT9zxGlOMkfu8FUo410Joi8mHxFNu0o3TfWYJZ3jx83BeNH9dlB 9/QjU5+MmDqMkLgxQaUBMWaBLOxXE8oDj6J1wwpiTT2Sf8h5R+lniWomY74b9srm7Lym 2VOwx/mxLc1WV9otqVNrb0T+LrLExxettdT8FW6aaouDt90/jC8dN8UDr4hgcJfF0fKK p2uNJhCeTm1Xg1kjtvhPq/JtKippM0fnHxNNjV0vGUQFyry+OobtAw//0Q9qOxlopT7U scNqN1Uxu/RIx/bdxm/7iiG3T2kQ8vMXd6viNQk89SwL5PjKerYTaGWDFkYCRkgELavt 4XDA== 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=vc880LwbgUgrvinaZJ29rDm6AdQgGipIK6nkHZKqFT4=; b=M085chWsXPVr8j9f5QO250zOgH5d0avz3ACmxZx92soMJUjopbG55b3+6obAHjTs4J h/DyU90T2BAhxRrxElwKF1aRK12V+puxMoYZKYIP53uqfWSMf0SIYoaZg/LfM/TMKnZO cG0fDwranBPbqR3woCll5ZiGV7n36WAGKUn8ul2Ca/23Dctiq2IsxC7vwoMYlVMAyDHi vdzi+YAoxJ8z7cKQpsBt/27huf8bXts8FyD7KM5eIjvtp7jtrOPaZuRwscekk/aTT1qN 9O68iMu0HAwsZXTWci8TeCCgWjDsLuk+pEvccVsrgbDdB6aVUHgoI5QnENONikIYB+gw 4HZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NHiI4Su6; 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 h124si10880095wmf.39.2019.01.10.04.50.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 Jan 2019 04:50:36 -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=NHiI4Su6; 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]:36634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZn8-0003N7-Vp for patch@linaro.org; Thu, 10 Jan 2019 07:50:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZmc-0003J3-OQ for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghZmb-00078f-L5 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:02 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:45008) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghZmb-00078L-FU for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:01 -0500 Received: by mail-pg1-x542.google.com with SMTP id t13so4783218pgr.11 for ; Thu, 10 Jan 2019 04:50:01 -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=vc880LwbgUgrvinaZJ29rDm6AdQgGipIK6nkHZKqFT4=; b=NHiI4Su6RveQDiMLHanz/4Y6KYUcDFnfSEJ93u90avaY703CH4Vq5okR0ORJMP5C63 f/c2ppZatJZZUA2wPriDVB3zg+tIBwz+XkYYjFuBgnD0KKp7mW4eZrn1b/DeyORa82fN q6WG2MJtP//SAz4OFw5JDWjoISQv+jbwESK64= 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=vc880LwbgUgrvinaZJ29rDm6AdQgGipIK6nkHZKqFT4=; b=Aoctira/wXcw/USQN4lR7QI31fQnr2UpIqySENOq/YpgVRGX5nd85oVz5oSj9rZSR/ FPpc2XCKf4hUNLd4Wud7tLrkK+hhohNNQhEq2amNeUYpZyrYZyT1brRauYcKK9UBIbzv gNXiQB1fMe1hGN5qDAVwWCDb/ljNZaH6He6HlAxJsGFKglbSC/FP5+SsMaXkCA/sdaOX +gJHCw+NvfXEj2OUYGTLQivv0ItpSOyhu6QAY0f/QDvIEv9E5zUaZ9IC+HIUfwx4TwZc q3yp3xPk4s+QQlITTWhRFlxK4eAL3OoVr0cUB3LXVY3PbV9gvz1WnpWU18nn9Nkvt59q wEUw== X-Gm-Message-State: AJcUukccGoekZNN/j4y3jWvhjwIGrUFa7Y6RlTKa9f8GupI1Iy85OO/o MVQ0JfgsIpcdtJVawP9dTApm9LR3hQ1ISw== X-Received: by 2002:a63:7044:: with SMTP id a4mr9084621pgn.359.1547124600044; Thu, 10 Jan 2019 04:50:00 -0800 (PST) Received: from cloudburst.twiddle.net (c220-239-117-135.belrs4.nsw.optusnet.com.au. [220.239.117.135]) by smtp.gmail.com with ESMTPSA id g28sm132656016pfd.100.2019.01.10.04.49.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 04:49:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 23:49:48 +1100 Message-Id: <20190110124951.15473-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190110124951.15473-1-richard.henderson@linaro.org> References: <20190110124951.15473-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::542 Subject: [Qemu-devel] [PATCH 1/4] target/arm: Add TBFLAG_A64_TBID, split out gen_top_byte_ignore 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" Split out gen_top_byte_ignore in preparation of handling these data accesses; the new tbflags field is not yet honored. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 1 + target/arm/translate.h | 3 ++- target/arm/helper.c | 1 + target/arm/translate-a64.c | 40 +++++++++++++++++--------------------- 4 files changed, 22 insertions(+), 23 deletions(-) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 929f16dd6b..02e6dcce25 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2996,6 +2996,7 @@ FIELD(TBFLAG_A64, ZCR_LEN, 4, 4) FIELD(TBFLAG_A64, PAUTH_ACTIVE, 8, 1) FIELD(TBFLAG_A64, BT, 9, 1) FIELD(TBFLAG_A64, BTYPE, 10, 2) +FIELD(TBFLAG_A64, TBID, 12, 2) static inline bool bswap_code(bool sctlr_b) { diff --git a/target/arm/translate.h b/target/arm/translate.h index f73939d7b4..17748ddfb9 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -26,7 +26,8 @@ typedef struct DisasContext { int user; #endif ARMMMUIdx mmu_idx; /* MMU index to use for normal loads/stores */ - uint8_t tbii; /* TBI1|TBI0 for EL0/1 or TBI for EL2/3 */ + uint8_t tbii; /* TBI1|TBI0 for insns */ + uint8_t tbid; /* TBI1|TBI0 for data */ bool ns; /* Use non-secure CPREG bank on access */ int fp_excp_el; /* FP exception EL or 0 if enabled */ int sve_excp_el; /* SVE exception EL or 0 if enabled */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 4e9ea2ed39..8c28c6d044 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13108,6 +13108,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } flags = FIELD_DP32(flags, TBFLAG_A64, TBII, tbii); + flags = FIELD_DP32(flags, TBFLAG_A64, TBID, tbid); } #endif diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f225517077..9548252782 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -284,31 +284,17 @@ void gen_a64_set_pc_im(uint64_t val) tcg_gen_movi_i64(cpu_pc, val); } -/* Load the PC from a generic TCG variable. - * - * If address tagging is enabled via the TCR TBI bits, then loading - * an address into the PC will clear out any tag in it: - * + for EL2 and EL3 there is only one TBI bit, and if it is set - * then the address is zero-extended, clearing bits [63:56] - * + for EL0 and EL1, TBI0 controls addresses with bit 55 == 0 - * and TBI1 controls addressses with bit 55 == 1. - * If the appropriate TBI bit is set for the address then - * the address is sign-extended from bit 55 into bits [63:56] - * - * We can avoid doing this for relative-branches, because the - * PC + offset can never overflow into the tag bits (assuming - * that virtual addresses are less than 56 bits wide, as they - * are currently), but we must handle it for branch-to-register. +/* + * Handle Top Byte Ignore (TBI) bits. + * We have concatenated tbi{1,0} into tbi. */ -static void gen_a64_set_pc(DisasContext *s, TCGv_i64 src) +static void gen_top_byte_ignore(DisasContext *s, TCGv_i64 dst, + TCGv_i64 src, int tbi) { - /* Note that TBII is TBI1:TBI0. */ - int tbi = s->tbii; - if (s->current_el <= 1) { if (tbi != 0) { /* Sign-extend from bit 55. */ - tcg_gen_sextract_i64(cpu_pc, src, 0, 56); + tcg_gen_sextract_i64(dst, src, 0, 56); if (tbi != 3) { TCGv_i64 tcg_zero = tcg_const_i64(0); @@ -327,13 +313,22 @@ static void gen_a64_set_pc(DisasContext *s, TCGv_i64 src) } else { if (tbi != 0) { /* Force tag byte to all zero */ - tcg_gen_extract_i64(cpu_pc, src, 0, 56); + tcg_gen_extract_i64(dst, src, 0, 56); return; } } /* Load unmodified address */ - tcg_gen_mov_i64(cpu_pc, src); + tcg_gen_mov_i64(dst, src); +} + +static void gen_a64_set_pc(DisasContext *s, TCGv_i64 src) +{ + /* + * If address tagging is enabled for instructions via the TCR TBI bits, + * then loading an address into the PC will clear out any tag. + */ + gen_top_byte_ignore(s, cpu_pc, src, s->tbii); } typedef struct DisasCompare64 { @@ -13981,6 +13976,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, core_mmu_idx = FIELD_EX32(tb_flags, TBFLAG_ANY, MMUIDX); dc->mmu_idx = core_to_arm_mmu_idx(env, core_mmu_idx); dc->tbii = FIELD_EX32(tb_flags, TBFLAG_A64, TBII); + dc->tbid = FIELD_EX32(tb_flags, TBFLAG_A64, TBID); dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx); #if !defined(CONFIG_USER_ONLY) dc->user = (dc->current_el == 0); From patchwork Thu Jan 10 12:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155157 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1861648jaa; Thu, 10 Jan 2019 04:55:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN6CygFy9jTq7TEFC7Z4np/dMXXDVS4/Fq/Tn7vuQMlX5nKJPf7/p+cwqwwm/OQtXgumqje4 X-Received: by 2002:adf:9205:: with SMTP id 5mr9143277wrj.189.1547124956636; Thu, 10 Jan 2019 04:55:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547124956; cv=none; d=google.com; s=arc-20160816; b=GzItGzSbIlls15hOTz/GG7K3exxAoCJtQtFijanpKeAflB0DPGksgOWv3bvKmLjAZD Q2uLUpBwQE5wQ0imBMYcVI50xRj5+PYx5qIBPlAhP3m/g85bxAOCokbdGskGHgIN7LZF T4UkPpMZwv+ayNt5G08GLxp8zZjAQbuvlr+VJUUWTP0l3dTsv1ubFgPNuYmSua4k1NAi eyhxKKyyeG5C1Pa1iHiVfhqZtQyyV9cX5YYSL9yWritbKX6xwfun07UftU+2fd9qdhF1 gSEkmZ3H2PJRh/dnb2mHHSzoymKcesGA7ZpVXutJW0csPZrWtIXHJwgOUtUHVRiVFmio /DKw== 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=aiq7cociCao/2bYT3GZsZhijKGK9KJST01JsHggxgBs=; b=QVZwGEhO//gmeqCsLuaQH7QlzjjoQcVwey43amFFQnVA/sHMBuWN2kRL1y5QDAL3A2 bMl+Eckmxxat1ZonmTmbGb/Z93UbqsqTrC08z7uHwskwfwRNwEYTuUk/oDlfm2saMXOu X5sasSF2KlGbZo+nps9RT1n2Anu0KGoEmh15QcV5gfttntrx74JTSIS3POMrMN9NTI5/ jd0l2maoPbRWYR+nCllSLaadoajoiUKt4IDQdysnBXBz3Tp38cTcofdclRblW/rX5mz7 EDR1f8j6IaIkxmUbntYwJBvgR1Y9zSKN11M5Cp2NDnjgdEnkJtIydBwo8heomPFy2Xmc xHnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bmnGkA2I; 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 j204si10940709wma.169.2019.01.10.04.55.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 Jan 2019 04:55:56 -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=bmnGkA2I; 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]:37708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZsJ-0007kc-Cm for patch@linaro.org; Thu, 10 Jan 2019 07:55:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZmm-0003Rw-0s for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghZme-00079g-VB for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:11 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:39102) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghZme-00079N-Lx for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:04 -0500 Received: by mail-pl1-x644.google.com with SMTP id 101so5149887pld.6 for ; Thu, 10 Jan 2019 04:50:04 -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=aiq7cociCao/2bYT3GZsZhijKGK9KJST01JsHggxgBs=; b=bmnGkA2IWuo6tc2WJ/JLKah7O9xRTmiLBVzRPAg4qk77OC2lYy1AROX9krdXyFCFM3 FnTJR+wGjJ+n0OUByzLUqvwv5mHsPuLzl5pjxbs+W9KdxzOJpLfkjYdhSu+XZ0pJhbLB sOd3a7nbO7S8Z8eZjpCFFZlDu3IGJUedhJtFI= 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=aiq7cociCao/2bYT3GZsZhijKGK9KJST01JsHggxgBs=; b=SBAycaiE/XKj7krZGyKw4/6rweoWAsk8V+FJ5EsOalqxQl4FPO2s6Z5lQ8Wd8PN/Ey D75BQtviN6S7NcGlh/jIRcWNUdGgmmq7Ebd9uhg55jQC3yR6lo61k3pV5WLfedQDIIX8 AkYe3jDbR/WvYtiEmjNoLErHeTDKfGBL0M8NBwD5nUmMc7eXJIlJaGPjbyrYY1t2yNxX 8osTYAtj//Umsar/FVTBludmFVSyjpH4w+XfDn9ojcn22WkCLoOr64h3sN2Iwp3ZQYuP VNs6UnHXCWHBXglc946JeJs4u72b5eZzfS1gtcgJtcnCf14up+UtSqkpaNiOy4hCpgB8 8dOA== X-Gm-Message-State: AJcUukeXEifDDV2RtUEX69Wk1RnSlROKhX1kls2Inf1ciabBMcrlIsqz WRpaRDfDlvFxQYjrh2IAatMCgDGcKyB9EQ== X-Received: by 2002:a17:902:850c:: with SMTP id bj12mr10043939plb.46.1547124602732; Thu, 10 Jan 2019 04:50:02 -0800 (PST) Received: from cloudburst.twiddle.net (c220-239-117-135.belrs4.nsw.optusnet.com.au. [220.239.117.135]) by smtp.gmail.com with ESMTPSA id g28sm132656016pfd.100.2019.01.10.04.50.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 04:50:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 23:49:49 +1100 Message-Id: <20190110124951.15473-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190110124951.15473-1-richard.henderson@linaro.org> References: <20190110124951.15473-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::644 Subject: [Qemu-devel] [PATCH 2/4] target/arm: Clean TBI for data operations in the translator 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" This will allow TBI to be used in user-only mode, as well as avoid ping-ponging the softmmu TLB when TBI is in use. It will also enable other armv8 extensions. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 217 ++++++++++++++++++++----------------- 1 file changed, 116 insertions(+), 101 deletions(-) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 9548252782..1d9e204884 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -331,6 +331,18 @@ static void gen_a64_set_pc(DisasContext *s, TCGv_i64 src) gen_top_byte_ignore(s, cpu_pc, src, s->tbii); } +/* + * Return a "clean" address for ADDR according to TBID. + * 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) +{ + TCGv_i64 clean = new_tmp_a64(s); + gen_top_byte_ignore(s, clean, addr, s->tbid); + return clean; +} + typedef struct DisasCompare64 { TCGCond cond; TCGv_i64 value; @@ -2342,12 +2354,13 @@ static void gen_compare_and_swap(DisasContext *s, int rs, int rt, TCGv_i64 tcg_rs = cpu_reg(s, rs); TCGv_i64 tcg_rt = cpu_reg(s, rt); int memidx = get_mem_index(s); - TCGv_i64 addr = cpu_reg_sp(s, rn); + TCGv_i64 clean_addr; if (rn == 31) { gen_check_sp_alignment(s); } - tcg_gen_atomic_cmpxchg_i64(tcg_rs, addr, tcg_rs, tcg_rt, memidx, + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + tcg_gen_atomic_cmpxchg_i64(tcg_rs, clean_addr, tcg_rs, tcg_rt, memidx, size | MO_ALIGN | s->be_data); } @@ -2358,12 +2371,13 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, TCGv_i64 s2 = cpu_reg(s, rs + 1); TCGv_i64 t1 = cpu_reg(s, rt); TCGv_i64 t2 = cpu_reg(s, rt + 1); - TCGv_i64 addr = cpu_reg_sp(s, rn); + TCGv_i64 clean_addr; int memidx = get_mem_index(s); if (rn == 31) { gen_check_sp_alignment(s); } + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); if (size == 2) { TCGv_i64 cmp = tcg_temp_new_i64(); @@ -2377,7 +2391,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, tcg_gen_concat32_i64(cmp, s2, s1); } - tcg_gen_atomic_cmpxchg_i64(cmp, addr, cmp, val, memidx, + tcg_gen_atomic_cmpxchg_i64(cmp, clean_addr, cmp, val, memidx, MO_64 | MO_ALIGN | s->be_data); tcg_temp_free_i64(val); @@ -2391,9 +2405,11 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, if (HAVE_CMPXCHG128) { TCGv_i32 tcg_rs = tcg_const_i32(rs); if (s->be_data == MO_LE) { - gen_helper_casp_le_parallel(cpu_env, tcg_rs, addr, t1, t2); + gen_helper_casp_le_parallel(cpu_env, tcg_rs, + clean_addr, t1, t2); } else { - gen_helper_casp_be_parallel(cpu_env, tcg_rs, addr, t1, t2); + gen_helper_casp_be_parallel(cpu_env, tcg_rs, + clean_addr, t1, t2); } tcg_temp_free_i32(tcg_rs); } else { @@ -2409,10 +2425,10 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, TCGv_i64 zero = tcg_const_i64(0); /* Load the two words, in memory order. */ - tcg_gen_qemu_ld_i64(d1, addr, memidx, + tcg_gen_qemu_ld_i64(d1, clean_addr, memidx, MO_64 | MO_ALIGN_16 | s->be_data); - tcg_gen_addi_i64(a2, addr, 8); - tcg_gen_qemu_ld_i64(d2, addr, memidx, MO_64 | s->be_data); + tcg_gen_addi_i64(a2, clean_addr, 8); + tcg_gen_qemu_ld_i64(d2, clean_addr, memidx, MO_64 | s->be_data); /* Compare the two words, also in memory order. */ tcg_gen_setcond_i64(TCG_COND_EQ, c1, d1, s1); @@ -2422,7 +2438,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, /* If compare equal, write back new data, else write back old data. */ tcg_gen_movcond_i64(TCG_COND_NE, c1, c2, zero, t1, d1); tcg_gen_movcond_i64(TCG_COND_NE, c2, c2, zero, t2, d2); - tcg_gen_qemu_st_i64(c1, addr, memidx, MO_64 | s->be_data); + tcg_gen_qemu_st_i64(c1, clean_addr, memidx, MO_64 | s->be_data); tcg_gen_qemu_st_i64(c2, a2, memidx, MO_64 | s->be_data); tcg_temp_free_i64(a2); tcg_temp_free_i64(c1); @@ -2475,7 +2491,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) int is_lasr = extract32(insn, 15, 1); int o2_L_o1_o0 = extract32(insn, 21, 3) * 2 | is_lasr; int size = extract32(insn, 30, 2); - TCGv_i64 tcg_addr; + TCGv_i64 clean_addr; switch (o2_L_o1_o0) { case 0x0: /* STXR */ @@ -2486,8 +2502,8 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); - gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, false); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + gen_store_exclusive(s, rs, rt, rt2, clean_addr, size, false); return; case 0x4: /* LDXR */ @@ -2495,9 +2511,9 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); s->is_ldex = true; - gen_load_exclusive(s, rt, rt2, tcg_addr, size, false); + gen_load_exclusive(s, rt, rt2, clean_addr, size, false); if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); } @@ -2515,8 +2531,8 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) gen_check_sp_alignment(s); } tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); - tcg_addr = read_cpu_reg_sp(s, rn, 1); - do_gpr_st(s, cpu_reg(s, rt), tcg_addr, size, true, rt, + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + do_gpr_st(s, cpu_reg(s, rt), clean_addr, size, true, rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); return; @@ -2531,8 +2547,8 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); - do_gpr_ld(s, cpu_reg(s, rt), tcg_addr, size, false, false, true, rt, + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + 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); return; @@ -2545,8 +2561,8 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); - gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, true); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); + gen_store_exclusive(s, rs, rt, rt2, clean_addr, size, true); return; } if (rt2 == 31 @@ -2563,9 +2579,9 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); s->is_ldex = true; - gen_load_exclusive(s, rt, rt2, tcg_addr, size, true); + gen_load_exclusive(s, rt, rt2, clean_addr, size, true); if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); } @@ -2614,7 +2630,7 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) int opc = extract32(insn, 30, 2); bool is_signed = false; int size = 2; - TCGv_i64 tcg_rt, tcg_addr; + TCGv_i64 tcg_rt, clean_addr; if (is_vector) { if (opc == 3) { @@ -2636,17 +2652,17 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) tcg_rt = cpu_reg(s, rt); - tcg_addr = tcg_const_i64((s->pc - 4) + imm); + clean_addr = tcg_const_i64((s->pc - 4) + imm); if (is_vector) { - do_fp_ld(s, rt, tcg_addr, size); + do_fp_ld(s, rt, clean_addr, size); } else { /* Only unsigned 32bit loads target 32bit registers. */ bool iss_sf = opc != 0; - do_gpr_ld(s, tcg_rt, tcg_addr, size, is_signed, false, + do_gpr_ld(s, tcg_rt, clean_addr, size, is_signed, false, true, rt, iss_sf, false); } - tcg_temp_free_i64(tcg_addr); + tcg_temp_free_i64(clean_addr); } /* @@ -2692,7 +2708,8 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) bool postindex = false; bool wback = false; - TCGv_i64 tcg_addr; /* calculated address */ + TCGv_i64 clean_addr, dirty_addr; + int size; if (opc == 3) { @@ -2748,23 +2765,23 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) gen_check_sp_alignment(s); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); - + dirty_addr = read_cpu_reg_sp(s, rn, 1); if (!postindex) { - tcg_gen_addi_i64(tcg_addr, tcg_addr, offset); + tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); } + clean_addr = clean_data_tbi(s, dirty_addr); if (is_vector) { if (is_load) { - do_fp_ld(s, rt, tcg_addr, size); + do_fp_ld(s, rt, clean_addr, size); } else { - do_fp_st(s, rt, tcg_addr, size); + do_fp_st(s, rt, clean_addr, size); } - tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); + tcg_gen_addi_i64(clean_addr, clean_addr, 1 << size); if (is_load) { - do_fp_ld(s, rt2, tcg_addr, size); + do_fp_ld(s, rt2, clean_addr, size); } else { - do_fp_st(s, rt2, tcg_addr, size); + do_fp_st(s, rt2, clean_addr, size); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); @@ -2776,30 +2793,28 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) /* Do not modify tcg_rt before recognizing any exception * from the second load. */ - do_gpr_ld(s, tmp, tcg_addr, size, is_signed, false, + do_gpr_ld(s, tmp, clean_addr, size, is_signed, false, false, 0, false, false); - tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); - do_gpr_ld(s, tcg_rt2, tcg_addr, size, is_signed, false, + tcg_gen_addi_i64(clean_addr, clean_addr, 1 << size); + do_gpr_ld(s, tcg_rt2, clean_addr, size, is_signed, false, false, 0, false, false); tcg_gen_mov_i64(tcg_rt, tmp); tcg_temp_free_i64(tmp); } else { - do_gpr_st(s, tcg_rt, tcg_addr, size, + do_gpr_st(s, tcg_rt, clean_addr, size, false, 0, false, false); - tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); - do_gpr_st(s, tcg_rt2, tcg_addr, size, + tcg_gen_addi_i64(clean_addr, clean_addr, 1 << size); + do_gpr_st(s, tcg_rt2, clean_addr, size, false, 0, false, false); } } if (wback) { if (postindex) { - tcg_gen_addi_i64(tcg_addr, tcg_addr, offset - (1 << size)); - } else { - tcg_gen_subi_i64(tcg_addr, tcg_addr, 1 << size); + tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); } - tcg_gen_mov_i64(cpu_reg_sp(s, rn), tcg_addr); + tcg_gen_mov_i64(cpu_reg_sp(s, rn), dirty_addr); } } @@ -2836,7 +2851,7 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, bool post_index; bool writeback; - TCGv_i64 tcg_addr; + TCGv_i64 clean_addr, dirty_addr; if (is_vector) { size |= (opc & 2) << 1; @@ -2887,17 +2902,18 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, if (rn == 31) { gen_check_sp_alignment(s); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); + dirty_addr = read_cpu_reg_sp(s, rn, 1); if (!post_index) { - tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9); + tcg_gen_addi_i64(dirty_addr, dirty_addr, imm9); } + clean_addr = clean_data_tbi(s, dirty_addr); if (is_vector) { if (is_store) { - do_fp_st(s, rt, tcg_addr, size); + do_fp_st(s, rt, clean_addr, size); } else { - do_fp_ld(s, rt, tcg_addr, size); + do_fp_ld(s, rt, clean_addr, size); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); @@ -2905,10 +2921,10 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); if (is_store) { - do_gpr_st_memidx(s, tcg_rt, tcg_addr, size, memidx, + do_gpr_st_memidx(s, tcg_rt, clean_addr, size, memidx, iss_valid, rt, iss_sf, false); } else { - do_gpr_ld_memidx(s, tcg_rt, tcg_addr, size, + do_gpr_ld_memidx(s, tcg_rt, clean_addr, size, is_signed, is_extended, memidx, iss_valid, rt, iss_sf, false); } @@ -2917,9 +2933,9 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, if (writeback) { TCGv_i64 tcg_rn = cpu_reg_sp(s, rn); if (post_index) { - tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9); + tcg_gen_addi_i64(dirty_addr, dirty_addr, imm9); } - tcg_gen_mov_i64(tcg_rn, tcg_addr); + tcg_gen_mov_i64(tcg_rn, dirty_addr); } } @@ -2958,8 +2974,7 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, bool is_store = false; bool is_extended = false; - TCGv_i64 tcg_rm; - TCGv_i64 tcg_addr; + TCGv_i64 tcg_rm, clean_addr, dirty_addr; if (extract32(opt, 1, 1) == 0) { unallocated_encoding(s); @@ -2993,27 +3008,28 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, if (rn == 31) { gen_check_sp_alignment(s); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); + dirty_addr = read_cpu_reg_sp(s, rn, 1); tcg_rm = read_cpu_reg(s, rm, 1); ext_and_shift_reg(tcg_rm, tcg_rm, opt, shift ? size : 0); - tcg_gen_add_i64(tcg_addr, tcg_addr, tcg_rm); + tcg_gen_add_i64(dirty_addr, dirty_addr, tcg_rm); + clean_addr = clean_data_tbi(s, dirty_addr); if (is_vector) { if (is_store) { - do_fp_st(s, rt, tcg_addr, size); + do_fp_st(s, rt, clean_addr, size); } else { - do_fp_ld(s, rt, tcg_addr, size); + do_fp_ld(s, rt, clean_addr, size); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); if (is_store) { - do_gpr_st(s, tcg_rt, tcg_addr, size, + do_gpr_st(s, tcg_rt, clean_addr, size, true, rt, iss_sf, false); } else { - do_gpr_ld(s, tcg_rt, tcg_addr, size, + do_gpr_ld(s, tcg_rt, clean_addr, size, is_signed, is_extended, true, rt, iss_sf, false); } @@ -3047,7 +3063,7 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, unsigned int imm12 = extract32(insn, 10, 12); unsigned int offset; - TCGv_i64 tcg_addr; + TCGv_i64 clean_addr, dirty_addr; bool is_store; bool is_signed = false; @@ -3080,24 +3096,25 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, if (rn == 31) { gen_check_sp_alignment(s); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); + dirty_addr = read_cpu_reg_sp(s, rn, 1); offset = imm12 << size; - tcg_gen_addi_i64(tcg_addr, tcg_addr, offset); + tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); + clean_addr = clean_data_tbi(s, dirty_addr); if (is_vector) { if (is_store) { - do_fp_st(s, rt, tcg_addr, size); + do_fp_st(s, rt, clean_addr, size); } else { - do_fp_ld(s, rt, tcg_addr, size); + do_fp_ld(s, rt, clean_addr, size); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); if (is_store) { - do_gpr_st(s, tcg_rt, tcg_addr, size, + do_gpr_st(s, tcg_rt, clean_addr, size, true, rt, iss_sf, false); } else { - do_gpr_ld(s, tcg_rt, tcg_addr, size, is_signed, is_extended, + do_gpr_ld(s, tcg_rt, clean_addr, size, is_signed, is_extended, true, rt, iss_sf, false); } } @@ -3123,7 +3140,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, int rs = extract32(insn, 16, 5); int rn = extract32(insn, 5, 5); int o3_opc = extract32(insn, 12, 4); - TCGv_i64 tcg_rn, tcg_rs; + TCGv_i64 tcg_rs, clean_addr; AtomicThreeOpFn *fn; if (is_vector || !dc_isar_feature(aa64_atomics, s)) { @@ -3166,7 +3183,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, if (rn == 31) { gen_check_sp_alignment(s); } - tcg_rn = cpu_reg_sp(s, rn); + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); tcg_rs = read_cpu_reg(s, rs, true); if (o3_opc == 1) { /* LDCLR */ @@ -3176,7 +3193,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, /* The tcg atomic primitives are all full barriers. Therefore we * can ignore the Acquire and Release bits of this instruction. */ - fn(cpu_reg(s, rt), tcg_rn, tcg_rs, get_mem_index(s), + fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s), s->be_data | size | MO_ALIGN); } @@ -3201,7 +3218,7 @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn, bool is_wback = extract32(insn, 11, 1); bool use_key_a = !extract32(insn, 23, 1); int offset; - TCGv_i64 tcg_addr, tcg_rt; + TCGv_i64 clean_addr, dirty_addr, tcg_rt; if (size != 3 || is_vector || !dc_isar_feature(aa64_pauth, s)) { unallocated_encoding(s); @@ -3211,29 +3228,31 @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn, if (rn == 31) { gen_check_sp_alignment(s); } - tcg_addr = read_cpu_reg_sp(s, rn, 1); + dirty_addr = read_cpu_reg_sp(s, rn, 1); if (s->pauth_active) { if (use_key_a) { - gen_helper_autda(tcg_addr, cpu_env, tcg_addr, cpu_X[31]); + gen_helper_autda(dirty_addr, cpu_env, dirty_addr, cpu_X[31]); } else { - gen_helper_autdb(tcg_addr, cpu_env, tcg_addr, cpu_X[31]); + gen_helper_autdb(dirty_addr, cpu_env, dirty_addr, cpu_X[31]); } } /* Form the 10-bit signed, scaled offset. */ offset = (extract32(insn, 22, 1) << 9) | extract32(insn, 12, 9); offset = sextract32(offset << size, 0, 10 + size); - tcg_gen_addi_i64(tcg_addr, tcg_addr, offset); + 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); tcg_rt = cpu_reg(s, rt); - - do_gpr_ld(s, tcg_rt, tcg_addr, size, /* is_signed */ false, + do_gpr_ld(s, tcg_rt, clean_addr, size, /* is_signed */ false, /* extend */ false, /* iss_valid */ !is_wback, /* iss_srt */ rt, /* iss_sf */ true, /* iss_ar */ false); if (is_wback) { - tcg_gen_mov_i64(cpu_reg_sp(s, rn), tcg_addr); + tcg_gen_mov_i64(cpu_reg_sp(s, rn), dirty_addr); } } @@ -3301,7 +3320,7 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) bool is_store = !extract32(insn, 22, 1); bool is_postidx = extract32(insn, 23, 1); bool is_q = extract32(insn, 30, 1); - TCGv_i64 tcg_addr, tcg_rn, tcg_ebytes; + TCGv_i64 clean_addr, tcg_rn, tcg_ebytes; TCGMemOp endian = s->be_data; int ebytes; /* bytes per element */ @@ -3379,8 +3398,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); - tcg_addr = tcg_temp_new_i64(); - tcg_gen_mov_i64(tcg_addr, tcg_rn); + clean_addr = clean_data_tbi(s, tcg_rn); tcg_ebytes = tcg_const_i64(ebytes); for (r = 0; r < rpt; r++) { @@ -3390,14 +3408,15 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) for (xs = 0; xs < selem; xs++) { int tt = (rt + r + xs) % 32; if (is_store) { - do_vec_st(s, tt, e, tcg_addr, size, endian); + do_vec_st(s, tt, e, clean_addr, size, endian); } else { - do_vec_ld(s, tt, e, tcg_addr, size, endian); + do_vec_ld(s, tt, e, clean_addr, size, endian); } - tcg_gen_add_i64(tcg_addr, tcg_addr, tcg_ebytes); + tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); } } } + tcg_temp_free_i64(tcg_ebytes); if (!is_store) { /* For non-quad operations, setting a slice of the low @@ -3416,13 +3435,11 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) if (is_postidx) { int rm = extract32(insn, 16, 5); if (rm == 31) { - tcg_gen_mov_i64(tcg_rn, tcg_addr); + tcg_gen_addi_i64(tcg_rn, tcg_rn, rpt * elements * selem * ebytes); } else { tcg_gen_add_i64(tcg_rn, tcg_rn, cpu_reg(s, rm)); } } - tcg_temp_free_i64(tcg_ebytes); - tcg_temp_free_i64(tcg_addr); } /* AdvSIMD load/store single structure @@ -3464,7 +3481,7 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) bool replicate = false; int index = is_q << 3 | S << 2 | size; int ebytes, xs; - TCGv_i64 tcg_addr, tcg_rn, tcg_ebytes; + TCGv_i64 clean_addr, tcg_rn, tcg_ebytes; switch (scale) { case 3: @@ -3515,8 +3532,7 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) } tcg_rn = cpu_reg_sp(s, rn); - tcg_addr = tcg_temp_new_i64(); - tcg_gen_mov_i64(tcg_addr, tcg_rn); + clean_addr = clean_data_tbi(s, tcg_rn); tcg_ebytes = tcg_const_i64(ebytes); for (xs = 0; xs < selem; xs++) { @@ -3524,7 +3540,7 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) /* Load and replicate to all elements */ TCGv_i64 tcg_tmp = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(tcg_tmp, tcg_addr, + tcg_gen_qemu_ld_i64(tcg_tmp, clean_addr, get_mem_index(s), s->be_data + scale); tcg_gen_gvec_dup_i64(scale, vec_full_reg_offset(s, rt), (is_q + 1) * 8, vec_full_reg_size(s), @@ -3533,25 +3549,24 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) } else { /* Load/store one element per register */ if (is_load) { - do_vec_ld(s, rt, index, tcg_addr, scale, s->be_data); + do_vec_ld(s, rt, index, clean_addr, scale, s->be_data); } else { - do_vec_st(s, rt, index, tcg_addr, scale, s->be_data); + do_vec_st(s, rt, index, clean_addr, scale, s->be_data); } } - tcg_gen_add_i64(tcg_addr, tcg_addr, tcg_ebytes); + tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); rt = (rt + 1) % 32; } + tcg_temp_free_i64(tcg_ebytes); if (is_postidx) { int rm = extract32(insn, 16, 5); if (rm == 31) { - tcg_gen_mov_i64(tcg_rn, tcg_addr); + tcg_gen_addi_i64(tcg_rn, tcg_rn, selem * ebytes); } else { tcg_gen_add_i64(tcg_rn, tcg_rn, cpu_reg(s, rm)); } } - tcg_temp_free_i64(tcg_ebytes); - tcg_temp_free_i64(tcg_addr); } /* Loads and stores */ From patchwork Thu Jan 10 12:49:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155156 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1861534jaa; Thu, 10 Jan 2019 04:55:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN5krElfzwHBWt0asRLqdovFhZ4FHOC47aoKsqqtRZyabX/4DBeGJYQabNcjlFo7SP1w8aS1 X-Received: by 2002:a5d:488f:: with SMTP id g15mr9044070wrq.15.1547124950095; Thu, 10 Jan 2019 04:55:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547124950; cv=none; d=google.com; s=arc-20160816; b=Q2iVQh+yHZ03fFPJKLEwsMN28W21OXuSvp3w6ykcNHwgDdfVuqHFnaZ1OVsVwDj5QD /Aay7hsP9rjkV657gG8XsxvVzu9vqimzoPiuAnTZHF4TNPOkFRkmS+r2KGBmtuC1AVDs wslqaVopLTct0Zzgz8JMBNsr4gUmU2+OjThwTrxLhZzIxoPa9l8ffUqYu7hz3bBFDo1e r6GFnBQMRvd1QHXwcOWkMNr4BZIMBWpNstJGPkCMxtGzA2lDrEuImqGJQp9ICT0Ge/E5 f1eXUUwbCiTVseHd+gttG+VQAc5Jn82J/itwc0Q9cGjVvhMuuVjsIAXfZ7OEGay1E7RL uBOQ== 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=Lgpz8q+muFznxKLaWMgdH+QvhIvbcK4cjoZjSmcuDjg=; b=t07uukLhRbVLcOzUS86V98A2ad7hWRbEXePRWl5xZcJh7VTPCmi8Hdqus6Frx4UIOI GCIntpJE8vCS76zWBid5oAg29jnoMSRKJEMFxxR7Sx8Ihs4kYMQafY2/K4m1OqTc/Gg2 0LRch6B46vCumkzCPZRkbRZ7sHZrWaBpobX2g+9EfaH2gba4QjmQtnOZDwKCL2hYHXzG +SoaA6rJU06pdYW5+7HoQhVUioctPmjREcpejIRvKH2AccxCyyCtnjTteBJo6Ymeureo tl/XXApVzOJCAZVt8CBKD6K/FZgcImAfVBFNc7owaTGkX9MXotzPhAtdrmw8ve2TP5x5 V5Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Uid/lklz"; 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 f15si43039633wrr.220.2019.01.10.04.55.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 Jan 2019 04:55:50 -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="Uid/lklz"; 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]:37692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZsC-0007iO-Vs for patch@linaro.org; Thu, 10 Jan 2019 07:55:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZmh-0003Q4-ST for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghZmh-0007Bs-1z for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:07 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:41149) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghZmg-00079z-Sc for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:06 -0500 Received: by mail-pf1-x444.google.com with SMTP id b7so5263526pfi.8 for ; Thu, 10 Jan 2019 04:50:06 -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=Lgpz8q+muFznxKLaWMgdH+QvhIvbcK4cjoZjSmcuDjg=; b=Uid/lklzKYYOiyR5eu4jRLu3OhCiA1mZLad+uRRHymK+MjTO8DluOYwhYf2RtypCIg bsFwJNHEpMkSERXwNegxN/1CmiGqmcUvmpoTvEZrcCyyA3Fmqur/xVNPlx0wQLuzGvrH kqBvygISLCZeey5lPk/xpoKJdMgaaqPfTBCdM= 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=Lgpz8q+muFznxKLaWMgdH+QvhIvbcK4cjoZjSmcuDjg=; b=IyOGkUeCTlvd37XwWcBJ0iJ4fftvaV1/A4eIirfmseSo3O5oytC6+wtr0ti6w4z/7V W/bmSxiTMt7CLglzVIHiXcTuOJZXALrWYP70L6wGh2ZI6VtlsOs5ao7kmNKv8jS1ZTmQ SZGLGWGncweHoWqY4/laOoZvcC84jrXqKYFMmMQs5BH5XA6frbu6O3rvoMFYVZzeVLhJ GRR+RMCQcZn0aN0d+JOZmXLo71/B0I4KNle28AaTC4DMeIVePVil13kbAXbGaI/VMRsR V83AU6xvEv7yXjyvzNBXHr2v0+zTCXv+tYhn11/whfUl9e8JtksAWB/9pIJPvcGHvaN9 3jPA== X-Gm-Message-State: AJcUukekDqCiLP5zdBJCUsnALUxvQBfXOlyVKEdvLogLImeYcnNka5AG mSESdR1Ql5vyBxIJaWrLUP5MhRQ9gc+ZJw== X-Received: by 2002:a63:6346:: with SMTP id x67mr7060533pgb.183.1547124605250; Thu, 10 Jan 2019 04:50:05 -0800 (PST) Received: from cloudburst.twiddle.net (c220-239-117-135.belrs4.nsw.optusnet.com.au. [220.239.117.135]) by smtp.gmail.com with ESMTPSA id g28sm132656016pfd.100.2019.01.10.04.50.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 04:50:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 23:49:50 +1100 Message-Id: <20190110124951.15473-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190110124951.15473-1-richard.henderson@linaro.org> References: <20190110124951.15473-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::444 Subject: [Qemu-devel] [PATCH 3/4] target/arm: Compute TB_FLAGS for TBI for user-only 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" Enables, but does not turn on, TBI for CONFIG_USER_ONLY. Signed-off-by: Richard Henderson --- target/arm/internals.h | 21 --------------------- target/arm/helper.c | 13 ++++++------- 2 files changed, 6 insertions(+), 28 deletions(-) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/target/arm/internals.h b/target/arm/internals.h index d01a3f9f44..a4bd1becb7 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -963,30 +963,9 @@ typedef struct ARMVAParameters { bool using64k : 1; } ARMVAParameters; -#ifdef CONFIG_USER_ONLY -static inline ARMVAParameters aa64_va_parameters_both(CPUARMState *env, - uint64_t va, - ARMMMUIdx mmu_idx) -{ - return (ARMVAParameters) { - /* 48-bit address space */ - .tsz = 16, - /* We can't handle tagged addresses properly in user-only mode */ - .tbi = false, - }; -} - -static inline ARMVAParameters aa64_va_parameters(CPUARMState *env, - uint64_t va, - ARMMMUIdx mmu_idx, bool data) -{ - return aa64_va_parameters_both(env, va, mmu_idx); -} -#else ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va, ARMMMUIdx mmu_idx); ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, ARMMMUIdx mmu_idx, bool data); -#endif #endif diff --git a/target/arm/helper.c b/target/arm/helper.c index 8c28c6d044..0ceb1fa2b8 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6549,7 +6549,7 @@ uint32_t HELPER(rbit)(uint32_t x) return revbit32(x); } -#if defined(CONFIG_USER_ONLY) +#ifdef CONFIG_USER_ONLY /* These should probably raise undefined insn exceptions. */ void HELPER(v7m_msr)(CPUARMState *env, uint32_t reg, uint32_t val) @@ -8923,6 +8923,7 @@ void arm_cpu_do_interrupt(CPUState *cs) cs->interrupt_request |= CPU_INTERRUPT_EXITTB; } } +#endif /* !CONFIG_USER_ONLY */ /* Return the exception level which controls this address translation regime */ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) @@ -9084,6 +9085,7 @@ static inline bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx) } } +#ifndef CONFIG_USER_ONLY /* Translate section/page access permissions to page * R/W protection flags * @@ -9771,6 +9773,7 @@ static uint8_t convert_stage2_attrs(CPUARMState *env, uint8_t s2attrs) return (hiattr << 6) | (hihint << 4) | (loattr << 2) | lohint; } +#endif /* !CONFIG_USER_ONLY */ ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va, ARMMMUIdx mmu_idx) @@ -9841,6 +9844,7 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, return ret; } +#ifndef CONFIG_USER_ONLY static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va, ARMMMUIdx mmu_idx) { @@ -13087,11 +13091,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, *pc = env->pc; flags = FIELD_DP32(flags, TBFLAG_ANY, AARCH64_STATE, 1); -#ifndef CONFIG_USER_ONLY - /* - * Get control bits for tagged addresses. Note that the - * translator only uses this for instruction addresses. - */ + /* Get control bits for tagged addresses. */ { ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx); ARMVAParameters p0 = aa64_va_parameters_both(env, 0, stage1); @@ -13110,7 +13110,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags = FIELD_DP32(flags, TBFLAG_A64, TBII, tbii); flags = FIELD_DP32(flags, TBFLAG_A64, TBID, tbid); } -#endif if (cpu_isar_feature(aa64_sve, cpu)) { int sve_el = sve_exception_el(env, current_el); From patchwork Thu Jan 10 12:49:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155155 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1859782jaa; Thu, 10 Jan 2019 04:53:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN7dSPhSZnwsJj3xn0hmvc2STenk8iw77g0fPKhYScmO9sE5xY6AO6LsMf+fk6stKmhIbqUQ X-Received: by 2002:a1c:df46:: with SMTP id w67mr10077790wmg.51.1547124798242; Thu, 10 Jan 2019 04:53:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547124798; cv=none; d=google.com; s=arc-20160816; b=FoTCIeU/HcasVKn/8RIeA87hFCCTwhuyY5Lydz88/iIh2Bs3nvaVGth5GF6260j0xd gltc1KNd90kqUgF8OvDVJQzXq1OvZG/eE1x73fF2m5uOpiZfXfOXSIZIX6j1BrC/z1z8 Ru/0QVZRzmzbt5AaSQQGZUQ4EiS9NpSLteY62xx/hPaMvsjuI8U928W8JvYnEi2h0FYY 1a/aJuI+KI2lATrjo/3bf7gxUEVUEnBtzOV42Bj87DKLLrsoHB4/58jw6wWu4QVRBC+L fcWNbsk3H9fnqE05EsnvBoizdSQ/cg8q/NzoRjPo3CHHwxOWqAoXErrC7BURI2mHpfrD KkhA== 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=gWMN06resPZXoHAK8JhnRzlcGJaOLJwrfdNNmZFKbB8=; b=as6BWQg/O1/zH65io7YTSKwYDcUqSi9/R8wXhG0/eTEZjm7dGnvjgvEU8a50dxXHrr zxhGUEtXn8Je4qNm5Gx+f7zbAfS3gKFWa9PVbpfTul/BlsFzsbiTnZpGqs5u2N0bk0B4 aEilZwTbcSuuOWlXEohn3J5i9yoPTQ3xmXxvCe54PHdX0riuHejOugqOEeR8q7Q/+Qbk cCDn9CITcT5jMhoK16sthgqbozbNcxsAzxlmP4yLyfZxTxImyfQHQ4AtoBhPaHcLnG8v hlUy5cqy1ITfLUr/tslMakz8U6KCU9N6jvkyvnM4ALrYB8r1REI6Gm6iD+ONg+W5wouh nMkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=N2QiAF4j; 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 z17si41543761wrp.53.2019.01.10.04.53.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 Jan 2019 04:53:18 -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=N2QiAF4j; 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]:37033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZpl-0005Fr-91 for patch@linaro.org; Thu, 10 Jan 2019 07:53:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZmj-0003Re-T5 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghZmj-0007Eb-5c for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:09 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:45225) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghZmi-0007EM-WB for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:50:09 -0500 Received: by mail-pl1-x644.google.com with SMTP id a14so5135581plm.12 for ; Thu, 10 Jan 2019 04:50:08 -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=gWMN06resPZXoHAK8JhnRzlcGJaOLJwrfdNNmZFKbB8=; b=N2QiAF4j9j9+9kTNuM264OisPOYmhcc8KO2N5mbc9ReXajoygLtC47ej6s3WaUfCoO XjjUDN5I4x3KebJa4JWppk75bUDZnuGkKlgeYurIxsXnn4caqDdnu8y2ijp3bSKyryve 4VNqqE1A5A8ctJxO2jFfOeK6duCHXvIyi9Zi4= 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=gWMN06resPZXoHAK8JhnRzlcGJaOLJwrfdNNmZFKbB8=; b=KNTx9ULgqg5DvIl9a3mnl++q8gZb2So3govexMFxWBT+sKttIg5J/IILtaNVfn2t2X mApQ2/4T6YCSKesjYVuzCHM6yRAWfLwkDVIGhhVReLgJe71HtqirlTyT2iREjpm3RvEQ 4MYEX2iUpd5lz8GMA3EyVVeMjtmg2QGm6YpnRSS4COrzDa9mgBVG3fV/K7myu50vE0nh mwps5ght3IgklLhK7+uEl6bLWC2ronoC1SfrvtU79QS+cY8OCA2KzQU2g1w4m4CMOkrO l0nJ41f7kXv/H8Uk61PWpREzXtpci1w/cGd8pStxlwzOwoOMGSHYGdfRl4MFY0z2sLRZ B4UQ== X-Gm-Message-State: AJcUukfiVUcKH1L2r2Vx2+vXgpIbV9mb0LtKFN+NOonAXoOSxeOXNZ6r /vyfDoVy9/W8otz/PNBOLQpc9btoA6MoPw== X-Received: by 2002:a17:902:9a47:: with SMTP id x7mr9102907plv.126.1547124607749; Thu, 10 Jan 2019 04:50:07 -0800 (PST) Received: from cloudburst.twiddle.net (c220-239-117-135.belrs4.nsw.optusnet.com.au. [220.239.117.135]) by smtp.gmail.com with ESMTPSA id g28sm132656016pfd.100.2019.01.10.04.50.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 04:50:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 23:49:51 +1100 Message-Id: <20190110124951.15473-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190110124951.15473-1-richard.henderson@linaro.org> References: <20190110124951.15473-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::644 Subject: [Qemu-devel] [PATCH 4/4] target/arm: Enable TBI for user-only 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" This has been enabled in the linux kernel since v3.11 (commit d50240a5f6cea, 2013-09-03, "arm64: mm: permit use of tagged pointers at EL0"). Signed-off-by: Richard Henderson --- target/arm/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 14bc24a35a..5eff6995ee 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -174,6 +174,12 @@ static void arm_cpu_reset(CPUState *s) env->vfp.zcr_el[1] = cpu->sve_max_vq - 1; env->vfp.zcr_el[2] = env->vfp.zcr_el[1]; env->vfp.zcr_el[3] = env->vfp.zcr_el[1]; + /* + * Enable TBI0 and TBI1. While the real kernel only enables TBI0, + * turning on both here will produce smaller code and otherwise + * make no difference to the user-level emulation. + */ + env->cp15.tcr_el[1].raw_tcr = (3ULL << 37); #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) {