pgalloc.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef _ASM_POWERPC_PGALLOC_H
  2. #define _ASM_POWERPC_PGALLOC_H
  3. #ifdef __KERNEL__
  4. #include <linux/mm.h>
  5. #ifdef CONFIG_PPC_BOOK3E
  6. extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address);
  7. #else /* CONFIG_PPC_BOOK3E */
  8. static inline void tlb_flush_pgtable(struct mmu_gather *tlb,
  9. unsigned long address)
  10. {
  11. }
  12. #endif /* !CONFIG_PPC_BOOK3E */
  13. static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
  14. {
  15. free_page((unsigned long)pte);
  16. }
  17. static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
  18. {
  19. pgtable_page_dtor(ptepage);
  20. __free_page(ptepage);
  21. }
  22. #ifdef CONFIG_PPC64
  23. #include <asm/pgalloc-64.h>
  24. #else
  25. #include <asm/pgalloc-32.h>
  26. #endif
  27. #ifdef CONFIG_SMP
  28. extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift);
  29. extern void pte_free_finish(void);
  30. #else /* CONFIG_SMP */
  31. static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift)
  32. {
  33. pgtable_free(table, shift);
  34. }
  35. static inline void pte_free_finish(void) { }
  36. #endif /* !CONFIG_SMP */
  37. static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage,
  38. unsigned long address)
  39. {
  40. tlb_flush_pgtable(tlb, address);
  41. pgtable_page_dtor(ptepage);
  42. pgtable_free_tlb(tlb, page_address(ptepage), 0);
  43. }
  44. #endif /* __KERNEL__ */
  45. #endif /* _ASM_POWERPC_PGALLOC_H */