hugetlb.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_SPARC64_HUGETLB_H
  3. #define _ASM_SPARC64_HUGETLB_H
  4. #include <asm/page.h>
  5. #include <asm-generic/hugetlb.h>
  6. #ifdef CONFIG_HUGETLB_PAGE
  7. struct pud_huge_patch_entry {
  8. unsigned int addr;
  9. unsigned int insn;
  10. };
  11. extern struct pud_huge_patch_entry __pud_huge_patch, __pud_huge_patch_end;
  12. #endif
  13. void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
  14. pte_t *ptep, pte_t pte);
  15. pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
  16. pte_t *ptep);
  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 huge_ptep_clear_flush(struct vm_area_struct *vma,
  37. unsigned long addr, pte_t *ptep)
  38. {
  39. }
  40. static inline int huge_pte_none(pte_t pte)
  41. {
  42. return pte_none(pte);
  43. }
  44. static inline pte_t huge_pte_wrprotect(pte_t pte)
  45. {
  46. return pte_wrprotect(pte);
  47. }
  48. static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
  49. unsigned long addr, pte_t *ptep)
  50. {
  51. pte_t old_pte = *ptep;
  52. set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
  53. }
  54. static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
  55. unsigned long addr, pte_t *ptep,
  56. pte_t pte, int dirty)
  57. {
  58. int changed = !pte_same(*ptep, pte);
  59. if (changed) {
  60. set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
  61. flush_tlb_page(vma, addr);
  62. }
  63. return changed;
  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. }
  72. void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
  73. unsigned long end, unsigned long floor,
  74. unsigned long ceiling);
  75. #endif /* _ASM_SPARC64_HUGETLB_H */