summaryrefslogtreecommitdiff
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmerdabbelt@google.com>2020-12-11 23:30:26 +0300
committerPalmer Dabbelt <palmerdabbelt@google.com>2020-12-11 23:30:26 +0300
commit7d95a88f9254b711a3a95106fc73f6a3a9866a40 (patch)
tree9c4551d7f2dce744bbefc359b941fd144f66333d /arch/arm/mm
parent3ae9c3cde51abcb777125cfcf74cc402f4d0a4c7 (diff)
parent6585bd827407f55ee30a782492208bfaf4f52feb (diff)
downloadlinux-7d95a88f9254b711a3a95106fc73f6a3a9866a40.tar.xz
Add and use a generic version of devmem_is_allowed()
As part of adding STRICT_DEVMEM support to the RISC-V port, Zong provided an implementation of devmem_is_allowed() that's exactly the same as the version in a handful of other ports. Rather than duplicate code, I've put a generic version of this in lib/ and used it for the RISC-V port. * palmer/generic-devmem: arm64: Use the generic devmem_is_allowed() arm: Use the generic devmem_is_allowed() RISC-V: Use the new generic devmem_is_allowed() lib: Add a generic version of devmem_is_allowed()
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/mmap.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index b8d912ac9e61..a0f8a0ca0788 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -165,25 +165,3 @@ int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
{
return (pfn + (size >> PAGE_SHIFT)) <= (1 + (PHYS_MASK >> PAGE_SHIFT));
}
-
-#ifdef CONFIG_STRICT_DEVMEM
-
-#include <linux/ioport.h>
-
-/*
- * devmem_is_allowed() checks to see if /dev/mem access to a certain
- * address is valid. The argument is a physical page number.
- * We mimic x86 here by disallowing access to system RAM as well as
- * device-exclusive MMIO regions. This effectively disable read()/write()
- * on /dev/mem.
- */
-int devmem_is_allowed(unsigned long pfn)
-{
- if (iomem_is_exclusive(pfn << PAGE_SHIFT))
- return 0;
- if (!page_is_ram(pfn))
- return 1;
- return 0;
-}
-
-#endif