public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* [PATCH v2 1/2] powerpc/mm: Move vm_get_page_prot() out of book3s64 code
@ 2022-08-08 13:01 Russell Currey
  2022-08-08 13:01 ` [PATCH v2 2/2] powerpc/mm: Support execute-only memory on the Radix MMU Russell Currey
  2022-08-08 14:32 ` [PATCH v2 1/2] powerpc/mm: Move vm_get_page_prot() out of book3s64 code Christophe Leroy
  0 siblings, 2 replies; 7+ messages in thread
From: Russell Currey @ 2022-08-08 13:01 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: ajd, anshuman.khandual, npiggin, aneesh.kumar, Russell Currey

protection_map is about to be __ro_after_init instead of const, so move
the only non-local function that consumes it to the same file so it can
at least be static.

Signed-off-by: Russell Currey <ruscur@russell•cc>
---
v2: new

 arch/powerpc/mm/book3s64/pgtable.c | 16 ----------------
 arch/powerpc/mm/pgtable.c          | 21 +++++++++++++++++++--
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index 7b9966402b25..e2a4ea5eb960 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -550,19 +550,3 @@ unsigned long memremap_compat_align(void)
 }
 EXPORT_SYMBOL_GPL(memremap_compat_align);
 #endif
-
-pgprot_t vm_get_page_prot(unsigned long vm_flags)
-{
-	unsigned long prot = pgprot_val(protection_map[vm_flags &
-					(VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]);
-
-	if (vm_flags & VM_SAO)
-		prot |= _PAGE_SAO;
-
-#ifdef CONFIG_PPC_MEM_KEYS
-	prot |= vmflag_to_pte_pkey_bits(vm_flags);
-#endif
-
-	return __pgprot(prot);
-}
-EXPORT_SYMBOL(vm_get_page_prot);
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index cb2dcdb18f8e..0b2bbde5fb65 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -27,6 +27,7 @@
 #include <asm/tlb.h>
 #include <asm/hugetlb.h>
 #include <asm/pte-walk.h>
+#include <asm/pkeys.h>
 
 #ifdef CONFIG_PPC64
 #define PGD_ALIGN (sizeof(pgd_t) * MAX_PTRS_PER_PGD)
@@ -493,6 +494,22 @@ const pgprot_t protection_map[16] = {
 	[VM_SHARED | VM_EXEC | VM_WRITE | VM_READ]	= PAGE_SHARED_X
 };
 
-#ifndef CONFIG_PPC_BOOK3S_64
-DECLARE_VM_GET_PAGE_PROT
+#ifdef CONFIG_PPC_BOOK3S_64
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+	unsigned long prot = pgprot_val(protection_map[vm_flags &
+					(VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]);
+
+	if (vm_flags & VM_SAO)
+		prot |= _PAGE_SAO;
+
+#ifdef CONFIG_PPC_MEM_KEYS
+	prot |= vmflag_to_pte_pkey_bits(vm_flags);
 #endif
+
+	return __pgprot(prot);
+}
+EXPORT_SYMBOL(vm_get_page_prot);
+#else
+DECLARE_VM_GET_PAGE_PROT
+#endif /* CONFIG_PPC_BOOK3S_64 */
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-09  5:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-08 13:01 [PATCH v2 1/2] powerpc/mm: Move vm_get_page_prot() out of book3s64 code Russell Currey
2022-08-08 13:01 ` [PATCH v2 2/2] powerpc/mm: Support execute-only memory on the Radix MMU Russell Currey
2022-08-08 13:24   ` Aneesh Kumar K V
2022-08-09  0:56     ` Russell Currey
2022-08-08 14:32 ` [PATCH v2 1/2] powerpc/mm: Move vm_get_page_prot() out of book3s64 code Christophe Leroy
2022-08-09  0:55   ` Russell Currey
2022-08-09  5:35     ` Christophe Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox