hugetlb.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef _ASM_SPARC64_HUGETLB_H
  2. #define _ASM_SPARC64_HUGETLB_H
  3. #include <asm/page.h>
  4. #include <asm-generic/hugetlb.h>
  5. #ifdef CONFIG_HUGETLB_PAGE
  6. struct pud_huge_patch_entry {
  7. unsigned int addr;
  8. unsigned int insn;
  9. };
  10. extern struct pud_huge_patch_entry __pud_huge_patch, __pud_huge_patch_end;
  11. #endif
  12. void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  13. pte_t *ptep, pte_t pte);
  14. pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
  15. pte_t *ptep);
  16. static inline int is_hugepage_only_range(struct mm_struct *mm,
  17. unsigned long addr,
  18. unsigned long len) {
  19. return 0;
  20. }
  21. /*
  22. * If the arch doesn't supply something else, assume that hugepage
  23. * size aligned regions are ok without further preparation.
  24. */
  25. static inline int prepare_hugepage_range(struct file *file,
  26. unsigned long addr, unsigned long len)
  27. {
  28. struct hstate *h = hstate_file(file);
  29. if (len & ~huge_page_mask(h))
  30. return -EINVAL;
  31. if (addr & ~huge_page_mask(h))
  32. return -EINVAL;
  33. return 0;
  34. }
  35. static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
  36. unsigned long addr, pte_t *ptep)
  37. {
  38. }
  39. static inline int huge_pte_none(pte_t pte)
  40. {
  41. return pte_none(pte);
  42. }
  43. static inline pte_t huge_pte_wrprotect(pte_t pte)
  44. {
  45. return pte_wrprotect(pte);
  46. }
  47. static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
  48. unsigned long addr, pte_t *ptep)
  49. {
  50. pte_t old_pte = *ptep;
  51. set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
  52. }
  53. static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
  54. unsigned long addr, pte_t *ptep,
  55. pte_t pte, int dirty)
  56. {
  57. int changed = !pte_same(*ptep, pte);
  58. if (changed) {
  59. set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
  60. flush_tlb_page(vma, addr);
  61. }
  62. return changed;
  63. }
  64. static inline pte_t huge_ptep_get(pte_t *ptep)
  65. {
  66. return *ptep;
  67. }
  68. static inline void arch_clear_hugepage_flags(struct page *page)
  69. {
  70. }
  71. void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
  72. unsigned long end, unsigned long floor,
  73. unsigned long ceiling);
  74. #endif /* _ASM_SPARC64_HUGETLB_H */