]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/mm/hash64_4k.c
powerpc/mm: Replace _PAGE_USER with _PAGE_PRIVILEGED
[karo-tx-linux.git] / arch / powerpc / mm / hash64_4k.c
index 47d1b26effc6a71115d371599590496fc2dd5b96..529e49204f6bd01cf5e1321c39bfbc9a9a80d18d 100644 (file)
@@ -37,7 +37,7 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,
                if (unlikely(old_pte & _PAGE_BUSY))
                        return 0;
                /* If PTE permissions don't match, take page fault */
-               if (unlikely(access & ~old_pte))
+               if (unlikely(!check_pte_access(access, old_pte)))
                        return 1;
                /*
                 * Try to lock the PTE, add ACCESSED and DIRTY if it was
@@ -45,10 +45,10 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,
                 * also add _PAGE_COMBO
                 */
                new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED;
-               if (access & _PAGE_RW)
+               if (access & _PAGE_WRITE)
                        new_pte |= _PAGE_DIRTY;
-       } while (old_pte != __cmpxchg_u64((unsigned long *)ptep,
-                                         old_pte, new_pte));
+       } while (!pte_xchg(ptep, __pte(old_pte), __pte(new_pte)));
+
        /*
         * PP bits. _PAGE_USER is already PP bit 0x2, so we only
         * need to add in 0x1 if it's a read-only user page