Message ID | 20230501192829.17086-30-vishal.moola@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Split ptdesc from struct page | expand |
Context | Check | Description |
---|---|---|
conchuod/tree_selection | fail | Failed to apply to next/pending-fixes or riscv/for-next |
On Mon, 01 May 2023 12:28:24 PDT (-0700), vishal.moola@gmail.com wrote: > 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 ptdesc_alloc() and ptdesc_address() instead to help > standardize page tables further. > > Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> > --- > arch/riscv/include/asm/pgalloc.h | 8 ++++---- > arch/riscv/mm/init.c | 16 ++++++---------- > 2 files changed, 10 insertions(+), 14 deletions(-) > > diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h > index 59dc12b5b7e8..cb5536403bd8 100644 > --- a/arch/riscv/include/asm/pgalloc.h > +++ b/arch/riscv/include/asm/pgalloc.h > @@ -153,10 +153,10 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) > > #endif /* __PAGETABLE_PMD_FOLDED */ > > -#define __pte_free_tlb(tlb, pte, buf) \ > -do { \ > - pgtable_pte_page_dtor(pte); \ > - tlb_remove_page((tlb), pte); \ > +#define __pte_free_tlb(tlb, pte, buf) \ > +do { \ > + ptdesc_pte_dtor(page_ptdesc(pte)); \ > + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\ > } while (0) > #endif /* CONFIG_MMU */ > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index eb8173a91ce3..8f1982664687 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -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) > { > - unsigned long vaddr; > - > - vaddr = __get_free_page(GFP_KERNEL); > - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr))); > + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); > > - return __pa(vaddr); > + BUG_ON(!ptdesc || !ptdesc_pte_ctor(ptdesc)); > + return __pa((pte_t *)ptdesc_address(ptdesc)); > } > > static void __init create_pte_mapping(pte_t *ptep, > @@ -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) > { > - unsigned long vaddr; > - > - vaddr = __get_free_page(GFP_KERNEL); > - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr))); > + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); > > - return __pa(vaddr); > + BUG_ON(!ptdesc || !ptdesc_pmd_ctor(ptdesc)); > + return __pa((pmd_t *)ptdesc_address(ptdesc)); > } > > static void __init create_pmd_mapping(pmd_t *pmdp, Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h index 59dc12b5b7e8..cb5536403bd8 100644 --- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -153,10 +153,10 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #endif /* __PAGETABLE_PMD_FOLDED */ -#define __pte_free_tlb(tlb, pte, buf) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, buf) \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\ } while (0) #endif /* CONFIG_MMU */ diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index eb8173a91ce3..8f1982664687 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -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) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr))); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !ptdesc_pte_ctor(ptdesc)); + return __pa((pte_t *)ptdesc_address(ptdesc)); } static void __init create_pte_mapping(pte_t *ptep, @@ -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) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr))); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !ptdesc_pmd_ctor(ptdesc)); + return __pa((pmd_t *)ptdesc_address(ptdesc)); } static void __init create_pmd_mapping(pmd_t *pmdp,
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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> --- arch/riscv/include/asm/pgalloc.h | 8 ++++---- arch/riscv/mm/init.c | 16 ++++++---------- 2 files changed, 10 insertions(+), 14 deletions(-)