From patchwork Fri Feb 12 18:49:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 381878 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp3202146jah; Fri, 12 Feb 2021 11:29:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9yFN2kPgeFW/42MhzhMmrpBHg/z4YrQRLR1yhx2GY+VmxOwKj0cRosd3RwsTrSh5YxVRo X-Received: by 2002:a25:f20b:: with SMTP id i11mr6431051ybe.273.1613158193181; Fri, 12 Feb 2021 11:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613158193; cv=none; d=google.com; s=arc-20160816; b=U3U19hRALTmcuXanZRsreHzK77xVdew7H6Z2/023ASVtnSojdE1zjgvLdETkDuNLKh ptNmSWcQZg9YOy5QMsgCpxHpSzGWsZe6ZiOgynqgSh1D8ONYfh7jd0P52rKxYWhjUucx 1HWMP+52V9PwK6ixDy+vRPwgAI1EuCbRonGtGNZiCewEWlAOXGdgu9oSWV2GvQ6ap6QY gMkcv+2WxoqkNjn+J6YQPZTc4BAJNKftIAh2cYI7tIWBjThOYpsZ5IvbA9V0HA/x2lx+ LPHpA7LGmuwkOxa/x/lXnrSDjJugrfOtGrDIauS58NgzBIWt0YL93DdsNi1qeyakN4ty pT8w== 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=8yFMudlC6Jtq58F3MWdhR32H45GMT5rfYjMflXhCdac=; b=hjbUMjABGSTNniA6mewMzxu/UxBrht9EMVn/wS8GPduVZdOUV0wn3Em+0/Aw7KFv0Q QR1fWA0O06Nnu3DH5lUePYqyLkYSIERdJ0yxaqH98wBIOE9OvZv3FKJmyWnPV6itMazC UANUCHG0U5M+re7kNWgpj6g5XTULKep1HV/faxJT6hmaIJGD+t4vSAuuAsHdbNnfFV0F KaGkr2ZpH2pf4Jo1QHlXsT3woB1MlKzkCRttTbTmwgTUvaOyEQhgv8TTSzklcZq/6FGX C9weJlaGfK4ct2hhjPnM21vwL+s4TovWglSjqqZ30j1n1U1q+7XtJhquZ2kuPoEo3hKk Jciw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l1VDEOha; 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 f91si9659504ybi.414.2021.02.12.11.29.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Feb 2021 11:29:53 -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=pass header.i=@linaro.org header.s=google header.b=l1VDEOha; 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]:41656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAe8W-0001nf-Ld for patch@linaro.org; Fri, 12 Feb 2021 14:29:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAdVh-00027T-1n for qemu-devel@nongnu.org; Fri, 12 Feb 2021 13:49:45 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:39052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAdVe-0007wx-03 for qemu-devel@nongnu.org; Fri, 12 Feb 2021 13:49:44 -0500 Received: by mail-pg1-x52f.google.com with SMTP id o63so246079pgo.6 for ; Fri, 12 Feb 2021 10:49:41 -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 :mime-version:content-transfer-encoding; bh=8yFMudlC6Jtq58F3MWdhR32H45GMT5rfYjMflXhCdac=; b=l1VDEOhaNNESyEXYSArjVAqbpGttz7E64h7NKXPqbFmOQSOzaGaAAW5hn/1TKgkksf XJHrKo21t7k2RZh/MDheF4NGWsu5dD38HtRE4OJBZ81k4ENOklfgjGdzfi9Y48nhcrbI LLu4waEy6t5FjiyimiGHY4Ol66ws7V9hjELKDtPXKlmOBrk9dtoH9VmtGB/bhTXzrga5 IC1cZuRJBfGirT7+6f10UHeDgx/ZywIS/wYMnwziPok1BuybEqfF3wkC7CIr2sRSrkET B6Jek5tzwjI5APU1Xt5PchJ8QVeaXJQQSinYAnQvTW1yNOCAV6fXx/8EyC+WRcvwXdZO KX/Q== 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=8yFMudlC6Jtq58F3MWdhR32H45GMT5rfYjMflXhCdac=; b=nzaGgdFXCGsW1d4O9AIw23ZluzXDOc6FAQ2v29zNA8DPAIWTCDIlc6Rsrw5gQUso6B YdbmLUpMnbF6+LNpcTbL5IWeE+fj3h3v4Hp58aqG82LTx4hrTbZ+lMZa/IxG6mVfaWb0 +RTkeT3Inxr01MhSi5Bv+7jYWYcoHDQx8ze/4vThmkvhBzJahykjIm7I+jczKzYV3v19 gM15CAXAELZ2QZdKl/LAdReXTsDkDgOmXRirZcabjpVSDuCMcoyt71Xcnk85ZsVZQpK6 Lnb0Hb4NPnhA9Jbt1T1zi4HiQebDqJufSENcgmKZLdEDdb/eJGqAgraVB/2yVAqAEcty RjQw== X-Gm-Message-State: AOAM531GyE9+GNWwp2ibhV4u4AxajicmjUj23V+c0Uq7gipeAfdQ7dCi hnvYSOR1gGFRpSYtXL2uQ2iYWqmgGaSdTQ== X-Received: by 2002:a62:444:0:b029:1bc:ebb6:71f8 with SMTP id 65-20020a6204440000b02901bcebb671f8mr3983384pfe.75.1613155780649; Fri, 12 Feb 2021 10:49:40 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id k5sm9427618pfi.31.2021.02.12.10.49.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 10:49:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 30/31] target/arm: Enable MTE for user-only Date: Fri, 12 Feb 2021 10:49:01 -0800 Message-Id: <20210212184902.1251044-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212184902.1251044-1-richard.henderson@linaro.org> References: <20210212184902.1251044-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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=ham 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.25.1 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 70cfcbc918..b8bc89e71f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -209,6 +209,21 @@ static void arm_cpu_reset(DeviceState *dev) * Note that this must match useronly_clean_ptr. */ env->cp15.tcr_el[1].raw_tcr = (1ULL << 37); + + /* Enable MTE */ + if (cpu_isar_feature(aa64_mte, cpu)) { + /* Enable tag access, but leave TCF0 as No Effect (0). */ + env->cp15.sctlr_el[1] |= SCTLR_ATA0; + /* + * Exclude all tags, so that tag 0 is always used. + * This corresponds to Linux current->thread.gcr_incl = 0. + * + * Set RRND, so that helper_irg() will generate a seed later. + * Here in cpu_reset(), the crypto subsystem has not yet been + * initialized. + */ + env->cp15.gcr_el1 = 0x1ffff; + } #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) {