blob: 038886834da5d3dcecf5a1581d2aa34514e541be [file] [log] [blame]
Gerald Schaefer6d779072008-04-28 02:13:27 -07001#ifndef _ASM_POWERPC_HUGETLB_H
2#define _ASM_POWERPC_HUGETLB_H
3
4#include <asm/page.h>
5
David Gibson883a3e52009-10-26 19:24:31 +00006pte_t *huge_pte_offset_and_shift(struct mm_struct *mm,
7 unsigned long addr, unsigned *shift);
8
Gerald Schaefer6d779072008-04-28 02:13:27 -07009int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
10 unsigned long len);
11
Jan Beulich42b77722008-07-23 21:27:10 -070012void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
Gerald Schaefer6d779072008-04-28 02:13:27 -070013 unsigned long end, unsigned long floor,
14 unsigned long ceiling);
15
16void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
17 pte_t *ptep, pte_t pte);
18
19pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
20 pte_t *ptep);
21
22/*
Mel Gorman33402892009-01-06 14:38:54 -080023 * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs
24 * to override the version in mm/hugetlb.c
25 */
26#define vma_mmu_pagesize vma_mmu_pagesize
27
28/*
Gerald Schaefer6d779072008-04-28 02:13:27 -070029 * If the arch doesn't supply something else, assume that hugepage
30 * size aligned regions are ok without further preparation.
31 */
Andi Kleena5516432008-07-23 21:27:41 -070032static inline int prepare_hugepage_range(struct file *file,
33 unsigned long addr, unsigned long len)
Gerald Schaefer6d779072008-04-28 02:13:27 -070034{
Jon Tollefson0d9ea752008-07-23 21:27:56 -070035 struct hstate *h = hstate_file(file);
36 if (len & ~huge_page_mask(h))
Gerald Schaefer6d779072008-04-28 02:13:27 -070037 return -EINVAL;
Jon Tollefson0d9ea752008-07-23 21:27:56 -070038 if (addr & ~huge_page_mask(h))
Gerald Schaefer6d779072008-04-28 02:13:27 -070039 return -EINVAL;
40 return 0;
41}
42
43static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
44{
45}
46
Gerald Schaefer8fe627e2008-04-28 02:13:28 -070047static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
48 unsigned long addr, pte_t *ptep)
49{
50}
51
Gerald Schaefer7f2e9522008-04-28 02:13:29 -070052static inline int huge_pte_none(pte_t pte)
53{
54 return pte_none(pte);
55}
56
57static inline pte_t huge_pte_wrprotect(pte_t pte)
58{
59 return pte_wrprotect(pte);
60}
61
Gerald Schaefer7f2e9522008-04-28 02:13:29 -070062static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
63 unsigned long addr, pte_t *ptep,
64 pte_t pte, int dirty)
65{
66 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
67}
68
69static inline pte_t huge_ptep_get(pte_t *ptep)
70{
71 return *ptep;
72}
73
74static inline int arch_prepare_hugepage(struct page *page)
75{
76 return 0;
77}
78
79static inline void arch_release_hugepage(struct page *page)
80{
81}
82
Gerald Schaefer6d779072008-04-28 02:13:27 -070083#endif /* _ASM_POWERPC_HUGETLB_H */