From mboxrd@z Thu Jan 1 00:00:00 1970 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 4C941FEFB6E for ; Fri, 27 Feb 2026 17:56: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5POj2Ofb+H7GemIQSmIA5tk0MgesYP1DsFVJbMebO7E=; b=ErMb1uFzNoiON3Xk7hA38zFQFW fEb/HlYjL4k8kk2ODKIZjYHxReAJ4bjDxHiVNie1XzltKlgRSFyYoXX9SaNgEXS6HfHb/QDAUVl3R /LvoqzsqeV6zE+cv1Zi193+pILR0r5HitavP4l7OLWq7QdgCDh35JiuFM0ZfgQuQjqQRmDwYbmUkA oO4i5Ogj6KzGcO88kwTklcI1djKyBKtJYJsoz8hmlRAU14CyFuV7YH6RdTioWPWB/qEz5oEWWMYrQ 4sKNkwcjRwmC6oLm0iHoPSn8XzxAsa5BTs/DJyRQlNCike5DdfloRCAnvTBcsC+xkKB5hQNnX9LuH xh73SqtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vw250-00000008qvh-0eIc; Fri, 27 Feb 2026 17:56:46 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vw24u-00000008qpt-2ShG for linux-arm-kernel@lists.infradead.org; Fri, 27 Feb 2026 17:56:41 +0000 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 8B0491516; Fri, 27 Feb 2026 09:56:33 -0800 (PST) Received: from e123572-lin.arm.com (e123572-lin.cambridge.arm.com [10.1.194.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 74D793F73B; Fri, 27 Feb 2026 09:56:35 -0800 (PST) From: Kevin Brodsky To: linux-hardening@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Kevin Brodsky , Andrew Morton , Andy Lutomirski , Catalin Marinas , Dave Hansen , David Hildenbrand , Ira Weiny , Jann Horn , Jeff Xu , Joey Gouly , Kees Cook , Linus Walleij , Lorenzo Stoakes , Marc Zyngier , Mark Brown , Matthew Wilcox , Maxwell Bland , "Mike Rapoport (IBM)" , Peter Zijlstra , Pierre Langlois , Quentin Perret , Rick Edgecombe , Ryan Roberts , Thomas Gleixner , Vlastimil Babka , Will Deacon , Yang Shi , Yeoreum Yun , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, x86@kernel.org Subject: [PATCH v6 12/30] set_memory: Introduce arch_has_pte_only_direct_map() Date: Fri, 27 Feb 2026 17:55:00 +0000 Message-ID: <20260227175518.3728055-13-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260227175518.3728055-1-kevin.brodsky@arm.com> References: <20260227175518.3728055-1-kevin.brodsky@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260227_095640_668116_9EFD21D6 X-CRM114-Status: GOOD ( 11.39 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce a helper that returns whether the linear map is fully PTE-mapped (i.e. no block mapping is used). This is a runtime decision for some architectures, hence the need for a new arch helper. Signed-off-by: Kevin Brodsky --- include/linux/set_memory.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/set_memory.h b/include/linux/set_memory.h index 7b3a8bfde3c6..c6df55422da2 100644 --- a/include/linux/set_memory.h +++ b/include/linux/set_memory.h @@ -58,6 +58,19 @@ static inline bool can_set_direct_map(void) #endif #endif /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */ +#ifndef arch_has_pte_only_direct_map +/* + * The default assumption is that the direct map might be created using block + * mappings (PMD or higher). An architecture may override this if the direct + * map is fully PTE-mapped. + */ +static inline bool arch_has_pte_only_direct_map(void) +{ + return false; +} +#define arch_has_pte_only_direct_map arch_has_pte_only_direct_map +#endif + #ifdef CONFIG_X86_64 int set_mce_nospec(unsigned long pfn); int clear_mce_nospec(unsigned long pfn); -- 2.51.2