Commit 358d1c39 authored by Vishal Moola (Oracle)'s avatar Vishal Moola (Oracle) Committed by Andrew Morton

arm: convert various functions to use ptdescs

As part of the conversions to replace pgtable constructor/destructors with
ptdesc equivalents, convert various page table functions to use ptdescs.

late_alloc() also uses the __get_free_pages() helper function.  Convert
this to use pagetable_alloc() and ptdesc_address() instead to help
standardize page tables further.

Link: https://lkml.kernel.org/r/20230807230513.102486-18-vishal.moola@gmail.comSigned-off-by: default avatarVishal Moola (Oracle) <vishal.moola@gmail.com>
Acked-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Guo Ren <guoren@kernel.org>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Palmer Dabbelt <palmer@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent c787ae5b
...@@ -39,7 +39,9 @@ static inline void __tlb_remove_table(void *_table) ...@@ -39,7 +39,9 @@ static inline void __tlb_remove_table(void *_table)
static inline void static inline void
__pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr)
{ {
pgtable_pte_page_dtor(pte); struct ptdesc *ptdesc = page_ptdesc(pte);
pagetable_pte_dtor(ptdesc);
#ifndef CONFIG_ARM_LPAE #ifndef CONFIG_ARM_LPAE
/* /*
...@@ -50,17 +52,17 @@ __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) ...@@ -50,17 +52,17 @@ __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr)
__tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE); __tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE);
#endif #endif
tlb_remove_table(tlb, pte); tlb_remove_ptdesc(tlb, ptdesc);
} }
static inline void static inline void
__pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr)
{ {
#ifdef CONFIG_ARM_LPAE #ifdef CONFIG_ARM_LPAE
struct page *page = virt_to_page(pmdp); struct ptdesc *ptdesc = virt_to_ptdesc(pmdp);
pgtable_pmd_page_dtor(page); pagetable_pmd_dtor(ptdesc);
tlb_remove_table(tlb, page); tlb_remove_ptdesc(tlb, ptdesc);
#endif #endif
} }
......
...@@ -737,11 +737,12 @@ static void __init *early_alloc(unsigned long sz) ...@@ -737,11 +737,12 @@ static void __init *early_alloc(unsigned long sz)
static void *__init late_alloc(unsigned long sz) static void *__init late_alloc(unsigned long sz)
{ {
void *ptr = (void *)__get_free_pages(GFP_PGTABLE_KERNEL, get_order(sz)); void *ptdesc = pagetable_alloc(GFP_PGTABLE_KERNEL & ~__GFP_HIGHMEM,
get_order(sz));
if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr))) if (!ptdesc || !pagetable_pte_ctor(ptdesc))
BUG(); BUG();
return ptr; return ptdesc_to_virt(ptdesc);
} }
static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr, static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment