hugetlb.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * arch/arm64/include/asm/hugetlb.h
  3. *
  4. * Copyright (C) 2013 Linaro Ltd.
  5. *
  6. * Based on arch/x86/include/asm/hugetlb.h
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. */
  17. #ifndef __ASM_HUGETLB_H
  18. #define __ASM_HUGETLB_H
  19. #include <asm-generic/hugetlb.h>
  20. #include <asm/page.h>
  21. static inline pte_t huge_ptep_get(pte_t *ptep)
  22. {
  23. return *ptep;
  24. }
  25. static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  26. pte_t *ptep, pte_t pte)
  27. {
  28. set_pte_at(mm, addr, ptep, pte);
  29. }
  30. static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
  31. unsigned long addr, pte_t *ptep)
  32. {
  33. ptep_clear_flush(vma, addr, ptep);
  34. }
  35. static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
  36. unsigned long addr, pte_t *ptep)
  37. {
  38. ptep_set_wrprotect(mm, addr, ptep);
  39. }
  40. static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
  41. unsigned long addr, pte_t *ptep)
  42. {
  43. return ptep_get_and_clear(mm, addr, ptep);
  44. }
  45. static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
  46. unsigned long addr, pte_t *ptep,
  47. pte_t pte, int dirty)
  48. {
  49. return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
  50. }
  51. static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
  52. unsigned long addr, unsigned long end,
  53. unsigned long floor,
  54. unsigned long ceiling)
  55. {
  56. free_pgd_range(tlb, addr, end, floor, ceiling);
  57. }
  58. static inline int is_hugepage_only_range(struct mm_struct *mm,
  59. unsigned long addr, unsigned long len)
  60. {
  61. return 0;
  62. }
  63. static inline int prepare_hugepage_range(struct file *file,
  64. unsigned long addr, unsigned long len)
  65. {
  66. struct hstate *h = hstate_file(file);
  67. if (len & ~huge_page_mask(h))
  68. return -EINVAL;
  69. if (addr & ~huge_page_mask(h))
  70. return -EINVAL;
  71. return 0;
  72. }
  73. static inline int huge_pte_none(pte_t pte)
  74. {
  75. return pte_none(pte);
  76. }
  77. static inline pte_t huge_pte_wrprotect(pte_t pte)
  78. {
  79. return pte_wrprotect(pte);
  80. }
  81. static inline void arch_clear_hugepage_flags(struct page *page)
  82. {
  83. clear_bit(PG_dcache_clean, &page->flags);
  84. }
  85. #endif /* __ASM_HUGETLB_H */