]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
powerpc: Fix usage of _PAGE_RO in hugepage
authorChristophe Leroy <christophe.leroy@c-s.fr>
Mon, 19 Sep 2016 10:58:54 +0000 (12:58 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 22 Sep 2016 21:54:22 +0000 (07:54 +1000)
On some CPUs like the 8xx, _PAGE_RW hence _PAGE_WRITE is defined
as 0 and _PAGE_RO has to be set when a page is not writable

_PAGE_RO is defined by default in pte-common.h, however BOOK3S/64
doesn't include that file so _PAGE_RO has to be defined explicitly
in book3s/64/pgtable.h

Fixes: a7b9f671f2d14 ("powerpc32: adds handling of _PAGE_RO")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/book3s/64/pgtable.h
arch/powerpc/mm/hugetlbpage.c

index 8ec8be9495ba73757c801eb8ebfb6eb94b72808e..9fd77f8794a0deeebf14ad922ab9869a8d428ebb 100644 (file)
@@ -6,6 +6,8 @@
  */
 #define _PAGE_BIT_SWAP_TYPE    0
 
+#define _PAGE_RO               0
+
 #define _PAGE_EXEC             0x00001 /* execute permission */
 #define _PAGE_WRITE            0x00002 /* write access allowed */
 #define _PAGE_READ             0x00004 /* read access allowed */
index 7372ee13eb1e43e6bcf7cd955b01452dbc696add..a5d3ecdabc44464e995c9a785e515359d43d4217 100644 (file)
@@ -1019,8 +1019,15 @@ int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
 
        pte = READ_ONCE(*ptep);
        mask = _PAGE_PRESENT | _PAGE_READ;
+
+       /*
+        * On some CPUs like the 8xx, _PAGE_RW hence _PAGE_WRITE is defined
+        * as 0 and _PAGE_RO has to be set when a page is not writable
+        */
        if (write)
                mask |= _PAGE_WRITE;
+       else
+               mask |= _PAGE_RO;
 
        if ((pte_val(pte) & mask) != mask)
                return 0;