hugetlb.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef _ASM_POWERPC_HUGETLB_H
  2. #define _ASM_POWERPC_HUGETLB_H
  3. #include <asm/page.h>
  4. pte_t *huge_pte_offset_and_shift(struct mm_struct *mm,
  5. unsigned long addr, unsigned *shift);
  6. void flush_dcache_icache_hugepage(struct page *page);
  7. int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
  8. unsigned long len);
  9. void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
  10. unsigned long end, unsigned long floor,
  11. unsigned long ceiling);
  12. /*
  13. * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs
  14. * to override the version in mm/hugetlb.c
  15. */
  16. #define vma_mmu_pagesize vma_mmu_pagesize
  17. /*
  18. * If the arch doesn't supply something else, assume that hugepage
  19. * size aligned regions are ok without further preparation.
  20. */
  21. static inline int prepare_hugepage_range(struct file *file,
  22. unsigned long addr, unsigned long len)
  23. {
  24. struct hstate *h = hstate_file(file);
  25. if (len & ~huge_page_mask(h))
  26. return -EINVAL;
  27. if (addr & ~huge_page_mask(h))
  28. return -EINVAL;
  29. return 0;
  30. }
  31. static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
  32. {
  33. }
  34. static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  35. pte_t *ptep, pte_t pte)
  36. {
  37. set_pte_at(mm, addr, ptep, pte);
  38. }
  39. static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
  40. unsigned long addr, pte_t *ptep)
  41. {
  42. unsigned long old = pte_update(mm, addr, ptep, ~0UL, 1);
  43. return __pte(old);
  44. }
  45. static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
  46. unsigned long addr, pte_t *ptep)
  47. {
  48. pte_t pte;
  49. pte = huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
  50. flush_tlb_page(vma, addr);
  51. }
  52. static inline int huge_pte_none(pte_t pte)
  53. {
  54. return pte_none(pte);
  55. }
  56. static inline pte_t huge_pte_wrprotect(pte_t pte)
  57. {
  58. return pte_wrprotect(pte);
  59. }
  60. static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
  61. unsigned long addr, pte_t *ptep,
  62. pte_t pte, int dirty)
  63. {
  64. return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
  65. }
  66. static inline pte_t huge_ptep_get(pte_t *ptep)
  67. {
  68. return *ptep;
  69. }
  70. static inline int arch_prepare_hugepage(struct page *page)
  71. {
  72. return 0;
  73. }
  74. static inline void arch_release_hugepage(struct page *page)
  75. {
  76. }
  77. #endif /* _ASM_POWERPC_HUGETLB_H */