2005-11-19 09:17:32 +00:00
|
|
|
#ifndef _ASM_POWERPC_PGALLOC_H
|
|
|
|
#define _ASM_POWERPC_PGALLOC_H
|
2005-12-16 21:43:46 +00:00
|
|
|
#ifdef __KERNEL__
|
2005-11-19 09:17:32 +00:00
|
|
|
|
2008-11-19 12:50:04 +00:00
|
|
|
#include <linux/mm.h>
|
|
|
|
|
2009-07-23 23:15:28 +00:00
|
|
|
#ifdef CONFIG_PPC_BOOK3E
|
|
|
|
extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address);
|
|
|
|
#else /* CONFIG_PPC_BOOK3E */
|
|
|
|
static inline void tlb_flush_pgtable(struct mmu_gather *tlb,
|
|
|
|
unsigned long address)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif /* !CONFIG_PPC_BOOK3E */
|
|
|
|
|
2008-11-19 12:50:04 +00:00
|
|
|
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
|
|
|
|
{
|
|
|
|
free_page((unsigned long)pte);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
|
|
|
|
{
|
|
|
|
pgtable_page_dtor(ptepage);
|
|
|
|
__free_page(ptepage);
|
|
|
|
}
|
|
|
|
|
2007-04-30 06:30:56 +00:00
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
#include <asm/pgalloc-64.h>
|
2005-11-19 09:17:32 +00:00
|
|
|
#else
|
2007-04-30 06:30:56 +00:00
|
|
|
#include <asm/pgalloc-32.h>
|
2005-11-07 00:06:55 +00:00
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-11-19 12:50:04 +00:00
|
|
|
#ifdef CONFIG_SMP
|
2011-05-25 00:12:00 +00:00
|
|
|
struct mmu_gather;
|
|
|
|
extern void tlb_remove_table(struct mmu_gather *, void *);
|
|
|
|
|
|
|
|
static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
|
|
|
|
{
|
|
|
|
unsigned long pgf = (unsigned long)table;
|
|
|
|
BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
|
|
|
|
pgf |= shift;
|
|
|
|
tlb_remove_table(tlb, (void *)pgf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void __tlb_remove_table(void *_table)
|
|
|
|
{
|
|
|
|
void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE);
|
|
|
|
unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE;
|
|
|
|
|
|
|
|
pgtable_free(table, shift);
|
|
|
|
}
|
2009-07-23 23:15:28 +00:00
|
|
|
#else /* CONFIG_SMP */
|
2009-10-28 16:27:18 +00:00
|
|
|
static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift)
|
2009-07-23 23:15:28 +00:00
|
|
|
{
|
2009-10-28 16:27:18 +00:00
|
|
|
pgtable_free(table, shift);
|
2009-07-23 23:15:28 +00:00
|
|
|
}
|
|
|
|
#endif /* !CONFIG_SMP */
|
2008-11-19 12:50:04 +00:00
|
|
|
|
2009-07-23 23:15:28 +00:00
|
|
|
static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage,
|
|
|
|
unsigned long address)
|
|
|
|
{
|
|
|
|
tlb_flush_pgtable(tlb, address);
|
|
|
|
pgtable_page_dtor(ptepage);
|
2009-10-28 16:27:18 +00:00
|
|
|
pgtable_free_tlb(tlb, page_address(ptepage), 0);
|
2009-07-23 23:15:28 +00:00
|
|
|
}
|
2008-11-19 12:50:04 +00:00
|
|
|
|
2005-12-16 21:43:46 +00:00
|
|
|
#endif /* __KERNEL__ */
|
2005-11-19 09:17:32 +00:00
|
|
|
#endif /* _ASM_POWERPC_PGALLOC_H */
|