hugetlb.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_SH_HUGETLB_H
  3. #define _ASM_SH_HUGETLB_H
  4. #include <asm/cacheflush.h>
  5. #include <asm/page.h>
  6. #include <asm-generic/hugetlb.h>
  7. static inline int is_hugepage_only_range(struct mm_struct *mm,
  8. unsigned long addr,
  9. unsigned long len) {
  10. return 0;
  11. }
  12. /*
  13. * If the arch doesn't supply something else, assume that hugepage
  14. * size aligned regions are ok without further preparation.
  15. */
  16. static inline int prepare_hugepage_range(struct file *file,
  17. unsigned long addr, unsigned long len)
  18. {
  19. if (len & ~HPAGE_MASK)
  20. return -EINVAL;
  21. if (addr & ~HPAGE_MASK)
  22. return -EINVAL;
  23. return 0;
  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 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  33. pte_t *ptep, pte_t pte)
  34. {
  35. set_pte_at(mm, addr, ptep, pte);
  36. }
  37. static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
  38. unsigned long addr, pte_t *ptep)
  39. {
  40. return ptep_get_and_clear(mm, addr, ptep);
  41. }
  42. static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
  43. unsigned long addr, pte_t *ptep)
  44. {
  45. }
  46. static inline int huge_pte_none(pte_t pte)
  47. {
  48. return pte_none(pte);
  49. }
  50. static inline pte_t huge_pte_wrprotect(pte_t pte)
  51. {
  52. return pte_wrprotect(pte);
  53. }
  54. static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
  55. unsigned long addr, pte_t *ptep)
  56. {
  57. ptep_set_wrprotect(mm, addr, ptep);
  58. }
  59. static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
  60. unsigned long addr, pte_t *ptep,
  61. pte_t pte, int dirty)
  62. {
  63. return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
  64. }
  65. static inline pte_t huge_ptep_get(pte_t *ptep)
  66. {
  67. return *ptep;
  68. }
  69. static inline void arch_clear_hugepage_flags(struct page *page)
  70. {
  71. clear_bit(PG_dcache_clean, &page->flags);
  72. }
  73. #endif /* _ASM_SH_HUGETLB_H */