Skip to content

Commit

Permalink
Merge commit '8246601a7d391ce8207408149d65732f28af81a1' into fixes
Browse files Browse the repository at this point in the history
This single fix is also part of a larger cleanup, so I'm merging it
into my fixes branch so it can be shared with for-next.

* commit '8246601a7d391ce8207408149d65732f28af81a1':
  riscv: tlb: fix __p*d_free_tlb()
  • Loading branch information
palmer-dabbelt committed Feb 22, 2024
2 parents 5850661 + 8246601 commit 4af2414
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions arch/riscv/include/asm/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
__pud_free(mm, pud);
}

#define __pud_free_tlb(tlb, pud, addr) pud_free((tlb)->mm, pud)
#define __pud_free_tlb(tlb, pud, addr) \
do { \
if (pgtable_l4_enabled) { \
pagetable_pud_dtor(virt_to_ptdesc(pud)); \
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pud)); \
} \
} while (0)

#define p4d_alloc_one p4d_alloc_one
static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long addr)
Expand Down Expand Up @@ -124,7 +130,11 @@ static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d)
__p4d_free(mm, p4d);
}

#define __p4d_free_tlb(tlb, p4d, addr) p4d_free((tlb)->mm, p4d)
#define __p4d_free_tlb(tlb, p4d, addr) \
do { \
if (pgtable_l5_enabled) \
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(p4d)); \
} while (0)
#endif /* __PAGETABLE_PMD_FOLDED */

static inline void sync_kernel_mappings(pgd_t *pgd)
Expand All @@ -149,7 +159,11 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)

#ifndef __PAGETABLE_PMD_FOLDED

#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
#define __pmd_free_tlb(tlb, pmd, addr) \
do { \
pagetable_pmd_dtor(virt_to_ptdesc(pmd)); \
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \
} while (0)

#endif /* __PAGETABLE_PMD_FOLDED */

Expand Down

0 comments on commit 4af2414

Please sign in to comment.