hugetlb.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #ifndef _ASM_TILE_HUGETLB_H
  15. #define _ASM_TILE_HUGETLB_H
  16. #include <asm/page.h>
  17. static inline int is_hugepage_only_range(struct mm_struct *mm,
  18. unsigned long addr,
  19. unsigned long len) {
  20. return 0;
  21. }
  22. /*
  23. * If the arch doesn't supply something else, assume that hugepage
  24. * size aligned regions are ok without further preparation.
  25. */
  26. static inline int prepare_hugepage_range(struct file *file,
  27. unsigned long addr, unsigned long len)
  28. {
  29. struct hstate *h = hstate_file(file);
  30. if (len & ~huge_page_mask(h))
  31. return -EINVAL;
  32. if (addr & ~huge_page_mask(h))
  33. return -EINVAL;
  34. return 0;
  35. }
  36. static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
  37. {
  38. }
  39. static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
  40. unsigned long addr, unsigned long end,
  41. unsigned long floor,
  42. unsigned long ceiling)
  43. {
  44. free_pgd_range(tlb, addr, end, floor, ceiling);
  45. }
  46. static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  47. pte_t *ptep, pte_t pte)
  48. {
  49. set_pte(ptep, pte);
  50. }
  51. static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
  52. unsigned long addr, pte_t *ptep)
  53. {
  54. return ptep_get_and_clear(mm, addr, ptep);
  55. }
  56. static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
  57. unsigned long addr, pte_t *ptep)
  58. {
  59. ptep_clear_flush(vma, addr, ptep);
  60. }
  61. static inline int huge_pte_none(pte_t pte)
  62. {
  63. return pte_none(pte);
  64. }
  65. static inline pte_t huge_pte_wrprotect(pte_t pte)
  66. {
  67. return pte_wrprotect(pte);
  68. }
  69. static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
  70. unsigned long addr, pte_t *ptep)
  71. {
  72. ptep_set_wrprotect(mm, addr, ptep);
  73. }
  74. static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
  75. unsigned long addr, pte_t *ptep,
  76. pte_t pte, int dirty)
  77. {
  78. return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
  79. }
  80. static inline pte_t huge_ptep_get(pte_t *ptep)
  81. {
  82. return *ptep;
  83. }
  84. static inline int arch_prepare_hugepage(struct page *page)
  85. {
  86. return 0;
  87. }
  88. static inline void arch_release_hugepage(struct page *page)
  89. {
  90. }
  91. #endif /* _ASM_TILE_HUGETLB_H */