xref: /openbmc/linux/arch/arm/include/asm/hugetlb.h (revision 1355e2a6eb88f04d76125c057dc5fca64d4b6a9e)
1*1355e2a6SCatalin Marinas /*
2*1355e2a6SCatalin Marinas  * arch/arm/include/asm/hugetlb.h
3*1355e2a6SCatalin Marinas  *
4*1355e2a6SCatalin Marinas  * Copyright (C) 2012 ARM Ltd.
5*1355e2a6SCatalin Marinas  *
6*1355e2a6SCatalin Marinas  * Based on arch/x86/include/asm/hugetlb.h
7*1355e2a6SCatalin Marinas  *
8*1355e2a6SCatalin Marinas  * This program is free software; you can redistribute it and/or modify
9*1355e2a6SCatalin Marinas  * it under the terms of the GNU General Public License version 2 as
10*1355e2a6SCatalin Marinas  * published by the Free Software Foundation.
11*1355e2a6SCatalin Marinas  *
12*1355e2a6SCatalin Marinas  * This program is distributed in the hope that it will be useful,
13*1355e2a6SCatalin Marinas  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14*1355e2a6SCatalin Marinas  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*1355e2a6SCatalin Marinas  * GNU General Public License for more details.
16*1355e2a6SCatalin Marinas  *
17*1355e2a6SCatalin Marinas  * You should have received a copy of the GNU General Public License
18*1355e2a6SCatalin Marinas  * along with this program; if not, write to the Free Software
19*1355e2a6SCatalin Marinas  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20*1355e2a6SCatalin Marinas  */
21*1355e2a6SCatalin Marinas 
22*1355e2a6SCatalin Marinas #ifndef _ASM_ARM_HUGETLB_H
23*1355e2a6SCatalin Marinas #define _ASM_ARM_HUGETLB_H
24*1355e2a6SCatalin Marinas 
25*1355e2a6SCatalin Marinas #include <asm/page.h>
26*1355e2a6SCatalin Marinas #include <asm-generic/hugetlb.h>
27*1355e2a6SCatalin Marinas 
28*1355e2a6SCatalin Marinas #include <asm/hugetlb-3level.h>
29*1355e2a6SCatalin Marinas 
30*1355e2a6SCatalin Marinas static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
31*1355e2a6SCatalin Marinas 					  unsigned long addr, unsigned long end,
32*1355e2a6SCatalin Marinas 					  unsigned long floor,
33*1355e2a6SCatalin Marinas 					  unsigned long ceiling)
34*1355e2a6SCatalin Marinas {
35*1355e2a6SCatalin Marinas 	free_pgd_range(tlb, addr, end, floor, ceiling);
36*1355e2a6SCatalin Marinas }
37*1355e2a6SCatalin Marinas 
38*1355e2a6SCatalin Marinas 
39*1355e2a6SCatalin Marinas static inline int is_hugepage_only_range(struct mm_struct *mm,
40*1355e2a6SCatalin Marinas 					 unsigned long addr, unsigned long len)
41*1355e2a6SCatalin Marinas {
42*1355e2a6SCatalin Marinas 	return 0;
43*1355e2a6SCatalin Marinas }
44*1355e2a6SCatalin Marinas 
45*1355e2a6SCatalin Marinas static inline int prepare_hugepage_range(struct file *file,
46*1355e2a6SCatalin Marinas 					 unsigned long addr, unsigned long len)
47*1355e2a6SCatalin Marinas {
48*1355e2a6SCatalin Marinas 	struct hstate *h = hstate_file(file);
49*1355e2a6SCatalin Marinas 	if (len & ~huge_page_mask(h))
50*1355e2a6SCatalin Marinas 		return -EINVAL;
51*1355e2a6SCatalin Marinas 	if (addr & ~huge_page_mask(h))
52*1355e2a6SCatalin Marinas 		return -EINVAL;
53*1355e2a6SCatalin Marinas 	return 0;
54*1355e2a6SCatalin Marinas }
55*1355e2a6SCatalin Marinas 
56*1355e2a6SCatalin Marinas static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
57*1355e2a6SCatalin Marinas {
58*1355e2a6SCatalin Marinas }
59*1355e2a6SCatalin Marinas 
60*1355e2a6SCatalin Marinas static inline int huge_pte_none(pte_t pte)
61*1355e2a6SCatalin Marinas {
62*1355e2a6SCatalin Marinas 	return pte_none(pte);
63*1355e2a6SCatalin Marinas }
64*1355e2a6SCatalin Marinas 
65*1355e2a6SCatalin Marinas static inline pte_t huge_pte_wrprotect(pte_t pte)
66*1355e2a6SCatalin Marinas {
67*1355e2a6SCatalin Marinas 	return pte_wrprotect(pte);
68*1355e2a6SCatalin Marinas }
69*1355e2a6SCatalin Marinas 
70*1355e2a6SCatalin Marinas static inline int arch_prepare_hugepage(struct page *page)
71*1355e2a6SCatalin Marinas {
72*1355e2a6SCatalin Marinas 	return 0;
73*1355e2a6SCatalin Marinas }
74*1355e2a6SCatalin Marinas 
75*1355e2a6SCatalin Marinas static inline void arch_release_hugepage(struct page *page)
76*1355e2a6SCatalin Marinas {
77*1355e2a6SCatalin Marinas }
78*1355e2a6SCatalin Marinas 
79*1355e2a6SCatalin Marinas static inline void arch_clear_hugepage_flags(struct page *page)
80*1355e2a6SCatalin Marinas {
81*1355e2a6SCatalin Marinas 	clear_bit(PG_dcache_clean, &page->flags);
82*1355e2a6SCatalin Marinas }
83*1355e2a6SCatalin Marinas 
84*1355e2a6SCatalin Marinas #endif /* _ASM_ARM_HUGETLB_H */
85