2 * IBM System z Huge TLB Page Support for Kernel.
4 * Copyright IBM Corp. 2008
5 * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
8 #ifndef _ASM_S390_HUGETLB_H
9 #define _ASM_S390_HUGETLB_H
12 #include <asm/pgtable.h>
15 #define is_hugepage_only_range(mm, addr, len) 0
16 #define hugetlb_free_pgd_range free_pgd_range
18 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
19 pte_t *ptep, pte_t pte);
20 pte_t huge_ptep_get(pte_t *ptep);
21 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
22 unsigned long addr, pte_t *ptep);
25 * If the arch doesn't supply something else, assume that hugepage
26 * size aligned regions are ok without further preparation.
28 static inline int prepare_hugepage_range(struct file *file,
29 unsigned long addr, unsigned long len)
31 if (len & ~HPAGE_MASK)
33 if (addr & ~HPAGE_MASK)
38 #define arch_clear_hugepage_flags(page) do { } while (0)
40 static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
43 pte_val(*ptep) = _SEGMENT_ENTRY_EMPTY;
46 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
47 unsigned long address, pte_t *ptep)
49 huge_ptep_get_and_clear(vma->vm_mm, address, ptep);
52 static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
53 unsigned long addr, pte_t *ptep,
56 int changed = !pte_same(huge_ptep_get(ptep), pte);
58 huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
59 set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
64 static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
65 unsigned long addr, pte_t *ptep)
67 pte_t pte = huge_ptep_get_and_clear(mm, addr, ptep);
68 set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
71 static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
73 return mk_pte(page, pgprot);
76 static inline int huge_pte_none(pte_t pte)
81 static inline int huge_pte_write(pte_t pte)
83 return pte_write(pte);
86 static inline int huge_pte_dirty(pte_t pte)
88 return pte_dirty(pte);
91 static inline pte_t huge_pte_mkwrite(pte_t pte)
93 return pte_mkwrite(pte);
96 static inline pte_t huge_pte_mkdirty(pte_t pte)
98 return pte_mkdirty(pte);
101 static inline pte_t huge_pte_wrprotect(pte_t pte)
103 return pte_wrprotect(pte);
106 static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot)
108 return pte_modify(pte, newprot);
111 #endif /* _ASM_S390_HUGETLB_H */