diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2021-09-21 13:57:22 +0200 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2021-10-19 11:30:56 +0200 |
commit | b8bc0e50a32a3c3b51605e41de41b4d7952e6aa4 (patch) | |
tree | f30b5a2086dc1093e185f5877060ab8a1d18730d /arch/arm/mm/ioremap.c | |
parent | ARM: 9124/1: uncompress: Parse "linux,usable-memory-range" DT property (diff) | |
download | linux-b8bc0e50a32a3c3b51605e41de41b4d7952e6aa4.tar.xz linux-b8bc0e50a32a3c3b51605e41de41b4d7952e6aa4.zip |
ARM: add __arm_iomem_set_ro() to write-protect ioremapped area
__arm_iomem_set_ro() marks an ioremapped area read-only. This is
intended for use with __arm_ioremap_exec() to allow the kernel to
write some code into e.g. SRAM and then write-protect it so the
kernel doesn't complain about W+X mappings.
Tested-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch/arm/mm/ioremap.c')
-rw-r--r-- | arch/arm/mm/ioremap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index 80fb5a4a5c05..6e830b9418c9 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -36,6 +36,7 @@ #include <asm/mmu_context.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h> +#include <asm/set_memory.h> #include <asm/system_info.h> #include <asm/mach/map.h> @@ -401,6 +402,11 @@ __arm_ioremap_exec(phys_addr_t phys_addr, size_t size, bool cached) __builtin_return_address(0)); } +void __arm_iomem_set_ro(void __iomem *ptr, size_t size) +{ + set_memory_ro((unsigned long)ptr, PAGE_ALIGN(size) / PAGE_SIZE); +} + void *arch_memremap_wb(phys_addr_t phys_addr, size_t size) { return (__force void *)arch_ioremap_caller(phys_addr, size, |