diff options
author | Nick Piggin <npiggin@suse.de> | 2008-07-25 22:45:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:05 -0400 |
commit | a0a8f5364a5ad248aec6cb705e0092ff563edc2f (patch) | |
tree | fe942b13adc527f66103d529c2ee91da05086d1c /include/asm-x86/pgtable.h | |
parent | 2682497245e7d22160ae63032c378745a7f2cfe5 (diff) |
x86: implement pte_special
Implement the pte_special bit for x86. This is required to support
lockless get_user_pages, because we need to know whether or not we can
refcount a particular page given only its pte (and no vma).
[hugh@veritas.com: fix a BUG]
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Zach Brown <zach.brown@oracle.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Reviewed-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-x86/pgtable.h')
-rw-r--r-- | include/asm-x86/pgtable.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index 3e5dbc4195f4..04caa2f544df 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #define _PAGE_BIT_UNUSED2 10 | 18 | #define _PAGE_BIT_UNUSED2 10 |
19 | #define _PAGE_BIT_UNUSED3 11 | 19 | #define _PAGE_BIT_UNUSED3 11 |
20 | #define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ | 20 | #define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ |
21 | #define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1 | ||
21 | #define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ | 22 | #define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ |
22 | 23 | ||
23 | #define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) | 24 | #define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) |
@@ -34,6 +35,8 @@ | |||
34 | #define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3) | 35 | #define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3) |
35 | #define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT) | 36 | #define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT) |
36 | #define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE) | 37 | #define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE) |
38 | #define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL) | ||
39 | #define __HAVE_ARCH_PTE_SPECIAL | ||
37 | 40 | ||
38 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) | 41 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) |
39 | #define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) | 42 | #define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) |
@@ -54,7 +57,7 @@ | |||
54 | 57 | ||
55 | /* Set of bits not changed in pte_modify */ | 58 | /* Set of bits not changed in pte_modify */ |
56 | #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ | 59 | #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ |
57 | _PAGE_ACCESSED | _PAGE_DIRTY) | 60 | _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY) |
58 | 61 | ||
59 | #define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT) | 62 | #define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT) |
60 | #define _PAGE_CACHE_WB (0) | 63 | #define _PAGE_CACHE_WB (0) |
@@ -180,7 +183,7 @@ static inline int pte_exec(pte_t pte) | |||
180 | 183 | ||
181 | static inline int pte_special(pte_t pte) | 184 | static inline int pte_special(pte_t pte) |
182 | { | 185 | { |
183 | return 0; | 186 | return pte_val(pte) & _PAGE_SPECIAL; |
184 | } | 187 | } |
185 | 188 | ||
186 | static inline int pmd_large(pmd_t pte) | 189 | static inline int pmd_large(pmd_t pte) |
@@ -246,7 +249,7 @@ static inline pte_t pte_clrglobal(pte_t pte) | |||
246 | 249 | ||
247 | static inline pte_t pte_mkspecial(pte_t pte) | 250 | static inline pte_t pte_mkspecial(pte_t pte) |
248 | { | 251 | { |
249 | return pte; | 252 | return __pte(pte_val(pte) | _PAGE_SPECIAL); |
250 | } | 253 | } |
251 | 254 | ||
252 | extern pteval_t __supported_pte_mask; | 255 | extern pteval_t __supported_pte_mask; |