--- v8
+++ v6
@@ -1,31 +1,81 @@
-Part of the conversions to replace pgtable constructor/destructors with
-ptdesc equivalents.
+As part of the conversions to replace pgtable constructor/destructors with
+ptdesc equivalents, convert various page table functions to use ptdescs.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
+Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
- arch/hexagon/include/asm/pgalloc.h | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
+ arch/arm64/include/asm/tlb.h | 14 ++++++++------
+ arch/arm64/mm/mmu.c | 7 ++++---
+ 2 files changed, 12 insertions(+), 9 deletions(-)
-diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h
-index f0c47e6a7427..55988625e6fb 100644
---- a/arch/hexagon/include/asm/pgalloc.h
-+++ b/arch/hexagon/include/asm/pgalloc.h
-@@ -87,10 +87,10 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
- max_kernel_seg = pmdindex;
+diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
+index c995d1f4594f..2c29239d05c3 100644
+--- a/arch/arm64/include/asm/tlb.h
++++ b/arch/arm64/include/asm/tlb.h
+@@ -75,18 +75,20 @@ static inline void tlb_flush(struct mmu_gather *tlb)
+ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
+ unsigned long addr)
+ {
+- pgtable_pte_page_dtor(pte);
+- tlb_remove_table(tlb, pte);
++ struct ptdesc *ptdesc = page_ptdesc(pte);
++
++ pagetable_pte_dtor(ptdesc);
++ tlb_remove_ptdesc(tlb, ptdesc);
}
--#define __pte_free_tlb(tlb, pte, addr) \
--do { \
-- pgtable_pte_page_dtor((pte)); \
-- tlb_remove_page((tlb), (pte)); \
-+#define __pte_free_tlb(tlb, pte, addr) \
-+do { \
-+ pagetable_pte_dtor((page_ptdesc(pte))); \
-+ tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \
- } while (0)
+ #if CONFIG_PGTABLE_LEVELS > 2
+ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
+ unsigned long addr)
+ {
+- struct page *page = virt_to_page(pmdp);
++ struct ptdesc *ptdesc = virt_to_ptdesc(pmdp);
+- pgtable_pmd_page_dtor(page);
+- tlb_remove_table(tlb, page);
++ pagetable_pmd_dtor(ptdesc);
++ tlb_remove_ptdesc(tlb, ptdesc);
+ }
#endif
+
+@@ -94,7 +96,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
+ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp,
+ unsigned long addr)
+ {
+- tlb_remove_table(tlb, virt_to_page(pudp));
++ tlb_remove_ptdesc(tlb, virt_to_ptdesc(pudp));
+ }
+ #endif
+
+diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
+index 95d360805f8a..47781bec6171 100644
+--- a/arch/arm64/mm/mmu.c
++++ b/arch/arm64/mm/mmu.c
+@@ -426,6 +426,7 @@ static phys_addr_t __pgd_pgtable_alloc(int shift)
+ static phys_addr_t pgd_pgtable_alloc(int shift)
+ {
+ phys_addr_t pa = __pgd_pgtable_alloc(shift);
++ struct ptdesc *ptdesc = page_ptdesc(phys_to_page(pa));
+
+ /*
+ * Call proper page table ctor in case later we need to
+@@ -433,12 +434,12 @@ static phys_addr_t pgd_pgtable_alloc(int shift)
+ * this pre-allocated page table.
+ *
+ * We don't select ARCH_ENABLE_SPLIT_PMD_PTLOCK if pmd is
+- * folded, and if so pgtable_pmd_page_ctor() becomes nop.
++ * folded, and if so pagetable_pte_ctor() becomes nop.
+ */
+ if (shift == PAGE_SHIFT)
+- BUG_ON(!pgtable_pte_page_ctor(phys_to_page(pa)));
++ BUG_ON(!pagetable_pte_ctor(ptdesc));
+ else if (shift == PMD_SHIFT)
+- BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa)));
++ BUG_ON(!pagetable_pmd_ctor(ptdesc));
+
+ return pa;
+ }
--
2.40.1