MMIO and gcc re-ordering issue
Benjamin Herrenschmidt
benh at kernel.crashing.org
Wed May 28 08:17:16 EST 2008
On Tue, 2008-05-27 at 15:42 -0600, Matthew Wilcox wrote:
> On Wed, May 28, 2008 at 07:38:55AM +1000, Benjamin Herrenschmidt wrote:
> > A problem with __raw_ though is that they -also- don't do byteswap,
> > which is a pain in the neck as people use them for either one reason
> > (relaxed ordering) or the other (no byteswap) without always knowing the
> > consequences of doing so...
>
> That's why there's __readl() which does byteswap, but doesn't do
> ordering ...
Ah, that one is news to me. I don't think we ever had it on powerpc :-)
> > I'm happy to say that __raw is purely about ordering and make them
> > byteswap on powerpc tho (ie, make them little endian like the non-raw
> > counterpart).
>
> That would break a lot of drivers.
How many actually use __raw_ * ?
> > Some archs started providing writel_be etc... I added those to powerpc a
> > little while ago, and I tend to prefer that approach for the byteswap
> > issue.
> Those are for people who use big endian chips on little endian
> architectures.
Why limit them to LE architecture ? There is nothing fundamentally
speicifc to LE architectures here, and it's wrong to provide accessors
on some archs and not others. The endianness is a property of the device
registers. Current writel/readl are basically writel_le/readl_le. It
thus makes sense to have the opposite, ie, readl_be/writel_be, which
thus byteswaps on LE platforms and not on BE platforms, which is what I
provided on powerpc a while ago.
Ben.
More information about the Linuxppc-dev
mailing list