From mboxrd@z Thu Jan 1 00:00:00 1970 From: Palmer Dabbelt Subject: Add and use a generic version of devmem_is_allowed() Date: Thu, 9 Jul 2020 14:19:20 -0700 Message-ID: <20200709211925.1926557-1-palmer@dabbelt.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbgGIVUU (ORCPT ); Thu, 9 Jul 2020 17:20:20 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A52CBC08C5CE for ; Thu, 9 Jul 2020 14:20:20 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id k5so1322915plk.13 for ; Thu, 09 Jul 2020 14:20:20 -0700 (PDT) Sender: linux-arch-owner@vger.kernel.org List-ID: To: zong.li@sifive.com, linux-riscv@lists.infradead.org, rppt@linux.ibm.com Cc: linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, Paul Walmsley , Palmer Dabbelt , aou@eecs.berkeley.edu, gxt@pku.edu.cn, Arnd Bergmann , linus.walleij@linaro.org, akpm@linux-foundation.org, mchehab+samsung@kernel.org, gregory.0xf0@gmail.com, masahiroy@kernel.org, Nick Desaulniers , bgolaszewski@baylibre.com, steve@sk2.org, tglx@linutronix.de, keescook@chromium.org, alex@ghiti.fr, mcgrof@kernel.org, mark.rutland@arm.com, james.morse@arm.com, alex.shi@linux.alibaba.com, andriy.shevchenko@linux.intel.com, broonie@kernel.org, rdunlap@infradead.org, davem@davemloft.net, rostedt@goodmis.org, dan.j.williams@intel.com, mhiramat@kernel.org, krzk@kernel.org, zaslonko@linux.ibm.comm 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. I've put those first two patches on riscv/for-next, which I'm targeting for 5.9 (though this is the first version, so they're unreviewed). The other three obviously depend on the first one going on, but I'm not putting them in the RISC-V tree as I don't want to step on anyone's toes. If you want me to take yours along with the others then please say something, as otherwise I'll probably forget. I've put the whole thing at ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git -b generic-devmem . Changes since v1 [<20200709200552.1910298-1-palmer@dabbelt.com]: * Don't have GENERIC_LIB_DEVMEM_IS_ALLOWED select ARCH_HAS_DEVMEM_IS_ALLOWED, instead just adapt the users. * Remove ARCH_HAS_DEVMEM_IS_ALLOWED from the arch Kconfigs, as I forgot to do so the first time. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbgGIVUU (ORCPT ); Thu, 9 Jul 2020 17:20:20 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A52CBC08C5CE for ; Thu, 9 Jul 2020 14:20:20 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id k5so1322915plk.13 for ; Thu, 09 Jul 2020 14:20:20 -0700 (PDT) Subject: Add and use a generic version of devmem_is_allowed() Date: Thu, 9 Jul 2020 14:19:20 -0700 Message-ID: <20200709211925.1926557-1-palmer@dabbelt.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Palmer Dabbelt Sender: linux-arch-owner@vger.kernel.org List-ID: To: zong.li@sifive.com, rppt@linux.ibm.com Cc: linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, Paul Walmsley , Palmer Dabbelt , aou@eecs.berkeley.edu, gxt@pku.edu.cn, Arnd Bergmann , linus.walleij@linaro.org, akpm@linux-foundation.org, mchehab+samsung@kernel.org, gregory.0xf0@gmail.com, masahiroy@kernel.org, Nick Desaulniers , bgolaszewski@baylibre.com, steve@sk2.org, tglx@linutronix.de, keescook@chromium.org, alex@ghiti.fr, mcgrof@kernel.org, mark.rutland@arm.com, james.morse@arm.com, alex.shi@linux.alibaba.com, andriy.shevchenko@linux.intel.com, broonie@kernel.org, rdunlap@infradead.org, davem@davemloft.net, rostedt@goodmis.org, dan.j.williams@intel.com, mhiramat@kernel.org, krzk@kernel.org, zaslonko@linux.ibm.com, matti.vaittinen@fi.rohmeurope.com, uwe@kleine-koenig.org, clabbe@baylibre.com, changbin.du@intel.com, Greg KH , paulmck@kernel.org, pmladek@suse.com, brendanhiggins@google.com, glider@google.com, elver@google.com, davidgow@google.com, ardb@kernel.org, takahiro.akashi@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, kernel-team@android.com Message-ID: <20200709211920.U7F1n6zocRElvt5aSiCL14_8VjZbGEhzBxWZNfIN1J8@z> 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. I've put those first two patches on riscv/for-next, which I'm targeting for 5.9 (though this is the first version, so they're unreviewed). The other three obviously depend on the first one going on, but I'm not putting them in the RISC-V tree as I don't want to step on anyone's toes. If you want me to take yours along with the others then please say something, as otherwise I'll probably forget. I've put the whole thing at ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git -b generic-devmem . Changes since v1 [<20200709200552.1910298-1-palmer@dabbelt.com]: * Don't have GENERIC_LIB_DEVMEM_IS_ALLOWED select ARCH_HAS_DEVMEM_IS_ALLOWED, instead just adapt the users. * Remove ARCH_HAS_DEVMEM_IS_ALLOWED from the arch Kconfigs, as I forgot to do so the first time.