Message ID | 20241014105912.3207374-51-ryan.roberts@arm.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59280D1A443 for <linux-mm@archiver.kernel.org>; Mon, 14 Oct 2024 11:02:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D718D6B00E4; Mon, 14 Oct 2024 07:02:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D21176B00E6; Mon, 14 Oct 2024 07:02:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4AE96B00E7; Mon, 14 Oct 2024 07:02:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 962356B00E4 for <linux-mm@kvack.org>; Mon, 14 Oct 2024 07:02:04 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 914D4140D64 for <linux-mm@kvack.org>; Mon, 14 Oct 2024 11:01:56 +0000 (UTC) X-FDA: 82671918042.02.616BFC7 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf20.hostedemail.com (Postfix) with ESMTP id 6C6EB1C0026 for <linux-mm@kvack.org>; Mon, 14 Oct 2024 11:01:55 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf20.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728903581; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VfAcTUi91ptQaK/CGe1CeXA9aaPE8rozFIbYUTlYxXU=; b=205FlPVQe6qhG42HhW00t9BVcd+5xFylrNhg0da+GPP3hC6yy896Nnc/+ZD+ALosHOaCc4 fHieCfDNLPY8KEIGVF/DXqMxX8v5toAT12z/HZQ35sVLYiiz67d4iOjn1LmU7g9GGq/Nt/ jlCw9E/1NAADyI/V2q/lhJv7vlix3SA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728903581; a=rsa-sha256; cv=none; b=gppj76eNZAI1EaSo20qcKWliEGpsG9uQMBYh2uX72LpwoNng4s+mP0OnX1H6nHGSLESsBW AUtxDKhd8z0heNnoRfYYUo4LCt5kDD3dU/wRZ83HLje8nFpTTfR66vcm0UJ1/DOhuh+6Di ivsaehrzPTEyaFPGKMrFwB/PNXCIWfc= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf20.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com 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 A49A51A25; Mon, 14 Oct 2024 04:02:31 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A5B033F51B; Mon, 14 Oct 2024 04:01:59 -0700 (PDT) From: Ryan Roberts <ryan.roberts@arm.com> To: Andrew Morton <akpm@linux-foundation.org>, Anshuman Khandual <anshuman.khandual@arm.com>, Ard Biesheuvel <ardb@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, David Hildenbrand <david@redhat.com>, Greg Marsden <greg.marsden@oracle.com>, Ivan Ivanov <ivan.ivanov@suse.com>, Kalesh Singh <kaleshsingh@google.com>, Marc Zyngier <maz@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Matthias Brugger <mbrugger@suse.com>, Miroslav Benes <mbenes@suse.cz>, Will Deacon <will@kernel.org> Cc: Ryan Roberts <ryan.roberts@arm.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v1 51/57] arm64: Introduce cpu features for page sizes Date: Mon, 14 Oct 2024 11:58:58 +0100 Message-ID: <20241014105912.3207374-51-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014105912.3207374-1-ryan.roberts@arm.com> References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6C6EB1C0026 X-Stat-Signature: gpjxw9y38b136cq1g7yhg75rdmuxj3n5 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728903715-532256 X-HE-Meta: U2FsdGVkX18SiMqX1pPWtypPAKhRRrNtFl9CAg+MxkMlP/KLMBr9+EUCCRqGmQXcbW5NsuVxhENc2HYQwlAp2bwDDht+5XdEiVX5hsR5zXGSqZ+yNSZ4c3xcfzggKM1Gw3Zbg8HbxCG6K2b8mXfALBDqornPs1ttsWaoxJ3YcPeCh4g4Y1PtusY9n0KqZJEq2mvLU9TaAhijZ/ueLPAdILo9eRz0Ref506UCfLoZFxIq4lo1nS3OwW0NUBX/D1hjLrnBBF+7aO+MPHxkswViGpY56ey2HHjZOeXNBmu5LNiJAlTzeoW1edoWXTXrmjkrR9EkaQfXZ9pqkyqc20lgDiJ2dThr+EIhHreT4R9Q6JS4MHjBGudPxFaVo3GnkZBZ/NEcpkU3tCay4DaGEekNcHbF46gs61FaPGQ/dHxUpru9vzWGsZV/hIPH8jalgQ+YgNe0g0HHafCKQ/+xJlDMoIaVmKLPkEOZXOorGhNdPM9/RrFtKxet3ZT1cz8MtcBx6oYZEPmWRwlh5ZzL0jWe1weE0OIvKWdkBXNBylHQeJKtx4pdLMvzy2VFo1fN/W/oR4yNfOJV1YXFb41RF2Ey/cYja2oGKbaJVMkk72SKVC/H9+3XQyAfkgY4ieX/enLx9jP2wqwGyhwNH3V5afMq2ij97uzbA4V6VK21ClAMX3traAgu3RjC6l7aWAlZvQAli+tCBubCuwStT9YTp3v6RMP3W0ugcTg/dQ0y6NHMlpLaFPw49v/bIRNeJmCQUQRLgLlJ7Eyyxagi45DYN8+ic4/kyy8TeW8v4X6qvnJpcEo90pOMCZl5p4kdzSK1NrPaVH7n9W3S0/3Wh8Zo5iqflhqx0rEtst/3r6NYEO+z6A6Ji31OZpHiQtuA4sEDngNtmTx0MvwY6u5V/c1X+H3rRpy5+5ddTXc7nQVfw21aPOSrPT+FLPTh64BxCcv2vlF9vj/4fYgYY4bicpX6r/J AzS8bCoU 4MYnMgob/Hizg1TH70qDj62LoVEQcjvINnx2DEdxMPcQI7Cyh00wrVYOrdtF7dXVp502FT6gUQj9ExVpLwp+tqutyppsJUSkxnIlChmZPTRBjz2xBpdVGD0cwOz/QVHqjGc8PN8h385Q6ty2oEqPLNILt76r9PCCd1Y3r1a+/Wb32s+bZtmKZi1rL5A== 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Boot-time page size selection for arm64
|
expand
|
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 7705c9c0e7142..e5618423bb99d 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1831,6 +1831,13 @@ static bool has_nv1(const struct arm64_cpu_capabilities *entry, int scope) is_midr_in_range_list(read_cpuid_id(), nv1_ni_list))); } +static bool use_page_size(const struct arm64_cpu_capabilities *entry, int scope) +{ + return (entry->capability == ARM64_USE_PAGE_SIZE_4K && PAGE_SIZE == SZ_4K) || + (entry->capability == ARM64_USE_PAGE_SIZE_16K && PAGE_SIZE == SZ_16K) || + (entry->capability == ARM64_USE_PAGE_SIZE_64K && PAGE_SIZE == SZ_64K); +} + static bool has_lpa2_at_stage1(u64 mmfr0) { unsigned int tgran; @@ -2881,6 +2888,24 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .matches = has_nv1, ARM64_CPUID_FIELDS_NEG(ID_AA64MMFR4_EL1, E2H0, NI_NV1) }, + { + .desc = "4K page size", + .capability = ARM64_USE_PAGE_SIZE_4K, + .type = ARM64_CPUCAP_BOOT_CPU_FEATURE, + .matches = use_page_size, + }, + { + .desc = "16K page size", + .capability = ARM64_USE_PAGE_SIZE_16K, + .type = ARM64_CPUCAP_BOOT_CPU_FEATURE, + .matches = use_page_size, + }, + { + .desc = "64K page size", + .capability = ARM64_USE_PAGE_SIZE_64K, + .type = ARM64_CPUCAP_BOOT_CPU_FEATURE, + .matches = use_page_size, + }, {}, }; diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index ac3429d892b9a..5cb75675303c6 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -71,6 +71,9 @@ SPECTRE_BHB SSBS SVE UNMAP_KERNEL_AT_EL0 +USE_PAGE_SIZE_4K +USE_PAGE_SIZE_16K +USE_PAGE_SIZE_64K WORKAROUND_834220 WORKAROUND_843419 WORKAROUND_845719
Introduce one boot cpu feature per page size, ARM64_USE_PAGE_SIZE_*K. These will enable use of the alternatives framework to patch code based on the page size selected at boot. Additionally, this provides a neat way to figure out what page size is in use during boot from the kernel log. Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> --- ***NOTE*** Any confused maintainers may want to read the cover note here for context: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ arch/arm64/kernel/cpufeature.c | 25 +++++++++++++++++++++++++ arch/arm64/tools/cpucaps | 3 +++ 2 files changed, 28 insertions(+)