Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBB0BC433F5 for ; Wed, 16 Feb 2022 17:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+MVfUELCkkYVEdMq8+DWNLFATUJwdEBIglXbPwkQa3U=; b=e8nKtIqEAXDj+5 Bw9tcF8ptv+2RXFLvQhZujfhfSggYXwu6p5W84YoWyp4H8WVprY3gMrUr7eBtdnQd1UnvWmGJtPqW TIsxctnkw0XKj+OxWe2JQHVvbGIWmrBRNCfs6lljbbcbp9hPTo+oqR4hN5sk/SQXO+SYWVapWgAn7 SDqUpdig/6qXnXwcsPEojmb9lh8V38TCocT2nQO7lPx/pEQWT+I1p5j97tc4COX6kzwWuVUp+z7v5 er6d2mywhvvSrlRZCPNGr4NEcqUFVOhM0KYsDUPNhH9xyQNPJTupa92enYqMJnRWIUtwEl8Z7ir3T 0yr3c62O2XfTFq7dtvVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKOBP-007y72-0u; Wed, 16 Feb 2022 17:33:39 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKOB0-007y0S-55 for linux-arm-kernel@lists.infradead.org; Wed, 16 Feb 2022 17:33:15 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 843E0B81F70; Wed, 16 Feb 2022 17:33:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FF90C340F0; Wed, 16 Feb 2022 17:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645032790; bh=3KAUrHxOaxounVGEq3l6GO6esVhGzRAWOAvg2LFMugc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjXZ+I3UzH1tLPiIVFvFAUVUFUHyOufO4FbLXMbCd4ErRInive/NP3UYhpw7tDV5I pruPutIfr/qHv4ZztA3WZC+A6EHlSw/Z2MxiH7O6C0J7IPmJqCuoQfjPtzwpkjkskE ELeNySUSKP2sfefsk0e084vl2DLvyeGvAGHkuApD2sB2e6LlTyCv3TcdvnmqK5GyKe TPRMAe01MCnDK4XboALeiu4FVkgnbDTibH6G/XHt1k3ebC9XZOCgK1hwGiKNRaeIly T+wqFJHhEhiEuYvxfPHxvdD+x+mbnvNLPMAO06mRZ9XKmUwkEJcr8d1S4rAFFyiEky AEeN1EaMi1QCw== From: Mark Brown To: Catalin Marinas , Will Deacon Cc: Joey Gouly , Branislav Rankov , Vincenzo Frascino , linux-arm-kernel@lists.infradead.org, Mark Brown , Vincenzo Frascino Subject: [PATCH v2 2/4] arm64/mte: Add a little bit of documentation for mte_update_sctlr_user() Date: Wed, 16 Feb 2022 17:32:22 +0000 Message-Id: <20220216173224.2342152-3-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220216173224.2342152-1-broonie@kernel.org> References: <20220216173224.2342152-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1647; h=from:subject; bh=3KAUrHxOaxounVGEq3l6GO6esVhGzRAWOAvg2LFMugc=; b=owGbwMvMwMWocq27KDak/QLjabUkhiReU9XfsVsKz/14EWqpF1owU27SF+uIkCm1IRl37WKZkpX5 Krw7GY1ZGBi5GGTFFFnWPstYlR4usXX+o/mvYAaxMoFMYeDiFICJlJmw/9M6/mzhnOxvnavr1l/fVv jqhPuWwBM6wk/O9slW6+5M/RlveZohOisnqCKIwb3pd7GRcOiajcdXzjA2zvwtbaCVprqh2IHDOerS qfnq+bUBBfs/KbzW9NY/cLBbVGOGBZ92B9O7rzI7L7/nejenxfOXK7P3qo1rly8Jdpn88U8Vwwlj+Q IzHubkiWpG7zR+5b3Xm8+zQubg+RcvjDX+SfE4tPX6bmt/wJa3ZIO1Y15dizkHDzP/tdP8Adybax2W W39sW63WPo0jpOJXusSdxM7vZZaHGdJ7nuy7MG1OqGKv1v8ADlMdPsupnFovdfYK7fjnVO5vHJG0qT r9YeVT5qpJSk9dVjXIOj97+mE6AA== X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220216_093314_573917_0A382276 X-CRM114-Status: GOOD ( 14.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The code isn't that obscure but it probably won't hurt to have a little bit more documentation for anyone trying to find out where everything actually takes effect. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas Reviewed-by: Vincenzo Frascino Tested-by: Branislav Rankov --- arch/arm64/kernel/mte.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c index f418ebc65f95..fa4001fee12a 100644 --- a/arch/arm64/kernel/mte.c +++ b/arch/arm64/kernel/mte.c @@ -186,6 +186,11 @@ void mte_check_tfsr_el1(void) } #endif +/* + * This is where we actually resolve the system and process MTE mode + * configuration into an actual value in SCTLR_EL1 that affects + * userspace. + */ static void mte_update_sctlr_user(struct task_struct *task) { /* @@ -199,8 +204,17 @@ static void mte_update_sctlr_user(struct task_struct *task) unsigned long pref, resolved_mte_tcf; pref = __this_cpu_read(mte_tcf_preferred); + /* + * If there is no overlap between the system preferred and + * program requested values go with what was requested. + */ resolved_mte_tcf = (mte_ctrl & pref) ? pref : mte_ctrl; sctlr &= ~SCTLR_EL1_TCF0_MASK; + /* + * Pick an actual setting. The order in which we check for + * set bits and map into register values determines our + * default order. + */ if (resolved_mte_tcf & MTE_CTRL_TCF_ASYNC) sctlr |= SCTLR_EL1_TCF0_ASYNC; else if (resolved_mte_tcf & MTE_CTRL_TCF_SYNC) -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel