Re: [PATCH v8 02/10] powerpc/8xx: add pte_set_huge()
From: Barry Song <baohua@kernel.org>
Date: 2026-09-18 08:44:34
Also in:
linux-arm-kernel, linux-mm, lkml
Subsystem:
linux for powerpc (32-bit and 64-bit), the rest · Maintainers:
Madhavan Srinivasan, Linus Torvalds
On Fri, Sep 18, 2026 at 2:14 PM Christophe Leroy (CS GROUP) [off-list ref] wrote:
Le 17/09/2026 à 07:29, Wen Jiang a écrit :quoted
From: Wen Jiang <redacted> vmap installs PTE-level block mappings (SZ_16K/SZ_512K on powerpc/8xx) by reusing set_huge_pte_at(), a HugeTLB helper gated by CONFIG_HUGETLB_PAGE. This makes the feature silently unavailable on CONFIG_HUGETLB_PAGE=n kernels and couples mm/vmalloc.c to HugeTLB internals it does not otherwise need. Add pte_set_huge() to powerpc/8xx, next to the existing pmd_clear_huge()/pud_clear_huge() in mm/nohash/8xx.c. It builds the huge PTE and writes it into the backing cells directly, without going through set_huge_pte_at(), so it does not depend on CONFIG_HUGETLB_PAGE. No pte_clear_huge() is needed: 8xx does not implement arch_vmap_pte_range_unmap_size(), so the vmap unmap path never takes the block-mapping branch. In practice PPC_8xx selects HUGETLBFS unconditionally, so CONFIG_HUGETLB_PAGE=n does not occur there today; this is a decoupling cleanup rather than a new configuration.8xx selects CONFIG_HUGETLB_PAGE because it uses set_huge_pte_at() to map kernel text with large pages. That was added by commit 34536d780683 ("powerpc/8xx: Add a function to early map kernel via huge pages") But now pte_set_huge() could be used instead in __early_map_kernel_hugepage() and then CONFIG_HUGETLB_PAGE could be removed.
Hi Christophe, Do you mean the code below? If so, it sounds like a good place to clean this up for powerpc as a separate cleanup patch.
diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c
index 2518d2a6bdb4..830cdb391161 100644
--- a/arch/powerpc/mm/nohash/8xx.c
+++ b/arch/powerpc/mm/nohash/8xx.c@@ -87,9 +87,7 @@ static int __ref__early_map_kernel_hugepage(unsigned long va, phys_addr_t pa,
if (WARN_ON(!ptep))
return -ENOMEM;
- set_huge_pte_at(&init_mm, va, ptep,
- arch_make_huge_pte(pfn_pte(pa >> PAGE_SHIFT,
prot), shift, 0),
- 1UL << shift);
+ pte_set_huge(ptep, va, pa, prot, 1UL << shift);
return 0;
}diff --git a/arch/powerpc/platforms/Kconfig.cputypeb/arch/powerpc/platforms/Kconfig.cputype index f0adbf7ecb7f..efba4d960083 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype@@ -41,7 +41,6 @@ config PPC_8xx select FSL_SOC select PPC_KUEP select HAVE_ARCH_VMAP_STACK - select HUGETLBFS config 44x bool "AMCC 44x, 46x or 47x"
quoted
There is no caller yet: mm/vmalloc.c is converted later in this series, once the generic fallbacks are in place. Signed-off-by: Wen Jiang <redacted>Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Best Regards Barry