[PATCH v4 1/3] arm64: mmu: introduce pgtable_alloc_t
Ryan Roberts
ryan.roberts at arm.com
Fri Jan 2 07:28:49 PST 2026
On 02/01/2026 15:07, Yeoreum Yun wrote:
> This is preparation patch to use preallocated page tables
> for linear_map_split_to_ptes().
>
> Define pgtable_alloc_t type for callback used by create_XXX_mapping().
>
> Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>
Reviewed-by: Ryan Roberts <ryan.roberts at arm.com>
> ---
> arch/arm64/mm/mmu.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 8e1d80a7033e..4b4908ae189b 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -74,6 +74,8 @@ EXPORT_SYMBOL(empty_zero_page);
> static DEFINE_SPINLOCK(swapper_pgdir_lock);
> static DEFINE_MUTEX(fixmap_lock);
>
> +typedef phys_addr_t (pgtable_alloc_t)(enum pgtable_type);
> +
> void noinstr set_swapper_pgd(pgd_t *pgdp, pgd_t pgd)
> {
> pgd_t *fixmap_pgdp;
> @@ -197,7 +199,7 @@ static void init_pte(pte_t *ptep, unsigned long addr, unsigned long end,
> static int alloc_init_cont_pte(pmd_t *pmdp, unsigned long addr,
> unsigned long end, phys_addr_t phys,
> pgprot_t prot,
> - phys_addr_t (*pgtable_alloc)(enum pgtable_type),
> + pgtable_alloc_t pgtable_alloc,
> int flags)
> {
> unsigned long next;
> @@ -252,7 +254,7 @@ static int alloc_init_cont_pte(pmd_t *pmdp, unsigned long addr,
>
> static int init_pmd(pmd_t *pmdp, unsigned long addr, unsigned long end,
> phys_addr_t phys, pgprot_t prot,
> - phys_addr_t (*pgtable_alloc)(enum pgtable_type), int flags)
> + pgtable_alloc_t pgtable_alloc, int flags)
> {
> unsigned long next;
>
> @@ -292,7 +294,7 @@ static int init_pmd(pmd_t *pmdp, unsigned long addr, unsigned long end,
> static int alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
> unsigned long end, phys_addr_t phys,
> pgprot_t prot,
> - phys_addr_t (*pgtable_alloc)(enum pgtable_type),
> + pgtable_alloc_t pgtable_alloc,
> int flags)
> {
> int ret;
> @@ -349,7 +351,7 @@ static int alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
>
> static int alloc_init_pud(p4d_t *p4dp, unsigned long addr, unsigned long end,
> phys_addr_t phys, pgprot_t prot,
> - phys_addr_t (*pgtable_alloc)(enum pgtable_type),
> + pgtable_alloc_t pgtable_alloc,
> int flags)
> {
> int ret = 0;
> @@ -415,7 +417,7 @@ static int alloc_init_pud(p4d_t *p4dp, unsigned long addr, unsigned long end,
>
> static int alloc_init_p4d(pgd_t *pgdp, unsigned long addr, unsigned long end,
> phys_addr_t phys, pgprot_t prot,
> - phys_addr_t (*pgtable_alloc)(enum pgtable_type),
> + pgtable_alloc_t pgtable_alloc,
> int flags)
> {
> int ret;
> @@ -467,7 +469,7 @@ static int alloc_init_p4d(pgd_t *pgdp, unsigned long addr, unsigned long end,
> static int __create_pgd_mapping_locked(pgd_t *pgdir, phys_addr_t phys,
> unsigned long virt, phys_addr_t size,
> pgprot_t prot,
> - phys_addr_t (*pgtable_alloc)(enum pgtable_type),
> + pgtable_alloc_t pgtable_alloc,
> int flags)
> {
> int ret;
> @@ -500,7 +502,7 @@ static int __create_pgd_mapping_locked(pgd_t *pgdir, phys_addr_t phys,
> static int __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
> unsigned long virt, phys_addr_t size,
> pgprot_t prot,
> - phys_addr_t (*pgtable_alloc)(enum pgtable_type),
> + pgtable_alloc_t pgtable_alloc,
> int flags)
> {
> int ret;
> @@ -516,7 +518,7 @@ static int __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
> static void early_create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
> unsigned long virt, phys_addr_t size,
> pgprot_t prot,
> - phys_addr_t (*pgtable_alloc)(enum pgtable_type),
> + pgtable_alloc_t pgtable_alloc,
> int flags)
> {
> int ret;
More information about the linux-arm-kernel
mailing list