Commit 380f2c1a authored by Vishal Moola (Oracle)'s avatar Vishal Moola (Oracle) Committed by Andrew Morton

riscv: convert alloc_{pmd, pte}_late() to use ptdescs

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

Some of the functions use the *get*page*() helper functions.  Convert
these to use pagetable_alloc() and ptdesc_address() instead to help
standardize page tables further.

Link: https://lkml.kernel.org/r/20230807230513.102486-27-vishal.moola@gmail.comSigned-off-by: default avatarVishal Moola (Oracle) <vishal.moola@gmail.com>
Acked-by: default avatarPalmer Dabbelt <palmer@rivosinc.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: 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 5823b9fe
...@@ -155,8 +155,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) ...@@ -155,8 +155,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
#define __pte_free_tlb(tlb, pte, buf) \ #define __pte_free_tlb(tlb, pte, buf) \
do { \ do { \
pgtable_pte_page_dtor(pte); \ pagetable_pte_dtor(page_ptdesc(pte)); \
tlb_remove_page((tlb), pte); \ tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\
} while (0) } while (0)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
......
...@@ -353,12 +353,10 @@ static inline phys_addr_t __init alloc_pte_fixmap(uintptr_t va) ...@@ -353,12 +353,10 @@ static inline phys_addr_t __init alloc_pte_fixmap(uintptr_t va)
static phys_addr_t __init alloc_pte_late(uintptr_t va) static phys_addr_t __init alloc_pte_late(uintptr_t va)
{ {
unsigned long vaddr; struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0);
vaddr = __get_free_page(GFP_KERNEL);
BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page((void *)vaddr)));
return __pa(vaddr); BUG_ON(!ptdesc || !pagetable_pte_ctor(ptdesc));
return __pa((pte_t *)ptdesc_address(ptdesc));
} }
static void __init create_pte_mapping(pte_t *ptep, static void __init create_pte_mapping(pte_t *ptep,
...@@ -436,12 +434,10 @@ static phys_addr_t __init alloc_pmd_fixmap(uintptr_t va) ...@@ -436,12 +434,10 @@ static phys_addr_t __init alloc_pmd_fixmap(uintptr_t va)
static phys_addr_t __init alloc_pmd_late(uintptr_t va) static phys_addr_t __init alloc_pmd_late(uintptr_t va)
{ {
unsigned long vaddr; struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0);
vaddr = __get_free_page(GFP_KERNEL);
BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page((void *)vaddr)));
return __pa(vaddr); BUG_ON(!ptdesc || !pagetable_pmd_ctor(ptdesc));
return __pa((pmd_t *)ptdesc_address(ptdesc));
} }
static void __init create_pmd_mapping(pmd_t *pmdp, static void __init create_pmd_mapping(pmd_t *pmdp,
......
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