]> git.baikalelectronics.ru Git - kernel.git/commitdiff
microblaze/mm: enable ARCH_HAS_VM_GET_PAGE_PROT
authorAnshuman Khandual <anshuman.khandual@arm.com>
Mon, 11 Jul 2022 07:05:42 +0000 (12:35 +0530)
committerakpm <akpm@linux-foundation.org>
Mon, 18 Jul 2022 00:14:38 +0000 (17:14 -0700)
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports
standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT,
which looks up a private and static protection_map[] array.  Subsequently
all __SXXX and __PXXX macros can be dropped which are no longer needed.

Link: https://lkml.kernel.org/r/20220711070600.2378316-9-anshuman.khandual@arm.com
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Brian Cain <bcain@quicinc.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chris Zankel <chris@zankel.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Rich Felker <dalias@libc.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Will Deacon <will@kernel.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/microblaze/Kconfig
arch/microblaze/include/asm/pgtable.h
arch/microblaze/mm/init.c

index 8cf429ad1c84fb19cf2ca41dd3b6a95a4b5e622e..15f91ba8a0c4c4f1b9da38b892494b3a9d9d5816 100644 (file)
@@ -7,6 +7,7 @@ config MICROBLAZE
        select ARCH_HAS_GCOV_PROFILE_ALL
        select ARCH_HAS_SYNC_DMA_FOR_CPU
        select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+       select ARCH_HAS_VM_GET_PAGE_PROT
        select ARCH_MIGHT_HAVE_PC_PARPORT
        select ARCH_WANT_IPC_PARSE_VERSION
        select BUILDTIME_TABLE_SORT
index 0c72646370e1aac5c4a5231ddcddfe2a16ce7cf3..ba348e997dbb4a26602b9277692523b9142c3ca5 100644 (file)
@@ -204,23 +204,6 @@ extern pte_t *va_to_pte(unsigned long address);
  * We consider execute permission the same as read.
  * Also, write permissions imply read permissions.
  */
-#define __P000 PAGE_NONE
-#define __P001 PAGE_READONLY_X
-#define __P010 PAGE_COPY
-#define __P011 PAGE_COPY_X
-#define __P100 PAGE_READONLY
-#define __P101 PAGE_READONLY_X
-#define __P110 PAGE_COPY
-#define __P111 PAGE_COPY_X
-
-#define __S000 PAGE_NONE
-#define __S001 PAGE_READONLY_X
-#define __S010 PAGE_SHARED
-#define __S011 PAGE_SHARED_X
-#define __S100 PAGE_READONLY
-#define __S101 PAGE_READONLY_X
-#define __S110 PAGE_SHARED
-#define __S111 PAGE_SHARED_X
 
 #ifndef __ASSEMBLY__
 /*
index f4e503461d24467e763b07f98333c90fcbf50247..353fabdfcbc54051cc6f5535e94d9cf6e0b26740 100644 (file)
@@ -285,3 +285,23 @@ void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)
 
        return p;
 }
+
+static const pgprot_t protection_map[16] = {
+       [VM_NONE]                                       = PAGE_NONE,
+       [VM_READ]                                       = PAGE_READONLY_X,
+       [VM_WRITE]                                      = PAGE_COPY,
+       [VM_WRITE | VM_READ]                            = PAGE_COPY_X,
+       [VM_EXEC]                                       = PAGE_READONLY,
+       [VM_EXEC | VM_READ]                             = PAGE_READONLY_X,
+       [VM_EXEC | VM_WRITE]                            = PAGE_COPY,
+       [VM_EXEC | VM_WRITE | VM_READ]                  = PAGE_COPY_X,
+       [VM_SHARED]                                     = PAGE_NONE,
+       [VM_SHARED | VM_READ]                           = PAGE_READONLY_X,
+       [VM_SHARED | VM_WRITE]                          = PAGE_SHARED,
+       [VM_SHARED | VM_WRITE | VM_READ]                = PAGE_SHARED_X,
+       [VM_SHARED | VM_EXEC]                           = PAGE_READONLY,
+       [VM_SHARED | VM_EXEC | VM_READ]                 = PAGE_READONLY_X,
+       [VM_SHARED | VM_EXEC | VM_WRITE]                = PAGE_SHARED,
+       [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ]      = PAGE_SHARED_X
+};
+DECLARE_VM_GET_PAGE_PROT