powerpc: Add 64 bit version of huge_ptep_set_wrprotect
[pandora-kernel.git] / include / asm-powerpc / pgtable-ppc64.h
index 7ca8b5c..b2754d4 100644 (file)
 
 #define VMALLOC_REGION_ID      (REGION_ID(VMALLOC_START))
 #define KERNEL_REGION_ID       (REGION_ID(PAGE_OFFSET))
+#define VMEMMAP_REGION_ID      (0xfUL)
 #define USER_REGION_ID         (0UL)
 
+/*
+ * Defines the address of the vmemap area, in its own region
+ */
+#define VMEMMAP_BASE           (VMEMMAP_REGION_ID << REGION_SHIFT)
+#define vmemmap                        ((struct page *)VMEMMAP_BASE)
+
+
 /*
  * Common bits in a linux-style PTE.  These match the bits in the
  * (hardware-defined) PowerPC PTE as closely as possible. Additional
@@ -83,7 +91,6 @@
 #define _PAGE_DIRTY    0x0080 /* C: page changed */
 #define _PAGE_ACCESSED 0x0100 /* R: page referenced */
 #define _PAGE_RW       0x0200 /* software: user write access allowed */
-#define _PAGE_HASHPTE  0x0400 /* software: pte has an associated HPTE */
 #define _PAGE_BUSY     0x0800 /* software: PTE & hash are busy */
 
 #define _PAGE_BASE     (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT)
@@ -231,6 +238,7 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;}
 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;}
 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;}
 static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;}
+static inline int pte_special(pte_t pte) { return 0; }
 
 static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
 static inline void pte_cache(pte_t pte)   { pte_val(pte) &= ~_PAGE_NO_CACHE; }
@@ -249,6 +257,8 @@ static inline pte_t pte_mkyoung(pte_t pte) {
        pte_val(pte) |= _PAGE_ACCESSED; return pte; }
 static inline pte_t pte_mkhuge(pte_t pte) {
        return pte; }
+static inline pte_t pte_mkspecial(pte_t pte) {
+       return pte; }
 
 /* Atomic PTE updates */
 static inline unsigned long pte_update(struct mm_struct *mm,
@@ -292,29 +302,6 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
        __r;                                                               \
 })
 
-/*
- * On RW/DIRTY bit transitions we can avoid flushing the hpte. For the
- * moment we always flush but we need to fix hpte_update and test if the
- * optimisation is worth it.
- */
-static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm,
-                                             unsigned long addr, pte_t *ptep)
-{
-       unsigned long old;
-
-               if ((pte_val(*ptep) & _PAGE_DIRTY) == 0)
-               return 0;
-       old = pte_update(mm, addr, ptep, _PAGE_DIRTY, 0);
-       return (old & _PAGE_DIRTY) != 0;
-}
-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
-#define ptep_test_and_clear_dirty(__vma, __addr, __ptep)                  \
-({                                                                        \
-       int __r;                                                           \
-       __r = __ptep_test_and_clear_dirty((__vma)->vm_mm, __addr, __ptep); \
-       __r;                                                               \
-})
-
 #define __HAVE_ARCH_PTEP_SET_WRPROTECT
 static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
                                      pte_t *ptep)
@@ -325,6 +312,15 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
                        return;
        old = pte_update(mm, addr, ptep, _PAGE_RW, 0);
 }
+static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
+                                          unsigned long addr, pte_t *ptep)
+{
+       unsigned long old;
+
+               if ((pte_val(*ptep) & _PAGE_RW) == 0)
+                       return;
+       old = pte_update(mm, addr, ptep, _PAGE_RW, 1);
+}
 
 /*
  * We currently remove entries from the hashtable regardless of whether
@@ -342,14 +338,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
        __young;                                                        \
 })
 
-#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
-#define ptep_clear_flush_dirty(__vma, __address, __ptep)               \
-({                                                                     \
-       int __dirty = __ptep_test_and_clear_dirty((__vma)->vm_mm, __address, \
-                                                 __ptep);              \
-       __dirty;                                                        \
-})
-
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
                                       unsigned long addr, pte_t *ptep)