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 CEE55FF8855 for ; Tue, 5 May 2026 16:08:00 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UmFSGXNg0MSZohWP7YtFKB7EUmCmD7qHsh+06I3nSqU=; b=tnldn+YiZhCAjsodC6RlK8Za4W L6DdGzJhvC8rE8uxItzc/LdtgOKNBTcrAstJoTWT0QeNx+rwIBcmhHQOg5tVnWLZXrtVN6WAzh7jc 5DEoKmjZkxcUPPhuzbcZOr6YnVvfAfvGq8+UDcC9o8UIXo0Abq0/eSPQKH6YJe48pwxicoXb7CR1x 1Wg+Ijj6ElAbVpMZ5nS2StV868XRGsp2iDvxbT+edxGCkbwUpjpyCEJ8prwRhyk2WNr/3Qh5evQqy WZ5IHd4ND4hkxdt8kNt45sBTp2LiLPhJWfZ0pFphoO9Mld+PfjACUCLMiAAl7ZRHTfQiBzTdGdzGn xidtVmmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wKIJO-0000000GnIP-2RZI; Tue, 05 May 2026 16:07:54 +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 1wKIJK-0000000GnDW-0ITj for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2026 16:07:53 +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 2469014BF; Tue, 5 May 2026 09:07:44 -0700 (PDT) Received: from localhost.localdomain (e123572-lin.cambridge.arm.com [10.1.194.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5C3773F763; Tue, 5 May 2026 09:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1777997269; bh=BIW+ZJvi1P4EeD5UF9lAJp1G+q4h4naKio10It8LHdc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ks1sXyRI1hThrfI0cdrtNGl/4LarukIMq3EhDGNS8hHCb8PwPBKxzVPt8glVqyZOY icrS0sCFNcZzIKKv23WubhfaR4pG99w8/OXoxkm58Oh5Rtt5dxmYtH78drowtyFFjt /l77Qi6sK7w3BiGnqWt4/d06GTx6uIJRHpS5Vwr4= From: Kevin Brodsky Date: Tue, 05 May 2026 17:05:59 +0100 Subject: [PATCH RFC v7 10/24] memblock: Move INIT_MEMBLOCK_* macros to header MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260505-kpkeys-v7-10-20c0bdd97197@arm.com> References: <20260505-kpkeys-v7-0-20c0bdd97197@arm.com> In-Reply-To: <20260505-kpkeys-v7-0-20c0bdd97197@arm.com> To: linux-hardening@vger.kernel.org Cc: Kevin Brodsky , Andrew Morton , Andy Lutomirski , Catalin Marinas , Dave Hansen , "David Hildenbrand (Arm)" , Ira Weiny , Jann Horn , Jeff Xu , Joey Gouly , Kees Cook , Linus Walleij , Marc Zyngier , Mark Brown , Matthew Wilcox , Maxwell Bland , "Mike Rapoport (IBM)" , Peter Zijlstra , Pierre Langlois , Quentin Perret , Rick Edgecombe , Ryan Roberts , Will Deacon , Yang Shi , Yeoreum Yun , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, x86@kernel.org, Lorenzo Stoakes , Thomas Gleixner , Vlastimil Babka X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777997220; l=1850; i=kevin.brodsky@arm.com; s=20260427; h=from:subject:message-id; bh=BIW+ZJvi1P4EeD5UF9lAJp1G+q4h4naKio10It8LHdc=; b=z5MDXNXpY+aTeXeMbaiCtyBMzuTaPkZmT8f7P/ADfP65GXXpjSAjvN21IuXvcFhCgjFsYnE2D lA1rmPOTU7sDIvgzVk9b/FlYvbl0xrxcAZyKwdW6IldgrgrGWI/hUwW X-Developer-Key: i=kevin.brodsky@arm.com; a=ed25519; pk=N2QG+eJKrvkNovwhhwJhnJ4+ScVfsGCHldmqLfcMTFs= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260505_090750_243315_7D3684A7 X-CRM114-Status: GOOD ( 11.75 ) 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 The upcoming page table allocator for the kpkeys_hardened_pgtables feature will need to know the maximum number of memblock regions. Move the corresponding macros to to allow that. INIT_MEMBLOCK_{RESERVED,MEMORY}_REGIONS may be overridden, but this should be fine as only arm64 and loong currently do that and the relevant header is already (indirectly) included by . Signed-off-by: Kevin Brodsky --- include/linux/memblock.h | 11 +++++++++++ mm/memblock.c | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index b0f750d22a7b..e58b2c859b95 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -24,6 +24,17 @@ extern unsigned long max_pfn; */ extern unsigned long long max_possible_pfn; +#define INIT_MEMBLOCK_REGIONS 128 +#define INIT_PHYSMEM_REGIONS 4 + +#ifndef INIT_MEMBLOCK_RESERVED_REGIONS +#define INIT_MEMBLOCK_RESERVED_REGIONS INIT_MEMBLOCK_REGIONS +#endif + +#ifndef INIT_MEMBLOCK_MEMORY_REGIONS +#define INIT_MEMBLOCK_MEMORY_REGIONS INIT_MEMBLOCK_REGIONS +#endif + /** * enum memblock_flags - definition of memory region attributes * @MEMBLOCK_NONE: no special request diff --git a/mm/memblock.c b/mm/memblock.c index a6a1c91e276d..e64ad9c72dc3 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -30,17 +30,6 @@ #include "internal.h" -#define INIT_MEMBLOCK_REGIONS 128 -#define INIT_PHYSMEM_REGIONS 4 - -#ifndef INIT_MEMBLOCK_RESERVED_REGIONS -# define INIT_MEMBLOCK_RESERVED_REGIONS INIT_MEMBLOCK_REGIONS -#endif - -#ifndef INIT_MEMBLOCK_MEMORY_REGIONS -#define INIT_MEMBLOCK_MEMORY_REGIONS INIT_MEMBLOCK_REGIONS -#endif - /** * DOC: memblock overview * -- 2.51.2