#define _PAGE_EXEC     0x200   /* hardware: EX permission */
 #define _PAGE_ACCESSED 0x400   /* software: R: page referenced */
 
+#define _PAGE_WRITE    _PAGE_RW
+
 /* No page size encoding in the linux PTE */
 #define _PAGE_PSIZE            0
 
 
 #define _PAGE_NO_CACHE 0x00000400              /* H: I bit */
 #define _PAGE_WRITETHRU        0x00000800              /* H: W bit */
 
+#define _PAGE_WRITE    _PAGE_RW
+
 /* No page size encoding in the linux PTE */
 #define _PAGE_PSIZE            0
 
 
 #define _PAGE_WRITETHRU        0x00400 /* H: W bit */
 #define _PAGE_SPECIAL  0x00800 /* S: Special page */
 
+#define _PAGE_WRITE    _PAGE_RW
+
 #define _PAGE_KERNEL_RO                0
 #define _PAGE_KERNEL_ROX       _PAGE_EXEC
 #define _PAGE_KERNEL_RW                (_PAGE_DIRTY | _PAGE_RW)
 
 static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
                                           unsigned long addr, pte_t *ptep)
 {
-       pte_update(mm, addr, ptep, _PAGE_RW, 0, 1);
+       pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 1);
 }
 
 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
 
 static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
                                      pte_t *ptep)
 {
-       pte_update(mm, addr, ptep, _PAGE_RW, 0, 0);
+       pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 0);
 }
 #endif
 #define __HAVE_ARCH_PTEP_SET_WRPROTECT
 #ifndef pte_mkwrite_novma
 static inline pte_t pte_mkwrite_novma(pte_t pte)
 {
+       /*
+        * write implies read, hence set both
+        */
        return __pte(pte_val(pte) | _PAGE_RW);
 }
 #endif
 #ifndef pte_wrprotect
 static inline pte_t pte_wrprotect(pte_t pte)
 {
-       return __pte(pte_val(pte) & ~_PAGE_RW);
+       return __pte(pte_val(pte) & ~_PAGE_WRITE);
 }
 #endif
 
 #ifndef pte_write
 static inline int pte_write(pte_t pte)
 {
-       return pte_val(pte) & _PAGE_RW;
+       return pte_val(pte) & _PAGE_WRITE;
 }
 #endif
 #ifndef pte_read
 
 #define _PAGE_KERNEL_ROX       (_PAGE_BAP_SR | _PAGE_BAP_SX)
 #define _PAGE_USER             (_PAGE_BAP_UR | _PAGE_BAP_SR) /* Can be read */
 
+#define _PAGE_WRITE    _PAGE_RW
+
 #define _PAGE_SPECIAL  _PAGE_SW0
 
 /* Base page size */
 
        andc.   r9, r9, r11             /* Check permission */
        bne     5f
 
-       rlwinm  r9, r11, 1, _PAGE_RW    /* dirty => rw */
-       and     r9, r9, r11             /* hwwrite = dirty & rw */
-       rlwimi  r11, r9, 0, _PAGE_RW    /* replace rw by hwwrite */
+       rlwinm  r9, r11, 1, _PAGE_WRITE /* dirty => w */
+       and     r9, r9, r11             /* hwwrite = dirty & w */
+       rlwimi  r11, r9, 0, _PAGE_WRITE /* replace w by hwwrite */
 
        /* Create TLB tag.  This is the faulting address plus a static
         * set of bits.  These are size, valid, E, U0.
        andc.   r9, r9, r11             /* Check permission */
        bne     5f
 
-       rlwinm  r9, r11, 1, _PAGE_RW    /* dirty => rw */
-       and     r9, r9, r11             /* hwwrite = dirty & rw */
-       rlwimi  r11, r9, 0, _PAGE_RW    /* replace rw by hwwrite */
+       rlwinm  r9, r11, 1, _PAGE_WRITE /* dirty => w */
+       and     r9, r9, r11             /* hwwrite = dirty & w */
+       rlwimi  r11, r9, 0, _PAGE_WRITE /* replace w by hwwrite */
 
        /* Create TLB tag.  This is the faulting address plus a static
         * set of bits.  These are size, valid, E, U0.
 
        mtspr   SPRN_MMUCR,r12
 
        /* Mask of required permission bits. Note that while we
-        * do copy ESR:ST to _PAGE_RW position as trying to write
+        * do copy ESR:ST to _PAGE_WRITE position as trying to write
         * to an RO page is pretty common, we don't do it with
         * _PAGE_DIRTY. We could do it, but it's a fairly rare
         * event so I'd rather take the overhead when it happens
 4:     mtspr   SPRN_MMUCR,r12          /* Set MMUCR */
 
        /* Mask of required permission bits. Note that while we
-        * do copy ESR:ST to _PAGE_RW position as trying to write
+        * do copy ESR:ST to _PAGE_WRITE position as trying to write
         * to an RO page is pretty common, we don't do it with
         * _PAGE_DIRTY. We could do it, but it's a fairly rare
         * event so I'd rather take the overhead when it happens
 
 
 4:
        /* Mask of required permission bits. Note that while we
-        * do copy ESR:ST to _PAGE_RW position as trying to write
+        * do copy ESR:ST to _PAGE_WRITE position as trying to write
         * to an RO page is pretty common, we don't do it with
         * _PAGE_DIRTY. We could do it, but it's a fairly rare
         * event so I'd rather take the overhead when it happens
 
        TLBCAM[index].MAS2 |= (flags & _PAGE_ENDIAN) ? MAS2_E : 0;
 
        TLBCAM[index].MAS3 = (phys & MAS3_RPN) | MAS3_SR;
-       TLBCAM[index].MAS3 |= (flags & _PAGE_RW) ? MAS3_SW : 0;
+       TLBCAM[index].MAS3 |= (flags & _PAGE_WRITE) ? MAS3_SW : 0;
        if (mmu_has_feature(MMU_FTR_BIG_PHYS))
                TLBCAM[index].MAS7 = (u64)phys >> 32;
 
        if (!is_kernel_addr(virt)) {
                TLBCAM[index].MAS3 |= MAS3_UR;
                TLBCAM[index].MAS3 |= (flags & _PAGE_EXEC) ? MAS3_UX : 0;
-               TLBCAM[index].MAS3 |= (flags & _PAGE_RW) ? MAS3_UW : 0;
+               TLBCAM[index].MAS3 |= (flags & _PAGE_WRITE) ? MAS3_UW : 0;
        } else {
                TLBCAM[index].MAS3 |= (flags & _PAGE_EXEC) ? MAS3_SX : 0;
        }