powerpc/mm: Implement _PAGE_SPECIAL & pte_special() for 64-bit

Implement _PAGE_SPECIAL and pte_special() for 64-bit powerpc. This bit will
be used by the fast get_user_pages() to differenciate PTEs that correspond
to a valid struct page from special mappings that don't such as IO mappings
obtained via io_remap_pfn_ranges().

Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Reviewed-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Nick Piggin and committed by
Benjamin Herrenschmidt
83ac6a1e 124c27d3

+6 -2
+2
include/asm-powerpc/pgtable-4k.h
··· 46 46 #define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */ 47 47 #define _PAGE_F_SECOND _PAGE_SECONDARY 48 48 #define _PAGE_F_GIX _PAGE_GROUP_IX 49 + #define _PAGE_SPECIAL 0x10000 /* software: special page */ 50 + #define __HAVE_ARCH_PTE_SPECIAL 49 51 50 52 /* PTE flags to conserve for HPTE identification */ 51 53 #define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \
+2
include/asm-powerpc/pgtable-64k.h
··· 70 70 #define PGDIR_MASK (~(PGDIR_SIZE-1)) 71 71 72 72 /* Additional PTE bits (don't change without checking asm in hash_low.S) */ 73 + #define __HAVE_ARCH_PTE_SPECIAL 74 + #define _PAGE_SPECIAL 0x00000400 /* software: special page */ 73 75 #define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */ 74 76 #define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */ 75 77 #define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */
+2 -2
include/asm-powerpc/pgtable-ppc64.h
··· 245 245 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} 246 246 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} 247 247 static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} 248 - static inline int pte_special(pte_t pte) { return 0; } 248 + static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } 249 249 250 250 static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 251 251 static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } ··· 265 265 static inline pte_t pte_mkhuge(pte_t pte) { 266 266 return pte; } 267 267 static inline pte_t pte_mkspecial(pte_t pte) { 268 - return pte; } 268 + pte_val(pte) |= _PAGE_SPECIAL; return pte; } 269 269 static inline unsigned long pte_pgprot(pte_t pte) 270 270 { 271 271 return __pgprot(pte_val(pte)) & PAGE_PROT_BITS;