From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Russell King <rmk+lkml@arm.linux.org.uk>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Jeff Garzik <jgarzik@pobox.com>, Andrew Morton <akpm@osdl.org>,
"David S. Miller" <davem@davemloft.net>,
Paul Mackerras <paulus@samba.org>
Subject: Re: lib/iomap.c mmio_{in,out}s* vs. __raw_* accessors
Date: Sun, 05 Nov 2006 14:55:53 +1100 [thread overview]
Message-ID: <1162698953.28571.147.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.0611041946020.25218@g5.osdl.org>
On Sat, 2006-11-04 at 19:46 -0800, Linus Torvalds wrote:
>
> On Sun, 5 Nov 2006, Benjamin Herrenschmidt wrote:
> >
> > Make the generic lib/iomap.c use arch provided MMIO accessors when
> > available for big endian and repeat operations. Also while at it,
> > fix the *_be version which are currently broken for PIO
>
> Just rip the _be versions out, methinks.
>
> Also, what does your "writesb()" actually look like? I assume it's the
> exact same thing as the generic one, with just another barrier. No?
With our old naming (we used _ins* for the base operations, the PIO ones
just calling them with a magic offset) :
void _insb(const volatile u8 __iomem *port, void *buf, long count)
{
u8 *tbuf = buf;
u8 tmp;
if (unlikely(count <= 0))
return;
asm volatile("sync");
do {
tmp = *port;
asm volatile("eieio");
*tbuf++ = tmp;
} while (--count != 0);
asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
}
EXPORT_SYMBOL(_insb);
void _outsb(volatile u8 __iomem *port, const void *buf, long count)
{
const u8 *tbuf = buf;
if (unlikely(count <= 0))
return;
asm volatile("sync");
do {
*port = *tbuf++;
} while (--count != 0);
asm volatile("sync");
}
EXPORT_SYMBOL(_outsb);
I'm not even entirely sure that the insb one is correct, maybe it should
or-in all the values to get a proper data dependency that acutally
depends on all previous loads to pass to the twi instructions (it's a
conditional trap instruction with the condition set as never, it forces
the CPU to think the data has been consumed and thus, in conjunction
with the subsequent isync, forces the loads to be performed before any
further code can execute).
The store also has two barriers as you can see. That's mostly related to
the need for very synchronous IOs to please drivers, though the second
one could be replaced with
get_paca()->io_sync = 1;
(Which is a new mecanism we introduced recently to tell spin_unlock that
one or previous MMIO stores might need a sync before we unlock. Looks
like we didn't update the "s" functions when adding that).
Ben.
next prev parent reply other threads:[~2006-11-05 3:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-04 7:52 lib/iomap.c mmio_{in,out}s* vs. __raw_* accessors Benjamin Herrenschmidt
2006-11-04 14:06 ` Russell King
2006-11-04 22:17 ` Benjamin Herrenschmidt
2006-11-04 23:52 ` Linus Torvalds
2006-11-05 1:10 ` Benjamin Herrenschmidt
2006-11-05 3:32 ` Benjamin Herrenschmidt
2006-11-05 3:46 ` Linus Torvalds
2006-11-05 3:55 ` Benjamin Herrenschmidt [this message]
2006-11-05 4:00 ` Benjamin Herrenschmidt
2006-11-05 4:16 ` Linus Torvalds
2006-11-05 4:38 ` Benjamin Herrenschmidt
2006-11-05 5:00 ` Linus Torvalds
2006-11-05 5:08 ` Benjamin Herrenschmidt
2006-11-05 5:28 ` Benjamin Herrenschmidt
2006-11-06 2:56 ` Benjamin Herrenschmidt
2006-11-06 3:13 ` Linus Torvalds
2006-11-06 4:50 ` Benjamin Herrenschmidt
2006-11-05 3:34 ` Linus Torvalds
2006-11-05 3:49 ` Benjamin Herrenschmidt
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=1162698953.28571.147.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=akpm@osdl.org \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=torvalds@osdl.org \
/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