| From: Baoquan He <bhe@redhat.com> |
| Subject: x86/mm: remove pgd_leaf definition in arch |
| Date: Mon, 31 Mar 2025 16:13:25 +0800 |
| |
| pgd huge page is not supported yet, let's use the generic definition in |
| linux/pgtable.h. |
| |
| And also update the BUILD_BUG_ON() checking for pgd_leaf() in |
| pti_user_pagetable_walk_p4d() because pgd_leaf() returns boolean value. |
| |
| Link: https://lkml.kernel.org/r/20250331081327.256412-6-bhe@redhat.com |
| Signed-off-by: Baoquan He <bhe@redhat.com> |
| Cc: <x86@kernel.org> |
| Cc: Yanjun.Zhu <yanjun.zhu@linux.dev> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| arch/x86/include/asm/pgtable.h | 3 --- |
| arch/x86/mm/pti.c | 2 +- |
| 2 files changed, 1 insertion(+), 4 deletions(-) |
| |
| --- a/arch/x86/include/asm/pgtable.h~x86-mm-remove-pgd_leaf-definition-in-arch |
| +++ a/arch/x86/include/asm/pgtable.h |
| @@ -1472,9 +1472,6 @@ static inline bool pgdp_maps_userspace(v |
| return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START); |
| } |
| |
| -#define pgd_leaf pgd_leaf |
| -static inline bool pgd_leaf(pgd_t pgd) { return false; } |
| - |
| #ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION |
| /* |
| * All top-level MITIGATION_PAGE_TABLE_ISOLATION page tables are order-1 pages |
| --- a/arch/x86/mm/pti.c~x86-mm-remove-pgd_leaf-definition-in-arch |
| +++ a/arch/x86/mm/pti.c |
| @@ -185,7 +185,7 @@ static p4d_t *pti_user_pagetable_walk_p4 |
| |
| set_pgd(pgd, __pgd(_KERNPG_TABLE | __pa(new_p4d_page))); |
| } |
| - BUILD_BUG_ON(pgd_leaf(*pgd) != 0); |
| + BUILD_BUG_ON(pgd_leaf(*pgd)); |
| |
| return p4d_offset(pgd, address); |
| } |
| _ |