xref: /openbmc/linux/arch/arm/include/asm/pgtable.h (revision ca2478a7d974f38d29d27acb42a952c7f168916e)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
24baa9922SRussell King /*
34baa9922SRussell King  *  arch/arm/include/asm/pgtable.h
44baa9922SRussell King  *
54baa9922SRussell King  *  Copyright (C) 1995-2002 Russell King
64baa9922SRussell King  */
74baa9922SRussell King #ifndef _ASMARM_PGTABLE_H
84baa9922SRussell King #define _ASMARM_PGTABLE_H
94baa9922SRussell King 
10f6e3354dSRussell King #include <linux/const.h>
114baa9922SRussell King #include <asm/proc-fns.h>
124baa9922SRussell King 
13340a9828SGiulio Benetti #ifndef __ASSEMBLY__
14340a9828SGiulio Benetti /*
15340a9828SGiulio Benetti  * ZERO_PAGE is a global shared page that is always zero: used
16340a9828SGiulio Benetti  * for zero-mapped memory areas etc..
17340a9828SGiulio Benetti  */
18340a9828SGiulio Benetti extern struct page *empty_zero_page;
19340a9828SGiulio Benetti #define ZERO_PAGE(vaddr)	(empty_zero_page)
20340a9828SGiulio Benetti #endif
21340a9828SGiulio Benetti 
224baa9922SRussell King #ifndef CONFIG_MMU
234baa9922SRussell King 
24aa662823SMike Rapoport #include <asm-generic/pgtable-nopud.h>
25a1ce3928SDavid Howells #include <asm/pgtable-nommu.h>
264baa9922SRussell King 
274baa9922SRussell King #else
284baa9922SRussell King 
29a32618d2SRussell King #include <asm-generic/pgtable-nopud.h>
30a9ff6961SLinus Walleij #include <asm/page.h>
314baa9922SRussell King #include <asm/pgtable-hwdef.h>
324baa9922SRussell King 
338d962507SCatalin Marinas 
348d962507SCatalin Marinas #include <asm/tlbflush.h>
358d962507SCatalin Marinas 
36dcfdae04SCatalin Marinas #ifdef CONFIG_ARM_LPAE
37dcfdae04SCatalin Marinas #include <asm/pgtable-3level.h>
38dcfdae04SCatalin Marinas #else
3917f57211SCatalin Marinas #include <asm/pgtable-2level.h>
40dcfdae04SCatalin Marinas #endif
4117f57211SCatalin Marinas 
424baa9922SRussell King /*
434baa9922SRussell King  * Just any arbitrary offset to the start of the vmalloc VM area: the
444baa9922SRussell King  * current 8MB value just means that there will be a 8MB "hole" after the
454baa9922SRussell King  * physical memory until the kernel virtual memory starts.  That means that
464baa9922SRussell King  * any out-of-bounds memory accesses will hopefully be caught.
474baa9922SRussell King  * The vmalloc() routines leaves a hole of 4kB between each vmalloced
484baa9922SRussell King  * area for the same reason. ;)
494baa9922SRussell King  */
504baa9922SRussell King #define VMALLOC_OFFSET		(8*1024*1024)
514baa9922SRussell King #define VMALLOC_START		(((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
526ff09660SNicolas Pitre #define VMALLOC_END		0xff800000UL
534baa9922SRussell King 
544baa9922SRussell King #define LIBRARY_TEXT_START	0x0c000000
554baa9922SRussell King 
564baa9922SRussell King #ifndef __ASSEMBLY__
5769529c0eSRussell King extern void __pte_error(const char *file, int line, pte_t);
5869529c0eSRussell King extern void __pmd_error(const char *file, int line, pmd_t);
5969529c0eSRussell King extern void __pgd_error(const char *file, int line, pgd_t);
604baa9922SRussell King 
6169529c0eSRussell King #define pte_ERROR(pte)		__pte_error(__FILE__, __LINE__, pte)
6269529c0eSRussell King #define pmd_ERROR(pmd)		__pmd_error(__FILE__, __LINE__, pmd)
6369529c0eSRussell King #define pgd_ERROR(pgd)		__pgd_error(__FILE__, __LINE__, pgd)
644baa9922SRussell King 
654baa9922SRussell King /*
664baa9922SRussell King  * This is the lowest virtual address we can permit any user space
674baa9922SRussell King  * mapping to be mapped at.  This is particularly important for
684baa9922SRussell King  * non-high vector CPUs.
694baa9922SRussell King  */
70d8aa712cSRussell King #define FIRST_USER_ADDRESS	(PAGE_SIZE * 2)
714baa9922SRussell King 
724baa9922SRussell King /*
73104ad3b3SCatalin Marinas  * Use TASK_SIZE as the ceiling argument for free_pgtables() and
74104ad3b3SCatalin Marinas  * free_pgd_range() to avoid freeing the modules pmd when LPAE is enabled (pmd
75104ad3b3SCatalin Marinas  * page shared between user and kernel).
76104ad3b3SCatalin Marinas  */
77104ad3b3SCatalin Marinas #ifdef CONFIG_ARM_LPAE
78104ad3b3SCatalin Marinas #define USER_PGTABLES_CEILING	TASK_SIZE
79104ad3b3SCatalin Marinas #endif
80104ad3b3SCatalin Marinas 
81104ad3b3SCatalin Marinas /*
824baa9922SRussell King  * The pgprot_* and protection_map entries will be fixed up in runtime
834baa9922SRussell King  * to include the cachable and bufferable bits based on memory policy,
844baa9922SRussell King  * as well as any architecture dependent bits like global/ASID and SMP
854baa9922SRussell King  * shared mapping bits.
864baa9922SRussell King  */
87bb30f36fSRussell King #define _L_PTE_DEFAULT	L_PTE_PRESENT | L_PTE_YOUNG
884baa9922SRussell King 
894baa9922SRussell King extern pgprot_t		pgprot_user;
904baa9922SRussell King extern pgprot_t		pgprot_kernel;
914baa9922SRussell King 
928ec53663SRussell King #define _MOD_PROT(p, b)	__pgprot(pgprot_val(p) | (b))
938ec53663SRussell King 
9426ffd0d4SWill Deacon #define PAGE_NONE		_MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY | L_PTE_NONE)
9536bb94baSRussell King #define PAGE_SHARED		_MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN)
9636bb94baSRussell King #define PAGE_SHARED_EXEC	_MOD_PROT(pgprot_user, L_PTE_USER)
9736bb94baSRussell King #define PAGE_COPY		_MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
9836bb94baSRussell King #define PAGE_COPY_EXEC		_MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY)
9936bb94baSRussell King #define PAGE_READONLY		_MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
10036bb94baSRussell King #define PAGE_READONLY_EXEC	_MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY)
1019522d7e4SRussell King #define PAGE_KERNEL		_MOD_PROT(pgprot_kernel, L_PTE_XN)
1029522d7e4SRussell King #define PAGE_KERNEL_EXEC	pgprot_kernel
1034baa9922SRussell King 
10426ffd0d4SWill Deacon #define __PAGE_NONE		__pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE)
10536bb94baSRussell King #define __PAGE_SHARED		__pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
10636bb94baSRussell King #define __PAGE_SHARED_EXEC	__pgprot(_L_PTE_DEFAULT | L_PTE_USER)
10736bb94baSRussell King #define __PAGE_COPY		__pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
10836bb94baSRussell King #define __PAGE_COPY_EXEC	__pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY)
10936bb94baSRussell King #define __PAGE_READONLY		__pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
11036bb94baSRussell King #define __PAGE_READONLY_EXEC	__pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY)
1114baa9922SRussell King 
112eb9b2b69SRussell King #define __pgprot_modify(prot,mask,bits)		\
113eb9b2b69SRussell King 	__pgprot((pgprot_val(prot) & ~(mask)) | (bits))
114eb9b2b69SRussell King 
115eb9b2b69SRussell King #define pgprot_noncached(prot) \
116eb9b2b69SRussell King 	__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED)
117eb9b2b69SRussell King 
118eb9b2b69SRussell King #define pgprot_writecombine(prot) \
119eb9b2b69SRussell King 	__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE)
120eb9b2b69SRussell King 
1218fb54284SSantosh Shilimkar #define pgprot_stronglyordered(prot) \
1228fb54284SSantosh Shilimkar 	__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED)
1238fb54284SSantosh Shilimkar 
12458ca3382SVincent Whitchurch #define pgprot_device(prot) \
12558ca3382SVincent Whitchurch 	__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_DEV_SHARED | L_PTE_SHARED | L_PTE_DIRTY | L_PTE_XN)
12658ca3382SVincent Whitchurch 
127eb9b2b69SRussell King #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
128eb9b2b69SRussell King #define pgprot_dmacoherent(prot) \
1299522d7e4SRussell King 	__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE | L_PTE_XN)
130eb9b2b69SRussell King #define __HAVE_PHYS_MEM_ACCESS_PROT
131eb9b2b69SRussell King struct file;
132eb9b2b69SRussell King extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
133eb9b2b69SRussell King 				     unsigned long size, pgprot_t vma_prot);
134eb9b2b69SRussell King #else
135eb9b2b69SRussell King #define pgprot_dmacoherent(prot) \
1369522d7e4SRussell King 	__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED | L_PTE_XN)
137eb9b2b69SRussell King #endif
138eb9b2b69SRussell King 
1394baa9922SRussell King #endif /* __ASSEMBLY__ */
1404baa9922SRussell King 
1414baa9922SRussell King /*
1424baa9922SRussell King  * The table below defines the page protection levels that we insert into our
1434baa9922SRussell King  * Linux page table version.  These get translated into the best that the
1444baa9922SRussell King  * architecture can perform.  Note that on most ARM hardware:
1454baa9922SRussell King  *  1) We cannot do execute protection
1464baa9922SRussell King  *  2) If we could do execute protection, then read is implied
1474baa9922SRussell King  *  3) write implies read permissions
1484baa9922SRussell King  */
1494baa9922SRussell King 
1504baa9922SRussell King #ifndef __ASSEMBLY__
1514eec4b13SRussell King 
1524eec4b13SRussell King extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
1534eec4b13SRussell King 
154*1a8b2391SAlexandre Ghiti #define pgdp_get(pgpd)		READ_ONCE(*pgdp)
155*1a8b2391SAlexandre Ghiti 
156972472c7SNicholas Piggin #define pud_page(pud)		pmd_page(__pmd(pud_val(pud)))
157972472c7SNicholas Piggin #define pud_write(pud)		pmd_write(__pmd(pud_val(pud)))
158972472c7SNicholas Piggin 
1594baa9922SRussell King #define pmd_none(pmd)		(!pmd_val(pmd))
1604baa9922SRussell King 
pmd_page_vaddr(pmd_t pmd)1614baa9922SRussell King static inline pte_t *pmd_page_vaddr(pmd_t pmd)
1624baa9922SRussell King {
163d7c5d0dcSCatalin Marinas 	return __va(pmd_val(pmd) & PHYS_MASK & (s32)PAGE_MASK);
1644baa9922SRussell King }
1654baa9922SRussell King 
166d7c5d0dcSCatalin Marinas #define pmd_page(pmd)		pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
1674baa9922SRussell King 
168d7c5d0dcSCatalin Marinas #define pte_pfn(pte)		((pte_val(pte) & PHYS_MASK) >> PAGE_SHIFT)
169cae6292bSWill Deacon #define pfn_pte(pfn,prot)	__pte(__pfn_to_phys(pfn) | pgprot_val(prot))
170b510b049SRussell King 
171b510b049SRussell King #define pte_page(pte)		pfn_to_page(pte_pfn(pte))
1724baa9922SRussell King #define mk_pte(page,prot)	pfn_pte(page_to_pfn(page), prot)
1734baa9922SRussell King 
174b510b049SRussell King #define pte_clear(mm,addr,ptep)	set_pte_ext(ptep, __pte(0), 0)
1754baa9922SRussell King 
176f2950706SSteven Capper #define pte_isset(pte, val)	((u32)(val) == (val) ? pte_val(pte) & (val) \
177f2950706SSteven Capper 						: !!(pte_val(pte) & (val)))
178f2950706SSteven Capper #define pte_isclear(pte, val)	(!(pte_val(pte) & (val)))
179f2950706SSteven Capper 
180b510b049SRussell King #define pte_none(pte)		(!pte_val(pte))
181f2950706SSteven Capper #define pte_present(pte)	(pte_isset((pte), L_PTE_PRESENT))
182f2950706SSteven Capper #define pte_valid(pte)		(pte_isset((pte), L_PTE_VALID))
1831971188aSWill Deacon #define pte_accessible(mm, pte)	(mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte))
184f2950706SSteven Capper #define pte_write(pte)		(pte_isclear((pte), L_PTE_RDONLY))
185f2950706SSteven Capper #define pte_dirty(pte)		(pte_isset((pte), L_PTE_DIRTY))
186f2950706SSteven Capper #define pte_young(pte)		(pte_isset((pte), L_PTE_YOUNG))
187f2950706SSteven Capper #define pte_exec(pte)		(pte_isclear((pte), L_PTE_XN))
188b510b049SRussell King 
1891971188aSWill Deacon #define pte_valid_user(pte)	\
190f2950706SSteven Capper 	(pte_valid(pte) && pte_isset((pte), L_PTE_USER) && pte_young(pte))
191b510b049SRussell King 
pte_access_permitted(pte_t pte,bool write)1921ee5e87fSRussell King static inline bool pte_access_permitted(pte_t pte, bool write)
1931ee5e87fSRussell King {
1941ee5e87fSRussell King 	pteval_t mask = L_PTE_PRESENT | L_PTE_USER;
1951ee5e87fSRussell King 	pteval_t needed = mask;
1961ee5e87fSRussell King 
1971ee5e87fSRussell King 	if (write)
1981ee5e87fSRussell King 		mask |= L_PTE_RDONLY;
1991ee5e87fSRussell King 
2001ee5e87fSRussell King 	return (pte_val(pte) & mask) == needed;
2011ee5e87fSRussell King }
2021ee5e87fSRussell King #define pte_access_permitted pte_access_permitted
2031ee5e87fSRussell King 
20447f12043SWill Deacon #if __LINUX_ARM_ARCH__ < 6
__sync_icache_dcache(pte_t pteval)20547f12043SWill Deacon static inline void __sync_icache_dcache(pte_t pteval)
20647f12043SWill Deacon {
20747f12043SWill Deacon }
20847f12043SWill Deacon #else
20947f12043SWill Deacon extern void __sync_icache_dcache(pte_t pteval);
21047f12043SWill Deacon #endif
21147f12043SWill Deacon 
2128b5989f3SMatthew Wilcox (Oracle) void set_ptes(struct mm_struct *mm, unsigned long addr,
2138b5989f3SMatthew Wilcox (Oracle) 		      pte_t *ptep, pte_t pteval, unsigned int nr);
2148b5989f3SMatthew Wilcox (Oracle) #define set_ptes set_ptes
21547f12043SWill Deacon 
clear_pte_bit(pte_t pte,pgprot_t prot)2161f92f77aSJungseung Lee static inline pte_t clear_pte_bit(pte_t pte, pgprot_t prot)
2171f92f77aSJungseung Lee {
2181f92f77aSJungseung Lee 	pte_val(pte) &= ~pgprot_val(prot);
2191f92f77aSJungseung Lee 	return pte;
2201f92f77aSJungseung Lee }
221b510b049SRussell King 
set_pte_bit(pte_t pte,pgprot_t prot)2221f92f77aSJungseung Lee static inline pte_t set_pte_bit(pte_t pte, pgprot_t prot)
2231f92f77aSJungseung Lee {
2241f92f77aSJungseung Lee 	pte_val(pte) |= pgprot_val(prot);
2251f92f77aSJungseung Lee 	return pte;
2261f92f77aSJungseung Lee }
2271f92f77aSJungseung Lee 
pte_wrprotect(pte_t pte)2281f92f77aSJungseung Lee static inline pte_t pte_wrprotect(pte_t pte)
2291f92f77aSJungseung Lee {
2301f92f77aSJungseung Lee 	return set_pte_bit(pte, __pgprot(L_PTE_RDONLY));
2311f92f77aSJungseung Lee }
2321f92f77aSJungseung Lee 
pte_mkwrite_novma(pte_t pte)2332f0584f3SRick Edgecombe static inline pte_t pte_mkwrite_novma(pte_t pte)
2341f92f77aSJungseung Lee {
2351f92f77aSJungseung Lee 	return clear_pte_bit(pte, __pgprot(L_PTE_RDONLY));
2361f92f77aSJungseung Lee }
2371f92f77aSJungseung Lee 
pte_mkclean(pte_t pte)2381f92f77aSJungseung Lee static inline pte_t pte_mkclean(pte_t pte)
2391f92f77aSJungseung Lee {
2401f92f77aSJungseung Lee 	return clear_pte_bit(pte, __pgprot(L_PTE_DIRTY));
2411f92f77aSJungseung Lee }
2421f92f77aSJungseung Lee 
pte_mkdirty(pte_t pte)2431f92f77aSJungseung Lee static inline pte_t pte_mkdirty(pte_t pte)
2441f92f77aSJungseung Lee {
2451f92f77aSJungseung Lee 	return set_pte_bit(pte, __pgprot(L_PTE_DIRTY));
2461f92f77aSJungseung Lee }
2471f92f77aSJungseung Lee 
pte_mkold(pte_t pte)2481f92f77aSJungseung Lee static inline pte_t pte_mkold(pte_t pte)
2491f92f77aSJungseung Lee {
2501f92f77aSJungseung Lee 	return clear_pte_bit(pte, __pgprot(L_PTE_YOUNG));
2511f92f77aSJungseung Lee }
2521f92f77aSJungseung Lee 
pte_mkyoung(pte_t pte)2531f92f77aSJungseung Lee static inline pte_t pte_mkyoung(pte_t pte)
2541f92f77aSJungseung Lee {
2551f92f77aSJungseung Lee 	return set_pte_bit(pte, __pgprot(L_PTE_YOUNG));
2561f92f77aSJungseung Lee }
2571f92f77aSJungseung Lee 
pte_mkexec(pte_t pte)2581f92f77aSJungseung Lee static inline pte_t pte_mkexec(pte_t pte)
2591f92f77aSJungseung Lee {
2601f92f77aSJungseung Lee 	return clear_pte_bit(pte, __pgprot(L_PTE_XN));
2611f92f77aSJungseung Lee }
2621f92f77aSJungseung Lee 
pte_mknexec(pte_t pte)2631f92f77aSJungseung Lee static inline pte_t pte_mknexec(pte_t pte)
2641f92f77aSJungseung Lee {
2651f92f77aSJungseung Lee 	return set_pte_bit(pte, __pgprot(L_PTE_XN));
2661f92f77aSJungseung Lee }
267b510b049SRussell King 
pte_modify(pte_t pte,pgprot_t newprot)2684baa9922SRussell King static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
2694baa9922SRussell King {
27069dde4c5SCatalin Marinas 	const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER |
27169dde4c5SCatalin Marinas 		L_PTE_NONE | L_PTE_VALID;
2724baa9922SRussell King 	pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
2734baa9922SRussell King 	return pte;
2744baa9922SRussell King }
2754baa9922SRussell King 
276fb93a1c7SRussell King /*
27720aae9efSDavid Hildenbrand  * Encode/decode swap entries and swap PTEs. Swap PTEs are all PTEs that
27820aae9efSDavid Hildenbrand  * are !pte_none() && !pte_present().
27920aae9efSDavid Hildenbrand  *
28020aae9efSDavid Hildenbrand  * Format of swap PTEs:
2814baa9922SRussell King  *
282fb93a1c7SRussell King  *   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
283fb93a1c7SRussell King  *   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
28420aae9efSDavid Hildenbrand  *   <------------------- offset ------------------> E < type -> 0 0
285fb93a1c7SRussell King  *
28620aae9efSDavid Hildenbrand  *   E is the exclusive marker that is not stored in swap entries.
28720aae9efSDavid Hildenbrand  *
28820aae9efSDavid Hildenbrand  * This gives us up to 31 swap files and 64GB per swap file.  Note that
289fb93a1c7SRussell King  * the offset field is always non-zero.
2904baa9922SRussell King  */
291b007ea79SKirill A. Shutemov #define __SWP_TYPE_SHIFT	2
292f5f2025eSWill Deacon #define __SWP_TYPE_BITS		5
293fb93a1c7SRussell King #define __SWP_TYPE_MASK		((1 << __SWP_TYPE_BITS) - 1)
29420aae9efSDavid Hildenbrand #define __SWP_OFFSET_SHIFT	(__SWP_TYPE_BITS + __SWP_TYPE_SHIFT + 1)
295fb93a1c7SRussell King 
296fb93a1c7SRussell King #define __swp_type(x)		(((x).val >> __SWP_TYPE_SHIFT) & __SWP_TYPE_MASK)
297fb93a1c7SRussell King #define __swp_offset(x)		((x).val >> __SWP_OFFSET_SHIFT)
2986f74c0ecSDavid Hildenbrand #define __swp_entry(type, offset) ((swp_entry_t) { (((type) & __SWP_TYPE_MASK) << __SWP_TYPE_SHIFT) | \
29920aae9efSDavid Hildenbrand 						   ((offset) << __SWP_OFFSET_SHIFT) })
300fb93a1c7SRussell King 
3014baa9922SRussell King #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
30220aae9efSDavid Hildenbrand #define __swp_entry_to_pte(swp)	__pte((swp).val)
30320aae9efSDavid Hildenbrand 
pte_swp_exclusive(pte_t pte)30420aae9efSDavid Hildenbrand static inline int pte_swp_exclusive(pte_t pte)
30520aae9efSDavid Hildenbrand {
30620aae9efSDavid Hildenbrand 	return pte_isset(pte, L_PTE_SWP_EXCLUSIVE);
30720aae9efSDavid Hildenbrand }
30820aae9efSDavid Hildenbrand 
pte_swp_mkexclusive(pte_t pte)30920aae9efSDavid Hildenbrand static inline pte_t pte_swp_mkexclusive(pte_t pte)
31020aae9efSDavid Hildenbrand {
31120aae9efSDavid Hildenbrand 	return set_pte_bit(pte, __pgprot(L_PTE_SWP_EXCLUSIVE));
31220aae9efSDavid Hildenbrand }
31320aae9efSDavid Hildenbrand 
pte_swp_clear_exclusive(pte_t pte)31420aae9efSDavid Hildenbrand static inline pte_t pte_swp_clear_exclusive(pte_t pte)
31520aae9efSDavid Hildenbrand {
31620aae9efSDavid Hildenbrand 	return clear_pte_bit(pte, __pgprot(L_PTE_SWP_EXCLUSIVE));
31720aae9efSDavid Hildenbrand }
3184baa9922SRussell King 
319fb93a1c7SRussell King /*
320fb93a1c7SRussell King  * It is an error for the kernel to have more swap files than we can
321fb93a1c7SRussell King  * encode in the PTEs.  This ensures that we know when MAX_SWAPFILES
322fb93a1c7SRussell King  * is increased beyond what we presently support.
323fb93a1c7SRussell King  */
324fb93a1c7SRussell King #define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS)
325fb93a1c7SRussell King 
3264baa9922SRussell King /*
3274baa9922SRussell King  * We provide our own arch_get_unmapped_area to cope with VIPT caches.
3284baa9922SRussell King  */
3294baa9922SRussell King #define HAVE_ARCH_UNMAPPED_AREA
3307dbaa466SRob Herring #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
3314baa9922SRussell King 
3324baa9922SRussell King #endif /* !__ASSEMBLY__ */
3334baa9922SRussell King 
3344baa9922SRussell King #endif /* CONFIG_MMU */
3354baa9922SRussell King 
3364baa9922SRussell King #endif /* _ASMARM_PGTABLE_H */
337