]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/mm/pgtable.c
powerpc/mm: Replace _PAGE_USER with _PAGE_PRIVILEGED
[karo-tx-linux.git] / arch / powerpc / mm / pgtable.c
index 83dfd7925c72c95efa47766c1806ef3e4a39126c..125fb4b54445ed5b0355519853aeedb91aa3fb06 100644 (file)
@@ -43,9 +43,20 @@ static inline int is_exec_fault(void)
  */
 static inline int pte_looks_normal(pte_t pte)
 {
+
+#if defined(CONFIG_PPC_BOOK3S_64)
+       if ((pte_val(pte) &
+            (_PAGE_PRESENT | _PAGE_SPECIAL | _PAGE_NO_CACHE)) ==
+           _PAGE_PRESENT) {
+               if (pte_user(pte))
+                       return 1;
+       }
+       return 0;
+#else
        return (pte_val(pte) &
-           (_PAGE_PRESENT | _PAGE_SPECIAL | _PAGE_NO_CACHE | _PAGE_USER)) ==
-           (_PAGE_PRESENT | _PAGE_USER);
+               (_PAGE_PRESENT | _PAGE_SPECIAL | _PAGE_NO_CACHE | _PAGE_USER)) ==
+               (_PAGE_PRESENT | _PAGE_USER);
+#endif
 }
 
 static struct page *maybe_pte_to_page(pte_t pte)
@@ -177,8 +188,8 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
         * _PAGE_PRESENT, but we can be sure that it is not in hpte.
         * Hence we can use set_pte_at for them.
         */
-       VM_WARN_ON((pte_val(*ptep) & (_PAGE_PRESENT | _PAGE_USER)) ==
-               (_PAGE_PRESENT | _PAGE_USER));
+       VM_WARN_ON(pte_present(*ptep) && !pte_protnone(*ptep));
+
        /*
         * Add the pte bit when tryint set a pte
         */
@@ -243,3 +254,11 @@ void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
 }
 #endif /* CONFIG_DEBUG_VM */
 
+unsigned long vmalloc_to_phys(void *va)
+{
+       unsigned long pfn = vmalloc_to_pfn(va);
+
+       BUG_ON(!pfn);
+       return __pa(pfn_to_kaddr(pfn)) + offset_in_page(va);
+}
+EXPORT_SYMBOL_GPL(vmalloc_to_phys);