aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/fixmap.h2
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc32.h41
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h46
-rw-r--r--arch/powerpc/include/asm/pgtable.h4
-rw-r--r--arch/powerpc/include/asm/pte-8xx.h3
-rw-r--r--arch/powerpc/include/asm/pte-hash32.h1
-rw-r--r--arch/powerpc/include/asm/pte-hash64-4k.h3
-rw-r--r--arch/powerpc/include/asm/pte-hash64.h47
8 files changed, 83 insertions, 64 deletions
diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h
index 8428b38a3d30..d60fd18f428c 100644
--- a/arch/powerpc/include/asm/fixmap.h
+++ b/arch/powerpc/include/asm/fixmap.h
@@ -61,7 +61,7 @@ extern void __set_fixmap (enum fixed_addresses idx,
61 * Some hardware wants to get fixmapped without caching. 61 * Some hardware wants to get fixmapped without caching.
62 */ 62 */
63#define set_fixmap_nocache(idx, phys) \ 63#define set_fixmap_nocache(idx, phys) \
64 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) 64 __set_fixmap(idx, phys, PAGE_KERNEL_NCG)
65 65
66#define clear_fixmap(idx) \ 66#define clear_fixmap(idx) \
67 __set_fixmap(idx, 0, __pgprot(0)) 67 __set_fixmap(idx, 0, __pgprot(0))
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
index 67ceffc01b43..7ce331e51f90 100644
--- a/arch/powerpc/include/asm/pgtable-ppc32.h
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -144,6 +144,13 @@ extern int icache_44x_need_flush;
144#define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE() 144#define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE()
145#endif 145#endif
146 146
147#ifndef _PAGE_KERNEL_RO
148#define _PAGE_KERNEL_RO 0
149#endif
150#ifndef _PAGE_KERNEL_RW
151#define _PAGE_KERNEL_RW (_PAGE_DIRTY | _PAGE_RW | _PAGE_HWWRITE)
152#endif
153
147#define _PAGE_HPTEFLAGS _PAGE_HASHPTE 154#define _PAGE_HPTEFLAGS _PAGE_HASHPTE
148 155
149/* Location of the PFN in the PTE. Most platforms use the same as _PAGE_SHIFT 156/* Location of the PFN in the PTE. Most platforms use the same as _PAGE_SHIFT
@@ -186,30 +193,25 @@ extern int icache_44x_need_flush;
186#else 193#else
187#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED) 194#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED)
188#endif 195#endif
189#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_NO_CACHE) 196#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED)
190 197
191#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE) 198/* Permission masks used for kernel mappings */
192#define _PAGE_KERNEL (_PAGE_BASE | _PAGE_SHARED | _PAGE_WRENABLE) 199#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW)
193#define _PAGE_KERNEL_NC (_PAGE_BASE_NC | _PAGE_SHARED | _PAGE_WRENABLE) 200#define PAGE_KERNEL_NC __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \
194 201 _PAGE_NO_CACHE)
195#ifdef CONFIG_PPC_STD_MMU 202#define PAGE_KERNEL_NCG __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \
196/* On standard PPC MMU, no user access implies kernel read/write access, 203 _PAGE_NO_CACHE | _PAGE_GUARDED)
197 * so to write-protect kernel memory we must turn on user access */ 204#define PAGE_KERNEL_X __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW | _PAGE_EXEC)
198#define _PAGE_KERNEL_RO (_PAGE_BASE | _PAGE_SHARED | _PAGE_USER) 205#define PAGE_KERNEL_RO __pgprot(_PAGE_BASE | _PAGE_KERNEL_RO)
199#else 206#define PAGE_KERNEL_ROX __pgprot(_PAGE_BASE | _PAGE_KERNEL_RO | _PAGE_EXEC)
200#define _PAGE_KERNEL_RO (_PAGE_BASE | _PAGE_SHARED)
201#endif
202
203#define _PAGE_IO (_PAGE_KERNEL_NC | _PAGE_GUARDED)
204#define _PAGE_RAM (_PAGE_KERNEL | _PAGE_HWEXEC)
205 207
206#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\ 208#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\
207 defined(CONFIG_KPROBES) 209 defined(CONFIG_KPROBES)
208/* We want the debuggers to be able to set breakpoints anywhere, so 210/* We want the debuggers to be able to set breakpoints anywhere, so
209 * don't write protect the kernel text */ 211 * don't write protect the kernel text */
210#define _PAGE_RAM_TEXT _PAGE_RAM 212#define PAGE_KERNEL_TEXT PAGE_KERNEL_X
211#else 213#else
212#define _PAGE_RAM_TEXT (_PAGE_KERNEL_RO | _PAGE_HWEXEC) 214#define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX
213#endif 215#endif
214 216
215#define PAGE_NONE __pgprot(_PAGE_BASE) 217#define PAGE_NONE __pgprot(_PAGE_BASE)
@@ -220,9 +222,6 @@ extern int icache_44x_need_flush;
220#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER) 222#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER)
221#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) 223#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
222 224
223#define PAGE_KERNEL __pgprot(_PAGE_RAM)
224#define PAGE_KERNEL_NOCACHE __pgprot(_PAGE_IO)
225
226/* 225/*
227 * The PowerPC can only do execute protection on a segment (256MB) basis, 226 * The PowerPC can only do execute protection on a segment (256MB) basis,
228 * not on a page basis. So we consider execute permission the same as read. 227 * not on a page basis. So we consider execute permission the same as read.
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 542073836b29..5a575f2905f5 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -81,11 +81,6 @@
81 */ 81 */
82#include <asm/pte-hash64.h> 82#include <asm/pte-hash64.h>
83 83
84/* To make some generic powerpc code happy */
85#ifndef _PAGE_HWEXEC
86#define _PAGE_HWEXEC 0
87#endif
88
89/* Some other useful definitions */ 84/* Some other useful definitions */
90#define PTE_RPN_MAX (1UL << (64 - PTE_RPN_SHIFT)) 85#define PTE_RPN_MAX (1UL << (64 - PTE_RPN_SHIFT))
91#define PTE_RPN_MASK (~((1UL<<PTE_RPN_SHIFT)-1)) 86#define PTE_RPN_MASK (~((1UL<<PTE_RPN_SHIFT)-1))
@@ -96,28 +91,44 @@
96#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ 91#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
97 _PAGE_ACCESSED | _PAGE_SPECIAL) 92 _PAGE_ACCESSED | _PAGE_SPECIAL)
98 93
94#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_PSIZE)
95#define _PAGE_BASE (_PAGE_BASE_NC | _PAGE_COHERENT)
99 96
100 97
101/* __pgprot defined in arch/powerpc/include/asm/page.h */ 98/* Permission masks used to generate the __P and __S table,
102#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) 99 *
103 100 * Note:__pgprot is defined in arch/powerpc/include/asm/page.h
104#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER) 101 */
105#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER | _PAGE_EXEC) 102#define PAGE_NONE __pgprot(_PAGE_BASE)
103#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW)
104#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW | _PAGE_EXEC)
106#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER) 105#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER)
107#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) 106#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
108#define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER) 107#define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER)
109#define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) 108#define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
110#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_WRENABLE)
111#define PAGE_KERNEL_CI __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
112 _PAGE_WRENABLE | _PAGE_NO_CACHE | _PAGE_GUARDED)
113#define PAGE_KERNEL_EXEC __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_EXEC)
114 109
115#define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) 110/* Permission masks used for kernel mappings */
116#define HAVE_PAGE_AGP 111#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW)
112#define PAGE_KERNEL_NC __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \
113 _PAGE_NO_CACHE)
114#define PAGE_KERNEL_NCG __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \
115 _PAGE_NO_CACHE | _PAGE_GUARDED)
116#define PAGE_KERNEL_X __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW | _PAGE_EXEC)
117#define PAGE_KERNEL_RO __pgprot(_PAGE_BASE | _PAGE_KERNEL_RO)
118#define PAGE_KERNEL_ROX __pgprot(_PAGE_BASE | _PAGE_KERNEL_RO | _PAGE_EXEC)
119
120/* Protection bits for use by pte_pgprot() */
121#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | \
122 _PAGE_NO_CACHE | _PAGE_WRITETHRU | \
123 _PAGE_4K_PFN | _PAGE_USER | _PAGE_RW | \
124 _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_EXEC)
125
117 126
118/* We always have _PAGE_SPECIAL on 64 bit */ 127/* We always have _PAGE_SPECIAL on 64 bit */
119#define __HAVE_ARCH_PTE_SPECIAL 128#define __HAVE_ARCH_PTE_SPECIAL
120 129
130/* Make modules code happy. We don't set RO yet */
131#define PAGE_KERNEL_EXEC PAGE_KERNEL_X
121 132
122/* 133/*
123 * POWER4 and newer have per page execute protection, older chips can only 134 * POWER4 and newer have per page execute protection, older chips can only
@@ -395,7 +406,8 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
395static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry) 406static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry)
396{ 407{
397 unsigned long bits = pte_val(entry) & 408 unsigned long bits = pte_val(entry) &
398 (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); 409 (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW |
410 _PAGE_EXEC | _PAGE_HWEXEC);
399 unsigned long old, tmp; 411 unsigned long old, tmp;
400 412
401 __asm__ __volatile__( 413 __asm__ __volatile__(
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 5c1c4880723c..81574f94ea32 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -25,6 +25,10 @@ static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
25# include <asm/pgtable-ppc32.h> 25# include <asm/pgtable-ppc32.h>
26#endif 26#endif
27 27
28/* Special mapping for AGP */
29#define PAGE_AGP (PAGE_KERNEL_NC)
30#define HAVE_PAGE_AGP
31
28#ifndef __ASSEMBLY__ 32#ifndef __ASSEMBLY__
29 33
30/* Insert a PTE, top-level function is out of line. It uses an inline 34/* Insert a PTE, top-level function is out of line. It uses an inline
diff --git a/arch/powerpc/include/asm/pte-8xx.h b/arch/powerpc/include/asm/pte-8xx.h
index b07acfd330b0..8c6e31251034 100644
--- a/arch/powerpc/include/asm/pte-8xx.h
+++ b/arch/powerpc/include/asm/pte-8xx.h
@@ -59,6 +59,9 @@
59/* Until my rework is finished, 8xx still needs atomic PTE updates */ 59/* Until my rework is finished, 8xx still needs atomic PTE updates */
60#define PTE_ATOMIC_UPDATES 1 60#define PTE_ATOMIC_UPDATES 1
61 61
62/* We need to add _PAGE_SHARED to kernel pages */
63#define _PAGE_KERNEL_RO (_PAGE_SHARED)
64#define _PAGE_KERNEL_RW (_PAGE_DIRTY | _PAGE_RW | _PAGE_HWWRITE)
62 65
63#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
64#endif /* _ASM_POWERPC_PTE_8xx_H */ 67#endif /* _ASM_POWERPC_PTE_8xx_H */
diff --git a/arch/powerpc/include/asm/pte-hash32.h b/arch/powerpc/include/asm/pte-hash32.h
index 6afe22b02f2f..16e571c7f9ef 100644
--- a/arch/powerpc/include/asm/pte-hash32.h
+++ b/arch/powerpc/include/asm/pte-hash32.h
@@ -44,6 +44,5 @@
44/* Hash table based platforms need atomic updates of the linux PTE */ 44/* Hash table based platforms need atomic updates of the linux PTE */
45#define PTE_ATOMIC_UPDATES 1 45#define PTE_ATOMIC_UPDATES 1
46 46
47
48#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
49#endif /* _ASM_POWERPC_PTE_HASH32_H */ 48#endif /* _ASM_POWERPC_PTE_HASH32_H */
diff --git a/arch/powerpc/include/asm/pte-hash64-4k.h b/arch/powerpc/include/asm/pte-hash64-4k.h
index 29fdc158fe3f..c134e809aac3 100644
--- a/arch/powerpc/include/asm/pte-hash64-4k.h
+++ b/arch/powerpc/include/asm/pte-hash64-4k.h
@@ -8,9 +8,6 @@
8#define _PAGE_F_GIX _PAGE_GROUP_IX 8#define _PAGE_F_GIX _PAGE_GROUP_IX
9#define _PAGE_SPECIAL 0x10000 /* software: special page */ 9#define _PAGE_SPECIAL 0x10000 /* software: special page */
10 10
11/* There is no 4K PFN hack on 4K pages */
12#define _PAGE_4K_PFN 0
13
14/* PTE flags to conserve for HPTE identification */ 11/* PTE flags to conserve for HPTE identification */
15#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \ 12#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \
16 _PAGE_SECONDARY | _PAGE_GROUP_IX) 13 _PAGE_SECONDARY | _PAGE_GROUP_IX)
diff --git a/arch/powerpc/include/asm/pte-hash64.h b/arch/powerpc/include/asm/pte-hash64.h
index 62766636cc1e..b61b7e4a18de 100644
--- a/arch/powerpc/include/asm/pte-hash64.h
+++ b/arch/powerpc/include/asm/pte-hash64.h
@@ -6,36 +6,41 @@
6 * Common bits between 4K and 64K pages in a linux-style PTE. 6 * Common bits between 4K and 64K pages in a linux-style PTE.
7 * These match the bits in the (hardware-defined) PowerPC PTE as closely 7 * These match the bits in the (hardware-defined) PowerPC PTE as closely
8 * as possible. Additional bits may be defined in pgtable-hash64-*.h 8 * as possible. Additional bits may be defined in pgtable-hash64-*.h
9 *
10 * Note: We only support user read/write permissions. Supervisor always
11 * have full read/write to pages above PAGE_OFFSET (pages below that
12 * always use the user access permissions).
13 *
14 * We could create separate kernel read-only if we used the 3 PP bits
15 * combinations that newer processors provide but we currently don't.
9 */ 16 */
10#define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ 17#define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */
11#define _PAGE_USER 0x0002 /* matches one of the PP bits */ 18#define _PAGE_USER 0x0002 /* matches one of the PP bits */
12#define _PAGE_FILE 0x0002 /* (!present only) software: pte holds file offset */ 19#define _PAGE_FILE 0x0002 /* (!present only) software: pte holds file offset */
13#define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we invert) */ 20#define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we invert) */
14#define _PAGE_GUARDED 0x0008 21#define _PAGE_GUARDED 0x0008
15#define _PAGE_COHERENT 0x0010 /* M: enforce memory coherence (SMP systems) */ 22#define _PAGE_COHERENT 0x0010 /* M: enforce memory coherence (SMP systems) */
16#define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */ 23#define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */
17#define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */ 24#define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */
18#define _PAGE_DIRTY 0x0080 /* C: page changed */ 25#define _PAGE_DIRTY 0x0080 /* C: page changed */
19#define _PAGE_ACCESSED 0x0100 /* R: page referenced */ 26#define _PAGE_ACCESSED 0x0100 /* R: page referenced */
20#define _PAGE_RW 0x0200 /* software: user write access allowed */ 27#define _PAGE_RW 0x0200 /* software: user write access allowed */
21#define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ 28#define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */
29
30/* No separate kernel read-only */
31#define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY) /* user access blocked by key */
32#define _PAGE_KERNEL_RO _PAGE_KERNEL_RW
22 33
23/* Strong Access Ordering */ 34/* Strong Access Ordering */
24#define _PAGE_SAO (_PAGE_WRITETHRU | _PAGE_NO_CACHE | _PAGE_COHERENT) 35#define _PAGE_SAO (_PAGE_WRITETHRU | _PAGE_NO_CACHE | _PAGE_COHERENT)
25 36
26#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) 37/* No page size encoding in the linux PTE */
27 38#define _PAGE_PSIZE 0
28#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY)
29 39
30/* PTEIDX nibble */ 40/* PTEIDX nibble */
31#define _PTEIDX_SECONDARY 0x8 41#define _PTEIDX_SECONDARY 0x8
32#define _PTEIDX_GROUP_IX 0x7 42#define _PTEIDX_GROUP_IX 0x7
33 43
34#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | \
35 _PAGE_NO_CACHE | _PAGE_WRITETHRU | \
36 _PAGE_4K_PFN | _PAGE_RW | _PAGE_USER | \
37 _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_EXEC)
38
39 44
40#ifdef CONFIG_PPC_64K_PAGES 45#ifdef CONFIG_PPC_64K_PAGES
41#include <asm/pte-hash64-64k.h> 46#include <asm/pte-hash64-64k.h>