From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796059227; b=RNjtXOmQB6uhVSBIHIloAV2RYH/7YUHtMiHA/IBqI48gU8+S601Mitp19SbQ+PsqPCU6 Nk6d+EUdHKLxkEQeVM0HZKtAaP5mNrGASgN4Nb2OxzG2Gg8Fnz0bUzjix1bbaabUaSbJQ zroqUn1XL2TQb7m9WtlxbeITmopKe/Mc8ESsacDp4xNGXQVaFlJfVSwWshE3GhB7lUrAx 5ixc/NLgrJPJAYvBOFwXdGIaGwl9/7navsFU76pw3mguSRL7gpP4IfjSUzkqHRfFMFiUd CxUeg/x1FjXqHdBDM9QY6GV92FLTNq435c0s2UlIsp1kuqjkweOMqbqXd3uqeXvS62g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796059227; h=DMARC-Filter:Received:Received:DKIM-Signature:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature: X-Developer-Key; bh=k7hw720ofjdZzjZJb9WCfH/p8FCJk+RRBNLgHNWJ0R8=; b=Vyk3C86Ku+bxWmwSDbCZJWyQkXNtV49HsrTJGBzfsJYP6Xd9xvZxzHyiecKE2KeKD/BK zIVkMPojs5yHE5WjDNakWhfx3aJZIh1qy7gWbIHW/LsXY//RIxGUJ8uJDZ9IcpckVokdN eXmHoSDCWGZDltYqezh0aEvRZi+8xdd/El/66ubCj9Co6PcqwTzyb1SvxxghV0vVuSHdP rwRNWvY2h6B3MxGbNk9Dj4qHchSe1oXOns7TjZDDtUd5gvp9QZmx3p/d3/kY08DqHcD8L IWEd/ccDyUrkSoIE8jTXgJNlhob+xI4N2O4t82zm/3YtnGKg8bc6e/rc0TyTnAp24Vw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=G1VHz7NJ; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62048606A338; Mon, 30 Nov 2026 17:20:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 62048606A338 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=G1VHz7NJ 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 0000D169C; Mon, 30 Nov 2026 09:20:23 -0800 (PST) Received: from e129823.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 432A53F86F; Mon, 30 Nov 2026 09:20:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796059226; bh=uxUE0+YMV6AW6Sj21DufVEBnIXZ326JRKxInQ30bTaU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=G1VHz7NJ008+0dPmevPGPnd91acU3HieJpic3qa8hTpu6+sHRQqONxr63x/D2aZeg qTT2c+8waG9KYvfL0ZM906su+TA3AdqkYy8a/bEHaJRgR8WwJdJaeSz5Hs1R+PhBiK l7UkpLonwFhHPnUZES3MtTw4vO6rYniMw3SmNj5I= From: Yeoreum Yun Date: Mon, 30 Nov 2026 17:18:40 +0000 Subject: [PATCH v3 07/20] mm/pgtable: define (pgd|p4d|pud)_leaf() for folded page tables X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261130-dummy_ptxp3-v3-7-456081a8ed0e@arm.com> References: <20261130-dummy_ptxp3-v3-0-456081a8ed0e@arm.com> In-Reply-To: <20261130-dummy_ptxp3-v3-0-456081a8ed0e@arm.com> To: Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , Andrew Morton , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , Tianrui Zhao , Bibo Mao , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jonas Bonn , Stefan Kristiansson , Stafford Horne Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-openrisc@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2651; i=yeoreum.yun@arm.com; h=from:subject:message-id; bh=Levykjbl1pmjYa93j9/w/7SGe6DMco/qhh7ou+cpfVI=; b=owEB7QES/pANAwAKAW3Vw9FaxTEzAcsmYgBrDa/4YPVokstbpqKuKsLSrkEEBWkqe3QNvV3oc a+SddP/Ww+JAbMEAAEKAB0WIQQtg+CS3QUzuFh1pJ1t1cPRWsUxMwUCaw2v+AAKCRBt1cPRWsUx M9R6C/4wyRJ5yJDuzsRtF70kAwfX5DCEoCeL291ZI833tnZqTRo7nx3pd0Malle9yJ5pNqzKpjw SgCzmRlp2GMyVncZqNDlhKpb5yz5yLRV5qjJF3CdHavPfUiolhA3Mt99Q+a3kEMjLcDfYZJcIkX rbrxqqe6r8qTXtb6JGmmZZiY1S5majUB2OUPSJ6dBZFPwRmyRZmlUR9MGd36pAHcA3T4sZPr0Nk UscomOsx0hKStiPojulXXK7j4eZFsDAO+LydKuQzMVXS8ptClkEx0xNZfllHy9BkvH/ik5p655z uM/QuzVMdgmfpAvNSrXpZL7vxMvNiGplroazD0wX2Lt5maqd4wSiFws+RegXs5kIM80WyHbPQSI bK1vxCMN/7LGb5JjkK03FznzdwyvV4NMsdzhEtSPKnyonC4Ij4MLcAuyYWd+wwM55KLZjU/+tMX tfsK4AbW6oQ8E4v3NfzWgNY0Ed2YNnvzI7Wmh6lySGEhni0wJj+JlJw2SemLy1/6nDlpI= X-Developer-Key: i=yeoreum.yun@arm.com; a=openpgp; fpr=2D83E092DD0533B85875A49D6DD5C3D15AC53133 From: "David Hildenbrand (Arm)" Define (pgd|p4d|pud)_leaf(), hard-coding it to "false". Note that it's missed to define pud_leaf() before, allowing architectures to unknowingly overwrite it. Still use static inline functions (type checking), and while at it, just use "bool" as a return value. Signed-off-by: David Hildenbrand (Arm) --- include/asm-generic/pgtable-nop4d.h | 3 +++ include/asm-generic/pgtable-nopmd.h | 3 ++- include/asm-generic/pgtable-nopud.h | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/pgtable-nop4d.h b/include/asm-generic/pgtable-nop4d.h index 9a912545a7b92..019c3f074b771 100644 --- a/include/asm-generic/pgtable-nop4d.h +++ b/include/asm-generic/pgtable-nop4d.h @@ -22,6 +22,9 @@ static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pgd_present(pgd_t pgd) { return 1; } static inline void pgd_clear(pgd_t *pgd) { } +static inline bool pgd_leaf(pgd_t pgd) { return false; } +#define pgd_leaf pgd_leaf +#define p4d_ERROR(p4d) (pgd_ERROR((p4d).pgd)) #define pgd_populate(mm, pgd, p4d) do { } while (0) #define pgd_populate_safe(mm, pgd, p4d) do { } while (0) diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index be7f6599d24e0..1dd5b165234be 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h @@ -31,7 +31,8 @@ static inline int pud_none(pud_t pud) { return 0; } static inline int pud_bad(pud_t pud) { return 0; } static inline int pud_present(pud_t pud) { return 1; } static inline int pud_user(pud_t pud) { return 0; } -static inline int pud_leaf(pud_t pud) { return 0; } +static inline bool pud_leaf(pud_t pud) { return false; } +#define pud_leaf pud_leaf static inline void pud_clear(pud_t *pud) { } #define pud_populate(mm, pmd, pte) do { } while (0) diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index 68df1a06b570c..5a2b0a81ae197 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h @@ -29,6 +29,9 @@ static inline int p4d_none(p4d_t p4d) { return 0; } static inline int p4d_bad(p4d_t p4d) { return 0; } static inline int p4d_present(p4d_t p4d) { return 1; } static inline void p4d_clear(p4d_t *p4d) { } +static inline bool p4d_leaf(p4d_t p4d) { return false; } +#define p4d_leaf p4d_leaf +#define pud_ERROR(pud) (p4d_ERROR((pud).p4d)) #define p4d_populate(mm, p4d, pud) do { } while (0) #define p4d_populate_safe(mm, p4d, pud) do { } while (0) -- 2.43.0