blob: 42aafba7a30834db7643213a3aec583a3cdd1b6a [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05302#ifndef _ASM_POWERPC_BOOK3S_64_PGTABLE_H_
3#define _ASM_POWERPC_BOOK3S_64_PGTABLE_H_
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +10004
Kirill A. Shutemov9849a562017-03-09 17:24:05 +03005#include <asm-generic/5level-fixup.h>
6
Aneesh Kumar K.Vc137a272017-02-24 14:59:21 -08007#ifndef __ASSEMBLY__
8#include <linux/mmdebug.h>
Oliver O'Halloranebd31192017-06-28 11:32:34 +10009#include <linux/bug.h>
Aneesh Kumar K.Vc137a272017-02-24 14:59:21 -080010#endif
Kirill A. Shutemov9849a562017-03-09 17:24:05 +030011
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +053012/*
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +100013 * Common bits between hash and Radix page table
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +053014 */
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +100015#define _PAGE_BIT_SWAP_TYPE 0
16
Christophe Leroy35175032018-01-12 13:45:29 +010017#define _PAGE_NA 0
Christophe Leroy6b8cb662016-09-19 12:58:54 +020018#define _PAGE_RO 0
Christophe Leroy812fadc2018-01-12 13:45:27 +010019#define _PAGE_USER 0
Christophe Leroy6b8cb662016-09-19 12:58:54 +020020
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +100021#define _PAGE_EXEC 0x00001 /* execute permission */
22#define _PAGE_WRITE 0x00002 /* write access allowed */
23#define _PAGE_READ 0x00004 /* read access allowed */
24#define _PAGE_RW (_PAGE_READ | _PAGE_WRITE)
25#define _PAGE_RWX (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)
26#define _PAGE_PRIVILEGED 0x00008 /* kernel access only */
27#define _PAGE_SAO 0x00010 /* Strong access order */
28#define _PAGE_NON_IDEMPOTENT 0x00020 /* non idempotent memory */
29#define _PAGE_TOLERANT 0x00030 /* tolerant memory, cache inhibited */
30#define _PAGE_DIRTY 0x00080 /* C: page changed */
31#define _PAGE_ACCESSED 0x00100 /* R: page referenced */
32/*
33 * Software bits
34 */
Aneesh Kumar K.V69dfbae2016-04-29 23:26:33 +100035#define _RPAGE_SW0 0x2000000000000000UL
36#define _RPAGE_SW1 0x00800
37#define _RPAGE_SW2 0x00400
38#define _RPAGE_SW3 0x00200
Aneesh Kumar K.V049d5672016-11-28 11:47:00 +053039#define _RPAGE_RSV1 0x1000000000000000UL
40#define _RPAGE_RSV2 0x0800000000000000UL
41#define _RPAGE_RSV3 0x0400000000000000UL
42#define _RPAGE_RSV4 0x0200000000000000UL
Ram Paieb95d012018-01-18 17:50:35 -080043#define _RPAGE_RSV5 0x00040UL
Aneesh Kumar K.V6aa59f52017-03-28 15:21:12 +110044
45#define _PAGE_PTE 0x4000000000000000UL /* distinguishes PTEs from pointers */
46#define _PAGE_PRESENT 0x8000000000000000UL /* pte contains a translation */
47
48/*
49 * Top and bottom bits of RPN which can be used by hash
50 * translation mode, because we expect them to be zero
51 * otherwise.
52 */
Aneesh Kumar K.V32789d32017-03-21 22:59:58 +053053#define _RPAGE_RPN0 0x01000
54#define _RPAGE_RPN1 0x02000
Aneesh Kumar K.V6aa59f52017-03-28 15:21:12 +110055#define _RPAGE_RPN44 0x0100000000000000UL
56#define _RPAGE_RPN43 0x0080000000000000UL
57#define _RPAGE_RPN42 0x0040000000000000UL
58#define _RPAGE_RPN41 0x0020000000000000UL
Aneesh Kumar K.V049d5672016-11-28 11:47:00 +053059
Aneesh Kumar K.V2f18d532017-03-21 22:59:59 +053060/* Max physical address bit as per radix table */
61#define _RPAGE_PA_MAX 57
62
63/*
64 * Max physical address bit we will use for now.
65 *
66 * This is mostly a hardware limitation and for now Power9 has
67 * a 51 bit limit.
68 *
69 * This is different from the number of physical bit required to address
70 * the last byte of memory. That is defined by MAX_PHYSMEM_BITS.
71 * MAX_PHYSMEM_BITS is a linux limitation imposed by the maximum
72 * number of sections we can support (SECTIONS_SHIFT).
73 *
74 * This is different from Radix page table limitation above and
75 * should always be less than that. The limit is done such that
76 * we can overload the bits between _RPAGE_PA_MAX and _PAGE_PA_MAX
77 * for hash linux page table specific bits.
78 *
79 * In order to be compatible with future hardware generations we keep
80 * some offsets and limit this for now to 53
81 */
82#define _PAGE_PA_MAX 53
83
Aneesh Kumar K.V69dfbae2016-04-29 23:26:33 +100084#define _PAGE_SOFT_DIRTY _RPAGE_SW3 /* software: software dirty tracking */
Aneesh Kumar K.V69dfbae2016-04-29 23:26:33 +100085#define _PAGE_SPECIAL _RPAGE_SW2 /* software: special page */
Oliver O'Halloranebd31192017-06-28 11:32:34 +100086#define _PAGE_DEVMAP _RPAGE_SW1 /* software: ZONE_DEVICE page */
87#define __HAVE_ARCH_PTE_DEVMAP
88
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +100089/*
90 * Drivers request for cache inhibited pte mapping using _PAGE_NO_CACHE
91 * Instead of fixing all of them, add an alternate define which
92 * maps CI pte mapping.
93 */
94#define _PAGE_NO_CACHE _PAGE_TOLERANT
95/*
Aneesh Kumar K.V2f18d532017-03-21 22:59:59 +053096 * We support _RPAGE_PA_MAX bit real address in pte. On the linux side
97 * we are limited by _PAGE_PA_MAX. Clear everything above _PAGE_PA_MAX
98 * and every thing below PAGE_SHIFT;
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +100099 */
Aneesh Kumar K.V2f18d532017-03-21 22:59:59 +0530100#define PTE_RPN_MASK (((1UL << _PAGE_PA_MAX) - 1) & (PAGE_MASK))
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +1000101/*
102 * set of bits not changed in pmd_modify. Even though we have hash specific bits
103 * in here, on radix we expect them to be zero.
104 */
105#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
106 _PAGE_ACCESSED | H_PAGE_THP_HUGE | _PAGE_PTE | \
107 _PAGE_SOFT_DIRTY)
108/*
109 * user access blocked by key
110 */
111#define _PAGE_KERNEL_RW (_PAGE_PRIVILEGED | _PAGE_RW | _PAGE_DIRTY)
112#define _PAGE_KERNEL_RO (_PAGE_PRIVILEGED | _PAGE_READ)
113#define _PAGE_KERNEL_RWX (_PAGE_PRIVILEGED | _PAGE_DIRTY | \
114 _PAGE_RW | _PAGE_EXEC)
115/*
116 * No page size encoding in the linux PTE
117 */
118#define _PAGE_PSIZE 0
119/*
120 * _PAGE_CHG_MASK masks of bits that are to be preserved across
121 * pgprot changes
122 */
123#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
124 _PAGE_ACCESSED | _PAGE_SPECIAL | _PAGE_PTE | \
125 _PAGE_SOFT_DIRTY)
Ram Paieb95d012018-01-18 17:50:35 -0800126
127#define H_PTE_PKEY (H_PTE_PKEY_BIT0 | H_PTE_PKEY_BIT1 | H_PTE_PKEY_BIT2 | \
128 H_PTE_PKEY_BIT3 | H_PTE_PKEY_BIT4)
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +1000129/*
130 * Mask of bits returned by pte_pgprot()
131 */
132#define PAGE_PROT_BITS (_PAGE_SAO | _PAGE_NON_IDEMPOTENT | _PAGE_TOLERANT | \
133 H_PAGE_4K_PFN | _PAGE_PRIVILEGED | _PAGE_ACCESSED | \
134 _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_EXEC | \
Ram Paieb95d012018-01-18 17:50:35 -0800135 _PAGE_SOFT_DIRTY | H_PTE_PKEY)
Aneesh Kumar K.V2e873512016-04-29 23:25:47 +1000136/*
137 * We define 2 sets of base prot bits, one for basic pages (ie,
138 * cacheable kernel and user pages) and one for non cacheable
139 * pages. We always set _PAGE_COHERENT when SMP is enabled or
140 * the processor might need it for DMA coherency.
141 */
142#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_PSIZE)
143#define _PAGE_BASE (_PAGE_BASE_NC)
144
145/* Permission masks used to generate the __P and __S table,
146 *
147 * Note:__pgprot is defined in arch/powerpc/include/asm/page.h
148 *
149 * Write permissions imply read permissions for now (we could make write-only
150 * pages on BookE but we don't bother for now). Execute permission control is
151 * possible on platforms that define _PAGE_EXEC
152 *
153 * Note due to the way vm flags are laid out, the bits are XWR
154 */
155#define PAGE_NONE __pgprot(_PAGE_BASE | _PAGE_PRIVILEGED)
156#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW)
157#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_EXEC)
158#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_READ)
159#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_EXEC)
160#define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_READ)
161#define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_EXEC)
162
163#define __P000 PAGE_NONE
164#define __P001 PAGE_READONLY
165#define __P010 PAGE_COPY
166#define __P011 PAGE_COPY
167#define __P100 PAGE_READONLY_X
168#define __P101 PAGE_READONLY_X
169#define __P110 PAGE_COPY_X
170#define __P111 PAGE_COPY_X
171
172#define __S000 PAGE_NONE
173#define __S001 PAGE_READONLY
174#define __S010 PAGE_SHARED
175#define __S011 PAGE_SHARED
176#define __S100 PAGE_READONLY_X
177#define __S101 PAGE_READONLY_X
178#define __S110 PAGE_SHARED_X
179#define __S111 PAGE_SHARED_X
180
181/* Permission masks used for kernel mappings */
182#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW)
183#define PAGE_KERNEL_NC __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \
184 _PAGE_TOLERANT)
185#define PAGE_KERNEL_NCG __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \
186 _PAGE_NON_IDEMPOTENT)
187#define PAGE_KERNEL_X __pgprot(_PAGE_BASE | _PAGE_KERNEL_RWX)
188#define PAGE_KERNEL_RO __pgprot(_PAGE_BASE | _PAGE_KERNEL_RO)
189#define PAGE_KERNEL_ROX __pgprot(_PAGE_BASE | _PAGE_KERNEL_ROX)
190
191/*
192 * Protection used for kernel text. We want the debuggers to be able to
193 * set breakpoints anywhere, so don't write protect the kernel text
194 * on platforms where such control is possible.
195 */
196#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) || \
197 defined(CONFIG_KPROBES) || defined(CONFIG_DYNAMIC_FTRACE)
198#define PAGE_KERNEL_TEXT PAGE_KERNEL_X
199#else
200#define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX
201#endif
202
203/* Make modules code happy. We don't set RO yet */
204#define PAGE_KERNEL_EXEC PAGE_KERNEL_X
205#define PAGE_AGP (PAGE_KERNEL_NC)
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530206
Aneesh Kumar K.Vdd1842a2016-04-29 23:25:49 +1000207#ifndef __ASSEMBLY__
208/*
209 * page table defines
210 */
211extern unsigned long __pte_index_size;
212extern unsigned long __pmd_index_size;
213extern unsigned long __pud_index_size;
214extern unsigned long __pgd_index_size;
Aneesh Kumar K.Vfae22112018-02-11 20:30:06 +0530215extern unsigned long __pud_cache_index;
Aneesh Kumar K.Vdd1842a2016-04-29 23:25:49 +1000216#define PTE_INDEX_SIZE __pte_index_size
217#define PMD_INDEX_SIZE __pmd_index_size
218#define PUD_INDEX_SIZE __pud_index_size
219#define PGD_INDEX_SIZE __pgd_index_size
Aneesh Kumar K.V738f9642018-04-16 16:57:23 +0530220/* pmd table use page table fragments */
221#define PMD_CACHE_INDEX 0
Aneesh Kumar K.Vfae22112018-02-11 20:30:06 +0530222#define PUD_CACHE_INDEX __pud_cache_index
Aneesh Kumar K.Vdd1842a2016-04-29 23:25:49 +1000223/*
224 * Because of use of pte fragments and THP, size of page table
225 * are not always derived out of index size above.
226 */
227extern unsigned long __pte_table_size;
228extern unsigned long __pmd_table_size;
229extern unsigned long __pud_table_size;
230extern unsigned long __pgd_table_size;
231#define PTE_TABLE_SIZE __pte_table_size
232#define PMD_TABLE_SIZE __pmd_table_size
233#define PUD_TABLE_SIZE __pud_table_size
234#define PGD_TABLE_SIZE __pgd_table_size
Aneesh Kumar K.Va2f41eb2016-04-29 23:26:19 +1000235
236extern unsigned long __pmd_val_bits;
237extern unsigned long __pud_val_bits;
238extern unsigned long __pgd_val_bits;
239#define PMD_VAL_BITS __pmd_val_bits
240#define PUD_VAL_BITS __pud_val_bits
241#define PGD_VAL_BITS __pgd_val_bits
Aneesh Kumar K.V5ed7ecd2016-04-29 23:26:23 +1000242
243extern unsigned long __pte_frag_nr;
244#define PTE_FRAG_NR __pte_frag_nr
245extern unsigned long __pte_frag_size_shift;
246#define PTE_FRAG_SIZE_SHIFT __pte_frag_size_shift
247#define PTE_FRAG_SIZE (1UL << PTE_FRAG_SIZE_SHIFT)
Aneesh Kumar K.Vdd1842a2016-04-29 23:25:49 +1000248
Aneesh Kumar K.V8a6c6972018-04-16 16:57:22 +0530249extern unsigned long __pmd_frag_nr;
250#define PMD_FRAG_NR __pmd_frag_nr
251extern unsigned long __pmd_frag_size_shift;
252#define PMD_FRAG_SIZE_SHIFT __pmd_frag_size_shift
253#define PMD_FRAG_SIZE (1UL << PMD_FRAG_SIZE_SHIFT)
254
Aneesh Kumar K.Vdd1842a2016-04-29 23:25:49 +1000255#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
256#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
257#define PTRS_PER_PUD (1 << PUD_INDEX_SIZE)
258#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
259
260/* PMD_SHIFT determines what a second-level page table entry can map */
261#define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
262#define PMD_SIZE (1UL << PMD_SHIFT)
263#define PMD_MASK (~(PMD_SIZE-1))
264
265/* PUD_SHIFT determines what a third-level page table entry can map */
266#define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE)
267#define PUD_SIZE (1UL << PUD_SHIFT)
268#define PUD_MASK (~(PUD_SIZE-1))
269
270/* PGDIR_SHIFT determines what a fourth-level page table entry can map */
271#define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE)
272#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
273#define PGDIR_MASK (~(PGDIR_SIZE-1))
274
275/* Bits to mask out from a PMD to get to the PTE page */
276#define PMD_MASKED_BITS 0xc0000000000000ffUL
277/* Bits to mask out from a PUD to get to the PMD page */
278#define PUD_MASKED_BITS 0xc0000000000000ffUL
279/* Bits to mask out from a PGD to get to the PUD page */
280#define PGD_MASKED_BITS 0xc0000000000000ffUL
Aneesh Kumar K.Vd6a99962016-04-29 23:26:21 +1000281
Aneesh Kumar K.V0c4d2682018-04-16 16:57:21 +0530282/*
283 * Used as an indicator for rcu callback functions
284 */
285enum pgtable_index {
286 PTE_INDEX = 0,
287 PMD_INDEX,
288 PUD_INDEX,
289 PGD_INDEX,
Aneesh Kumar K.Vfadd03c2018-06-14 16:01:52 +0530290 /*
291 * Below are used with 4k page size and hugetlb
292 */
293 HTLB_16M_INDEX,
294 HTLB_16G_INDEX,
Aneesh Kumar K.V0c4d2682018-04-16 16:57:21 +0530295};
296
Aneesh Kumar K.Vd6a99962016-04-29 23:26:21 +1000297extern unsigned long __vmalloc_start;
298extern unsigned long __vmalloc_end;
299#define VMALLOC_START __vmalloc_start
300#define VMALLOC_END __vmalloc_end
301
302extern unsigned long __kernel_virt_start;
303extern unsigned long __kernel_virt_size;
Michael Ellerman63ee9b22017-08-01 20:29:22 +1000304extern unsigned long __kernel_io_start;
Aneesh Kumar K.Vd6a99962016-04-29 23:26:21 +1000305#define KERN_VIRT_START __kernel_virt_start
306#define KERN_VIRT_SIZE __kernel_virt_size
Michael Ellerman63ee9b22017-08-01 20:29:22 +1000307#define KERN_IO_START __kernel_io_start
Aneesh Kumar K.Vd6a99962016-04-29 23:26:21 +1000308extern struct page *vmemmap;
309extern unsigned long ioremap_bot;
Darren Stevensbfa37082016-06-29 21:06:28 +0100310extern unsigned long pci_io_base;
Aneesh Kumar K.Vdd1842a2016-04-29 23:25:49 +1000311#endif /* __ASSEMBLY__ */
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530312
Aneesh Kumar K.Vab537dc2015-12-01 09:06:30 +0530313#include <asm/book3s/64/hash.h>
Aneesh Kumar K.Vb0b5e9b2016-04-29 23:25:52 +1000314#include <asm/book3s/64/radix.h>
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530315
Aneesh Kumar K.Va9252aae2016-04-29 23:25:55 +1000316#ifdef CONFIG_PPC_64K_PAGES
317#include <asm/book3s/64/pgtable-64k.h>
318#else
319#include <asm/book3s/64/pgtable-4k.h>
320#endif
321
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530322#include <asm/barrier.h>
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530323/*
324 * The second half of the kernel virtual space is used for IO mappings,
325 * it's itself carved into the PIO region (ISA and PHB IO space) and
326 * the ioremap space
327 *
328 * ISA_IO_BASE = KERN_IO_START, 64K reserved area
329 * PHB_IO_BASE = ISA_IO_BASE + 64K to ISA_IO_BASE + 2G, PHB IO spaces
330 * IOREMAP_BASE = ISA_IO_BASE + 2G to VMALLOC_START + PGTABLE_RANGE
331 */
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530332#define FULL_IO_SIZE 0x80000000ul
333#define ISA_IO_BASE (KERN_IO_START)
334#define ISA_IO_END (KERN_IO_START + 0x10000ul)
335#define PHB_IO_BASE (ISA_IO_END)
336#define PHB_IO_END (KERN_IO_START + FULL_IO_SIZE)
337#define IOREMAP_BASE (PHB_IO_END)
338#define IOREMAP_END (KERN_VIRT_START + KERN_VIRT_SIZE)
339
Aneesh Kumar K.Vb0412ea2015-12-01 09:06:33 +0530340/* Advertise special mapping type for AGP */
Aneesh Kumar K.Vb0412ea2015-12-01 09:06:33 +0530341#define HAVE_PAGE_AGP
342
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530343#ifndef __ASSEMBLY__
344
345/*
346 * This is the default implementation of various PTE accessors, it's
347 * used in all cases except Book3S with 64K pages where we have a
348 * concept of sub-pages
349 */
350#ifndef __real_pte
351
Aneesh Kumar K.Vff31e102018-02-11 20:30:08 +0530352#define __real_pte(e, p, o) ((real_pte_t){(e)})
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530353#define __rpte_to_pte(r) ((r).pte)
Aneesh Kumar K.V945537d2016-04-29 23:25:45 +1000354#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530355
356#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
357 do { \
358 index = 0; \
359 shift = mmu_psize_defs[psize].shift; \
360
361#define pte_iterate_hashed_end() } while(0)
362
363/*
364 * We expect this to be called only for user addresses or kernel virtual
365 * addresses other than the linear mapping.
366 */
367#define pte_pagesize_index(mm, addr, pte) MMU_PAGE_4K
368
369#endif /* __real_pte */
370
Aneesh Kumar K.Vac94ac792016-04-29 23:25:54 +1000371static inline unsigned long pte_update(struct mm_struct *mm, unsigned long addr,
372 pte_t *ptep, unsigned long clr,
373 unsigned long set, int huge)
374{
375 if (radix_enabled())
376 return radix__pte_update(mm, addr, ptep, clr, set, huge);
377 return hash__pte_update(mm, addr, ptep, clr, set, huge);
378}
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000379/*
380 * For hash even if we have _PAGE_ACCESSED = 0, we do a pte_update.
381 * We currently remove entries from the hashtable regardless of whether
382 * the entry was young or dirty.
383 *
384 * We should be more intelligent about this but for the moment we override
385 * these functions and force a tlb flush unconditionally
386 * For radix: H_PAGE_HASHPTE should be zero. Hence we can use the same
387 * function for both hash and radix.
388 */
389static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
390 unsigned long addr, pte_t *ptep)
391{
392 unsigned long old;
393
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530394 if ((pte_raw(*ptep) & cpu_to_be64(_PAGE_ACCESSED | H_PAGE_HASHPTE)) == 0)
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000395 return 0;
396 old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0, 0);
397 return (old & _PAGE_ACCESSED) != 0;
398}
399
400#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
401#define ptep_test_and_clear_young(__vma, __addr, __ptep) \
402({ \
403 int __r; \
404 __r = __ptep_test_and_clear_young((__vma)->vm_mm, __addr, __ptep); \
405 __r; \
406})
407
Aneesh Kumar K.Vd19469e2017-03-09 16:16:39 -0800408static inline int __pte_write(pte_t pte)
Aneesh Kumar K.V52c50ca2017-03-09 16:16:36 -0800409{
410 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_WRITE));
411}
412
413#ifdef CONFIG_NUMA_BALANCING
414#define pte_savedwrite pte_savedwrite
415static inline bool pte_savedwrite(pte_t pte)
416{
417 /*
418 * Saved write ptes are prot none ptes that doesn't have
419 * privileged bit sit. We mark prot none as one which has
420 * present and pviliged bit set and RWX cleared. To mark
421 * protnone which used to have _PAGE_WRITE set we clear
422 * the privileged bit.
423 */
424 return !(pte_raw(pte) & cpu_to_be64(_PAGE_RWX | _PAGE_PRIVILEGED));
425}
426#else
427#define pte_savedwrite pte_savedwrite
428static inline bool pte_savedwrite(pte_t pte)
429{
430 return false;
431}
432#endif
433
Aneesh Kumar K.Vd19469e2017-03-09 16:16:39 -0800434static inline int pte_write(pte_t pte)
435{
436 return __pte_write(pte) || pte_savedwrite(pte);
437}
438
Christophe Leroyca8afd42017-07-12 17:03:42 +0200439static inline int pte_read(pte_t pte)
440{
441 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_READ));
442}
443
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000444#define __HAVE_ARCH_PTEP_SET_WRPROTECT
445static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
446 pte_t *ptep)
447{
Aneesh Kumar K.Vd19469e2017-03-09 16:16:39 -0800448 if (__pte_write(*ptep))
Aneesh Kumar K.V52c50ca2017-03-09 16:16:36 -0800449 pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 0);
450 else if (unlikely(pte_savedwrite(*ptep)))
451 pte_update(mm, addr, ptep, 0, _PAGE_PRIVILEGED, 0);
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000452}
453
454static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
455 unsigned long addr, pte_t *ptep)
456{
Aneesh Kumar K.V52c50ca2017-03-09 16:16:36 -0800457 /*
458 * We should not find protnone for hugetlb, but this complete the
459 * interface.
460 */
Aneesh Kumar K.Vd19469e2017-03-09 16:16:39 -0800461 if (__pte_write(*ptep))
Aneesh Kumar K.V52c50ca2017-03-09 16:16:36 -0800462 pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 1);
463 else if (unlikely(pte_savedwrite(*ptep)))
464 pte_update(mm, addr, ptep, 0, _PAGE_PRIVILEGED, 1);
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000465}
466
467#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
468static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
469 unsigned long addr, pte_t *ptep)
470{
471 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 0, 0);
472 return __pte(old);
473}
474
Aneesh Kumar K.Vf4894b82017-02-09 08:28:20 +0530475#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
476static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
477 unsigned long addr,
478 pte_t *ptep, int full)
479{
480 if (full && radix_enabled()) {
481 /*
482 * Let's skip the DD1 style pte update here. We know that
483 * this is a full mm pte clear and hence can be sure there is
484 * no parallel set_pte.
485 */
486 return radix__ptep_get_and_clear_full(mm, addr, ptep, full);
487 }
488 return ptep_get_and_clear(mm, addr, ptep);
489}
490
491
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000492static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
493 pte_t * ptep)
494{
495 pte_update(mm, addr, ptep, ~0UL, 0, 0);
496}
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530497
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530498static inline int pte_dirty(pte_t pte)
499{
500 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_DIRTY));
501}
502
503static inline int pte_young(pte_t pte)
504{
505 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_ACCESSED));
506}
507
508static inline int pte_special(pte_t pte)
509{
510 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_SPECIAL));
511}
512
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000513static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); }
514
515#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
516static inline bool pte_soft_dirty(pte_t pte)
517{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530518 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_SOFT_DIRTY));
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000519}
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530520
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000521static inline pte_t pte_mksoft_dirty(pte_t pte)
522{
523 return __pte(pte_val(pte) | _PAGE_SOFT_DIRTY);
524}
525
526static inline pte_t pte_clear_soft_dirty(pte_t pte)
527{
528 return __pte(pte_val(pte) & ~_PAGE_SOFT_DIRTY);
529}
530#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
531
532#ifdef CONFIG_NUMA_BALANCING
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000533static inline int pte_protnone(pte_t pte)
534{
Aneesh Kumar K.Vc137a272017-02-24 14:59:21 -0800535 return (pte_raw(pte) & cpu_to_be64(_PAGE_PRESENT | _PAGE_PTE | _PAGE_RWX)) ==
536 cpu_to_be64(_PAGE_PRESENT | _PAGE_PTE);
537}
538
539#define pte_mk_savedwrite pte_mk_savedwrite
540static inline pte_t pte_mk_savedwrite(pte_t pte)
541{
542 /*
543 * Used by Autonuma subsystem to preserve the write bit
544 * while marking the pte PROT_NONE. Only allow this
545 * on PROT_NONE pte
546 */
547 VM_BUG_ON((pte_raw(pte) & cpu_to_be64(_PAGE_PRESENT | _PAGE_RWX | _PAGE_PRIVILEGED)) !=
548 cpu_to_be64(_PAGE_PRESENT | _PAGE_PRIVILEGED));
549 return __pte(pte_val(pte) & ~_PAGE_PRIVILEGED);
550}
551
552#define pte_clear_savedwrite pte_clear_savedwrite
553static inline pte_t pte_clear_savedwrite(pte_t pte)
554{
555 /*
556 * Used by KSM subsystem to make a protnone pte readonly.
557 */
558 VM_BUG_ON(!pte_protnone(pte));
559 return __pte(pte_val(pte) | _PAGE_PRIVILEGED);
560}
Aneesh Kumar K.Vd19469e2017-03-09 16:16:39 -0800561#else
562#define pte_clear_savedwrite pte_clear_savedwrite
563static inline pte_t pte_clear_savedwrite(pte_t pte)
564{
565 VM_WARN_ON(1);
566 return __pte(pte_val(pte) & ~_PAGE_WRITE);
567}
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000568#endif /* CONFIG_NUMA_BALANCING */
569
570static inline int pte_present(pte_t pte)
571{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530572 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_PRESENT));
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000573}
Aneesh Kumar K.Vf72a85e2017-12-04 07:49:11 +0530574
Ram Paibca7aac2018-01-18 17:50:38 -0800575#ifdef CONFIG_PPC_MEM_KEYS
Ram Paif2407ef2018-01-18 17:50:37 -0800576extern bool arch_pte_access_permitted(u64 pte, bool write, bool execute);
Ram Paibca7aac2018-01-18 17:50:38 -0800577#else
578static inline bool arch_pte_access_permitted(u64 pte, bool write, bool execute)
579{
580 return true;
581}
582#endif /* CONFIG_PPC_MEM_KEYS */
Ram Paif2407ef2018-01-18 17:50:37 -0800583
Aneesh Kumar K.Vf72a85e2017-12-04 07:49:11 +0530584#define pte_access_permitted pte_access_permitted
585static inline bool pte_access_permitted(pte_t pte, bool write)
586{
587 unsigned long pteval = pte_val(pte);
588 /* Also check for pte_user */
589 unsigned long clear_pte_bits = _PAGE_PRIVILEGED;
590 /*
591 * _PAGE_READ is needed for any access and will be
592 * cleared for PROT_NONE
593 */
594 unsigned long need_pte_bits = _PAGE_PRESENT | _PAGE_READ;
595
596 if (write)
597 need_pte_bits |= _PAGE_WRITE;
598
599 if ((pteval & need_pte_bits) != need_pte_bits)
600 return false;
601
602 if ((pteval & clear_pte_bits) == clear_pte_bits)
603 return false;
Ram Paibca7aac2018-01-18 17:50:38 -0800604
605 return arch_pte_access_permitted(pte_val(pte), write, 0);
Aneesh Kumar K.Vf72a85e2017-12-04 07:49:11 +0530606}
607
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000608/*
609 * Conversion functions: convert a page and protection to a page entry,
610 * and a page entry and page directory to the page they refer to.
611 *
612 * Even if PTEs can be unsigned long long, a PFN is always an unsigned
613 * long for now.
614 */
615static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
616{
617 return __pte((((pte_basic_t)(pfn) << PAGE_SHIFT) & PTE_RPN_MASK) |
618 pgprot_val(pgprot));
619}
620
621static inline unsigned long pte_pfn(pte_t pte)
622{
623 return (pte_val(pte) & PTE_RPN_MASK) >> PAGE_SHIFT;
624}
625
626/* Generic modifiers for PTE bits */
627static inline pte_t pte_wrprotect(pte_t pte)
628{
Aneesh Kumar K.Vd19469e2017-03-09 16:16:39 -0800629 if (unlikely(pte_savedwrite(pte)))
630 return pte_clear_savedwrite(pte);
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000631 return __pte(pte_val(pte) & ~_PAGE_WRITE);
632}
633
634static inline pte_t pte_mkclean(pte_t pte)
635{
636 return __pte(pte_val(pte) & ~_PAGE_DIRTY);
637}
638
639static inline pte_t pte_mkold(pte_t pte)
640{
641 return __pte(pte_val(pte) & ~_PAGE_ACCESSED);
642}
643
644static inline pte_t pte_mkwrite(pte_t pte)
645{
646 /*
647 * write implies read, hence set both
648 */
649 return __pte(pte_val(pte) | _PAGE_RW);
650}
651
652static inline pte_t pte_mkdirty(pte_t pte)
653{
654 return __pte(pte_val(pte) | _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
655}
656
657static inline pte_t pte_mkyoung(pte_t pte)
658{
659 return __pte(pte_val(pte) | _PAGE_ACCESSED);
660}
661
662static inline pte_t pte_mkspecial(pte_t pte)
663{
664 return __pte(pte_val(pte) | _PAGE_SPECIAL);
665}
666
667static inline pte_t pte_mkhuge(pte_t pte)
668{
669 return pte;
670}
671
Oliver O'Halloranebd31192017-06-28 11:32:34 +1000672static inline pte_t pte_mkdevmap(pte_t pte)
673{
674 return __pte(pte_val(pte) | _PAGE_SPECIAL|_PAGE_DEVMAP);
675}
676
Oliver O'Halloranc9c98bc2017-07-28 01:35:53 +1000677/*
678 * This is potentially called with a pmd as the argument, in which case it's not
679 * safe to check _PAGE_DEVMAP unless we also confirm that _PAGE_PTE is set.
680 * That's because the bit we use for _PAGE_DEVMAP is not reserved for software
681 * use in page directory entries (ie. non-ptes).
682 */
Oliver O'Halloranebd31192017-06-28 11:32:34 +1000683static inline int pte_devmap(pte_t pte)
684{
Oliver O'Halloranc9c98bc2017-07-28 01:35:53 +1000685 u64 mask = cpu_to_be64(_PAGE_DEVMAP | _PAGE_PTE);
686
687 return (pte_raw(pte) & mask) == mask;
Oliver O'Halloranebd31192017-06-28 11:32:34 +1000688}
689
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000690static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
691{
692 /* FIXME!! check whether this need to be a conditional */
693 return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot));
694}
695
Aneesh Kumar K.V34fbadd2016-04-29 23:25:51 +1000696static inline bool pte_user(pte_t pte)
697{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530698 return !(pte_raw(pte) & cpu_to_be64(_PAGE_PRIVILEGED));
Aneesh Kumar K.V34fbadd2016-04-29 23:25:51 +1000699}
700
701/* Encode and de-code a swap entry */
702#define MAX_SWAPFILES_CHECK() do { \
703 BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS); \
704 /* \
705 * Don't have overlapping bits with _PAGE_HPTEFLAGS \
706 * We filter HPTEFLAGS on set_pte. \
707 */ \
708 BUILD_BUG_ON(_PAGE_HPTEFLAGS & (0x1f << _PAGE_BIT_SWAP_TYPE)); \
709 BUILD_BUG_ON(_PAGE_HPTEFLAGS & _PAGE_SWP_SOFT_DIRTY); \
710 } while (0)
711/*
712 * on pte we don't need handle RADIX_TREE_EXCEPTIONAL_SHIFT;
713 */
714#define SWP_TYPE_BITS 5
715#define __swp_type(x) (((x).val >> _PAGE_BIT_SWAP_TYPE) \
716 & ((1UL << SWP_TYPE_BITS) - 1))
717#define __swp_offset(x) (((x).val & PTE_RPN_MASK) >> PAGE_SHIFT)
718#define __swp_entry(type, offset) ((swp_entry_t) { \
719 ((type) << _PAGE_BIT_SWAP_TYPE) \
720 | (((offset) << PAGE_SHIFT) & PTE_RPN_MASK)})
721/*
722 * swp_entry_t must be independent of pte bits. We build a swp_entry_t from
723 * swap type and offset we get from swap and convert that to pte to find a
724 * matching pte in linux page table.
725 * Clear bits not found in swap entries here.
726 */
727#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) & ~_PAGE_PTE })
728#define __swp_entry_to_pte(x) __pte((x).val | _PAGE_PTE)
729
730#ifdef CONFIG_MEM_SOFT_DIRTY
731#define _PAGE_SWP_SOFT_DIRTY (1UL << (SWP_TYPE_BITS + _PAGE_BIT_SWAP_TYPE))
732#else
733#define _PAGE_SWP_SOFT_DIRTY 0UL
734#endif /* CONFIG_MEM_SOFT_DIRTY */
735
736#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
737static inline pte_t pte_swp_mksoft_dirty(pte_t pte)
738{
739 return __pte(pte_val(pte) | _PAGE_SWP_SOFT_DIRTY);
740}
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530741
Aneesh Kumar K.V34fbadd2016-04-29 23:25:51 +1000742static inline bool pte_swp_soft_dirty(pte_t pte)
743{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530744 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_SWP_SOFT_DIRTY));
Aneesh Kumar K.V34fbadd2016-04-29 23:25:51 +1000745}
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530746
Aneesh Kumar K.V34fbadd2016-04-29 23:25:51 +1000747static inline pte_t pte_swp_clear_soft_dirty(pte_t pte)
748{
749 return __pte(pte_val(pte) & ~_PAGE_SWP_SOFT_DIRTY);
750}
751#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
752
753static inline bool check_pte_access(unsigned long access, unsigned long ptev)
754{
755 /*
756 * This check for _PAGE_RWX and _PAGE_PRESENT bits
757 */
758 if (access & ~ptev)
759 return false;
760 /*
761 * This check for access to privilege space
762 */
763 if ((access & _PAGE_PRIVILEGED) != (ptev & _PAGE_PRIVILEGED))
764 return false;
765
766 return true;
767}
Aneesh Kumar K.Vac94ac792016-04-29 23:25:54 +1000768/*
769 * Generic functions with hash/radix callbacks
770 */
771
Aneesh Kumar K.Ve4c11122018-05-29 19:58:40 +0530772static inline void __ptep_set_access_flags(struct vm_area_struct *vma,
Aneesh Kumar K.Vb3603e12016-11-28 11:47:02 +0530773 pte_t *ptep, pte_t entry,
Aneesh Kumar K.Ve4c11122018-05-29 19:58:40 +0530774 unsigned long address,
775 int psize)
Aneesh Kumar K.Vac94ac792016-04-29 23:25:54 +1000776{
777 if (radix_enabled())
Aneesh Kumar K.Ve4c11122018-05-29 19:58:40 +0530778 return radix__ptep_set_access_flags(vma, ptep, entry,
779 address, psize);
Aneesh Kumar K.Vac94ac792016-04-29 23:25:54 +1000780 return hash__ptep_set_access_flags(ptep, entry);
781}
782
783#define __HAVE_ARCH_PTE_SAME
784static inline int pte_same(pte_t pte_a, pte_t pte_b)
785{
786 if (radix_enabled())
787 return radix__pte_same(pte_a, pte_b);
788 return hash__pte_same(pte_a, pte_b);
789}
790
791static inline int pte_none(pte_t pte)
792{
793 if (radix_enabled())
794 return radix__pte_none(pte);
795 return hash__pte_none(pte);
796}
797
798static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
799 pte_t *ptep, pte_t pte, int percpu)
800{
801 if (radix_enabled())
802 return radix__set_pte_at(mm, addr, ptep, pte, percpu);
803 return hash__set_pte_at(mm, addr, ptep, pte, percpu);
804}
Aneesh Kumar K.V34fbadd2016-04-29 23:25:51 +1000805
Aneesh Kumar K.V13f829a2016-04-29 23:25:48 +1000806#define _PAGE_CACHE_CTL (_PAGE_NON_IDEMPOTENT | _PAGE_TOLERANT)
807
808#define pgprot_noncached pgprot_noncached
809static inline pgprot_t pgprot_noncached(pgprot_t prot)
810{
811 return __pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) |
812 _PAGE_NON_IDEMPOTENT);
813}
814
815#define pgprot_noncached_wc pgprot_noncached_wc
816static inline pgprot_t pgprot_noncached_wc(pgprot_t prot)
817{
818 return __pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) |
819 _PAGE_TOLERANT);
820}
821
822#define pgprot_cached pgprot_cached
823static inline pgprot_t pgprot_cached(pgprot_t prot)
824{
825 return __pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL));
826}
827
828#define pgprot_writecombine pgprot_writecombine
829static inline pgprot_t pgprot_writecombine(pgprot_t prot)
830{
831 return pgprot_noncached_wc(prot);
832}
833/*
834 * check a pte mapping have cache inhibited property
835 */
836static inline bool pte_ci(pte_t pte)
837{
838 unsigned long pte_v = pte_val(pte);
839
840 if (((pte_v & _PAGE_CACHE_CTL) == _PAGE_TOLERANT) ||
841 ((pte_v & _PAGE_CACHE_CTL) == _PAGE_NON_IDEMPOTENT))
842 return true;
843 return false;
844}
845
Aneesh Kumar K.Vf281b5d2015-12-01 09:06:35 +0530846static inline void pmd_set(pmd_t *pmdp, unsigned long val)
847{
848 *pmdp = __pmd(val);
849}
850
851static inline void pmd_clear(pmd_t *pmdp)
852{
853 *pmdp = __pmd(0);
854}
855
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530856static inline int pmd_none(pmd_t pmd)
857{
858 return !pmd_raw(pmd);
859}
860
861static inline int pmd_present(pmd_t pmd)
862{
863
864 return !pmd_none(pmd);
865}
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530866
Aneesh Kumar K.Vac94ac792016-04-29 23:25:54 +1000867static inline int pmd_bad(pmd_t pmd)
868{
869 if (radix_enabled())
870 return radix__pmd_bad(pmd);
871 return hash__pmd_bad(pmd);
872}
873
Aneesh Kumar K.Vf281b5d2015-12-01 09:06:35 +0530874static inline void pud_set(pud_t *pudp, unsigned long val)
875{
876 *pudp = __pud(val);
877}
878
879static inline void pud_clear(pud_t *pudp)
880{
881 *pudp = __pud(0);
882}
883
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530884static inline int pud_none(pud_t pud)
885{
886 return !pud_raw(pud);
887}
888
889static inline int pud_present(pud_t pud)
890{
891 return !pud_none(pud);
892}
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530893
894extern struct page *pud_page(pud_t pud);
Aneesh Kumar K.V371352c2015-12-01 09:06:36 +0530895extern struct page *pmd_page(pmd_t pmd);
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530896static inline pte_t pud_pte(pud_t pud)
897{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530898 return __pte_raw(pud_raw(pud));
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530899}
900
901static inline pud_t pte_pud(pte_t pte)
902{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530903 return __pud_raw(pte_raw(pte));
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530904}
905#define pud_write(pud) pte_write(pud_pte(pud))
Aneesh Kumar K.Vac94ac792016-04-29 23:25:54 +1000906
907static inline int pud_bad(pud_t pud)
908{
909 if (radix_enabled())
910 return radix__pud_bad(pud);
911 return hash__pud_bad(pud);
912}
913
Aneesh Kumar K.Vf72a85e2017-12-04 07:49:11 +0530914#define pud_access_permitted pud_access_permitted
915static inline bool pud_access_permitted(pud_t pud, bool write)
916{
917 return pte_access_permitted(pud_pte(pud), write);
918}
Aneesh Kumar K.Vac94ac792016-04-29 23:25:54 +1000919
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530920#define pgd_write(pgd) pte_write(pgd_pte(pgd))
Aneesh Kumar K.Vf281b5d2015-12-01 09:06:35 +0530921static inline void pgd_set(pgd_t *pgdp, unsigned long val)
922{
923 *pgdp = __pgd(val);
924}
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530925
Aneesh Kumar K.V368ced72016-03-01 09:45:13 +0530926static inline void pgd_clear(pgd_t *pgdp)
927{
928 *pgdp = __pgd(0);
929}
930
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530931static inline int pgd_none(pgd_t pgd)
932{
933 return !pgd_raw(pgd);
934}
935
936static inline int pgd_present(pgd_t pgd)
937{
938 return !pgd_none(pgd);
939}
Aneesh Kumar K.V368ced72016-03-01 09:45:13 +0530940
941static inline pte_t pgd_pte(pgd_t pgd)
942{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530943 return __pte_raw(pgd_raw(pgd));
Aneesh Kumar K.V368ced72016-03-01 09:45:13 +0530944}
945
946static inline pgd_t pte_pgd(pte_t pte)
947{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +0530948 return __pgd_raw(pte_raw(pte));
Aneesh Kumar K.V368ced72016-03-01 09:45:13 +0530949}
950
Aneesh Kumar K.Vac94ac792016-04-29 23:25:54 +1000951static inline int pgd_bad(pgd_t pgd)
952{
953 if (radix_enabled())
954 return radix__pgd_bad(pgd);
955 return hash__pgd_bad(pgd);
956}
957
Aneesh Kumar K.Vf72a85e2017-12-04 07:49:11 +0530958#define pgd_access_permitted pgd_access_permitted
959static inline bool pgd_access_permitted(pgd_t pgd, bool write)
960{
961 return pte_access_permitted(pgd_pte(pgd), write);
962}
963
Aneesh Kumar K.V368ced72016-03-01 09:45:13 +0530964extern struct page *pgd_page(pgd_t pgd);
965
Aneesh Kumar K.Vaba480e2016-04-29 23:25:50 +1000966/* Pointers in the page table tree are physical addresses */
967#define __pgtable_ptr_val(ptr) __pa(ptr)
968
969#define pmd_page_vaddr(pmd) __va(pmd_val(pmd) & ~PMD_MASKED_BITS)
970#define pud_page_vaddr(pud) __va(pud_val(pud) & ~PUD_MASKED_BITS)
971#define pgd_page_vaddr(pgd) __va(pgd_val(pgd) & ~PGD_MASKED_BITS)
972
973#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1))
974#define pud_index(address) (((address) >> (PUD_SHIFT)) & (PTRS_PER_PUD - 1))
975#define pmd_index(address) (((address) >> (PMD_SHIFT)) & (PTRS_PER_PMD - 1))
976#define pte_index(address) (((address) >> (PAGE_SHIFT)) & (PTRS_PER_PTE - 1))
977
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530978/*
979 * Find an entry in a page-table-directory. We combine the address region
980 * (the high order N bits) and the pgd portion of the address.
981 */
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530982
983#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
984
Aneesh Kumar K.V368ced72016-03-01 09:45:13 +0530985#define pud_offset(pgdp, addr) \
986 (((pud_t *) pgd_page_vaddr(*(pgdp))) + pud_index(addr))
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530987#define pmd_offset(pudp,addr) \
Aneesh Kumar K.V371352c2015-12-01 09:06:36 +0530988 (((pmd_t *) pud_page_vaddr(*(pudp))) + pmd_index(addr))
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530989#define pte_offset_kernel(dir,addr) \
Aneesh Kumar K.V371352c2015-12-01 09:06:36 +0530990 (((pte_t *) pmd_page_vaddr(*(dir))) + pte_index(addr))
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530991
992#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr))
993#define pte_unmap(pte) do { } while(0)
994
995/* to find an entry in a kernel page-table-directory */
996/* This now only contains the vmalloc pages */
997#define pgd_offset_k(address) pgd_offset(&init_mm, address)
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +0530998
999#define pte_ERROR(e) \
1000 pr_err("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
1001#define pmd_ERROR(e) \
1002 pr_err("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
Aneesh Kumar K.V368ced72016-03-01 09:45:13 +05301003#define pud_ERROR(e) \
1004 pr_err("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e))
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301005#define pgd_ERROR(e) \
1006 pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
1007
Aneesh Kumar K.V31a14fa2016-04-29 23:25:59 +10001008static inline int map_kernel_page(unsigned long ea, unsigned long pa,
1009 unsigned long flags)
1010{
Aneesh Kumar K.Vd9225ad2016-04-29 23:26:00 +10001011 if (radix_enabled()) {
1012#if defined(CONFIG_PPC_RADIX_MMU) && defined(DEBUG_VM)
1013 unsigned long page_size = 1 << mmu_psize_defs[mmu_io_psize].shift;
1014 WARN((page_size != PAGE_SIZE), "I/O page size != PAGE_SIZE");
1015#endif
1016 return radix__map_kernel_page(ea, pa, __pgprot(flags), PAGE_SIZE);
1017 }
Aneesh Kumar K.V31a14fa2016-04-29 23:25:59 +10001018 return hash__map_kernel_page(ea, pa, flags);
1019}
1020
1021static inline int __meminit vmemmap_create_mapping(unsigned long start,
1022 unsigned long page_size,
1023 unsigned long phys)
1024{
Aneesh Kumar K.Vd9225ad2016-04-29 23:26:00 +10001025 if (radix_enabled())
1026 return radix__vmemmap_create_mapping(start, page_size, phys);
Aneesh Kumar K.V31a14fa2016-04-29 23:25:59 +10001027 return hash__vmemmap_create_mapping(start, page_size, phys);
1028}
1029
1030#ifdef CONFIG_MEMORY_HOTPLUG
1031static inline void vmemmap_remove_mapping(unsigned long start,
1032 unsigned long page_size)
1033{
Aneesh Kumar K.Vd9225ad2016-04-29 23:26:00 +10001034 if (radix_enabled())
1035 return radix__vmemmap_remove_mapping(start, page_size);
Aneesh Kumar K.V31a14fa2016-04-29 23:25:59 +10001036 return hash__vmemmap_remove_mapping(start, page_size);
1037}
1038#endif
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301039struct page *realmode_pfn_to_page(unsigned long pfn);
1040
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301041static inline pte_t pmd_pte(pmd_t pmd)
1042{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +05301043 return __pte_raw(pmd_raw(pmd));
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301044}
1045
1046static inline pmd_t pte_pmd(pte_t pte)
1047{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +05301048 return __pmd_raw(pte_raw(pte));
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301049}
1050
1051static inline pte_t *pmdp_ptep(pmd_t *pmd)
1052{
1053 return (pte_t *)pmd;
1054}
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301055#define pmd_pfn(pmd) pte_pfn(pmd_pte(pmd))
1056#define pmd_dirty(pmd) pte_dirty(pmd_pte(pmd))
1057#define pmd_young(pmd) pte_young(pmd_pte(pmd))
1058#define pmd_mkold(pmd) pte_pmd(pte_mkold(pmd_pte(pmd)))
1059#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd)))
1060#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))
Minchan Kimd5d6a442016-01-15 16:55:29 -08001061#define pmd_mkclean(pmd) pte_pmd(pte_mkclean(pmd_pte(pmd)))
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301062#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
1063#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd)))
Aneesh Kumar K.Vc137a272017-02-24 14:59:21 -08001064#define pmd_mk_savedwrite(pmd) pte_pmd(pte_mk_savedwrite(pmd_pte(pmd)))
1065#define pmd_clear_savedwrite(pmd) pte_pmd(pte_clear_savedwrite(pmd_pte(pmd)))
Laurent Dufour7207f432015-12-03 11:29:19 +01001066
1067#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
1068#define pmd_soft_dirty(pmd) pte_soft_dirty(pmd_pte(pmd))
1069#define pmd_mksoft_dirty(pmd) pte_pmd(pte_mksoft_dirty(pmd_pte(pmd)))
1070#define pmd_clear_soft_dirty(pmd) pte_pmd(pte_clear_soft_dirty(pmd_pte(pmd)))
1071#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
1072
Aneesh Kumar K.V1ca72122015-12-01 09:06:37 +05301073#ifdef CONFIG_NUMA_BALANCING
1074static inline int pmd_protnone(pmd_t pmd)
1075{
1076 return pte_protnone(pmd_pte(pmd));
1077}
1078#endif /* CONFIG_NUMA_BALANCING */
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301079
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301080#define pmd_write(pmd) pte_write(pmd_pte(pmd))
Aneesh Kumar K.Vd19469e2017-03-09 16:16:39 -08001081#define __pmd_write(pmd) __pte_write(pmd_pte(pmd))
Aneesh Kumar K.Vc137a272017-02-24 14:59:21 -08001082#define pmd_savedwrite(pmd) pte_savedwrite(pmd_pte(pmd))
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301083
Aneesh Kumar K.Vf72a85e2017-12-04 07:49:11 +05301084#define pmd_access_permitted pmd_access_permitted
1085static inline bool pmd_access_permitted(pmd_t pmd, bool write)
1086{
1087 return pte_access_permitted(pmd_pte(pmd), write);
1088}
1089
Aneesh Kumar K.V6a1ea362016-04-29 23:26:28 +10001090#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1091extern pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot);
1092extern pmd_t mk_pmd(struct page *page, pgprot_t pgprot);
1093extern pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot);
1094extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1095 pmd_t *pmdp, pmd_t pmd);
1096extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
1097 pmd_t *pmd);
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001098extern int hash__has_transparent_hugepage(void);
1099static inline int has_transparent_hugepage(void)
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301100{
Aneesh Kumar K.Vbde3eb62016-04-29 23:26:30 +10001101 if (radix_enabled())
1102 return radix__has_transparent_hugepage();
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001103 return hash__has_transparent_hugepage();
1104}
Linus Torvaldsc04a5882016-05-20 10:12:41 -07001105#define has_transparent_hugepage has_transparent_hugepage
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001106
1107static inline unsigned long
1108pmd_hugepage_update(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp,
1109 unsigned long clr, unsigned long set)
1110{
Aneesh Kumar K.Vbde3eb62016-04-29 23:26:30 +10001111 if (radix_enabled())
1112 return radix__pmd_hugepage_update(mm, addr, pmdp, clr, set);
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001113 return hash__pmd_hugepage_update(mm, addr, pmdp, clr, set);
1114}
1115
1116static inline int pmd_large(pmd_t pmd)
1117{
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +05301118 return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE));
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001119}
1120
1121static inline pmd_t pmd_mknotpresent(pmd_t pmd)
1122{
1123 return __pmd(pmd_val(pmd) & ~_PAGE_PRESENT);
1124}
1125/*
1126 * For radix we should always find H_PAGE_HASHPTE zero. Hence
1127 * the below will work for radix too
1128 */
1129static inline int __pmdp_test_and_clear_young(struct mm_struct *mm,
1130 unsigned long addr, pmd_t *pmdp)
1131{
1132 unsigned long old;
1133
Aneesh Kumar K.V66c570f2016-07-13 15:05:22 +05301134 if ((pmd_raw(*pmdp) & cpu_to_be64(_PAGE_ACCESSED | H_PAGE_HASHPTE)) == 0)
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001135 return 0;
1136 old = pmd_hugepage_update(mm, addr, pmdp, _PAGE_ACCESSED, 0);
1137 return ((old & _PAGE_ACCESSED) != 0);
1138}
1139
1140#define __HAVE_ARCH_PMDP_SET_WRPROTECT
1141static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,
1142 pmd_t *pmdp)
1143{
Aneesh Kumar K.Vd19469e2017-03-09 16:16:39 -08001144 if (__pmd_write((*pmdp)))
Aneesh Kumar K.V52c50ca2017-03-09 16:16:36 -08001145 pmd_hugepage_update(mm, addr, pmdp, _PAGE_WRITE, 0);
1146 else if (unlikely(pmd_savedwrite(*pmdp)))
1147 pmd_hugepage_update(mm, addr, pmdp, 0, _PAGE_PRIVILEGED);
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301148}
1149
Aneesh Kumar K.Vab624762016-04-29 23:26:31 +10001150static inline int pmd_trans_huge(pmd_t pmd)
1151{
1152 if (radix_enabled())
1153 return radix__pmd_trans_huge(pmd);
1154 return hash__pmd_trans_huge(pmd);
1155}
1156
1157#define __HAVE_ARCH_PMD_SAME
1158static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
1159{
1160 if (radix_enabled())
1161 return radix__pmd_same(pmd_a, pmd_b);
1162 return hash__pmd_same(pmd_a, pmd_b);
1163}
1164
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301165static inline pmd_t pmd_mkhuge(pmd_t pmd)
1166{
Aneesh Kumar K.Vab624762016-04-29 23:26:31 +10001167 if (radix_enabled())
1168 return radix__pmd_mkhuge(pmd);
1169 return hash__pmd_mkhuge(pmd);
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301170}
1171
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301172#define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS
1173extern int pmdp_set_access_flags(struct vm_area_struct *vma,
1174 unsigned long address, pmd_t *pmdp,
1175 pmd_t entry, int dirty);
1176
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301177#define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
1178extern int pmdp_test_and_clear_young(struct vm_area_struct *vma,
1179 unsigned long address, pmd_t *pmdp);
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301180
1181#define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001182static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
1183 unsigned long addr, pmd_t *pmdp)
1184{
Aneesh Kumar K.Vbde3eb62016-04-29 23:26:30 +10001185 if (radix_enabled())
1186 return radix__pmdp_huge_get_and_clear(mm, addr, pmdp);
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001187 return hash__pmdp_huge_get_and_clear(mm, addr, pmdp);
1188}
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301189
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001190static inline pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
1191 unsigned long address, pmd_t *pmdp)
1192{
Aneesh Kumar K.Vbde3eb62016-04-29 23:26:30 +10001193 if (radix_enabled())
1194 return radix__pmdp_collapse_flush(vma, address, pmdp);
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001195 return hash__pmdp_collapse_flush(vma, address, pmdp);
1196}
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301197#define pmdp_collapse_flush pmdp_collapse_flush
1198
1199#define __HAVE_ARCH_PGTABLE_DEPOSIT
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001200static inline void pgtable_trans_huge_deposit(struct mm_struct *mm,
1201 pmd_t *pmdp, pgtable_t pgtable)
1202{
Aneesh Kumar K.Vbde3eb62016-04-29 23:26:30 +10001203 if (radix_enabled())
1204 return radix__pgtable_trans_huge_deposit(mm, pmdp, pgtable);
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001205 return hash__pgtable_trans_huge_deposit(mm, pmdp, pgtable);
1206}
1207
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301208#define __HAVE_ARCH_PGTABLE_WITHDRAW
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001209static inline pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm,
1210 pmd_t *pmdp)
1211{
Aneesh Kumar K.Vbde3eb62016-04-29 23:26:30 +10001212 if (radix_enabled())
1213 return radix__pgtable_trans_huge_withdraw(mm, pmdp);
Aneesh Kumar K.V3df33f12016-04-29 23:26:29 +10001214 return hash__pgtable_trans_huge_withdraw(mm, pmdp);
1215}
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301216
1217#define __HAVE_ARCH_PMDP_INVALIDATE
Aneesh Kumar K.V8cc931e2018-01-31 16:18:02 -08001218extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
1219 pmd_t *pmdp);
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301220
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301221#define pmd_move_must_withdraw pmd_move_must_withdraw
1222struct spinlock;
1223static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
Aneesh Kumar K.V1dd38b62016-12-12 16:44:29 -08001224 struct spinlock *old_pmd_ptl,
1225 struct vm_area_struct *vma)
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301226{
Aneesh Kumar K.Vbde3eb62016-04-29 23:26:30 +10001227 if (radix_enabled())
1228 return false;
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301229 /*
1230 * Archs like ppc64 use pgtable to store per pmd
1231 * specific information. So when we switch the pmd,
1232 * we should also withdraw and deposit the pgtable
1233 */
1234 return true;
1235}
Aneesh Kumar K.V953c66c2016-12-12 16:44:32 -08001236
1237
1238#define arch_needs_pgtable_deposit arch_needs_pgtable_deposit
1239static inline bool arch_needs_pgtable_deposit(void)
1240{
1241 if (radix_enabled())
1242 return false;
1243 return true;
1244}
Aneesh Kumar K.Vfa4531f2017-07-27 11:54:54 +05301245extern void serialize_against_pte_lookup(struct mm_struct *mm);
Aneesh Kumar K.V953c66c2016-12-12 16:44:32 -08001246
Oliver O'Halloranebd31192017-06-28 11:32:34 +10001247
1248static inline pmd_t pmd_mkdevmap(pmd_t pmd)
1249{
1250 return __pmd(pmd_val(pmd) | (_PAGE_PTE | _PAGE_DEVMAP));
1251}
1252
1253static inline int pmd_devmap(pmd_t pmd)
1254{
1255 return pte_devmap(pmd_pte(pmd));
1256}
1257
1258static inline int pud_devmap(pud_t pud)
1259{
1260 return 0;
1261}
1262
1263static inline int pgd_devmap(pgd_t pgd)
1264{
1265 return 0;
1266}
Aneesh Kumar K.V6a1ea362016-04-29 23:26:28 +10001267#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
Oliver O'Halloranebd31192017-06-28 11:32:34 +10001268
1269static inline const int pud_pfn(pud_t pud)
1270{
1271 /*
1272 * Currently all calls to pud_pfn() are gated around a pud_devmap()
1273 * check so this should never be used. If it grows another user we
1274 * want to know about it.
1275 */
1276 BUILD_BUG();
1277 return 0;
1278}
Michael Ellerman029d9252017-07-14 16:51:23 +10001279
Aneesh Kumar K.V3dfcb3152015-12-01 09:06:28 +05301280#endif /* __ASSEMBLY__ */
1281#endif /* _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ */