[PATCH v4 1/4] lib: Introduce atomic MMIO modify
Linus Torvalds
torvalds at linux-foundation.org
Wed Aug 28 12:16:48 EDT 2013
On Wed, Aug 28, 2013 at 3:37 AM, Ezequiel Garcia
<ezequiel.garcia at free-electrons.com> wrote:
> Linus,
>
> Andrew suggested you might have opinions on this, so I'm cc'ing you.
> Since you'll probably want some better context, here it is:
>
> http://lwn.net/Articles/564709/
>
> On Sat, Aug 24, 2013 at 12:35:29PM -0300, Ezequiel Garcia wrote:
>> Some platforms have MMIO regions that are shared across orthogonal
>> subsystems. This commit implements a possible solution for the
>> thread-safe access of such regions through a spinlock-protected API.
>>
>> Concurrent access is protected with a single spinlock for the
>> entire MMIO address space. While this protects shared-registers,
>> it also serializes access to unrelated/unshared registers.
I have nothing against this, except that
"__HAVE_ARCH_ATOMIC_IO_MODIFY" needs to die, along with the #ifdef.
It should be a CONFIG_xyz option that gets set by the architectures
that have it, and then instead of an #ifdef in code, the Makefile
should make the generic target be conditional.
So add a generic
bool GENERIC_ATOMIC_MMIO_MODIFY
depends on !ARCH_ATOMIC_MMIO_MODIFY
default y
to the lib/Kconfig file, and then lib/Makefile just does
obj-$(CONFIG_GENERIC_ATOMIC_MMIO_MODIFY) += atomic_io.o
After that, ARM can then implement some architecture-optimized
version, and in its own Kconfig file just do "select
ARCH_ATOMIC_MMIO_MODIFY" to let the generic code know that it should
disable that generic version.
Linus
More information about the linux-arm-kernel
mailing list