From patchwork Fri Oct 11 13:47:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 175967 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp800268ill; Fri, 11 Oct 2019 07:03:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFv8pbN/TB7JF7keMGK2ns5YhcoktVgyyrvRJREpLkreb3pumPxghfpCeqg97bkXWclhsA X-Received: by 2002:ad4:4503:: with SMTP id k3mr15359139qvu.155.1570802630412; Fri, 11 Oct 2019 07:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570802630; cv=none; d=google.com; s=arc-20160816; b=jBR+/+fJ3VSzOpANamcL9/EC7JwKCGBLDuv6VVWuYfess5xvGZ2yyOMzF4tcuglqAY /MZy6E5lRrOGmTDmXEu8Bee74if+koqdRTh6V99rHq0qiB52fBecznPoxSIHfq7uDlNk IwPFiWRdCnlxoti2oVAp8i/0MhkV/jylUaFy3Y5ctXzkt4t53RygPwaGkztJBeDT16xy X5LVxEmwAs+wAlLVxV57+oIAUDwJ60UMt9TLilqLnwl+Wd2V3UL4cdgTBF1VydzWRclQ 83cAiOzew/dWNy1XCc9tSyNzd8xsfZ/JApz6W8GlJS3yO7gwX4U6Xfg6x+CPeovabyq/ CX7g== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=XGJIZDe8e48mjnd3S1UnH/xuMhjquSRYJ/YgYFRxSl4=; b=y05fjx9ZDuBwHI4dOEvxrcLbKuiPCIzRE6NVec7mVr3VS3ZaMdTMG3/UwIK2Mq4qNb Kos86LyrPV04EYnLJIHyku1SDQgBhriTH2cvvNQwDYz8F1FxjRGpWJr2w0M69NHL5df1 Ub70ro7WowIOQrcOu9lD+0CjC1VqyxsmVK2HzYZu70RsankO9GhHVSlADQckFMbHEcfx C87fTF9DszTw/SaxAFzqlWFMOx2W1dyBR5vzHNGf2LGSkZVBRY1+WRNfGSHUuO77GS3q vJZqS74Kz2Xv11zZ3+oeWlhcfy5k0Ee0yuWKPyuBB00YXZlAogHlVaxNc/Bx2EUOKQx8 u5Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=W6SHTLM1; 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 w48si9048820qth.381.2019.10.11.07.03.50 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Oct 2019 07:03:50 -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=fail header.i=@linaro.org header.s=google header.b=W6SHTLM1; 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 ([::1]:50866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIvWG-0005Vn-Qq for patch@linaro.org; Fri, 11 Oct 2019 10:03:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39303) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIvJM-00064m-25 for qemu-devel@nongnu.org; Fri, 11 Oct 2019 09:50:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iIvJK-00049b-V6 for qemu-devel@nongnu.org; Fri, 11 Oct 2019 09:50:27 -0400 Received: from mail-yb1-xb42.google.com ([2607:f8b0:4864:20::b42]:46086) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iIvJK-00049M-Rc for qemu-devel@nongnu.org; Fri, 11 Oct 2019 09:50:26 -0400 Received: by mail-yb1-xb42.google.com with SMTP id h202so3098694ybg.13 for ; Fri, 11 Oct 2019 06:50:26 -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; bh=XGJIZDe8e48mjnd3S1UnH/xuMhjquSRYJ/YgYFRxSl4=; b=W6SHTLM1x7e1T4AuRr+qe1lW5dgNk0JSG4O6ttxTNvnWs2DoR4p80QHSkJ5IGkf17R w2a1AAZX4NwS1586L6OGsSubrOml5J5is/pFeobTC+rVhll7oaiXCN3Ahq7ziuAbKK/y 7hA105SQYNrRHpCTot1wFywnaDN4IEMqc4HqlnezwsYtDlNGJRYqqOIEeCXppHrT+r4O j2KZX7qk/v4mNoLDyXO3PKf5wGEi2JwpQA6kkw5OqmbENZatIPElawjV8rWzqglyz4Jc AT1LQwU2ZLlu4za50/KHujxayAZdN1ZsbPSVKZH0X9ZOXxAPVzmhKLpKfXlhYcKieXnf 0quA== 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=XGJIZDe8e48mjnd3S1UnH/xuMhjquSRYJ/YgYFRxSl4=; b=lJJ2uCFdwbMPy409BZCwq9vxZoAdFE5/DwpOtgdFgl+0xSccqO6pYtS/iylzWMczwQ 6nqJCMK81JL0pyIFlzBuTHxQgOpzjkOlT4oqDUcxVjO5725MoQyu/OIOzxPudeXUdHzx bVBD0/WeYPCGJmN6f99JsUICbH5SfL94toKPa/8WPon16dno2Onf6uieQonKFXxsOOZU Q/9SJhp0MW8fQVCTkMBxvtaV5kAmaqeYxEN9Xl4QIUhLo4SvbjXLh9FqSj/VscfJ1Yv9 qJOBHzL5MOO0VI3kszfVAE+aaYZy9JlejGFfOWVogPDWiK7kGRQWUrgCcJYP1V3owlj1 xlIA== X-Gm-Message-State: APjAAAWsEQ5jBfzB1C2SMtrGHr7eSnykU3E0Gef80ere152DKQOzKov2 nfmjmO5bK0l1kJlDotuj7/nDlMYl034= X-Received: by 2002:a25:3041:: with SMTP id w62mr10789764ybw.67.1570801825958; Fri, 11 Oct 2019 06:50:25 -0700 (PDT) Received: from cloudburst.gateway.pace.com (67.216.151.25.pool.hargray.net. [67.216.151.25]) by smtp.gmail.com with ESMTPSA id f68sm2534000ywb.96.2019.10.11.06.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2019 06:50:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 18/22] target/arm: Enable MTE Date: Fri, 11 Oct 2019 09:47:40 -0400 Message-Id: <20191011134744.2477-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011134744.2477-1-richard.henderson@linaro.org> References: <20191011134744.2477-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::b42 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: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We now implement all of the components of MTE, without actually supporting any tagged memory. All MTE instructions will work, trivially, so we can enable support. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 10 ++++++++++ target/arm/cpu64.c | 1 + 2 files changed, 11 insertions(+) -- 2.17.1 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 2399c14471..12fffa3ee4 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -209,6 +209,16 @@ static void arm_cpu_reset(CPUState *s) * make no difference to the user-level emulation. */ env->cp15.tcr_el[1].raw_tcr = (3ULL << 37); + /* Enable MTE allocation tags. */ + env->cp15.hcr_el2 |= HCR_ATA; + env->cp15.scr_el3 |= SCR_ATA; + env->cp15.sctlr_el[1] |= SCTLR_ATA0; + /* Enable synchronous tag check failures. */ + env->cp15.sctlr_el[1] |= 1ull << 38; +#ifdef TARGET_AARCH64 + /* Set MTE seed to non-zero value, otherwise RandomTag fails. */ + env->cp15.rgsr_el1 = 0x123400; +#endif #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) { diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index d7f5bf610a..ac1e2dc2c4 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -350,6 +350,7 @@ static void aarch64_max_initfn(Object *obj) t = cpu->isar.id_aa64pfr1; t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); + t = FIELD_DP64(t, ID_AA64PFR1, MTE, 2); cpu->isar.id_aa64pfr1 = t; t = cpu->isar.id_aa64mmfr1;