Merge branch 'bugzilla-14483' into release
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / powerpc / include / asm / hugetlb.h
1 #ifndef _ASM_POWERPC_HUGETLB_H
2 #define _ASM_POWERPC_HUGETLB_H
3
4 #include <asm/page.h>
5
6 pte_t *huge_pte_offset_and_shift(struct mm_struct *mm,
7 unsigned long addr, unsigned *shift);
8
9 void flush_dcache_icache_hugepage(struct page *page);
10
11 int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
12 unsigned long len);
13
14 void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
15 unsigned long end, unsigned long floor,
16 unsigned long ceiling);
17
18 /*
19 * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs
20 * to override the version in mm/hugetlb.c
21 */
22 #define vma_mmu_pagesize vma_mmu_pagesize
23
24 /*
25 * If the arch doesn't supply something else, assume that hugepage
26 * size aligned regions are ok without further preparation.
27 */
28 static inline int prepare_hugepage_range(struct file *file,
29 unsigned long addr, unsigned long len)
30 {
31 struct hstate *h = hstate_file(file);
32 if (len & ~huge_page_mask(h))
33 return -EINVAL;
34 if (addr & ~huge_page_mask(h))
35 return -EINVAL;
36 return 0;
37 }
38
39 static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
40 {
41 }
42
43
44 static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
45 pte_t *ptep, pte_t pte)
46 {
47 set_pte_at(mm, addr, ptep, pte);
48 }
49
50 static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
51 unsigned long addr, pte_t *ptep)
52 {
53 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 1);
54 return __pte(old);
55 }
56
57 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
58 unsigned long addr, pte_t *ptep)
59 {
60 pte_t pte;
61 pte = huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
62 flush_tlb_page(vma, addr);
63 }
64
65 static inline int huge_pte_none(pte_t pte)
66 {
67 return pte_none(pte);
68 }
69
70 static inline pte_t huge_pte_wrprotect(pte_t pte)
71 {
72 return pte_wrprotect(pte);
73 }
74
75 static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
76 unsigned long addr, pte_t *ptep,
77 pte_t pte, int dirty)
78 {
79 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
80 }
81
82 static inline pte_t huge_ptep_get(pte_t *ptep)
83 {
84 return *ptep;
85 }
86
87 static inline int arch_prepare_hugepage(struct page *page)
88 {
89 return 0;
90 }
91
92 static inline void arch_release_hugepage(struct page *page)
93 {
94 }
95
96 #endif /* _ASM_POWERPC_HUGETLB_H */