Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Kossifidis <mick@ics.forth.gr>
To: Christoph Hellwig <hch@infradead.org>
Cc: mark.rutland@arm.com, steve@sk2.org, davidgow@google.com,
	catalin.marinas@arm.com, linus.walleij@linaro.org,
	Palmer Dabbelt <palmerdabbelt@google.com>,
	elver@google.com, glider@google.com, willy@infradead.org,
	zong.li@sifive.com, mchehab+samsung@kernel.org,
	linux-riscv@lists.infradead.org, alex.shi@linux.alibaba.com,
	will@kernel.org, ardb@kernel.org, linux-arch@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>,
	alex@ghiti.fr, takahiro.akashi@linaro.org, masahiroy@kernel.org,
	linux@armlinux.org.uk, krzk@kernel.org,
	Mike Rapoport <rppt@linux.ibm.com>,
	bgolaszewski@baylibre.com, Palmer Dabbelt <palmer@dabbelt.com>,
	kernel-team@android.com, pmladek@suse.com,
	zaslonko@linux.ibm.com, aou@eecs.berkeley.edu,
	keescook@chromium.org, paulmck@kernel.org, rostedt@goodmis.org,
	uwe@kleine-koenig.org, broonie@kernel.org,
	matti.vaittinen@fi.rohmeurope.com, gregory.0xf0@gmail.com,
	Paul Walmsley <paul.walmsley@sifive.com>,
	dan.j.williams@intel.com, andriy.shevchenko@linux.intel.com,
	gxt@pku.edu.cn, linux-arm-kernel@lists.infradead.org,
	tglx@linutronix.de, rdunlap@infradead.org,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org, mcgrof@kernel.org,
	james.morse@arm.com, mhiramat@kernel.org,
	akpm@linux-foundation.org, davem@davemloft.net
Subject: Re: [PATCH 1/5] lib: Add a generic version of devmem_is_allowed()
Date: Fri, 10 Jul 2020 08:48:17 +0300	[thread overview]
Message-ID: <a037dac961c989d027eab293a0280643@mailhost.ics.forth.gr> (raw)
In-Reply-To: <20200710053850.GA27019@infradead.org>

Στις 2020-07-10 08:38, Christoph Hellwig έγραψε:
> On Thu, Jul 09, 2020 at 11:49:21PM +0300, Mike Rapoport wrote:
>> > +#ifndef CONFIG_GENERIC_DEVMEM_IS_ALLOWED
>> > +extern int devmem_is_allowed(unsigned long pfn);
>> > +#endif
> 
> Nit: no need for the extern here.
> 
>> > +config GENERIC_LIB_DEVMEM_IS_ALLOWED
>> > +	bool
>> > +	select ARCH_HAS_DEVMEM_IS_ALLOWED
>> 
>> This seems to work the other way around from the usual Kconfig chains.
>> In the most cases ARCH_HAS_SOMETHING selects GENERIC_SOMETHING.
>> 
>> I believe nicer way would be to make
>> 
>> config STRICT_DEVMEM
>> 	bool "Filter access to /dev/mem"
>> 	depends on MMU && DEVMEM
>> 	depends on ARCH_HAS_DEVMEM_IS_ALLOWED || 
>> GENERIC_LIB_DEVMEM_IS_ALLOWED
>> 
>> config GENERIC_LIB_DEVMEM_IS_ALLOWED
>> 	bool
>> 
>> and then s/select ARCH_HAS_DEVMEM_IS_ALLOWED/select 
>> GENERIC_LIB_DEVMEM_IS_ALLOWED/
>> in the arch Kconfigs and drop ARCH_HAS_DEVMEM_IS_ALLOWED in the end.
> 
> To take a step back:  Is there any reason to not just always
> STRICT_DEVMEM? Maybe for a few architectures that don't currently
> support a strict /dev/mem the generic version isn't quite correct, but
> someone selecting the option and finding the issue is the best way to
> figure that out..
> 

During prototyping / testing having full access to all physical memory 
through /dev/mem is very useful. We should have it enabled by default 
but leave the config option there so that users / developers can disable 
it if needed IMHO.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2020-07-10  5:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 20:05 Add and use a generic version of devmem_is_allowed() Palmer Dabbelt
2020-07-09 20:05 ` [PATCH 1/5] lib: Add " Palmer Dabbelt
2020-07-09 20:49   ` Mike Rapoport
2020-07-09 20:54     ` Palmer Dabbelt
2020-07-10  5:38     ` Christoph Hellwig
2020-07-10  5:48       ` Nick Kossifidis [this message]
2020-07-10  5:51         ` Christoph Hellwig
2020-07-09 20:05 ` [PATCH 2/5] RISC-V: Use the new generic devmem_is_allowed() Palmer Dabbelt
2020-07-09 20:05 ` [PATCH 3/5] arm: Use the " Palmer Dabbelt
2020-07-09 20:05 ` [PATCH 4/5] arm64: " Palmer Dabbelt
2020-07-09 20:05 ` [PATCH 5/5] unicore32: " 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=a037dac961c989d027eab293a0280643@mailhost.ics.forth.gr \
    --to=mick@ics.forth.gr \
    --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=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dan.j.williams@intel.com \
    --cc=davem@davemloft.net \
    --cc=davidgow@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=gregory.0xf0@gmail.com \
    --cc=gxt@pku.edu.cn \
    --cc=hch@infradead.org \
    --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=palmer@dabbelt.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=willy@infradead.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