linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] Introduce atomic MMIO modify
@ 2013-08-24 15:35 Ezequiel Garcia
  2013-08-24 15:35 ` [PATCH v4 1/4] lib: " Ezequiel Garcia
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Ezequiel Garcia @ 2013-08-24 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset introduces an atomic MMIO modify API.
The motivation for adding this is to allow cheap, infrastructure-less,
thread-safe access to an MMIO region, even in very early scenarios.

The chosen mask/set semantic (proposed by Russell King) is clean and flexible
enough and matches the regmap_update_bits() prototype. Consistency is good.

This series adds a simple arch-generic implementation in a new lib/atomicio.c
file. On top of that it implements an ARM-optimized variant following Will
Deacon's suggestions, that take advantage of ARM relaxed read/write functions.

Finally, just to show a few usage for this function, last two patches show
how this would solve one of the current shared-registers issues.

Since this 4th version is no longer ARM-specific but kernel-wide, and perhaps
new reviewers might jump in, please read the previous discussion on why this
is needed and why we cannot use a regmap API.

v1: https://lkml.org/lkml/2013/8/10/75
v2: http://comments.gmane.org/gmane.linux.ports.arm.kernel/261879
v3: http://www.spinics.net/lists/arm-kernel/msg269263.html

Thoughts?

Changes from v3:
* Implemented an arch-generic atomic_io_modify(), as suggested by Baruch
  and Catalin.

* Add an ARM-specific variant, using relaxed R/W as Will suggested.

* Replaced spin_locks by raw_spin_locks, to protect the registers
  even on RT.

* Fixed two stupid typos.

Changes from v2:
* As suggested by Will Deacon, dropped the iowmb() barrier
  and use relaxed variants instead. See Will's explanation for
  details: http://www.spinics.net/lists/arm-kernel/msg268775.html

* Use spin_{}_irqsave/restore to allow irq-context usage
  also suggested by Will Deacon.

* Re-worked the API semantics as proposed by Russell King.

Changes from v1:
* Added an io barrier iowmb() as suggested by Will Deacon,
  to ensure the writel gets completed before the spin_unlock().

Ezequiel Garcia (4):
  lib: Introduce atomic MMIO modify
  ARM: Add atomic_io_modify optimized routines
  clocksource: orion: Use atomic access for shared registers
  watchdog: orion: Use atomic access for shared registers

 arch/arm/include/asm/io.h        |  4 ++++
 arch/arm/kernel/io.c             | 29 +++++++++++++++++++++++++++++
 drivers/clocksource/time-orion.c | 29 +++++++++++------------------
 drivers/watchdog/orion_wdt.c     |  8 ++------
 include/linux/io.h               |  5 +++++
 lib/Makefile                     |  2 +-
 lib/atomicio.c                   | 27 +++++++++++++++++++++++++++
 7 files changed, 79 insertions(+), 25 deletions(-)
 create mode 100644 lib/atomicio.c

-- 
1.8.1.5

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2013-08-29  8:03 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-24 15:35 [PATCH v4 0/4] Introduce atomic MMIO modify Ezequiel Garcia
2013-08-24 15:35 ` [PATCH v4 1/4] lib: " Ezequiel Garcia
2013-08-24 18:27   ` richard -rw- weinberger
2013-08-24 19:58     ` Ezequiel Garcia
2013-08-24 20:35       ` Richard Weinberger
2013-08-24 20:49         ` Ezequiel Garcia
2013-08-24 20:53           ` Richard Weinberger
2013-08-24 23:15       ` Russell King - ARM Linux
2013-08-27 14:37   ` Ezequiel Garcia
2013-08-27 20:37   ` Andrew Morton
2013-08-28 10:24     ` Ezequiel Garcia
2013-08-28 19:33       ` Andrew Morton
2013-08-29  8:03         ` Thomas Petazzoni
2013-08-28 10:37   ` Ezequiel Garcia
2013-08-28 16:16     ` Linus Torvalds
2013-08-24 15:35 ` [PATCH v4 2/4] ARM: Add atomic_io_modify optimized routines Ezequiel Garcia
2013-08-28  8:53   ` Catalin Marinas
2013-08-28  9:49     ` Ezequiel Garcia
2013-08-28 10:01       ` Thomas Petazzoni
2013-08-28 11:39         ` Catalin Marinas
2013-08-24 15:35 ` [PATCH v4 3/4] clocksource: orion: Use atomic access for shared registers Ezequiel Garcia
2013-08-24 15:35 ` [PATCH v4 4/4] watchdog: " Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).