From: Palmer Dabbelt <palmer@dabbelt.com>
To: zong.li@sifive.com, linux-riscv@lists.infradead.org, rppt@linux.ibm.com
Cc: mark.rutland@arm.com, steve@sk2.org, davidgow@google.com,
catalin.marinas@arm.com, linus.walleij@linaro.org,
Palmer Dabbelt <palmerdabbelt@google.com>,
brendanhiggins@google.com, elver@google.com, glider@google.com,
mchehab+samsung@kernel.org, linux-riscv@lists.infradead.org,
alex.shi@linux.alibaba.com, will@kernel.org,
dan.j.williams@intel.com, linux-arch@vger.kernel.org,
uwe@kleine-koenig.org, alex@ghiti.fr, takahiro.akashi@linaro.org,
paulmck@kernel.org, masahiroy@kernel.org, linux@armlinux.org.uk,
krzk@kernel.org, ardb@kernel.org, bgolaszewski@baylibre.com,
clabbe@baylibre.com, james.morse@arm.com,
kernel-team@android.com, pmladek@suse.com,
zaslonko@linux.ibm.com, aou@eecs.berkeley.edu,
keescook@chromium.org, Arnd Bergmann <arnd@arndb.de>,
rostedt@goodmis.org, broonie@kernel.org,
matti.vaittinen@fi.rohmeurope.com, gregory.0xf0@gmail.com,
Paul Walmsley <paul.walmsley@sifive.com>,
tglx@linutronix.de, andriy.shevchenko@linux.intel.com,
gxt@pku.edu.cn, linux-arm-kernel@lists.infradead.org,
Greg KH <gregkh@linuxfoundation.org>,
rdunlap@infradead.org, Nick Desaulniers <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org, changbin.du@intel.com,
mcgrof@kernel.org, Palmer Dabbelt <palmer@dabbelt.com>,
mhiramat@kernel.org, akpm@linux-foundation.org,
davem@davemloft.net
Subject: [PATCH v2 5/5] unicore32: Use the generic devmem_is_allowed()
Date: Thu, 9 Jul 2020 14:19:25 -0700 [thread overview]
Message-ID: <20200709211925.1926557-6-palmer@dabbelt.com> (raw)
In-Reply-To: <20200709211925.1926557-1-palmer@dabbelt.com>
From: Palmer Dabbelt <palmerdabbelt@google.com>
Aside from being inlineable, this is exactly the same as the arm64
version, which I recently copied into lib/ for use by the RISC-V port.
[I haven't even build tested this. The lib/ patch is on riscv/for-next,
which I'm targeting for 5.9, so this won't work alone. See the cover
letter for more details.]
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
---
arch/unicore32/Kconfig | 2 +-
arch/unicore32/include/asm/io.h | 23 -----------------------
2 files changed, 1 insertion(+), 24 deletions(-)
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index 11ba1839d198..7610571044f4 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -2,7 +2,6 @@
config UNICORE32
def_bool y
select ARCH_32BIT_OFF_T
- select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_KEEPINITRD
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
@@ -12,6 +11,7 @@ config UNICORE32
select HAVE_KERNEL_LZO
select HAVE_KERNEL_LZMA
select HAVE_PCI
+ select GENERIC_LIB_DEVMEM_IS_ALLOWED
select VIRT_TO_BUS
select ARCH_HAVE_CUSTOM_GPIO_H
select GENERIC_FIND_FIRST_BIT
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h
index bd4e7c332f85..4560d2531655 100644
--- a/arch/unicore32/include/asm/io.h
+++ b/arch/unicore32/include/asm/io.h
@@ -42,28 +42,5 @@ extern void __uc32_iounmap(volatile void __iomem *addr);
#define PIO_MASK (unsigned int)(IO_SPACE_LIMIT)
#define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1)
-#ifdef CONFIG_STRICT_DEVMEM
-
-#include <linux/ioport.h>
-#include <linux/mm.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.
- */
-static inline 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 /* CONFIG_STRICT_DEVMEM */
-
#endif /* __KERNEL__ */
#endif /* __UNICORE_IO_H__ */
--
2.27.0.383.g050319c2ae-goog
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2020-07-09 21:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 21:19 Add and use a generic version of devmem_is_allowed() Palmer Dabbelt
2020-07-09 21:19 ` [PATCH v2 1/5] lib: Add " Palmer Dabbelt
2020-07-09 21:19 ` [PATCH v2 2/5] RISC-V: Use the new generic devmem_is_allowed() Palmer Dabbelt
2020-07-09 21:19 ` [PATCH v2 3/5] arm: Use the " Palmer Dabbelt
2020-07-09 21:19 ` [PATCH v2 4/5] arm64: " Palmer Dabbelt
2020-07-14 18:14 ` Catalin Marinas
2020-07-09 21:19 ` Palmer Dabbelt [this message]
2020-07-12 6:09 ` Add and use a generic version of devmem_is_allowed() Mike Rapoport
2020-07-29 0:00 ` Luis Chamberlain
2020-12-11 20:32 ` Palmer Dabbelt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200709211925.1926557-6-palmer@dabbelt.com \
--to=palmer@dabbelt.com \
--cc=akpm@linux-foundation.org \
--cc=alex.shi@linux.alibaba.com \
--cc=alex@ghiti.fr \
--cc=andriy.shevchenko@linux.intel.com \
--cc=aou@eecs.berkeley.edu \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=bgolaszewski@baylibre.com \
--cc=brendanhiggins@google.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=changbin.du@intel.com \
--cc=clabbe@baylibre.com \
--cc=dan.j.williams@intel.com \
--cc=davem@davemloft.net \
--cc=davidgow@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.0xf0@gmail.com \
--cc=gxt@pku.edu.cn \
--cc=james.morse@arm.com \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=krzk@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mcgrof@kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=mhiramat@kernel.org \
--cc=ndesaulniers@google.com \
--cc=palmerdabbelt@google.com \
--cc=paul.walmsley@sifive.com \
--cc=paulmck@kernel.org \
--cc=pmladek@suse.com \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=rppt@linux.ibm.com \
--cc=steve@sk2.org \
--cc=takahiro.akashi@linaro.org \
--cc=tglx@linutronix.de \
--cc=uwe@kleine-koenig.org \
--cc=will@kernel.org \
--cc=zaslonko@linux.ibm.com \
--cc=zong.li@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox