From patchwork Thu Mar 7 17:04:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 159905 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7689129jad; Thu, 7 Mar 2019 09:22:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwScvOKRb0rDmtxAi2jlcJxiwf72yCL+873C06IshWWGJHmvfp/U3/UZhvoBNyAaFw+NZ3D X-Received: by 2002:a81:4907:: with SMTP id w7mr11140136ywa.150.1551979361454; Thu, 07 Mar 2019 09:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551979361; cv=none; d=google.com; s=arc-20160816; b=JPJEmsqtmYQbBZUuZRWwdkaUhPdghbbDVWQjy5uq17pOxi7FjXnJXZPaMsEG3rzWFa 9XV9yaG0PGBnHiclGCjSmoYG+en/e7On+T76TgtYqpC3fztSlZINhvTmyRlEqxwJ9NMT X5tKB979JfkbPzpnP8nx/T1aWJQz730xzoH70wIFSRLubhGUVoaIaMFq3T1QHLOWbWjb OL/e70IOgRgJ1uwOgxwcs2YNW9Lk8ghtUHLv/IqC3pOeQ6UIHIWif75+tb6luUXPmtag OITGXIBzw8I2BjEAYyFiI28PTj02erLPDZxDzzCVCdSiLOzypKPRdvK5GMUmNO+P7Rwv dA+A== 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=kZSCj41zsLv3G3Z37H9nlBKFYKrUJPFTvgfq0XY5xHA=; b=g0bmmvhJS3T9DjBqSM+9ZqjI4bHDeghRYWbBU/9y+d+rwT1EV4nKrGBXONDROZeDpP SBMY9k47FtyY+Vg5r7NSWV+2g3zT1s++bzKKeaKJBCeOrEmcRkX8uhfJSdwPNVur1aA2 BkAEe0VM783zrmawDzJqqDexEBt7+AEWhGXV95oSQW57sP7TBfXtKvW8+xzaA0V75JrL UVbg/qN/ivg6nUCWWkKqCYkLeZZcI+tuWcsErcO04o2slMZUMWsCetFsEVq+M/9UtNgU aw3A4bhaBjiEdc/kh88eilsIZUCXeRvNjHQS3bHBPegaCJLMTTi4AdtuOmDjvLoX67dH eckw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ghDXqfWz; 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 k124si3158169ybb.117.2019.03.07.09.22.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Mar 2019 09:22: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=ghDXqfWz; 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]:55862 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wjA-0003nW-RZ for patch@linaro.org; Thu, 07 Mar 2019 12:22:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wT5-0007A2-9c for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wSu-0005mV-6d for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:05:58 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:46061) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wSl-0004i0-U5 for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:05:44 -0500 Received: by mail-pg1-x543.google.com with SMTP id 125so11496549pgc.12 for ; Thu, 07 Mar 2019 09:05: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=kZSCj41zsLv3G3Z37H9nlBKFYKrUJPFTvgfq0XY5xHA=; b=ghDXqfWzZE+8kDXRJs8DpKYVc/a/u/TU2+AEBj73VaNaFVP24Y1grLG5oSdiI6IRrb IQqLa8ymkWntdsoVuWQtGT4uf4nVzTR4hD8be3Q/L25Sxcd9Lg2PwK6JBxTfYXfYfN/z 1PPdPfBFg7ZMfa9WBWoqm4SfJM5a0DRLQuvfCgfiZtwK2huVWHkPGpGCgBuS25ubc29t YnaUBAkUoFnYo82/YHfQpu2EZE+vNRIKpMxH7u7pYWHCgCepx/IniRdaCu1+PoNlRBE/ sPF37zzru073PStQeCw+KX6fBxwXXv+PTflR4CA5Q13ZQR0uEkQ+2MLTVrveYyFAWeM1 Dkeg== 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=kZSCj41zsLv3G3Z37H9nlBKFYKrUJPFTvgfq0XY5xHA=; b=adzb1nY1WdgjAdJwz87TiZU2P3fOYw9XIQK7RvnNI+a4Zwkfd9X3apXUiQbUvwIZ5F Z/P3IWR3Dza7TUq2Q4GtehZWywoKWhdXQ6o6863w5mrCkj5hMfCcToIwauNqfhrVwQRa QQ2k781tWUP80faB2YkyBivZRS1gf4cNkEJUMk8RtZJ1dvVRXhgdZ4XpeZ35whhbblie CFeI7PTpGUWxJQIAPY4jjg02YUVlNK745tqlwBrzULKlZe2gCT0w545xjnPtfznk187H abo2tH535CojEbDk4tDqatluBaldYwC2yHmjhwZBrykSN/ioD2HRP8muO6l4jyNhM2y9 Xstw== X-Gm-Message-State: APjAAAW7V3fmAFzbZUX94eXmNJQw/gy70lz6bZ4U6xgxrkmbQS9fh4Zb JXgpTMXG/bw/GKX9zj4dUqrfRhFkOJ8= X-Received: by 2002:a63:6b45:: with SMTP id g66mr12502402pgc.301.1551978304882; Thu, 07 Mar 2019 09:05:04 -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.05.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Mar 2019 09:05:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 09:04:36 -0800 Message-Id: <20190307170440.3113-19-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::543 Subject: [Qemu-devel] [PATCH v4 18/22] target/arm: Cache the Tagged bit for a page in MemTxAttrs 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 "bit" is a particular value of the page's MemAttr. Signed-off-by: Richard Henderson --- target/arm/helper.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) -- 2.17.2 diff --git a/target/arm/helper.c b/target/arm/helper.c index a529d30700..fcab7f99be 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10892,6 +10892,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, uint64_t descaddrmask; bool aarch64 = arm_el_is_aa64(env, el); bool guarded = false; + uint8_t memattr; /* TODO: * This code does not handle the different format TCR for VTCR_EL2. @@ -11122,17 +11123,21 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, txattrs->target_tlb_bit0 = true; } + if (mmu_idx == ARMMMUIdx_S2NS) { + memattr = convert_stage2_attrs(env, extract32(attrs, 0, 4)); + } else { + /* Index into MAIR registers for cache attributes */ + uint64_t mair = env->cp15.mair_el[el]; + memattr = extract64(mair, extract32(attrs, 0, 3) * 8, 8); + } + + /* When in aarch64 mode, and MTE is enabled, remember Tagged in IOTLB. */ + if (aarch64 && memattr == 0xf0 && cpu_isar_feature(aa64_mte, cpu)) { + txattrs->target_tlb_bit1 = true; + } + if (cacheattrs != NULL) { - if (mmu_idx == ARMMMUIdx_S2NS) { - cacheattrs->attrs = convert_stage2_attrs(env, - extract32(attrs, 0, 4)); - } else { - /* Index into MAIR registers for cache attributes */ - uint8_t attrindx = extract32(attrs, 0, 3); - uint64_t mair = env->cp15.mair_el[regime_el(env, mmu_idx)]; - assert(attrindx <= 7); - cacheattrs->attrs = extract64(mair, attrindx * 8, 8); - } + cacheattrs->attrs = memattr; cacheattrs->shareability = extract32(attrs, 6, 2); }