linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] {read,write}s{b,w,l} or iobarrier_*()
@ 2002-09-26 15:59 Benjamin Herrenschmidt
  2002-09-26 16:23 ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2002-09-26 15:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds

Hi !

Here I need people to agree so we decide once for all what
we want and move further (this has been discussed several
times already withotu agreement).

So, the "generic" problem is: reading/writing from/to a FIFO
that is larger than 8 bits wide on a big endian machine requires
more than just a loop of reads or writes. Those IO functions
are doing byteswap (and barriers on every call) while the FIFO
access wants typically to be not byteswapped nor have barriers
on every access.

For "PIO", we already provide the "s" functions {in,out}s{b,w,l}
that are implemented by every arch and provide drivers with a
good abstraction to use (see ide_insw/ide_outsw in 2.5 which
should just be a simple insw/outsw for normal interfaces for
example).

However, we don't provide a similar abstraction for MMIO.
Typical cases where we want this is MMIO versions of the
IDE iops (we probably want to provide generic impl of both
PIO and MMIO ones in ide-iops, not just PIO); some sound
cards, etc...

A driver needing that today will have to either use a loop
of {read,write}{b,w,l} and undo byteswapping (ugh), or try
to re-implement it using raw_{read,write}{b,w,l} and adding
proper iobarrier_* where needed. But the iobarrier functions
aren't provided by all archs which means ugly #ifdef salad,
and I hate having to put the burden of knowing everything
about barriers one each single driver maintainer.

So we have 2 solutions here (one of which I prefer, but I
still want the debate open here):

 - Have all archs provide {read,write}s{b,w,l} functions.
Those will hide all of the details of bytewapping & barriers
from the drivers and can be used as-is for things like IDE
MMIO iops.

 - Have all archs provide iobarrier_* functions. Here, drivers
would still have to re-implement the transfer loops with
raw_{read,write}{b,w,l} and do proper use of iobarrier_*.

Ben.



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

end of thread, other threads:[~2002-09-27  9:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-26 15:59 [RFC] {read,write}s{b,w,l} or iobarrier_*() Benjamin Herrenschmidt
2002-09-26 16:23 ` Jeff Garzik
2002-09-26 21:12   ` David S. Miller
2002-09-27  6:21     ` Andre Hedrick
2002-09-27  9:59       ` Benjamin Herrenschmidt
2002-09-27  8:41   ` Geert Uytterhoeven

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).