From patchwork Fri May 15 17:16:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 11552721 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42C00697 for ; Fri, 15 May 2020 17:17:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1771820709 for ; Fri, 15 May 2020 17:17:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1771820709 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 574878E001D; Fri, 15 May 2020 13:17:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 524698E0001; Fri, 15 May 2020 13:17:11 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39F8A8E001D; Fri, 15 May 2020 13:17:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 01F0B8E0001 for ; Fri, 15 May 2020 13:17:10 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A7CCD6D894 for ; Fri, 15 May 2020 17:17:10 +0000 (UTC) X-FDA: 76819609020.10.vest72_46d7b205a743 X-Spam-Summary: 10,1,0,3bfee5f191fe4750,d41d8cd98f00b204,catalin.marinas@arm.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3871:3872:4250:4321:4384:4605:5007:6119:6261:7903:8634:10004:11026:11232:11473:11658:11914:12043:12296:12297:12438:12555:12986:13069:13138:13161:13180:13229:13231:13311:13357:13523:13524:13894:14096:14181:14384:14394:14721:21080:21230:21451:21627:21795:21990:30051:30054:30090,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: vest72_46d7b205a743 X-Filterd-Recvd-Size: 3364 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 May 2020 17:17:10 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CC414113E; Fri, 15 May 2020 10:17:09 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 339633F305; Fri, 15 May 2020 10:17:08 -0700 (PDT) From: Catalin Marinas To: linux-arm-kernel@lists.infradead.org Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, Will Deacon , Dave P Martin , Vincenzo Frascino , Szabolcs Nagy , Kevin Brodsky , Andrey Konovalov , Peter Collingbourne Subject: [PATCH v4 24/26] arm64: mte: Introduce early param to disable MTE support Date: Fri, 15 May 2020 18:16:10 +0100 Message-Id: <20200515171612.1020-25-catalin.marinas@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200515171612.1020-1-catalin.marinas@arm.com> References: <20200515171612.1020-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: For performance analysis it may be desirable to disable MTE altogether via an early param. Introduce arm64.mte_disable and, if true, filter out the sanitised ID_AA64PFR1_EL1.MTE field to avoid exposing the HWCAP to user. Signed-off-by: Catalin Marinas Cc: Will Deacon --- Notes: New in v4. Documentation/admin-guide/kernel-parameters.txt | 4 ++++ arch/arm64/kernel/cpufeature.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index f2a93c8679e8..7436e7462b85 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -373,6 +373,10 @@ arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards Format: ,, + arm64.mte_disable= + [ARM64] Disable Linux support for the Memory + Tagging Extension (both user and in-kernel). + ataflop= [HW,M68k] atarimouse= [HW,MOUSE] Atari Mouse diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index aaadc1cbc006..f7596830694f 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -126,12 +126,23 @@ static void cpu_enable_cnp(struct arm64_cpu_capabilities const *cap); static bool __system_matches_cap(unsigned int n); #ifdef CONFIG_ARM64_MTE +static bool mte_disable; + +static int __init arm64_mte_disable(char *buf) +{ + return strtobool(buf, &mte_disable); +} +early_param("arm64.mte_disable", arm64_mte_disable); + s64 mte_ftr_filter(const struct arm64_ftr_bits *ftrp, s64 val) { struct device_node *np; static bool memory_checked = false; static bool mte_capable = true; + if (mte_disable) + return ID_AA64PFR1_MTE_NI; + /* EL0-only MTE is not supported by Linux, don't expose it */ if (val < ID_AA64PFR1_MTE) return ID_AA64PFR1_MTE_NI;