* [PATCH V6 0/7] mm/mmap: Drop arch_vm_get_page_prot() and arch_filter_pgprot()
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel
protection_map[] is an array based construct that translates given vm_flags
combination. This array contains page protection map, which is populated by
the platform via [__S000 .. __S111] and [__P000 .. __P111] exported macros.
Primary usage for protection_map[] is for vm_get_page_prot(), which is used
to determine page protection value for a given vm_flags. vm_get_page_prot()
implementation, could again call platform overrides arch_vm_get_page_prot()
and arch_filter_pgprot(). Some platforms override protection_map[] that was
originally built with __SXXX/__PXXX with different runtime values.
Currently there are multiple layers of abstraction i.e __SXXX/__PXXX macros
, protection_map[], arch_vm_get_page_prot() and arch_filter_pgprot() built
between the platform and generic MM, finally defining vm_get_page_prot().
Hence this series proposes to drop later two abstraction levels and instead
just move the responsibility of defining vm_get_page_prot() to the platform
(still utilizing generic protection_map[] array) itself making it clean and
simple.
This first introduces ARCH_HAS_VM_GET_PAGE_PROT which enables the platforms
to define custom vm_get_page_prot(). This starts converting platforms that
define the overrides arch_filter_pgprot() or arch_vm_get_page_prot() which
enables for those constructs to be dropped off completely.
The series has been inspired from an earlier discuss with Christoph Hellwig
https://lore.kernel.org/all/1632712920-8171-1-git-send-email-anshuman.khandual@arm.com/
This series applies on 5.18-rc2.
This series has been cross built for multiple platforms.
- Anshuman
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: sparclinux@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Changes in V6:
- Created single merged vm_get_page_prot() function per Christophe
- Dropped local variable 'ret' in generic vm_get_page_prot() per Christophe
- Dropped __pgprot(pgprot_val(x)) in generic vm_get_page_prot() per Christophe
Changes in V5:
https://lore.kernel.org/all/20220412043848.80464-2-anshuman.khandual@arm.com/
- Collected new tags on various patches in the series
- Coalesced arm64_arch_vm_get_page_prot() into vm_get_page_prot() per Catalin
- Modified powerpc's vm_get_page_prot() implementation per Christophe
Changes in V4:
https://lore.kernel.org/all/20220407103251.1209606-1-anshuman.khandual@arm.com/
- ARCH_HAS_VM_GET_PAGE_PROT now excludes generic protection_map[]
- Changed platform's vm_get_page_prot() to use generic protection_map[]
- Dropped all platform changes not enabling either arch_vm_get_page_prot() or arch_filter_pgprot()
- Dropped all previous tags as code base has changed
Changes in V3:
https://lore.kernel.org/all/1646045273-9343-1-git-send-email-anshuman.khandual@arm.com/
- Dropped variable 'i' from sme_early_init() on x86 platform
- Moved CONFIG_COLDFIRE vm_get_page_prot() inside arch/m68k/mm/mcfmmu.c
- Moved CONFIG_SUN3 vm_get_page_prot() inside arch/m68k/mm/sun3mmu.c
- Dropped cachebits for vm_get_page_prot() inside arch/m68k/mm/motorola.c
- Dropped PAGE_XXX_C definitions from arch/m68k/include/asm/motorola_pgtable.h
- Used PAGE_XXX instead for vm_get_page_prot() inside arch/m68k/mm/motorola.c
- Dropped all references to protection_map[] in the tree
- Replaced s/extensa/xtensa/ on the patch title
- Moved left over comments from pgtable.h into init.c on nios2 platform
Changes in V2:
https://lore.kernel.org/all/1645425519-9034-1-git-send-email-anshuman.khandual@arm.com/
- Dropped the entire comment block in [PATCH 30/30] per Geert
- Replaced __P010 (although commented) with __PAGE_COPY on arm platform
- Replaced __P101 with PAGE_READONLY on um platform
Changes in V1:
https://lore.kernel.org/all/1644805853-21338-1-git-send-email-anshuman.khandual@arm.com/
- Add white spaces around the | operators
- Moved powerpc_vm_get_page_prot() near vm_get_page_prot() on powerpc
- Moved arm64_vm_get_page_prot() near vm_get_page_prot() on arm64
- Moved sparc_vm_get_page_prot() near vm_get_page_prot() on sparc
- Compacted vm_get_page_prot() switch cases on all platforms
- _PAGE_CACHE040 inclusion is dependent on CPU_IS_040_OR_060
- VM_SHARED case should return PAGE_NONE (not PAGE_COPY) on SH platform
- Reorganized VM_SHARED, VM_EXEC, VM_WRITE, VM_READ
- Dropped the last patch [RFC V1 31/31] which added macros for vm_flags combinations
https://lore.kernel.org/all/1643029028-12710-32-git-send-email-anshuman.khandual@arm.com/
Changes in RFC:
https://lore.kernel.org/all/1643029028-12710-1-git-send-email-anshuman.khandual@arm.com/
Anshuman Khandual (6):
mm/mmap: Add new config ARCH_HAS_VM_GET_PAGE_PROT
powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
arm64/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
mm/mmap: Drop arch_filter_pgprot()
mm/mmap: Drop arch_vm_get_page_pgprot()
Christoph Hellwig (1):
x86/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/mman.h | 24 --------------------
arch/arm64/mm/mmap.c | 25 +++++++++++++++++++++
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/mman.h | 12 ----------
arch/powerpc/mm/book3s64/pgtable.c | 17 +++++++++++++++
arch/sparc/Kconfig | 1 +
arch/sparc/include/asm/mman.h | 6 -----
arch/sparc/mm/init_64.c | 13 +++++++++++
arch/x86/Kconfig | 2 +-
arch/x86/include/asm/pgtable.h | 5 -----
arch/x86/include/uapi/asm/mman.h | 14 ------------
arch/x86/mm/Makefile | 2 +-
arch/x86/mm/pgprot.c | 35 ++++++++++++++++++++++++++++++
include/linux/mman.h | 4 ----
mm/Kconfig | 2 +-
mm/mmap.c | 15 +++----------
17 files changed, 99 insertions(+), 80 deletions(-)
create mode 100644 arch/x86/mm/pgprot.c
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH V6 0/7] mm/mmap: Drop arch_vm_get_page_prot() and arch_filter_pgprot()
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: linux-arch, Anshuman Khandual, catalin.marinas, linux-kernel,
Christoph Hellwig, sparclinux, linuxppc-dev, linux-arm-kernel
protection_map[] is an array based construct that translates given vm_flags
combination. This array contains page protection map, which is populated by
the platform via [__S000 .. __S111] and [__P000 .. __P111] exported macros.
Primary usage for protection_map[] is for vm_get_page_prot(), which is used
to determine page protection value for a given vm_flags. vm_get_page_prot()
implementation, could again call platform overrides arch_vm_get_page_prot()
and arch_filter_pgprot(). Some platforms override protection_map[] that was
originally built with __SXXX/__PXXX with different runtime values.
Currently there are multiple layers of abstraction i.e __SXXX/__PXXX macros
, protection_map[], arch_vm_get_page_prot() and arch_filter_pgprot() built
between the platform and generic MM, finally defining vm_get_page_prot().
Hence this series proposes to drop later two abstraction levels and instead
just move the responsibility of defining vm_get_page_prot() to the platform
(still utilizing generic protection_map[] array) itself making it clean and
simple.
This first introduces ARCH_HAS_VM_GET_PAGE_PROT which enables the platforms
to define custom vm_get_page_prot(). This starts converting platforms that
define the overrides arch_filter_pgprot() or arch_vm_get_page_prot() which
enables for those constructs to be dropped off completely.
The series has been inspired from an earlier discuss with Christoph Hellwig
https://lore.kernel.org/all/1632712920-8171-1-git-send-email-anshuman.khandual@arm.com/
This series applies on 5.18-rc2.
This series has been cross built for multiple platforms.
- Anshuman
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: sparclinux@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Changes in V6:
- Created single merged vm_get_page_prot() function per Christophe
- Dropped local variable 'ret' in generic vm_get_page_prot() per Christophe
- Dropped __pgprot(pgprot_val(x)) in generic vm_get_page_prot() per Christophe
Changes in V5:
https://lore.kernel.org/all/20220412043848.80464-2-anshuman.khandual@arm.com/
- Collected new tags on various patches in the series
- Coalesced arm64_arch_vm_get_page_prot() into vm_get_page_prot() per Catalin
- Modified powerpc's vm_get_page_prot() implementation per Christophe
Changes in V4:
https://lore.kernel.org/all/20220407103251.1209606-1-anshuman.khandual@arm.com/
- ARCH_HAS_VM_GET_PAGE_PROT now excludes generic protection_map[]
- Changed platform's vm_get_page_prot() to use generic protection_map[]
- Dropped all platform changes not enabling either arch_vm_get_page_prot() or arch_filter_pgprot()
- Dropped all previous tags as code base has changed
Changes in V3:
https://lore.kernel.org/all/1646045273-9343-1-git-send-email-anshuman.khandual@arm.com/
- Dropped variable 'i' from sme_early_init() on x86 platform
- Moved CONFIG_COLDFIRE vm_get_page_prot() inside arch/m68k/mm/mcfmmu.c
- Moved CONFIG_SUN3 vm_get_page_prot() inside arch/m68k/mm/sun3mmu.c
- Dropped cachebits for vm_get_page_prot() inside arch/m68k/mm/motorola.c
- Dropped PAGE_XXX_C definitions from arch/m68k/include/asm/motorola_pgtable.h
- Used PAGE_XXX instead for vm_get_page_prot() inside arch/m68k/mm/motorola.c
- Dropped all references to protection_map[] in the tree
- Replaced s/extensa/xtensa/ on the patch title
- Moved left over comments from pgtable.h into init.c on nios2 platform
Changes in V2:
https://lore.kernel.org/all/1645425519-9034-1-git-send-email-anshuman.khandual@arm.com/
- Dropped the entire comment block in [PATCH 30/30] per Geert
- Replaced __P010 (although commented) with __PAGE_COPY on arm platform
- Replaced __P101 with PAGE_READONLY on um platform
Changes in V1:
https://lore.kernel.org/all/1644805853-21338-1-git-send-email-anshuman.khandual@arm.com/
- Add white spaces around the | operators
- Moved powerpc_vm_get_page_prot() near vm_get_page_prot() on powerpc
- Moved arm64_vm_get_page_prot() near vm_get_page_prot() on arm64
- Moved sparc_vm_get_page_prot() near vm_get_page_prot() on sparc
- Compacted vm_get_page_prot() switch cases on all platforms
- _PAGE_CACHE040 inclusion is dependent on CPU_IS_040_OR_060
- VM_SHARED case should return PAGE_NONE (not PAGE_COPY) on SH platform
- Reorganized VM_SHARED, VM_EXEC, VM_WRITE, VM_READ
- Dropped the last patch [RFC V1 31/31] which added macros for vm_flags combinations
https://lore.kernel.org/all/1643029028-12710-32-git-send-email-anshuman.khandual@arm.com/
Changes in RFC:
https://lore.kernel.org/all/1643029028-12710-1-git-send-email-anshuman.khandual@arm.com/
Anshuman Khandual (6):
mm/mmap: Add new config ARCH_HAS_VM_GET_PAGE_PROT
powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
arm64/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
mm/mmap: Drop arch_filter_pgprot()
mm/mmap: Drop arch_vm_get_page_pgprot()
Christoph Hellwig (1):
x86/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/mman.h | 24 --------------------
arch/arm64/mm/mmap.c | 25 +++++++++++++++++++++
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/mman.h | 12 ----------
arch/powerpc/mm/book3s64/pgtable.c | 17 +++++++++++++++
arch/sparc/Kconfig | 1 +
arch/sparc/include/asm/mman.h | 6 -----
arch/sparc/mm/init_64.c | 13 +++++++++++
arch/x86/Kconfig | 2 +-
arch/x86/include/asm/pgtable.h | 5 -----
arch/x86/include/uapi/asm/mman.h | 14 ------------
arch/x86/mm/Makefile | 2 +-
arch/x86/mm/pgprot.c | 35 ++++++++++++++++++++++++++++++
include/linux/mman.h | 4 ----
mm/Kconfig | 2 +-
mm/mmap.c | 15 +++----------
17 files changed, 99 insertions(+), 80 deletions(-)
create mode 100644 arch/x86/mm/pgprot.c
--
2.25.1
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH V6 1/7] mm/mmap: Add new config ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 5:58 ` Anshuman Khandual
-1 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel
Add a new config ARCH_HAS_VM_GET_PAGE_PROT, which when subscribed enables a
given platform to define its own vm_get_page_prot() but still utilizing the
generic protection_map[] array.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
mm/Kconfig | 3 +++
mm/mmap.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/mm/Kconfig b/mm/Kconfig
index 034d87953600..b1f7624276f8 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -765,6 +765,9 @@ config ARCH_HAS_CURRENT_STACK_POINTER
config ARCH_HAS_FILTER_PGPROT
bool
+config ARCH_HAS_VM_GET_PAGE_PROT
+ bool
+
config ARCH_HAS_PTE_DEVMAP
bool
diff --git a/mm/mmap.c b/mm/mmap.c
index 3aa839f81e63..87cb2eaf7e1a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -106,6 +106,7 @@ pgprot_t protection_map[16] __ro_after_init = {
__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
};
+#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
{
@@ -122,6 +123,7 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags)
return arch_filter_pgprot(ret);
}
EXPORT_SYMBOL(vm_get_page_prot);
+#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 1/7] mm/mmap: Add new config ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: linux-arch, Anshuman Khandual, catalin.marinas, linux-kernel,
Christoph Hellwig, sparclinux, linuxppc-dev, linux-arm-kernel
Add a new config ARCH_HAS_VM_GET_PAGE_PROT, which when subscribed enables a
given platform to define its own vm_get_page_prot() but still utilizing the
generic protection_map[] array.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
mm/Kconfig | 3 +++
mm/mmap.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/mm/Kconfig b/mm/Kconfig
index 034d87953600..b1f7624276f8 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -765,6 +765,9 @@ config ARCH_HAS_CURRENT_STACK_POINTER
config ARCH_HAS_FILTER_PGPROT
bool
+config ARCH_HAS_VM_GET_PAGE_PROT
+ bool
+
config ARCH_HAS_PTE_DEVMAP
bool
diff --git a/mm/mmap.c b/mm/mmap.c
index 3aa839f81e63..87cb2eaf7e1a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -106,6 +106,7 @@ pgprot_t protection_map[16] __ro_after_init = {
__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
};
+#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
{
@@ -122,6 +123,7 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags)
return arch_filter_pgprot(ret);
}
EXPORT_SYMBOL(vm_get_page_prot);
+#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 1/7] mm/mmap: Add new config ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel
Add a new config ARCH_HAS_VM_GET_PAGE_PROT, which when subscribed enables a
given platform to define its own vm_get_page_prot() but still utilizing the
generic protection_map[] array.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
mm/Kconfig | 3 +++
mm/mmap.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/mm/Kconfig b/mm/Kconfig
index 034d87953600..b1f7624276f8 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -765,6 +765,9 @@ config ARCH_HAS_CURRENT_STACK_POINTER
config ARCH_HAS_FILTER_PGPROT
bool
+config ARCH_HAS_VM_GET_PAGE_PROT
+ bool
+
config ARCH_HAS_PTE_DEVMAP
bool
diff --git a/mm/mmap.c b/mm/mmap.c
index 3aa839f81e63..87cb2eaf7e1a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -106,6 +106,7 @@ pgprot_t protection_map[16] __ro_after_init = {
__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
};
+#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
{
@@ -122,6 +123,7 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags)
return arch_filter_pgprot(ret);
}
EXPORT_SYMBOL(vm_get_page_prot);
+#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
{
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH V6 1/7] mm/mmap: Add new config ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 6:07 ` Christophe Leroy
-1 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:07 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> Add a new config ARCH_HAS_VM_GET_PAGE_PROT, which when subscribed enables a
> given platform to define its own vm_get_page_prot() but still utilizing the
> generic protection_map[] array.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Suggested-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> mm/Kconfig | 3 +++
> mm/mmap.c | 2 ++
> 2 files changed, 5 insertions(+)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 034d87953600..b1f7624276f8 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -765,6 +765,9 @@ config ARCH_HAS_CURRENT_STACK_POINTER
> config ARCH_HAS_FILTER_PGPROT
> bool
>
> +config ARCH_HAS_VM_GET_PAGE_PROT
> + bool
> +
> config ARCH_HAS_PTE_DEVMAP
> bool
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 3aa839f81e63..87cb2eaf7e1a 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -106,6 +106,7 @@ pgprot_t protection_map[16] __ro_after_init = {
> __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
> };
>
> +#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> #ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
> static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
> {
> @@ -122,6 +123,7 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags)
> return arch_filter_pgprot(ret);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> +#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
>
> static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
> {
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 1/7] mm/mmap: Add new config ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 6:07 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:07 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> Add a new config ARCH_HAS_VM_GET_PAGE_PROT, which when subscribed enables a
> given platform to define its own vm_get_page_prot() but still utilizing the
> generic protection_map[] array.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Suggested-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> mm/Kconfig | 3 +++
> mm/mmap.c | 2 ++
> 2 files changed, 5 insertions(+)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 034d87953600..b1f7624276f8 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -765,6 +765,9 @@ config ARCH_HAS_CURRENT_STACK_POINTER
> config ARCH_HAS_FILTER_PGPROT
> bool
>
> +config ARCH_HAS_VM_GET_PAGE_PROT
> + bool
> +
> config ARCH_HAS_PTE_DEVMAP
> bool
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 3aa839f81e63..87cb2eaf7e1a 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -106,6 +106,7 @@ pgprot_t protection_map[16] __ro_after_init = {
> __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
> };
>
> +#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> #ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
> static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
> {
> @@ -122,6 +123,7 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags)
> return arch_filter_pgprot(ret);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> +#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
>
> static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
> {
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 1/7] mm/mmap: Add new config ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 6:07 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:07 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: linux-arch, catalin.marinas, linux-kernel, Christoph Hellwig,
sparclinux, linuxppc-dev, linux-arm-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> Add a new config ARCH_HAS_VM_GET_PAGE_PROT, which when subscribed enables a
> given platform to define its own vm_get_page_prot() but still utilizing the
> generic protection_map[] array.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Suggested-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> mm/Kconfig | 3 +++
> mm/mmap.c | 2 ++
> 2 files changed, 5 insertions(+)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 034d87953600..b1f7624276f8 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -765,6 +765,9 @@ config ARCH_HAS_CURRENT_STACK_POINTER
> config ARCH_HAS_FILTER_PGPROT
> bool
>
> +config ARCH_HAS_VM_GET_PAGE_PROT
> + bool
> +
> config ARCH_HAS_PTE_DEVMAP
> bool
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 3aa839f81e63..87cb2eaf7e1a 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -106,6 +106,7 @@ pgprot_t protection_map[16] __ro_after_init = {
> __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
> };
>
> +#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> #ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
> static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
> {
> @@ -122,6 +123,7 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags)
> return arch_filter_pgprot(ret);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> +#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
>
> static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
> {
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH V6 2/7] powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 5:58 ` Anshuman Khandual
-1 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel, Michael Ellerman, Paul Mackerras
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. While here, this also localizes
arch_vm_get_page_prot() as __vm_get_page_prot() and moves it near
vm_get_page_prot().
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/mman.h | 12 ------------
arch/powerpc/mm/book3s64/pgtable.c | 17 +++++++++++++++++
3 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 174edabb74fa..69e44358a235 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -140,6 +140,7 @@ config PPC
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAS_UACCESS_FLUSHCACHE
select ARCH_HAS_UBSAN_SANITIZE_ALL
+ select ARCH_HAS_VM_GET_PAGE_PROT if PPC_BOOK3S_64
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select ARCH_KEEP_MEMBLOCK
select ARCH_MIGHT_HAVE_PC_PARPORT
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
index 7cb6d18f5cd6..1b024e64c8ec 100644
--- a/arch/powerpc/include/asm/mman.h
+++ b/arch/powerpc/include/asm/mman.h
@@ -24,18 +24,6 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
}
#define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
-static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
-{
-#ifdef CONFIG_PPC_MEM_KEYS
- return (vm_flags & VM_SAO) ?
- __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) :
- __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags));
-#else
- return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
-#endif
-}
-#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-
static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
{
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index 052e6590f84f..8b474ab32f67 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -7,6 +7,7 @@
#include <linux/mm_types.h>
#include <linux/memblock.h>
#include <linux/memremap.h>
+#include <linux/pkeys.h>
#include <linux/debugfs.h>
#include <misc/cxl-base.h>
@@ -549,3 +550,19 @@ 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);
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 2/7] powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: linux-arch, Anshuman Khandual, catalin.marinas, linux-kernel,
Christoph Hellwig, Paul Mackerras, sparclinux, linuxppc-dev,
linux-arm-kernel
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. While here, this also localizes
arch_vm_get_page_prot() as __vm_get_page_prot() and moves it near
vm_get_page_prot().
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/mman.h | 12 ------------
arch/powerpc/mm/book3s64/pgtable.c | 17 +++++++++++++++++
3 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 174edabb74fa..69e44358a235 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -140,6 +140,7 @@ config PPC
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAS_UACCESS_FLUSHCACHE
select ARCH_HAS_UBSAN_SANITIZE_ALL
+ select ARCH_HAS_VM_GET_PAGE_PROT if PPC_BOOK3S_64
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select ARCH_KEEP_MEMBLOCK
select ARCH_MIGHT_HAVE_PC_PARPORT
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
index 7cb6d18f5cd6..1b024e64c8ec 100644
--- a/arch/powerpc/include/asm/mman.h
+++ b/arch/powerpc/include/asm/mman.h
@@ -24,18 +24,6 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
}
#define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
-static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
-{
-#ifdef CONFIG_PPC_MEM_KEYS
- return (vm_flags & VM_SAO) ?
- __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) :
- __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags));
-#else
- return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
-#endif
-}
-#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-
static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
{
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index 052e6590f84f..8b474ab32f67 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -7,6 +7,7 @@
#include <linux/mm_types.h>
#include <linux/memblock.h>
#include <linux/memremap.h>
+#include <linux/pkeys.h>
#include <linux/debugfs.h>
#include <misc/cxl-base.h>
@@ -549,3 +550,19 @@ 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);
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 2/7] powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel, Michael Ellerman, Paul Mackerras
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. While here, this also localizes
arch_vm_get_page_prot() as __vm_get_page_prot() and moves it near
vm_get_page_prot().
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/mman.h | 12 ------------
arch/powerpc/mm/book3s64/pgtable.c | 17 +++++++++++++++++
3 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 174edabb74fa..69e44358a235 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -140,6 +140,7 @@ config PPC
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAS_UACCESS_FLUSHCACHE
select ARCH_HAS_UBSAN_SANITIZE_ALL
+ select ARCH_HAS_VM_GET_PAGE_PROT if PPC_BOOK3S_64
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select ARCH_KEEP_MEMBLOCK
select ARCH_MIGHT_HAVE_PC_PARPORT
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
index 7cb6d18f5cd6..1b024e64c8ec 100644
--- a/arch/powerpc/include/asm/mman.h
+++ b/arch/powerpc/include/asm/mman.h
@@ -24,18 +24,6 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
}
#define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
-static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
-{
-#ifdef CONFIG_PPC_MEM_KEYS
- return (vm_flags & VM_SAO) ?
- __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) :
- __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags));
-#else
- return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
-#endif
-}
-#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-
static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
{
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index 052e6590f84f..8b474ab32f67 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -7,6 +7,7 @@
#include <linux/mm_types.h>
#include <linux/memblock.h>
#include <linux/memremap.h>
+#include <linux/pkeys.h>
#include <linux/debugfs.h>
#include <misc/cxl-base.h>
@@ -549,3 +550,19 @@ 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);
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH V6 2/7] powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 6:07 ` Christophe Leroy
-1 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:07 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel,
Michael Ellerman, Paul Mackerras
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> This defines and exports a platform specific custom vm_get_page_prot() via
> subscribing ARCH_HAS_VM_GET_PAGE_PROT. While here, this also localizes
> arch_vm_get_page_prot() as __vm_get_page_prot() and moves it near
> vm_get_page_prot().
>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/mman.h | 12 ------------
> arch/powerpc/mm/book3s64/pgtable.c | 17 +++++++++++++++++
> 3 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 174edabb74fa..69e44358a235 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -140,6 +140,7 @@ config PPC
> select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> select ARCH_HAS_UACCESS_FLUSHCACHE
> select ARCH_HAS_UBSAN_SANITIZE_ALL
> + select ARCH_HAS_VM_GET_PAGE_PROT if PPC_BOOK3S_64
> select ARCH_HAVE_NMI_SAFE_CMPXCHG
> select ARCH_KEEP_MEMBLOCK
> select ARCH_MIGHT_HAVE_PC_PARPORT
> diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
> index 7cb6d18f5cd6..1b024e64c8ec 100644
> --- a/arch/powerpc/include/asm/mman.h
> +++ b/arch/powerpc/include/asm/mman.h
> @@ -24,18 +24,6 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
> }
> #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
>
> -static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
> -{
> -#ifdef CONFIG_PPC_MEM_KEYS
> - return (vm_flags & VM_SAO) ?
> - __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) :
> - __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags));
> -#else
> - return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
> -#endif
> -}
> -#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
> -
> static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
> {
> if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
> diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
> index 052e6590f84f..8b474ab32f67 100644
> --- a/arch/powerpc/mm/book3s64/pgtable.c
> +++ b/arch/powerpc/mm/book3s64/pgtable.c
> @@ -7,6 +7,7 @@
> #include <linux/mm_types.h>
> #include <linux/memblock.h>
> #include <linux/memremap.h>
> +#include <linux/pkeys.h>
> #include <linux/debugfs.h>
> #include <misc/cxl-base.h>
>
> @@ -549,3 +550,19 @@ 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);
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 2/7] powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 6:07 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:07 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel,
Michael Ellerman, Paul Mackerras
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> This defines and exports a platform specific custom vm_get_page_prot() via
> subscribing ARCH_HAS_VM_GET_PAGE_PROT. While here, this also localizes
> arch_vm_get_page_prot() as __vm_get_page_prot() and moves it near
> vm_get_page_prot().
>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/mman.h | 12 ------------
> arch/powerpc/mm/book3s64/pgtable.c | 17 +++++++++++++++++
> 3 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 174edabb74fa..69e44358a235 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -140,6 +140,7 @@ config PPC
> select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> select ARCH_HAS_UACCESS_FLUSHCACHE
> select ARCH_HAS_UBSAN_SANITIZE_ALL
> + select ARCH_HAS_VM_GET_PAGE_PROT if PPC_BOOK3S_64
> select ARCH_HAVE_NMI_SAFE_CMPXCHG
> select ARCH_KEEP_MEMBLOCK
> select ARCH_MIGHT_HAVE_PC_PARPORT
> diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
> index 7cb6d18f5cd6..1b024e64c8ec 100644
> --- a/arch/powerpc/include/asm/mman.h
> +++ b/arch/powerpc/include/asm/mman.h
> @@ -24,18 +24,6 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
> }
> #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
>
> -static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
> -{
> -#ifdef CONFIG_PPC_MEM_KEYS
> - return (vm_flags & VM_SAO) ?
> - __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) :
> - __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags));
> -#else
> - return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
> -#endif
> -}
> -#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
> -
> static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
> {
> if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
> diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
> index 052e6590f84f..8b474ab32f67 100644
> --- a/arch/powerpc/mm/book3s64/pgtable.c
> +++ b/arch/powerpc/mm/book3s64/pgtable.c
> @@ -7,6 +7,7 @@
> #include <linux/mm_types.h>
> #include <linux/memblock.h>
> #include <linux/memremap.h>
> +#include <linux/pkeys.h>
> #include <linux/debugfs.h>
> #include <misc/cxl-base.h>
>
> @@ -549,3 +550,19 @@ 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);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 2/7] powerpc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 6:07 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:07 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: linux-arch, catalin.marinas, linux-kernel, Christoph Hellwig,
Paul Mackerras, sparclinux, linuxppc-dev, linux-arm-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> This defines and exports a platform specific custom vm_get_page_prot() via
> subscribing ARCH_HAS_VM_GET_PAGE_PROT. While here, this also localizes
> arch_vm_get_page_prot() as __vm_get_page_prot() and moves it near
> vm_get_page_prot().
>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/mman.h | 12 ------------
> arch/powerpc/mm/book3s64/pgtable.c | 17 +++++++++++++++++
> 3 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 174edabb74fa..69e44358a235 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -140,6 +140,7 @@ config PPC
> select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> select ARCH_HAS_UACCESS_FLUSHCACHE
> select ARCH_HAS_UBSAN_SANITIZE_ALL
> + select ARCH_HAS_VM_GET_PAGE_PROT if PPC_BOOK3S_64
> select ARCH_HAVE_NMI_SAFE_CMPXCHG
> select ARCH_KEEP_MEMBLOCK
> select ARCH_MIGHT_HAVE_PC_PARPORT
> diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
> index 7cb6d18f5cd6..1b024e64c8ec 100644
> --- a/arch/powerpc/include/asm/mman.h
> +++ b/arch/powerpc/include/asm/mman.h
> @@ -24,18 +24,6 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
> }
> #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
>
> -static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
> -{
> -#ifdef CONFIG_PPC_MEM_KEYS
> - return (vm_flags & VM_SAO) ?
> - __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) :
> - __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags));
> -#else
> - return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
> -#endif
> -}
> -#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
> -
> static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
> {
> if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
> diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
> index 052e6590f84f..8b474ab32f67 100644
> --- a/arch/powerpc/mm/book3s64/pgtable.c
> +++ b/arch/powerpc/mm/book3s64/pgtable.c
> @@ -7,6 +7,7 @@
> #include <linux/mm_types.h>
> #include <linux/memblock.h>
> #include <linux/memremap.h>
> +#include <linux/pkeys.h>
> #include <linux/debugfs.h>
> #include <misc/cxl-base.h>
>
> @@ -549,3 +550,19 @@ 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);
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH V6 3/7] arm64/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 5:58 ` Anshuman Khandual
-1 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel, Will Deacon
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
and moves it near vm_get_page_prot().
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/mman.h | 24 ------------------------
arch/arm64/mm/mmap.c | 25 +++++++++++++++++++++++++
3 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 57c4c995965f..dd0b15162bb3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -45,6 +45,7 @@ config ARM64
select ARCH_HAS_SYSCALL_WRAPPER
select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
+ select ARCH_HAS_VM_GET_PAGE_PROT
select ARCH_HAS_ZONE_DMA_SET if EXPERT
select ARCH_HAVE_ELF_PROT
select ARCH_HAVE_NMI_SAFE_CMPXCHG
diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h
index e3e28f7daf62..5966ee4a6154 100644
--- a/arch/arm64/include/asm/mman.h
+++ b/arch/arm64/include/asm/mman.h
@@ -35,30 +35,6 @@ static inline unsigned long arch_calc_vm_flag_bits(unsigned long flags)
}
#define arch_calc_vm_flag_bits(flags) arch_calc_vm_flag_bits(flags)
-static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
-{
- pteval_t prot = 0;
-
- if (vm_flags & VM_ARM64_BTI)
- prot |= PTE_GP;
-
- /*
- * There are two conditions required for returning a Normal Tagged
- * memory type: (1) the user requested it via PROT_MTE passed to
- * mmap() or mprotect() and (2) the corresponding vma supports MTE. We
- * register (1) as VM_MTE in the vma->vm_flags and (2) as
- * VM_MTE_ALLOWED. Note that the latter can only be set during the
- * mmap() call since mprotect() does not accept MAP_* flags.
- * Checking for VM_MTE only is sufficient since arch_validate_flags()
- * does not permit (VM_MTE & !VM_MTE_ALLOWED).
- */
- if (vm_flags & VM_MTE)
- prot |= PTE_ATTRINDX(MT_NORMAL_TAGGED);
-
- return __pgprot(prot);
-}
-#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-
static inline bool arch_validate_prot(unsigned long prot,
unsigned long addr __always_unused)
{
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 77ada00280d9..78e9490f748d 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -55,3 +55,28 @@ static int __init adjust_protection_map(void)
return 0;
}
arch_initcall(adjust_protection_map);
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ pteval_t prot = pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]);
+
+ if (vm_flags & VM_ARM64_BTI)
+ prot |= PTE_GP;
+
+ /*
+ * There are two conditions required for returning a Normal Tagged
+ * memory type: (1) the user requested it via PROT_MTE passed to
+ * mmap() or mprotect() and (2) the corresponding vma supports MTE. We
+ * register (1) as VM_MTE in the vma->vm_flags and (2) as
+ * VM_MTE_ALLOWED. Note that the latter can only be set during the
+ * mmap() call since mprotect() does not accept MAP_* flags.
+ * Checking for VM_MTE only is sufficient since arch_validate_flags()
+ * does not permit (VM_MTE & !VM_MTE_ALLOWED).
+ */
+ if (vm_flags & VM_MTE)
+ prot |= PTE_ATTRINDX(MT_NORMAL_TAGGED);
+
+ return __pgprot(prot);
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 3/7] arm64/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: linux-arch, Will Deacon, Anshuman Khandual, catalin.marinas,
linux-kernel, Christoph Hellwig, sparclinux, linuxppc-dev,
linux-arm-kernel
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
and moves it near vm_get_page_prot().
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/mman.h | 24 ------------------------
arch/arm64/mm/mmap.c | 25 +++++++++++++++++++++++++
3 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 57c4c995965f..dd0b15162bb3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -45,6 +45,7 @@ config ARM64
select ARCH_HAS_SYSCALL_WRAPPER
select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
+ select ARCH_HAS_VM_GET_PAGE_PROT
select ARCH_HAS_ZONE_DMA_SET if EXPERT
select ARCH_HAVE_ELF_PROT
select ARCH_HAVE_NMI_SAFE_CMPXCHG
diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h
index e3e28f7daf62..5966ee4a6154 100644
--- a/arch/arm64/include/asm/mman.h
+++ b/arch/arm64/include/asm/mman.h
@@ -35,30 +35,6 @@ static inline unsigned long arch_calc_vm_flag_bits(unsigned long flags)
}
#define arch_calc_vm_flag_bits(flags) arch_calc_vm_flag_bits(flags)
-static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
-{
- pteval_t prot = 0;
-
- if (vm_flags & VM_ARM64_BTI)
- prot |= PTE_GP;
-
- /*
- * There are two conditions required for returning a Normal Tagged
- * memory type: (1) the user requested it via PROT_MTE passed to
- * mmap() or mprotect() and (2) the corresponding vma supports MTE. We
- * register (1) as VM_MTE in the vma->vm_flags and (2) as
- * VM_MTE_ALLOWED. Note that the latter can only be set during the
- * mmap() call since mprotect() does not accept MAP_* flags.
- * Checking for VM_MTE only is sufficient since arch_validate_flags()
- * does not permit (VM_MTE & !VM_MTE_ALLOWED).
- */
- if (vm_flags & VM_MTE)
- prot |= PTE_ATTRINDX(MT_NORMAL_TAGGED);
-
- return __pgprot(prot);
-}
-#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-
static inline bool arch_validate_prot(unsigned long prot,
unsigned long addr __always_unused)
{
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 77ada00280d9..78e9490f748d 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -55,3 +55,28 @@ static int __init adjust_protection_map(void)
return 0;
}
arch_initcall(adjust_protection_map);
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ pteval_t prot = pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]);
+
+ if (vm_flags & VM_ARM64_BTI)
+ prot |= PTE_GP;
+
+ /*
+ * There are two conditions required for returning a Normal Tagged
+ * memory type: (1) the user requested it via PROT_MTE passed to
+ * mmap() or mprotect() and (2) the corresponding vma supports MTE. We
+ * register (1) as VM_MTE in the vma->vm_flags and (2) as
+ * VM_MTE_ALLOWED. Note that the latter can only be set during the
+ * mmap() call since mprotect() does not accept MAP_* flags.
+ * Checking for VM_MTE only is sufficient since arch_validate_flags()
+ * does not permit (VM_MTE & !VM_MTE_ALLOWED).
+ */
+ if (vm_flags & VM_MTE)
+ prot |= PTE_ATTRINDX(MT_NORMAL_TAGGED);
+
+ return __pgprot(prot);
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 3/7] arm64/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel, Will Deacon
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
and moves it near vm_get_page_prot().
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/mman.h | 24 ------------------------
arch/arm64/mm/mmap.c | 25 +++++++++++++++++++++++++
3 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 57c4c995965f..dd0b15162bb3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -45,6 +45,7 @@ config ARM64
select ARCH_HAS_SYSCALL_WRAPPER
select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
+ select ARCH_HAS_VM_GET_PAGE_PROT
select ARCH_HAS_ZONE_DMA_SET if EXPERT
select ARCH_HAVE_ELF_PROT
select ARCH_HAVE_NMI_SAFE_CMPXCHG
diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h
index e3e28f7daf62..5966ee4a6154 100644
--- a/arch/arm64/include/asm/mman.h
+++ b/arch/arm64/include/asm/mman.h
@@ -35,30 +35,6 @@ static inline unsigned long arch_calc_vm_flag_bits(unsigned long flags)
}
#define arch_calc_vm_flag_bits(flags) arch_calc_vm_flag_bits(flags)
-static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
-{
- pteval_t prot = 0;
-
- if (vm_flags & VM_ARM64_BTI)
- prot |= PTE_GP;
-
- /*
- * There are two conditions required for returning a Normal Tagged
- * memory type: (1) the user requested it via PROT_MTE passed to
- * mmap() or mprotect() and (2) the corresponding vma supports MTE. We
- * register (1) as VM_MTE in the vma->vm_flags and (2) as
- * VM_MTE_ALLOWED. Note that the latter can only be set during the
- * mmap() call since mprotect() does not accept MAP_* flags.
- * Checking for VM_MTE only is sufficient since arch_validate_flags()
- * does not permit (VM_MTE & !VM_MTE_ALLOWED).
- */
- if (vm_flags & VM_MTE)
- prot |= PTE_ATTRINDX(MT_NORMAL_TAGGED);
-
- return __pgprot(prot);
-}
-#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-
static inline bool arch_validate_prot(unsigned long prot,
unsigned long addr __always_unused)
{
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 77ada00280d9..78e9490f748d 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -55,3 +55,28 @@ static int __init adjust_protection_map(void)
return 0;
}
arch_initcall(adjust_protection_map);
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ pteval_t prot = pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]);
+
+ if (vm_flags & VM_ARM64_BTI)
+ prot |= PTE_GP;
+
+ /*
+ * There are two conditions required for returning a Normal Tagged
+ * memory type: (1) the user requested it via PROT_MTE passed to
+ * mmap() or mprotect() and (2) the corresponding vma supports MTE. We
+ * register (1) as VM_MTE in the vma->vm_flags and (2) as
+ * VM_MTE_ALLOWED. Note that the latter can only be set during the
+ * mmap() call since mprotect() does not accept MAP_* flags.
+ * Checking for VM_MTE only is sufficient since arch_validate_flags()
+ * does not permit (VM_MTE & !VM_MTE_ALLOWED).
+ */
+ if (vm_flags & VM_MTE)
+ prot |= PTE_ATTRINDX(MT_NORMAL_TAGGED);
+
+ return __pgprot(prot);
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 5:58 ` Anshuman Khandual
-1 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel, David S. Miller, Khalid Aziz
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Khalid Aziz <khalid.aziz@oracle.com>
Cc: sparclinux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/sparc/Kconfig | 1 +
arch/sparc/include/asm/mman.h | 6 ------
arch/sparc/mm/init_64.c | 13 +++++++++++++
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9200bc04701c..85b573643af6 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -84,6 +84,7 @@ config SPARC64
select PERF_USE_VMALLOC
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select HAVE_C_RECORDMCOUNT
+ select ARCH_HAS_VM_GET_PAGE_PROT
select HAVE_ARCH_AUDITSYSCALL
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_SUPPORTS_DEBUG_PAGEALLOC
diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
index 274217e7ed70..af9c10c83dc5 100644
--- a/arch/sparc/include/asm/mman.h
+++ b/arch/sparc/include/asm/mman.h
@@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
}
}
-#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
-static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
-{
- return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
-}
-
#define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
{
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 8b1911591581..dcb17763c1f2 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
}
}
EXPORT_SYMBOL(copy_highpage);
+
+static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
+{
+ return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
+}
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ return __pgprot(pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
+ pgprot_val(sparc_vm_get_page_prot(vm_flags)));
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: linux-arch, Anshuman Khandual, catalin.marinas, linux-kernel,
Christoph Hellwig, Khalid Aziz, sparclinux, linuxppc-dev,
David S. Miller, linux-arm-kernel
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Khalid Aziz <khalid.aziz@oracle.com>
Cc: sparclinux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/sparc/Kconfig | 1 +
arch/sparc/include/asm/mman.h | 6 ------
arch/sparc/mm/init_64.c | 13 +++++++++++++
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9200bc04701c..85b573643af6 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -84,6 +84,7 @@ config SPARC64
select PERF_USE_VMALLOC
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select HAVE_C_RECORDMCOUNT
+ select ARCH_HAS_VM_GET_PAGE_PROT
select HAVE_ARCH_AUDITSYSCALL
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_SUPPORTS_DEBUG_PAGEALLOC
diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
index 274217e7ed70..af9c10c83dc5 100644
--- a/arch/sparc/include/asm/mman.h
+++ b/arch/sparc/include/asm/mman.h
@@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
}
}
-#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
-static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
-{
- return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
-}
-
#define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
{
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 8b1911591581..dcb17763c1f2 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
}
}
EXPORT_SYMBOL(copy_highpage);
+
+static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
+{
+ return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
+}
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ return __pgprot(pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
+ pgprot_val(sparc_vm_get_page_prot(vm_flags)));
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel, David S. Miller, Khalid Aziz
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Khalid Aziz <khalid.aziz@oracle.com>
Cc: sparclinux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/sparc/Kconfig | 1 +
arch/sparc/include/asm/mman.h | 6 ------
arch/sparc/mm/init_64.c | 13 +++++++++++++
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9200bc04701c..85b573643af6 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -84,6 +84,7 @@ config SPARC64
select PERF_USE_VMALLOC
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select HAVE_C_RECORDMCOUNT
+ select ARCH_HAS_VM_GET_PAGE_PROT
select HAVE_ARCH_AUDITSYSCALL
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_SUPPORTS_DEBUG_PAGEALLOC
diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
index 274217e7ed70..af9c10c83dc5 100644
--- a/arch/sparc/include/asm/mman.h
+++ b/arch/sparc/include/asm/mman.h
@@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
}
}
-#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
-static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
-{
- return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
-}
-
#define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
{
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 8b1911591581..dcb17763c1f2 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
}
}
EXPORT_SYMBOL(copy_highpage);
+
+static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
+{
+ return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
+}
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ return __pgprot(pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
+ pgprot_val(sparc_vm_get_page_prot(vm_flags)));
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 6:13 ` Christophe Leroy
-1 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:13 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel,
David S. Miller, Khalid Aziz
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> This defines and exports a platform specific custom vm_get_page_prot() via
> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Khalid Aziz <khalid.aziz@oracle.com>
> Cc: sparclinux@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> arch/sparc/Kconfig | 1 +
> arch/sparc/include/asm/mman.h | 6 ------
> arch/sparc/mm/init_64.c | 13 +++++++++++++
> 3 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 9200bc04701c..85b573643af6 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -84,6 +84,7 @@ config SPARC64
> select PERF_USE_VMALLOC
> select ARCH_HAVE_NMI_SAFE_CMPXCHG
> select HAVE_C_RECORDMCOUNT
> + select ARCH_HAS_VM_GET_PAGE_PROT
> select HAVE_ARCH_AUDITSYSCALL
> select ARCH_SUPPORTS_ATOMIC_RMW
> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
> index 274217e7ed70..af9c10c83dc5 100644
> --- a/arch/sparc/include/asm/mman.h
> +++ b/arch/sparc/include/asm/mman.h
> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
> }
> }
>
> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
> -{
> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
> -}
> -
> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
> {
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 8b1911591581..dcb17763c1f2 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
> }
> }
> EXPORT_SYMBOL(copy_highpage);
> +
> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
> +{
> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
> +}
> +
> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
> +{
> + return __pgprot(pgprot_val(protection_map[vm_flags &
> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
> +}
> +EXPORT_SYMBOL(vm_get_page_prot);
sparc is now the only one with two functions. You can most likely do
like you did for ARM and POWERPC: merge into a single function:
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_SPARC_ADI)
prot |= _PAGE_MCD_4V;
return __pgprot(prot);
}
EXPORT_SYMBOL(vm_get_page_prot);
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 6:13 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:13 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel,
David S. Miller, Khalid Aziz
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> This defines and exports a platform specific custom vm_get_page_prot() via
> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Khalid Aziz <khalid.aziz@oracle.com>
> Cc: sparclinux@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> arch/sparc/Kconfig | 1 +
> arch/sparc/include/asm/mman.h | 6 ------
> arch/sparc/mm/init_64.c | 13 +++++++++++++
> 3 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 9200bc04701c..85b573643af6 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -84,6 +84,7 @@ config SPARC64
> select PERF_USE_VMALLOC
> select ARCH_HAVE_NMI_SAFE_CMPXCHG
> select HAVE_C_RECORDMCOUNT
> + select ARCH_HAS_VM_GET_PAGE_PROT
> select HAVE_ARCH_AUDITSYSCALL
> select ARCH_SUPPORTS_ATOMIC_RMW
> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
> index 274217e7ed70..af9c10c83dc5 100644
> --- a/arch/sparc/include/asm/mman.h
> +++ b/arch/sparc/include/asm/mman.h
> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
> }
> }
>
> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
> -{
> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
> -}
> -
> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
> {
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 8b1911591581..dcb17763c1f2 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
> }
> }
> EXPORT_SYMBOL(copy_highpage);
> +
> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
> +{
> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
> +}
> +
> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
> +{
> + return __pgprot(pgprot_val(protection_map[vm_flags &
> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
> +}
> +EXPORT_SYMBOL(vm_get_page_prot);
sparc is now the only one with two functions. You can most likely do
like you did for ARM and POWERPC: merge into a single function:
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_SPARC_ADI)
prot |= _PAGE_MCD_4V;
return __pgprot(prot);
}
EXPORT_SYMBOL(vm_get_page_prot);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 6:13 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:13 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: linux-arch, catalin.marinas, linux-kernel, Christoph Hellwig,
Khalid Aziz, sparclinux, linuxppc-dev, David S. Miller,
linux-arm-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> This defines and exports a platform specific custom vm_get_page_prot() via
> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Khalid Aziz <khalid.aziz@oracle.com>
> Cc: sparclinux@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> arch/sparc/Kconfig | 1 +
> arch/sparc/include/asm/mman.h | 6 ------
> arch/sparc/mm/init_64.c | 13 +++++++++++++
> 3 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 9200bc04701c..85b573643af6 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -84,6 +84,7 @@ config SPARC64
> select PERF_USE_VMALLOC
> select ARCH_HAVE_NMI_SAFE_CMPXCHG
> select HAVE_C_RECORDMCOUNT
> + select ARCH_HAS_VM_GET_PAGE_PROT
> select HAVE_ARCH_AUDITSYSCALL
> select ARCH_SUPPORTS_ATOMIC_RMW
> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
> index 274217e7ed70..af9c10c83dc5 100644
> --- a/arch/sparc/include/asm/mman.h
> +++ b/arch/sparc/include/asm/mman.h
> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
> }
> }
>
> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
> -{
> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
> -}
> -
> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
> {
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 8b1911591581..dcb17763c1f2 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
> }
> }
> EXPORT_SYMBOL(copy_highpage);
> +
> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
> +{
> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
> +}
> +
> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
> +{
> + return __pgprot(pgprot_val(protection_map[vm_flags &
> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
> +}
> +EXPORT_SYMBOL(vm_get_page_prot);
sparc is now the only one with two functions. You can most likely do
like you did for ARM and POWERPC: merge into a single function:
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_SPARC_ADI)
prot |= _PAGE_MCD_4V;
return __pgprot(prot);
}
EXPORT_SYMBOL(vm_get_page_prot);
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 6:13 ` Christophe Leroy
(?)
@ 2022-04-13 6:22 ` Anshuman Khandual
-1 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 6:22 UTC (permalink / raw)
To: Christophe Leroy, linux-mm, akpm, khalid.aziz
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel,
David S. Miller, Khalid Aziz
On 4/13/22 11:43, Christophe Leroy wrote:
>
>
> Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
>> This defines and exports a platform specific custom vm_get_page_prot() via
>> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
>> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Khalid Aziz <khalid.aziz@oracle.com>
>> Cc: sparclinux@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> arch/sparc/Kconfig | 1 +
>> arch/sparc/include/asm/mman.h | 6 ------
>> arch/sparc/mm/init_64.c | 13 +++++++++++++
>> 3 files changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>> index 9200bc04701c..85b573643af6 100644
>> --- a/arch/sparc/Kconfig
>> +++ b/arch/sparc/Kconfig
>> @@ -84,6 +84,7 @@ config SPARC64
>> select PERF_USE_VMALLOC
>> select ARCH_HAVE_NMI_SAFE_CMPXCHG
>> select HAVE_C_RECORDMCOUNT
>> + select ARCH_HAS_VM_GET_PAGE_PROT
>> select HAVE_ARCH_AUDITSYSCALL
>> select ARCH_SUPPORTS_ATOMIC_RMW
>> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
>> index 274217e7ed70..af9c10c83dc5 100644
>> --- a/arch/sparc/include/asm/mman.h
>> +++ b/arch/sparc/include/asm/mman.h
>> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
>> }
>> }
>>
>> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
>> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>> -{
>> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>> -}
>> -
>> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
>> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
>> {
>> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
>> index 8b1911591581..dcb17763c1f2 100644
>> --- a/arch/sparc/mm/init_64.c
>> +++ b/arch/sparc/mm/init_64.c
>> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
>> }
>> }
>> EXPORT_SYMBOL(copy_highpage);
>> +
>> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>> +{
>> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>> +}
>> +
>> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
>> +{
>> + return __pgprot(pgprot_val(protection_map[vm_flags &
>> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
>> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
>> +}
>> +EXPORT_SYMBOL(vm_get_page_prot);
>
>
> sparc is now the only one with two functions. You can most likely do
> like you did for ARM and POWERPC: merge into a single function:
I was almost about to do this one as well but as this patch has already been
reviewed with a tag, just skipped it. I will respin the series once more :)
Khalid,
Could I keep your review tag after the following change ?
>
> 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_SPARC_ADI)
> prot |= _PAGE_MCD_4V;
>
> return __pgprot(prot);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
- Anshuman
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 6:22 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 6:22 UTC (permalink / raw)
To: Christophe Leroy, linux-mm, akpm, khalid.aziz
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel,
David S. Miller, Khalid Aziz
On 4/13/22 11:43, Christophe Leroy wrote:
>
>
> Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
>> This defines and exports a platform specific custom vm_get_page_prot() via
>> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
>> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Khalid Aziz <khalid.aziz@oracle.com>
>> Cc: sparclinux@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> arch/sparc/Kconfig | 1 +
>> arch/sparc/include/asm/mman.h | 6 ------
>> arch/sparc/mm/init_64.c | 13 +++++++++++++
>> 3 files changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>> index 9200bc04701c..85b573643af6 100644
>> --- a/arch/sparc/Kconfig
>> +++ b/arch/sparc/Kconfig
>> @@ -84,6 +84,7 @@ config SPARC64
>> select PERF_USE_VMALLOC
>> select ARCH_HAVE_NMI_SAFE_CMPXCHG
>> select HAVE_C_RECORDMCOUNT
>> + select ARCH_HAS_VM_GET_PAGE_PROT
>> select HAVE_ARCH_AUDITSYSCALL
>> select ARCH_SUPPORTS_ATOMIC_RMW
>> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
>> index 274217e7ed70..af9c10c83dc5 100644
>> --- a/arch/sparc/include/asm/mman.h
>> +++ b/arch/sparc/include/asm/mman.h
>> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
>> }
>> }
>>
>> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
>> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>> -{
>> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>> -}
>> -
>> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
>> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
>> {
>> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
>> index 8b1911591581..dcb17763c1f2 100644
>> --- a/arch/sparc/mm/init_64.c
>> +++ b/arch/sparc/mm/init_64.c
>> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
>> }
>> }
>> EXPORT_SYMBOL(copy_highpage);
>> +
>> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>> +{
>> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>> +}
>> +
>> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
>> +{
>> + return __pgprot(pgprot_val(protection_map[vm_flags &
>> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
>> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
>> +}
>> +EXPORT_SYMBOL(vm_get_page_prot);
>
>
> sparc is now the only one with two functions. You can most likely do
> like you did for ARM and POWERPC: merge into a single function:
I was almost about to do this one as well but as this patch has already been
reviewed with a tag, just skipped it. I will respin the series once more :)
Khalid,
Could I keep your review tag after the following change ?
>
> 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_SPARC_ADI)
> prot |= _PAGE_MCD_4V;
>
> return __pgprot(prot);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
- Anshuman
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 6:22 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 6:22 UTC (permalink / raw)
To: Christophe Leroy, linux-mm, akpm, khalid.aziz
Cc: linux-arch, catalin.marinas, linux-kernel, Christoph Hellwig,
Khalid Aziz, sparclinux, linuxppc-dev, David S. Miller,
linux-arm-kernel
On 4/13/22 11:43, Christophe Leroy wrote:
>
>
> Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
>> This defines and exports a platform specific custom vm_get_page_prot() via
>> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
>> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Khalid Aziz <khalid.aziz@oracle.com>
>> Cc: sparclinux@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> arch/sparc/Kconfig | 1 +
>> arch/sparc/include/asm/mman.h | 6 ------
>> arch/sparc/mm/init_64.c | 13 +++++++++++++
>> 3 files changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>> index 9200bc04701c..85b573643af6 100644
>> --- a/arch/sparc/Kconfig
>> +++ b/arch/sparc/Kconfig
>> @@ -84,6 +84,7 @@ config SPARC64
>> select PERF_USE_VMALLOC
>> select ARCH_HAVE_NMI_SAFE_CMPXCHG
>> select HAVE_C_RECORDMCOUNT
>> + select ARCH_HAS_VM_GET_PAGE_PROT
>> select HAVE_ARCH_AUDITSYSCALL
>> select ARCH_SUPPORTS_ATOMIC_RMW
>> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
>> index 274217e7ed70..af9c10c83dc5 100644
>> --- a/arch/sparc/include/asm/mman.h
>> +++ b/arch/sparc/include/asm/mman.h
>> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
>> }
>> }
>>
>> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
>> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>> -{
>> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>> -}
>> -
>> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
>> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
>> {
>> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
>> index 8b1911591581..dcb17763c1f2 100644
>> --- a/arch/sparc/mm/init_64.c
>> +++ b/arch/sparc/mm/init_64.c
>> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
>> }
>> }
>> EXPORT_SYMBOL(copy_highpage);
>> +
>> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>> +{
>> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>> +}
>> +
>> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
>> +{
>> + return __pgprot(pgprot_val(protection_map[vm_flags &
>> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
>> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
>> +}
>> +EXPORT_SYMBOL(vm_get_page_prot);
>
>
> sparc is now the only one with two functions. You can most likely do
> like you did for ARM and POWERPC: merge into a single function:
I was almost about to do this one as well but as this patch has already been
reviewed with a tag, just skipped it. I will respin the series once more :)
Khalid,
Could I keep your review tag after the following change ?
>
> 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_SPARC_ADI)
> prot |= _PAGE_MCD_4V;
>
> return __pgprot(prot);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
- Anshuman
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 6:22 ` Anshuman Khandual
(?)
@ 2022-04-13 14:15 ` Khalid Aziz
-1 siblings, 0 replies; 45+ messages in thread
From: Khalid Aziz @ 2022-04-13 14:15 UTC (permalink / raw)
To: Anshuman Khandual, Christophe Leroy, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel,
David S. Miller
On 4/13/22 00:22, Anshuman Khandual wrote:
>
>
> On 4/13/22 11:43, Christophe Leroy wrote:
>>
>>
>> Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
>>> This defines and exports a platform specific custom vm_get_page_prot() via
>>> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
>>> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>>>
>>> Cc: "David S. Miller" <davem@davemloft.net>
>>> Cc: Khalid Aziz <khalid.aziz@oracle.com>
>>> Cc: sparclinux@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>> ---
>>> arch/sparc/Kconfig | 1 +
>>> arch/sparc/include/asm/mman.h | 6 ------
>>> arch/sparc/mm/init_64.c | 13 +++++++++++++
>>> 3 files changed, 14 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>>> index 9200bc04701c..85b573643af6 100644
>>> --- a/arch/sparc/Kconfig
>>> +++ b/arch/sparc/Kconfig
>>> @@ -84,6 +84,7 @@ config SPARC64
>>> select PERF_USE_VMALLOC
>>> select ARCH_HAVE_NMI_SAFE_CMPXCHG
>>> select HAVE_C_RECORDMCOUNT
>>> + select ARCH_HAS_VM_GET_PAGE_PROT
>>> select HAVE_ARCH_AUDITSYSCALL
>>> select ARCH_SUPPORTS_ATOMIC_RMW
>>> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>>> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
>>> index 274217e7ed70..af9c10c83dc5 100644
>>> --- a/arch/sparc/include/asm/mman.h
>>> +++ b/arch/sparc/include/asm/mman.h
>>> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
>>> }
>>> }
>>>
>>> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
>>> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>>> -{
>>> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>>> -}
>>> -
>>> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
>>> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
>>> {
>>> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
>>> index 8b1911591581..dcb17763c1f2 100644
>>> --- a/arch/sparc/mm/init_64.c
>>> +++ b/arch/sparc/mm/init_64.c
>>> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
>>> }
>>> }
>>> EXPORT_SYMBOL(copy_highpage);
>>> +
>>> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>>> +{
>>> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>>> +}
>>> +
>>> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
>>> +{
>>> + return __pgprot(pgprot_val(protection_map[vm_flags &
>>> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
>>> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
>>> +}
>>> +EXPORT_SYMBOL(vm_get_page_prot);
>>
>>
>> sparc is now the only one with two functions. You can most likely do
>> like you did for ARM and POWERPC: merge into a single function:
>
> I was almost about to do this one as well but as this patch has already been
> reviewed with a tag, just skipped it. I will respin the series once more :)
>
> Khalid,
>
> Could I keep your review tag after the following change ?
Hi Anshuman,
Yes, this change makes sense.
--
Khalid
>
>>
>> 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_SPARC_ADI)
>> prot |= _PAGE_MCD_4V;
>>
>> return __pgprot(prot);
>> }
>> EXPORT_SYMBOL(vm_get_page_prot);
>
> - Anshuman
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 14:15 ` Khalid Aziz
0 siblings, 0 replies; 45+ messages in thread
From: Khalid Aziz @ 2022-04-13 14:15 UTC (permalink / raw)
To: Anshuman Khandual, Christophe Leroy, linux-mm, akpm
Cc: linux-arch, catalin.marinas, linux-kernel, Christoph Hellwig,
sparclinux, linuxppc-dev, David S. Miller, linux-arm-kernel
On 4/13/22 00:22, Anshuman Khandual wrote:
>
>
> On 4/13/22 11:43, Christophe Leroy wrote:
>>
>>
>> Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
>>> This defines and exports a platform specific custom vm_get_page_prot() via
>>> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
>>> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>>>
>>> Cc: "David S. Miller" <davem@davemloft.net>
>>> Cc: Khalid Aziz <khalid.aziz@oracle.com>
>>> Cc: sparclinux@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>> ---
>>> arch/sparc/Kconfig | 1 +
>>> arch/sparc/include/asm/mman.h | 6 ------
>>> arch/sparc/mm/init_64.c | 13 +++++++++++++
>>> 3 files changed, 14 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>>> index 9200bc04701c..85b573643af6 100644
>>> --- a/arch/sparc/Kconfig
>>> +++ b/arch/sparc/Kconfig
>>> @@ -84,6 +84,7 @@ config SPARC64
>>> select PERF_USE_VMALLOC
>>> select ARCH_HAVE_NMI_SAFE_CMPXCHG
>>> select HAVE_C_RECORDMCOUNT
>>> + select ARCH_HAS_VM_GET_PAGE_PROT
>>> select HAVE_ARCH_AUDITSYSCALL
>>> select ARCH_SUPPORTS_ATOMIC_RMW
>>> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>>> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
>>> index 274217e7ed70..af9c10c83dc5 100644
>>> --- a/arch/sparc/include/asm/mman.h
>>> +++ b/arch/sparc/include/asm/mman.h
>>> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
>>> }
>>> }
>>>
>>> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
>>> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>>> -{
>>> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>>> -}
>>> -
>>> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
>>> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
>>> {
>>> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
>>> index 8b1911591581..dcb17763c1f2 100644
>>> --- a/arch/sparc/mm/init_64.c
>>> +++ b/arch/sparc/mm/init_64.c
>>> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
>>> }
>>> }
>>> EXPORT_SYMBOL(copy_highpage);
>>> +
>>> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>>> +{
>>> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>>> +}
>>> +
>>> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
>>> +{
>>> + return __pgprot(pgprot_val(protection_map[vm_flags &
>>> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
>>> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
>>> +}
>>> +EXPORT_SYMBOL(vm_get_page_prot);
>>
>>
>> sparc is now the only one with two functions. You can most likely do
>> like you did for ARM and POWERPC: merge into a single function:
>
> I was almost about to do this one as well but as this patch has already been
> reviewed with a tag, just skipped it. I will respin the series once more :)
>
> Khalid,
>
> Could I keep your review tag after the following change ?
Hi Anshuman,
Yes, this change makes sense.
--
Khalid
>
>>
>> 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_SPARC_ADI)
>> prot |= _PAGE_MCD_4V;
>>
>> return __pgprot(prot);
>> }
>> EXPORT_SYMBOL(vm_get_page_prot);
>
> - Anshuman
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 4/7] sparc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 14:15 ` Khalid Aziz
0 siblings, 0 replies; 45+ messages in thread
From: Khalid Aziz @ 2022-04-13 14:15 UTC (permalink / raw)
To: Anshuman Khandual, Christophe Leroy, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel,
David S. Miller
On 4/13/22 00:22, Anshuman Khandual wrote:
>
>
> On 4/13/22 11:43, Christophe Leroy wrote:
>>
>>
>> Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
>>> This defines and exports a platform specific custom vm_get_page_prot() via
>>> subscribing ARCH_HAS_VM_GET_PAGE_PROT. It localizes arch_vm_get_page_prot()
>>> as sparc_vm_get_page_prot() and moves near vm_get_page_prot().
>>>
>>> Cc: "David S. Miller" <davem@davemloft.net>
>>> Cc: Khalid Aziz <khalid.aziz@oracle.com>
>>> Cc: sparclinux@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>> ---
>>> arch/sparc/Kconfig | 1 +
>>> arch/sparc/include/asm/mman.h | 6 ------
>>> arch/sparc/mm/init_64.c | 13 +++++++++++++
>>> 3 files changed, 14 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>>> index 9200bc04701c..85b573643af6 100644
>>> --- a/arch/sparc/Kconfig
>>> +++ b/arch/sparc/Kconfig
>>> @@ -84,6 +84,7 @@ config SPARC64
>>> select PERF_USE_VMALLOC
>>> select ARCH_HAVE_NMI_SAFE_CMPXCHG
>>> select HAVE_C_RECORDMCOUNT
>>> + select ARCH_HAS_VM_GET_PAGE_PROT
>>> select HAVE_ARCH_AUDITSYSCALL
>>> select ARCH_SUPPORTS_ATOMIC_RMW
>>> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>>> diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h
>>> index 274217e7ed70..af9c10c83dc5 100644
>>> --- a/arch/sparc/include/asm/mman.h
>>> +++ b/arch/sparc/include/asm/mman.h
>>> @@ -46,12 +46,6 @@ static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot)
>>> }
>>> }
>>>
>>> -#define arch_vm_get_page_prot(vm_flags) sparc_vm_get_page_prot(vm_flags)
>>> -static inline pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>>> -{
>>> - return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>>> -}
>>> -
>>> #define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
>>> static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
>>> {
>>> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
>>> index 8b1911591581..dcb17763c1f2 100644
>>> --- a/arch/sparc/mm/init_64.c
>>> +++ b/arch/sparc/mm/init_64.c
>>> @@ -3184,3 +3184,16 @@ void copy_highpage(struct page *to, struct page *from)
>>> }
>>> }
>>> EXPORT_SYMBOL(copy_highpage);
>>> +
>>> +static pgprot_t sparc_vm_get_page_prot(unsigned long vm_flags)
>>> +{
>>> + return (vm_flags & VM_SPARC_ADI) ? __pgprot(_PAGE_MCD_4V) : __pgprot(0);
>>> +}
>>> +
>>> +pgprot_t vm_get_page_prot(unsigned long vm_flags)
>>> +{
>>> + return __pgprot(pgprot_val(protection_map[vm_flags &
>>> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
>>> + pgprot_val(sparc_vm_get_page_prot(vm_flags)));
>>> +}
>>> +EXPORT_SYMBOL(vm_get_page_prot);
>>
>>
>> sparc is now the only one with two functions. You can most likely do
>> like you did for ARM and POWERPC: merge into a single function:
>
> I was almost about to do this one as well but as this patch has already been
> reviewed with a tag, just skipped it. I will respin the series once more :)
>
> Khalid,
>
> Could I keep your review tag after the following change ?
Hi Anshuman,
Yes, this change makes sense.
--
Khalid
>
>>
>> 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_SPARC_ADI)
>> prot |= _PAGE_MCD_4V;
>>
>> return __pgprot(prot);
>> }
>> EXPORT_SYMBOL(vm_get_page_prot);
>
> - Anshuman
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH V6 5/7] x86/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 5:58 ` Anshuman Khandual
-1 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel, Thomas Gleixner, Ingo Molnar
From: Christoph Hellwig <hch@infradead.org>
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. This also unsubscribes from config
ARCH_HAS_FILTER_PGPROT, after dropping off arch_filter_pgprot() and
arch_vm_get_page_prot().
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/x86/Kconfig | 2 +-
arch/x86/include/asm/pgtable.h | 5 -----
arch/x86/include/uapi/asm/mman.h | 14 -------------
arch/x86/mm/Makefile | 2 +-
arch/x86/mm/pgprot.c | 35 ++++++++++++++++++++++++++++++++
5 files changed, 37 insertions(+), 21 deletions(-)
create mode 100644 arch/x86/mm/pgprot.c
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b0142e01002e..c355c420150e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -76,7 +76,6 @@ config X86
select ARCH_HAS_EARLY_DEBUG if KGDB
select ARCH_HAS_ELF_RANDOMIZE
select ARCH_HAS_FAST_MULTIPLIER
- select ARCH_HAS_FILTER_PGPROT
select ARCH_HAS_FORTIFY_SOURCE
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_HAS_KCOV if X86_64
@@ -95,6 +94,7 @@ config X86
select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
select ARCH_HAS_SYSCALL_WRAPPER
select ARCH_HAS_UBSAN_SANITIZE_ALL
+ select ARCH_HAS_VM_GET_PAGE_PROT
select ARCH_HAS_DEBUG_WX
select ARCH_HAS_ZONE_DMA_SET if EXPERT
select ARCH_HAVE_NMI_SAFE_CMPXCHG
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 62ab07e24aef..3563f4645fa1 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -649,11 +649,6 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
#define canon_pgprot(p) __pgprot(massage_pgprot(p))
-static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
-{
- return canon_pgprot(prot);
-}
-
static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
enum page_cache_mode pcm,
enum page_cache_mode new_pcm)
diff --git a/arch/x86/include/uapi/asm/mman.h b/arch/x86/include/uapi/asm/mman.h
index d4a8d0424bfb..775dbd3aff73 100644
--- a/arch/x86/include/uapi/asm/mman.h
+++ b/arch/x86/include/uapi/asm/mman.h
@@ -5,20 +5,6 @@
#define MAP_32BIT 0x40 /* only give out 32bit addresses */
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
-/*
- * Take the 4 protection key bits out of the vma->vm_flags
- * value and turn them in to the bits that we can put in
- * to a pte.
- *
- * Only override these if Protection Keys are available
- * (which is only on 64-bit).
- */
-#define arch_vm_get_page_prot(vm_flags) __pgprot( \
- ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) | \
- ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \
- ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \
- ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0))
-
#define arch_calc_vm_prot_bits(prot, key) ( \
((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \
((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index fe3d3061fc11..fb6b41a48ae5 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -20,7 +20,7 @@ CFLAGS_REMOVE_mem_encrypt_identity.o = -pg
endif
obj-y := init.o init_$(BITS).o fault.o ioremap.o extable.o mmap.o \
- pgtable.o physaddr.o setup_nx.o tlb.o cpu_entry_area.o maccess.o
+ pgtable.o physaddr.o setup_nx.o tlb.o cpu_entry_area.o maccess.o pgprot.o
obj-y += pat/
diff --git a/arch/x86/mm/pgprot.c b/arch/x86/mm/pgprot.c
new file mode 100644
index 000000000000..763742782286
--- /dev/null
+++ b/arch/x86/mm/pgprot.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <asm/pgtable.h>
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ unsigned long val = pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]);
+
+#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
+ /*
+ * Take the 4 protection key bits out of the vma->vm_flags value and
+ * turn them in to the bits that we can put in to a pte.
+ *
+ * Only override these if Protection Keys are available (which is only
+ * on 64-bit).
+ */
+ if (vm_flags & VM_PKEY_BIT0)
+ val |= _PAGE_PKEY_BIT0;
+ if (vm_flags & VM_PKEY_BIT1)
+ val |= _PAGE_PKEY_BIT1;
+ if (vm_flags & VM_PKEY_BIT2)
+ val |= _PAGE_PKEY_BIT2;
+ if (vm_flags & VM_PKEY_BIT3)
+ val |= _PAGE_PKEY_BIT3;
+#endif
+
+ val = __sme_set(val);
+ if (val & _PAGE_PRESENT)
+ val &= __supported_pte_mask;
+ return __pgprot(val);
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 5/7] x86/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: linux-arch, Anshuman Khandual, catalin.marinas, linux-kernel,
Christoph Hellwig, Ingo Molnar, sparclinux, Thomas Gleixner,
linuxppc-dev, linux-arm-kernel
From: Christoph Hellwig <hch@infradead.org>
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. This also unsubscribes from config
ARCH_HAS_FILTER_PGPROT, after dropping off arch_filter_pgprot() and
arch_vm_get_page_prot().
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/x86/Kconfig | 2 +-
arch/x86/include/asm/pgtable.h | 5 -----
arch/x86/include/uapi/asm/mman.h | 14 -------------
arch/x86/mm/Makefile | 2 +-
arch/x86/mm/pgprot.c | 35 ++++++++++++++++++++++++++++++++
5 files changed, 37 insertions(+), 21 deletions(-)
create mode 100644 arch/x86/mm/pgprot.c
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b0142e01002e..c355c420150e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -76,7 +76,6 @@ config X86
select ARCH_HAS_EARLY_DEBUG if KGDB
select ARCH_HAS_ELF_RANDOMIZE
select ARCH_HAS_FAST_MULTIPLIER
- select ARCH_HAS_FILTER_PGPROT
select ARCH_HAS_FORTIFY_SOURCE
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_HAS_KCOV if X86_64
@@ -95,6 +94,7 @@ config X86
select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
select ARCH_HAS_SYSCALL_WRAPPER
select ARCH_HAS_UBSAN_SANITIZE_ALL
+ select ARCH_HAS_VM_GET_PAGE_PROT
select ARCH_HAS_DEBUG_WX
select ARCH_HAS_ZONE_DMA_SET if EXPERT
select ARCH_HAVE_NMI_SAFE_CMPXCHG
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 62ab07e24aef..3563f4645fa1 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -649,11 +649,6 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
#define canon_pgprot(p) __pgprot(massage_pgprot(p))
-static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
-{
- return canon_pgprot(prot);
-}
-
static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
enum page_cache_mode pcm,
enum page_cache_mode new_pcm)
diff --git a/arch/x86/include/uapi/asm/mman.h b/arch/x86/include/uapi/asm/mman.h
index d4a8d0424bfb..775dbd3aff73 100644
--- a/arch/x86/include/uapi/asm/mman.h
+++ b/arch/x86/include/uapi/asm/mman.h
@@ -5,20 +5,6 @@
#define MAP_32BIT 0x40 /* only give out 32bit addresses */
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
-/*
- * Take the 4 protection key bits out of the vma->vm_flags
- * value and turn them in to the bits that we can put in
- * to a pte.
- *
- * Only override these if Protection Keys are available
- * (which is only on 64-bit).
- */
-#define arch_vm_get_page_prot(vm_flags) __pgprot( \
- ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) | \
- ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \
- ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \
- ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0))
-
#define arch_calc_vm_prot_bits(prot, key) ( \
((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \
((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index fe3d3061fc11..fb6b41a48ae5 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -20,7 +20,7 @@ CFLAGS_REMOVE_mem_encrypt_identity.o = -pg
endif
obj-y := init.o init_$(BITS).o fault.o ioremap.o extable.o mmap.o \
- pgtable.o physaddr.o setup_nx.o tlb.o cpu_entry_area.o maccess.o
+ pgtable.o physaddr.o setup_nx.o tlb.o cpu_entry_area.o maccess.o pgprot.o
obj-y += pat/
diff --git a/arch/x86/mm/pgprot.c b/arch/x86/mm/pgprot.c
new file mode 100644
index 000000000000..763742782286
--- /dev/null
+++ b/arch/x86/mm/pgprot.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <asm/pgtable.h>
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ unsigned long val = pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]);
+
+#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
+ /*
+ * Take the 4 protection key bits out of the vma->vm_flags value and
+ * turn them in to the bits that we can put in to a pte.
+ *
+ * Only override these if Protection Keys are available (which is only
+ * on 64-bit).
+ */
+ if (vm_flags & VM_PKEY_BIT0)
+ val |= _PAGE_PKEY_BIT0;
+ if (vm_flags & VM_PKEY_BIT1)
+ val |= _PAGE_PKEY_BIT1;
+ if (vm_flags & VM_PKEY_BIT2)
+ val |= _PAGE_PKEY_BIT2;
+ if (vm_flags & VM_PKEY_BIT3)
+ val |= _PAGE_PKEY_BIT3;
+#endif
+
+ val = __sme_set(val);
+ if (val & _PAGE_PRESENT)
+ val &= __supported_pte_mask;
+ return __pgprot(val);
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 5/7] x86/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel, Thomas Gleixner, Ingo Molnar
From: Christoph Hellwig <hch@infradead.org>
This defines and exports a platform specific custom vm_get_page_prot() via
subscribing ARCH_HAS_VM_GET_PAGE_PROT. This also unsubscribes from config
ARCH_HAS_FILTER_PGPROT, after dropping off arch_filter_pgprot() and
arch_vm_get_page_prot().
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/x86/Kconfig | 2 +-
arch/x86/include/asm/pgtable.h | 5 -----
arch/x86/include/uapi/asm/mman.h | 14 -------------
arch/x86/mm/Makefile | 2 +-
arch/x86/mm/pgprot.c | 35 ++++++++++++++++++++++++++++++++
5 files changed, 37 insertions(+), 21 deletions(-)
create mode 100644 arch/x86/mm/pgprot.c
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b0142e01002e..c355c420150e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -76,7 +76,6 @@ config X86
select ARCH_HAS_EARLY_DEBUG if KGDB
select ARCH_HAS_ELF_RANDOMIZE
select ARCH_HAS_FAST_MULTIPLIER
- select ARCH_HAS_FILTER_PGPROT
select ARCH_HAS_FORTIFY_SOURCE
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_HAS_KCOV if X86_64
@@ -95,6 +94,7 @@ config X86
select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
select ARCH_HAS_SYSCALL_WRAPPER
select ARCH_HAS_UBSAN_SANITIZE_ALL
+ select ARCH_HAS_VM_GET_PAGE_PROT
select ARCH_HAS_DEBUG_WX
select ARCH_HAS_ZONE_DMA_SET if EXPERT
select ARCH_HAVE_NMI_SAFE_CMPXCHG
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 62ab07e24aef..3563f4645fa1 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -649,11 +649,6 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
#define canon_pgprot(p) __pgprot(massage_pgprot(p))
-static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
-{
- return canon_pgprot(prot);
-}
-
static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
enum page_cache_mode pcm,
enum page_cache_mode new_pcm)
diff --git a/arch/x86/include/uapi/asm/mman.h b/arch/x86/include/uapi/asm/mman.h
index d4a8d0424bfb..775dbd3aff73 100644
--- a/arch/x86/include/uapi/asm/mman.h
+++ b/arch/x86/include/uapi/asm/mman.h
@@ -5,20 +5,6 @@
#define MAP_32BIT 0x40 /* only give out 32bit addresses */
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
-/*
- * Take the 4 protection key bits out of the vma->vm_flags
- * value and turn them in to the bits that we can put in
- * to a pte.
- *
- * Only override these if Protection Keys are available
- * (which is only on 64-bit).
- */
-#define arch_vm_get_page_prot(vm_flags) __pgprot( \
- ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) | \
- ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \
- ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \
- ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0))
-
#define arch_calc_vm_prot_bits(prot, key) ( \
((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \
((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index fe3d3061fc11..fb6b41a48ae5 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -20,7 +20,7 @@ CFLAGS_REMOVE_mem_encrypt_identity.o = -pg
endif
obj-y := init.o init_$(BITS).o fault.o ioremap.o extable.o mmap.o \
- pgtable.o physaddr.o setup_nx.o tlb.o cpu_entry_area.o maccess.o
+ pgtable.o physaddr.o setup_nx.o tlb.o cpu_entry_area.o maccess.o pgprot.o
obj-y += pat/
diff --git a/arch/x86/mm/pgprot.c b/arch/x86/mm/pgprot.c
new file mode 100644
index 000000000000..763742782286
--- /dev/null
+++ b/arch/x86/mm/pgprot.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <asm/pgtable.h>
+
+pgprot_t vm_get_page_prot(unsigned long vm_flags)
+{
+ unsigned long val = pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]);
+
+#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
+ /*
+ * Take the 4 protection key bits out of the vma->vm_flags value and
+ * turn them in to the bits that we can put in to a pte.
+ *
+ * Only override these if Protection Keys are available (which is only
+ * on 64-bit).
+ */
+ if (vm_flags & VM_PKEY_BIT0)
+ val |= _PAGE_PKEY_BIT0;
+ if (vm_flags & VM_PKEY_BIT1)
+ val |= _PAGE_PKEY_BIT1;
+ if (vm_flags & VM_PKEY_BIT2)
+ val |= _PAGE_PKEY_BIT2;
+ if (vm_flags & VM_PKEY_BIT3)
+ val |= _PAGE_PKEY_BIT3;
+#endif
+
+ val = __sme_set(val);
+ if (val & _PAGE_PRESENT)
+ val &= __supported_pte_mask;
+ return __pgprot(val);
+}
+EXPORT_SYMBOL(vm_get_page_prot);
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 6/7] mm/mmap: Drop arch_filter_pgprot()
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 5:58 ` Anshuman Khandual
-1 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel
There are no platforms left which subscribe ARCH_HAS_FILTER_PGPROT. Hence
drop generic arch_filter_pgprot() and also config ARCH_HAS_FILTER_PGPROT.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
mm/Kconfig | 3 ---
mm/mmap.c | 13 ++-----------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/mm/Kconfig b/mm/Kconfig
index b1f7624276f8..3f7b6d7b69df 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -762,9 +762,6 @@ config ARCH_HAS_CURRENT_STACK_POINTER
register alias named "current_stack_pointer", this config can be
selected.
-config ARCH_HAS_FILTER_PGPROT
- bool
-
config ARCH_HAS_VM_GET_PAGE_PROT
bool
diff --git a/mm/mmap.c b/mm/mmap.c
index 87cb2eaf7e1a..b96e995f3733 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -107,20 +107,11 @@ pgprot_t protection_map[16] __ro_after_init = {
};
#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
-#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
-static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
-{
- return prot;
-}
-#endif
-
pgprot_t vm_get_page_prot(unsigned long vm_flags)
{
- pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags &
- (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
+ return __pgprot(pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
pgprot_val(arch_vm_get_page_prot(vm_flags)));
-
- return arch_filter_pgprot(ret);
}
EXPORT_SYMBOL(vm_get_page_prot);
#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 6/7] mm/mmap: Drop arch_filter_pgprot()
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: linux-arch, Anshuman Khandual, catalin.marinas, linux-kernel,
Christoph Hellwig, sparclinux, linuxppc-dev, linux-arm-kernel
There are no platforms left which subscribe ARCH_HAS_FILTER_PGPROT. Hence
drop generic arch_filter_pgprot() and also config ARCH_HAS_FILTER_PGPROT.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
mm/Kconfig | 3 ---
mm/mmap.c | 13 ++-----------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/mm/Kconfig b/mm/Kconfig
index b1f7624276f8..3f7b6d7b69df 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -762,9 +762,6 @@ config ARCH_HAS_CURRENT_STACK_POINTER
register alias named "current_stack_pointer", this config can be
selected.
-config ARCH_HAS_FILTER_PGPROT
- bool
-
config ARCH_HAS_VM_GET_PAGE_PROT
bool
diff --git a/mm/mmap.c b/mm/mmap.c
index 87cb2eaf7e1a..b96e995f3733 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -107,20 +107,11 @@ pgprot_t protection_map[16] __ro_after_init = {
};
#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
-#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
-static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
-{
- return prot;
-}
-#endif
-
pgprot_t vm_get_page_prot(unsigned long vm_flags)
{
- pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags &
- (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
+ return __pgprot(pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
pgprot_val(arch_vm_get_page_prot(vm_flags)));
-
- return arch_filter_pgprot(ret);
}
EXPORT_SYMBOL(vm_get_page_prot);
#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 6/7] mm/mmap: Drop arch_filter_pgprot()
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel
There are no platforms left which subscribe ARCH_HAS_FILTER_PGPROT. Hence
drop generic arch_filter_pgprot() and also config ARCH_HAS_FILTER_PGPROT.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
mm/Kconfig | 3 ---
mm/mmap.c | 13 ++-----------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/mm/Kconfig b/mm/Kconfig
index b1f7624276f8..3f7b6d7b69df 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -762,9 +762,6 @@ config ARCH_HAS_CURRENT_STACK_POINTER
register alias named "current_stack_pointer", this config can be
selected.
-config ARCH_HAS_FILTER_PGPROT
- bool
-
config ARCH_HAS_VM_GET_PAGE_PROT
bool
diff --git a/mm/mmap.c b/mm/mmap.c
index 87cb2eaf7e1a..b96e995f3733 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -107,20 +107,11 @@ pgprot_t protection_map[16] __ro_after_init = {
};
#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
-#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
-static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
-{
- return prot;
-}
-#endif
-
pgprot_t vm_get_page_prot(unsigned long vm_flags)
{
- pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags &
- (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
+ return __pgprot(pgprot_val(protection_map[vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
pgprot_val(arch_vm_get_page_prot(vm_flags)));
-
- return arch_filter_pgprot(ret);
}
EXPORT_SYMBOL(vm_get_page_prot);
#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH V6 6/7] mm/mmap: Drop arch_filter_pgprot()
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 6:06 ` Christophe Leroy
-1 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:06 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> There are no platforms left which subscribe ARCH_HAS_FILTER_PGPROT. Hence
> drop generic arch_filter_pgprot() and also config ARCH_HAS_FILTER_PGPROT.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> mm/Kconfig | 3 ---
> mm/mmap.c | 13 ++-----------
> 2 files changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index b1f7624276f8..3f7b6d7b69df 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -762,9 +762,6 @@ config ARCH_HAS_CURRENT_STACK_POINTER
> register alias named "current_stack_pointer", this config can be
> selected.
>
> -config ARCH_HAS_FILTER_PGPROT
> - bool
> -
> config ARCH_HAS_VM_GET_PAGE_PROT
> bool
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 87cb2eaf7e1a..b96e995f3733 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -107,20 +107,11 @@ pgprot_t protection_map[16] __ro_after_init = {
> };
>
> #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> -#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
> -static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
> -{
> - return prot;
> -}
> -#endif
> -
> pgprot_t vm_get_page_prot(unsigned long vm_flags)
> {
> - pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags &
> - (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> + return __pgprot(pgprot_val(protection_map[vm_flags &
> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> pgprot_val(arch_vm_get_page_prot(vm_flags)));
> -
> - return arch_filter_pgprot(ret);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 6/7] mm/mmap: Drop arch_filter_pgprot()
@ 2022-04-13 6:06 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:06 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> There are no platforms left which subscribe ARCH_HAS_FILTER_PGPROT. Hence
> drop generic arch_filter_pgprot() and also config ARCH_HAS_FILTER_PGPROT.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> mm/Kconfig | 3 ---
> mm/mmap.c | 13 ++-----------
> 2 files changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index b1f7624276f8..3f7b6d7b69df 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -762,9 +762,6 @@ config ARCH_HAS_CURRENT_STACK_POINTER
> register alias named "current_stack_pointer", this config can be
> selected.
>
> -config ARCH_HAS_FILTER_PGPROT
> - bool
> -
> config ARCH_HAS_VM_GET_PAGE_PROT
> bool
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 87cb2eaf7e1a..b96e995f3733 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -107,20 +107,11 @@ pgprot_t protection_map[16] __ro_after_init = {
> };
>
> #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> -#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
> -static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
> -{
> - return prot;
> -}
> -#endif
> -
> pgprot_t vm_get_page_prot(unsigned long vm_flags)
> {
> - pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags &
> - (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> + return __pgprot(pgprot_val(protection_map[vm_flags &
> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> pgprot_val(arch_vm_get_page_prot(vm_flags)));
> -
> - return arch_filter_pgprot(ret);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 6/7] mm/mmap: Drop arch_filter_pgprot()
@ 2022-04-13 6:06 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:06 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: linux-arch, catalin.marinas, linux-kernel, Christoph Hellwig,
sparclinux, linuxppc-dev, linux-arm-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> There are no platforms left which subscribe ARCH_HAS_FILTER_PGPROT. Hence
> drop generic arch_filter_pgprot() and also config ARCH_HAS_FILTER_PGPROT.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> mm/Kconfig | 3 ---
> mm/mmap.c | 13 ++-----------
> 2 files changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index b1f7624276f8..3f7b6d7b69df 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -762,9 +762,6 @@ config ARCH_HAS_CURRENT_STACK_POINTER
> register alias named "current_stack_pointer", this config can be
> selected.
>
> -config ARCH_HAS_FILTER_PGPROT
> - bool
> -
> config ARCH_HAS_VM_GET_PAGE_PROT
> bool
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 87cb2eaf7e1a..b96e995f3733 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -107,20 +107,11 @@ pgprot_t protection_map[16] __ro_after_init = {
> };
>
> #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> -#ifndef CONFIG_ARCH_HAS_FILTER_PGPROT
> -static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
> -{
> - return prot;
> -}
> -#endif
> -
> pgprot_t vm_get_page_prot(unsigned long vm_flags)
> {
> - pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags &
> - (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> + return __pgprot(pgprot_val(protection_map[vm_flags &
> + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> pgprot_val(arch_vm_get_page_prot(vm_flags)));
> -
> - return arch_filter_pgprot(ret);
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH V6 7/7] mm/mmap: Drop arch_vm_get_page_pgprot()
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 5:58 ` Anshuman Khandual
-1 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel
There are no platforms left which use arch_vm_get_page_prot(). Just drop
generic arch_vm_get_page_prot().
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
include/linux/mman.h | 4 ----
mm/mmap.c | 4 +---
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/include/linux/mman.h b/include/linux/mman.h
index b66e91b8176c..58b3abd457a3 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -93,10 +93,6 @@ static inline void vm_unacct_memory(long pages)
#define arch_calc_vm_flag_bits(flags) 0
#endif
-#ifndef arch_vm_get_page_prot
-#define arch_vm_get_page_prot(vm_flags) __pgprot(0)
-#endif
-
#ifndef arch_validate_prot
/*
* This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have
diff --git a/mm/mmap.c b/mm/mmap.c
index b96e995f3733..475b7c367032 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -109,9 +109,7 @@ pgprot_t protection_map[16] __ro_after_init = {
#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
pgprot_t vm_get_page_prot(unsigned long vm_flags)
{
- return __pgprot(pgprot_val(protection_map[vm_flags &
- (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
- pgprot_val(arch_vm_get_page_prot(vm_flags)));
+ return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
}
EXPORT_SYMBOL(vm_get_page_prot);
#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 7/7] mm/mmap: Drop arch_vm_get_page_pgprot()
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: linux-arch, Anshuman Khandual, catalin.marinas, linux-kernel,
Christoph Hellwig, sparclinux, linuxppc-dev, linux-arm-kernel
There are no platforms left which use arch_vm_get_page_prot(). Just drop
generic arch_vm_get_page_prot().
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
include/linux/mman.h | 4 ----
mm/mmap.c | 4 +---
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/include/linux/mman.h b/include/linux/mman.h
index b66e91b8176c..58b3abd457a3 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -93,10 +93,6 @@ static inline void vm_unacct_memory(long pages)
#define arch_calc_vm_flag_bits(flags) 0
#endif
-#ifndef arch_vm_get_page_prot
-#define arch_vm_get_page_prot(vm_flags) __pgprot(0)
-#endif
-
#ifndef arch_validate_prot
/*
* This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have
diff --git a/mm/mmap.c b/mm/mmap.c
index b96e995f3733..475b7c367032 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -109,9 +109,7 @@ pgprot_t protection_map[16] __ro_after_init = {
#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
pgprot_t vm_get_page_prot(unsigned long vm_flags)
{
- return __pgprot(pgprot_val(protection_map[vm_flags &
- (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
- pgprot_val(arch_vm_get_page_prot(vm_flags)));
+ return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
}
EXPORT_SYMBOL(vm_get_page_prot);
#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
--
2.25.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH V6 7/7] mm/mmap: Drop arch_vm_get_page_pgprot()
@ 2022-04-13 5:58 ` Anshuman Khandual
0 siblings, 0 replies; 45+ messages in thread
From: Anshuman Khandual @ 2022-04-13 5:58 UTC (permalink / raw)
To: linux-mm, akpm
Cc: christophe.leroy, catalin.marinas, Anshuman Khandual,
Christoph Hellwig, linuxppc-dev, linux-arm-kernel, sparclinux,
linux-arch, linux-kernel
There are no platforms left which use arch_vm_get_page_prot(). Just drop
generic arch_vm_get_page_prot().
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
include/linux/mman.h | 4 ----
mm/mmap.c | 4 +---
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/include/linux/mman.h b/include/linux/mman.h
index b66e91b8176c..58b3abd457a3 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -93,10 +93,6 @@ static inline void vm_unacct_memory(long pages)
#define arch_calc_vm_flag_bits(flags) 0
#endif
-#ifndef arch_vm_get_page_prot
-#define arch_vm_get_page_prot(vm_flags) __pgprot(0)
-#endif
-
#ifndef arch_validate_prot
/*
* This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have
diff --git a/mm/mmap.c b/mm/mmap.c
index b96e995f3733..475b7c367032 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -109,9 +109,7 @@ pgprot_t protection_map[16] __ro_after_init = {
#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
pgprot_t vm_get_page_prot(unsigned long vm_flags)
{
- return __pgprot(pgprot_val(protection_map[vm_flags &
- (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
- pgprot_val(arch_vm_get_page_prot(vm_flags)));
+ return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
}
EXPORT_SYMBOL(vm_get_page_prot);
#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH V6 7/7] mm/mmap: Drop arch_vm_get_page_pgprot()
2022-04-13 5:58 ` Anshuman Khandual
(?)
@ 2022-04-13 6:06 ` Christophe Leroy
-1 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:06 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> There are no platforms left which use arch_vm_get_page_prot(). Just drop
> generic arch_vm_get_page_prot().
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> include/linux/mman.h | 4 ----
> mm/mmap.c | 4 +---
> 2 files changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/include/linux/mman.h b/include/linux/mman.h
> index b66e91b8176c..58b3abd457a3 100644
> --- a/include/linux/mman.h
> +++ b/include/linux/mman.h
> @@ -93,10 +93,6 @@ static inline void vm_unacct_memory(long pages)
> #define arch_calc_vm_flag_bits(flags) 0
> #endif
>
> -#ifndef arch_vm_get_page_prot
> -#define arch_vm_get_page_prot(vm_flags) __pgprot(0)
> -#endif
> -
> #ifndef arch_validate_prot
> /*
> * This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have
> diff --git a/mm/mmap.c b/mm/mmap.c
> index b96e995f3733..475b7c367032 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -109,9 +109,7 @@ pgprot_t protection_map[16] __ro_after_init = {
> #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> pgprot_t vm_get_page_prot(unsigned long vm_flags)
> {
> - return __pgprot(pgprot_val(protection_map[vm_flags &
> - (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> - pgprot_val(arch_vm_get_page_prot(vm_flags)));
> + return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 7/7] mm/mmap: Drop arch_vm_get_page_pgprot()
@ 2022-04-13 6:06 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:06 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: catalin.marinas, Christoph Hellwig, linuxppc-dev,
linux-arm-kernel, sparclinux, linux-arch, linux-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> There are no platforms left which use arch_vm_get_page_prot(). Just drop
> generic arch_vm_get_page_prot().
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> include/linux/mman.h | 4 ----
> mm/mmap.c | 4 +---
> 2 files changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/include/linux/mman.h b/include/linux/mman.h
> index b66e91b8176c..58b3abd457a3 100644
> --- a/include/linux/mman.h
> +++ b/include/linux/mman.h
> @@ -93,10 +93,6 @@ static inline void vm_unacct_memory(long pages)
> #define arch_calc_vm_flag_bits(flags) 0
> #endif
>
> -#ifndef arch_vm_get_page_prot
> -#define arch_vm_get_page_prot(vm_flags) __pgprot(0)
> -#endif
> -
> #ifndef arch_validate_prot
> /*
> * This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have
> diff --git a/mm/mmap.c b/mm/mmap.c
> index b96e995f3733..475b7c367032 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -109,9 +109,7 @@ pgprot_t protection_map[16] __ro_after_init = {
> #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> pgprot_t vm_get_page_prot(unsigned long vm_flags)
> {
> - return __pgprot(pgprot_val(protection_map[vm_flags &
> - (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> - pgprot_val(arch_vm_get_page_prot(vm_flags)));
> + return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH V6 7/7] mm/mmap: Drop arch_vm_get_page_pgprot()
@ 2022-04-13 6:06 ` Christophe Leroy
0 siblings, 0 replies; 45+ messages in thread
From: Christophe Leroy @ 2022-04-13 6:06 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, akpm
Cc: linux-arch, catalin.marinas, linux-kernel, Christoph Hellwig,
sparclinux, linuxppc-dev, linux-arm-kernel
Le 13/04/2022 à 07:58, Anshuman Khandual a écrit :
> There are no platforms left which use arch_vm_get_page_prot(). Just drop
> generic arch_vm_get_page_prot().
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> include/linux/mman.h | 4 ----
> mm/mmap.c | 4 +---
> 2 files changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/include/linux/mman.h b/include/linux/mman.h
> index b66e91b8176c..58b3abd457a3 100644
> --- a/include/linux/mman.h
> +++ b/include/linux/mman.h
> @@ -93,10 +93,6 @@ static inline void vm_unacct_memory(long pages)
> #define arch_calc_vm_flag_bits(flags) 0
> #endif
>
> -#ifndef arch_vm_get_page_prot
> -#define arch_vm_get_page_prot(vm_flags) __pgprot(0)
> -#endif
> -
> #ifndef arch_validate_prot
> /*
> * This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have
> diff --git a/mm/mmap.c b/mm/mmap.c
> index b96e995f3733..475b7c367032 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -109,9 +109,7 @@ pgprot_t protection_map[16] __ro_after_init = {
> #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> pgprot_t vm_get_page_prot(unsigned long vm_flags)
> {
> - return __pgprot(pgprot_val(protection_map[vm_flags &
> - (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> - pgprot_val(arch_vm_get_page_prot(vm_flags)));
> + return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
> }
> EXPORT_SYMBOL(vm_get_page_prot);
> #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
^ permalink raw reply [flat|nested] 45+ messages in thread