hugetlb.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 hugetlb_free_pgd_range(struct mmu_gather *tlb,
  26. unsigned long addr, unsigned long end,
  27. unsigned long floor,
  28. unsigned long ceiling)
  29. {
  30. free_pgd_range(tlb, addr, end, floor, ceiling);
  31. }
  32. static inline int is_hugepage_only_range(struct mm_struct *mm,
  33. unsigned long addr, unsigned long len)
  34. {
  35. return 0;
  36. }
  37. static inline int prepare_hugepage_range(struct file *file,
  38. unsigned long addr, unsigned long len)
  39. {
  40. struct hstate *h = hstate_file(file);
  41. if (len & ~huge_page_mask(h))
  42. return -EINVAL;
  43. if (addr & ~huge_page_mask(h))
  44. return -EINVAL;
  45. return 0;
  46. }
  47. static inline int huge_pte_none(pte_t pte)
  48. {
  49. return pte_none(pte);
  50. }
  51. static inline pte_t huge_pte_wrprotect(pte_t pte)
  52. {
  53. return pte_wrprotect(pte);
  54. }
  55. static inline void arch_clear_hugepage_flags(struct page *page)
  56. {
  57. clear_bit(PG_dcache_clean, &page->flags);
  58. }
  59. extern pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
  60. struct page *page, int writable);
  61. #define arch_make_huge_pte arch_make_huge_pte
  62. extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  63. pte_t *ptep, pte_t pte);
  64. extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
  65. unsigned long addr, pte_t *ptep,
  66. pte_t pte, int dirty);
  67. extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
  68. unsigned long addr, pte_t *ptep);
  69. extern void huge_ptep_set_wrprotect(struct mm_struct *mm,
  70. unsigned long addr, pte_t *ptep);
  71. extern void huge_ptep_clear_flush(struct vm_area_struct *vma,
  72. unsigned long addr, pte_t *ptep);
  73. #endif /* __ASM_HUGETLB_H */