From: Arnd Bergmann <arnd@arndb.de>
To: Pekka Paalanen <pq@iki.fi>
Cc: Christoph Hellwig <hch@infradead.org>,
Jiri Slaby <jirislaby@gmail.com>,
linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: Do cpu-endian MMIO accessors exist?
Date: Wed, 22 Jul 2009 23:20:58 +0200 [thread overview]
Message-ID: <200907222320.58744.arnd@arndb.de> (raw)
In-Reply-To: <20090722201148.19f47119@daedalus.pq.iki.fi>
On Wednesday 22 July 2009, Pekka Paalanen wrote:
> > The powerpc in_le32 style functions are a completely different
> > story, they are basically defined to operate only on on-chip
> > components, while ioread32 and readl do work on PCI devices.
>
> So what should I use on BE arches when the card is in BE mode?
> Not out_be32() but iowrite32be()?
> I never even noticed that io*be() functions exist, thanks for the hint.
If it's a PCI/AGP/PCIe device, use iowrite32be(), otherwise it
may not work correctly on a pseries, celleb or qs20 machine.
If it's connected over a different bus (IOIF on PS3), out_be32
would be more appropriate, but AFAICT, iowrite32be should work
just as well.
> On LE arches I'll stick to {read,write}[bwl], which in my
> understanding always handle the hardware as LE. Right?
Right. For consistency you could decide to switch to iowrite32()
to go along with iowrite32be(), that should be equivalent on
MMIO based devices to writel.
> > It would of course be easy to just define an API extension
> > to ioread along the lines of
> >
> > #ifdef __BIG_ENDIAN
> > #define ioread16_native ioread16be
> > #define ioread32_native ioread32be
> > #define iowrite16_native iowrite16be
> > #define iowrite32_native iowrite32be
> > #else
> > #define ioread16_native ioread16
> > #define ioread32_native ioread32
> > #define iowrite16_native iowrite16
> > #define iowrite32_native iowrite32
> > #endif
> >
> > but I'm not yet convinced that there is a potential user that
> > should not just be fixed in a different way.
>
> This is how it currently is.
Well, I meant we could add it to asm-generic/iomap.h. If we
decide that this is the right approach after all, it should
be part of the common linux API, not private to a single driver.
Arnd <><
next prev parent reply other threads:[~2009-07-22 21:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 20:42 Do cpu-endian MMIO accessors exist? Pekka Paalanen
2009-07-21 20:59 ` Jiri Slaby
2009-07-21 21:15 ` Arnd Bergmann
2009-07-21 21:33 ` Christoph Hellwig
2009-07-21 22:01 ` Arnd Bergmann
2009-07-22 17:11 ` Pekka Paalanen
2009-07-22 21:19 ` Arnd Bergmann
2009-07-23 16:23 ` Pekka Paalanen
2009-07-22 21:20 ` Arnd Bergmann [this message]
2009-07-21 21:56 ` Jiri Slaby
2009-07-21 22:05 ` Arnd Bergmann
2009-07-22 7:24 ` Jiri Slaby
2009-07-22 8:35 ` Arnd Bergmann
2009-07-22 8:43 ` Alan Cox
2009-07-22 13:44 ` Arnd Bergmann
2009-07-27 5:00 ` Paul Mundt
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=200907222320.58744.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=hch@infradead.org \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pq@iki.fi \
/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