Commit 40d1bb92 authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Palmer Dabbelt

riscv: tlb: convert __p*d_free_tlb() to inline functions

This is to prepare for enabling MMU_GATHER_RCU_TABLE_FREE.
No functionality changes.
Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20231219175046.2496-3-jszhang@kernel.orgSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 8246601a
...@@ -95,13 +95,16 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud) ...@@ -95,13 +95,16 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
__pud_free(mm, pud); __pud_free(mm, pud);
} }
#define __pud_free_tlb(tlb, pud, addr) \ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
do { \ unsigned long addr)
if (pgtable_l4_enabled) { \ {
pagetable_pud_dtor(virt_to_ptdesc(pud)); \ if (pgtable_l4_enabled) {
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pud)); \ struct ptdesc *ptdesc = virt_to_ptdesc(pud);
} \
} while (0) pagetable_pud_dtor(ptdesc);
tlb_remove_page_ptdesc(tlb, ptdesc);
}
}
#define p4d_alloc_one p4d_alloc_one #define p4d_alloc_one p4d_alloc_one
static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long addr) static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long addr)
...@@ -130,11 +133,12 @@ static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d) ...@@ -130,11 +133,12 @@ static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d)
__p4d_free(mm, p4d); __p4d_free(mm, p4d);
} }
#define __p4d_free_tlb(tlb, p4d, addr) \ static inline void __p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
do { \ unsigned long addr)
if (pgtable_l5_enabled) \ {
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(p4d)); \ if (pgtable_l5_enabled)
} while (0) tlb_remove_page_ptdesc(tlb, virt_to_ptdesc(p4d));
}
#endif /* __PAGETABLE_PMD_FOLDED */ #endif /* __PAGETABLE_PMD_FOLDED */
static inline void sync_kernel_mappings(pgd_t *pgd) static inline void sync_kernel_mappings(pgd_t *pgd)
...@@ -159,19 +163,25 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) ...@@ -159,19 +163,25 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
#ifndef __PAGETABLE_PMD_FOLDED #ifndef __PAGETABLE_PMD_FOLDED
#define __pmd_free_tlb(tlb, pmd, addr) \ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
do { \ unsigned long addr)
pagetable_pmd_dtor(virt_to_ptdesc(pmd)); \ {
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \ struct ptdesc *ptdesc = virt_to_ptdesc(pmd);
} while (0)
pagetable_pmd_dtor(ptdesc);
tlb_remove_page_ptdesc(tlb, ptdesc);
}
#endif /* __PAGETABLE_PMD_FOLDED */ #endif /* __PAGETABLE_PMD_FOLDED */
#define __pte_free_tlb(tlb, pte, buf) \ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
do { \ unsigned long addr)
pagetable_pte_dtor(page_ptdesc(pte)); \ {
tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\ struct ptdesc *ptdesc = page_ptdesc(pte);
} while (0)
pagetable_pte_dtor(ptdesc);
tlb_remove_page_ptdesc(tlb, ptdesc);
}
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
#endif /* _ASM_RISCV_PGALLOC_H */ #endif /* _ASM_RISCV_PGALLOC_H */
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