powerpc/mm: Add hook to flush pgtables when a PTE page is freed
PATCH 12/20 powerpc/mm: Add hook to flush pgtables when a PTE page is freed
64-bit BookE will use that hook to maintain the virtually linear page tables or the indirect entries in the TLB when using the HW loader.
Signed-off-by Benjamin Herrenschmidt <[email protected]>
---
arch/powerpc/include/asm/pgalloc.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/pgalloc.h +12 -1
@@ -4,6 +4,12 @@#include <linux/mm.h> +#ifdef CONFIG_PPC_BOOK3E +extern void tlb_flush_pgtable (struct mmu_gather *tlb,unsigned long address); +#else +#define tlb_flush_pgtable (tlb, address) do { } while(0) +#endif +static inline void pte_free_kernel (struct mm_struct *mm,pte_t *pte) {free_page ((unsigned long )pte);
@@ -41,11 +47,16 @@ extern void pgtable_free_tlb(struct mmu_#define __pte_free_tlb (tlb,ptepage,address) \ do { \ pgtable_page_dtor(ptepage); \ + tlb_flush_pgtable(tlb, address); \ pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \ PTE_NONCACHE_NUM, PTE_TABLE_SIZE-1)); \ } while (0)#else -#define __pte_free_tlb (tlb, pte, address) pte_free((tlb)->mm, (pte)) +#define __pte_free_tlb (tlb,pte,address) \ +do { \ + tlb_flush_pgtable(tlb, address); \ + pte_free((tlb)->mm, (pte)); \ +} while (0)#endif
Hi Ben,
arch/powerpc/include/asm/pgalloc.h line 10
Quoted 5 lines · On Thu, 23 Jul 2009 15:59:46 +1000 Benjamin Herrenschmidt…
arch/powerpc/include/asm/pgalloc.h +4
-0+#ifdef CONFIG_PPC_BOOK3E +extern void tlb_flush_pgtable (struct mmu_gather *tlb,unsigned long address); +#else +#define tlb_flush_pgtable (tlb, address) do { } while(0)
static inline void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address) {}
arch/powerpc/include/asm/pgalloc.h extern void pgtable_free_tlb(struct mmu_ · line 59
Quoted 7 lines
#else
arch/powerpc/include/asm/pgalloc.h +5
-1-#define __pte_free_tlb (tlb, pte, address) pte_free((tlb)->mm, (pte)) +#define __pte_free_tlb (tlb,pte,address) \ +do { \ + tlb_flush_pgtable(tlb, address); \ + pte_free((tlb)->mm, (pte)); \ +} while (0)
This could (should?) be a static inline as well.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/