Add linux-next specific files for 20110831
[linux-2.6/next.git] / arch / powerpc / include / asm / hugetlb.h
blob5856a66ab4047e02c1ce8ed09a69b7c6a2b209be
1 #ifndef _ASM_POWERPC_HUGETLB_H
2 #define _ASM_POWERPC_HUGETLB_H
4 #include <asm/page.h>
6 pte_t *huge_pte_offset_and_shift(struct mm_struct *mm,
7 unsigned long addr, unsigned *shift);
9 void flush_dcache_icache_hugepage(struct page *page);
11 int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
12 unsigned long len);
14 void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
15 unsigned long end, unsigned long floor,
16 unsigned long ceiling);
19 * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs
20 * to override the version in mm/hugetlb.c
22 #define vma_mmu_pagesize vma_mmu_pagesize
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 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;
39 static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
44 static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
45 pte_t *ptep, pte_t pte)
47 set_pte_at(mm, addr, ptep, pte);
50 static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
51 unsigned long addr, pte_t *ptep)
53 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 1);
54 return __pte(old);
57 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
58 unsigned long addr, pte_t *ptep)
60 pte_t pte;
61 pte = huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
62 flush_tlb_page(vma, addr);
65 static inline int huge_pte_none(pte_t pte)
67 return pte_none(pte);
70 static inline pte_t huge_pte_wrprotect(pte_t pte)
72 return pte_wrprotect(pte);
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)
79 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
82 static inline pte_t huge_ptep_get(pte_t *ptep)
84 return *ptep;
87 static inline int arch_prepare_hugepage(struct page *page)
89 return 0;
92 static inline void arch_release_hugepage(struct page *page)
96 #endif /* _ASM_POWERPC_HUGETLB_H */