powerpc/mm: Add option for non-atomic PTE updates to ppc64

ppc32 has it already, add it to ppc64 as a preliminary for adding
support for Book3E 64-bit support
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent ff7c6600
...@@ -178,6 +178,7 @@ static inline unsigned long pte_update(struct mm_struct *mm, ...@@ -178,6 +178,7 @@ static inline unsigned long pte_update(struct mm_struct *mm,
pte_t *ptep, unsigned long clr, pte_t *ptep, unsigned long clr,
int huge) int huge)
{ {
#ifdef PTE_ATOMIC_UPDATES
unsigned long old, tmp; unsigned long old, tmp;
__asm__ __volatile__( __asm__ __volatile__(
...@@ -190,7 +191,10 @@ static inline unsigned long pte_update(struct mm_struct *mm, ...@@ -190,7 +191,10 @@ static inline unsigned long pte_update(struct mm_struct *mm,
: "=&r" (old), "=&r" (tmp), "=m" (*ptep) : "=&r" (old), "=&r" (tmp), "=m" (*ptep)
: "r" (ptep), "r" (clr), "m" (*ptep), "i" (_PAGE_BUSY) : "r" (ptep), "r" (clr), "m" (*ptep), "i" (_PAGE_BUSY)
: "cc" ); : "cc" );
#else
unsigned long old = pte_val(*ptep);
*ptep = __pte(old & ~clr);
#endif
/* huge pages use the old page table lock */ /* huge pages use the old page table lock */
if (!huge) if (!huge)
assert_pte_locked(mm, addr); assert_pte_locked(mm, addr);
...@@ -278,6 +282,8 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry) ...@@ -278,6 +282,8 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry)
unsigned long bits = pte_val(entry) & unsigned long bits = pte_val(entry) &
(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW |
_PAGE_EXEC | _PAGE_HWEXEC); _PAGE_EXEC | _PAGE_HWEXEC);
#ifdef PTE_ATOMIC_UPDATES
unsigned long old, tmp; unsigned long old, tmp;
__asm__ __volatile__( __asm__ __volatile__(
...@@ -290,6 +296,10 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry) ...@@ -290,6 +296,10 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry)
:"=&r" (old), "=&r" (tmp), "=m" (*ptep) :"=&r" (old), "=&r" (tmp), "=m" (*ptep)
:"r" (bits), "r" (ptep), "m" (*ptep), "i" (_PAGE_BUSY) :"r" (bits), "r" (ptep), "m" (*ptep), "i" (_PAGE_BUSY)
:"cc"); :"cc");
#else
unsigned long old = pte_val(*ptep);
*ptep = __pte(old | bits);
#endif
} }
#define __HAVE_ARCH_PTE_SAME #define __HAVE_ARCH_PTE_SAME
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#define _PTEIDX_SECONDARY 0x8 #define _PTEIDX_SECONDARY 0x8
#define _PTEIDX_GROUP_IX 0x7 #define _PTEIDX_GROUP_IX 0x7
/* Hash table based platforms need atomic updates of the linux PTE */
#define PTE_ATOMIC_UPDATES 1
#ifdef CONFIG_PPC_64K_PAGES #ifdef CONFIG_PPC_64K_PAGES
#include <asm/pte-hash64-64k.h> #include <asm/pte-hash64-64k.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment