From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: optimize memset_io()/memcpy_fromio()/memcpy_toio()
Date: Fri, 28 Sep 2012 13:36:30 +0000 [thread overview]
Message-ID: <201209281336.30728.arnd@arndb.de> (raw)
In-Reply-To: <E1THMAC-0004nL-8B@rmk-PC.arm.linux.org.uk>
On Thursday 27 September 2012, Russell King wrote:
> +#ifndef __ARMBE__
> +static inline void memset_io(volatile void __iomem *dst, unsigned c,
> + size_t count)
> +{
> + memset((void __force *)dst, c, count);
> +}
> +#define memset_io(dst,c,count) memset_io(dst,c,count)
> +
> +static inline void memcpy_fromio(void *to, const volatile void __iomem *from,
> + size_t count)
> +{
> + memcpy(to, (const void __force *)from, count);
> +}
> +#define memcpy_fromio(to,from,count) memcpy_fromio(to,from,count)
> +
I wonder whether we need any barriers here. PowerPC has the strongest
barriers befor eand after the access, at least since f007cacffc8870
"[POWERPC] Fix MMIO ops to provide expected barrier behaviour".
This seems to be done more out of caution and trying to mimic the
x86 behavior (where all MMIO accesses are synchronous so some degree)
than fixing a particular bug that was observed.
Most other architectures are just using the raw string operations like
you do here.
Some architectures (powerpc and parisc at least) split the access into
naturally aligned accesses of up to 4 bytes. I think those are the
ones that allow unaligned accesses on RAM but not on MMIO pointers
(powerpc will checkstop or throw an exception).
arm64 actually copies the arm variant, and I suspect we can use the
simpler version there as well.
Arnd
next prev parent reply other threads:[~2012-09-28 13:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-27 22:02 [PATCH] ARM: optimize memset_io()/memcpy_fromio()/memcpy_toio() Russell King
2012-09-28 4:17 ` Nicolas Pitre
2012-09-28 9:58 ` Will Deacon
2012-09-28 10:31 ` Russell King - ARM Linux
2012-09-28 10:42 ` Will Deacon
2012-09-28 10:44 ` Russell King - ARM Linux
2012-09-28 13:36 ` Arnd Bergmann [this message]
2012-09-28 14:13 ` Catalin Marinas
2012-09-28 14:29 ` Russell King - ARM Linux
2013-06-05 6:02 ` Dirk Behme
2013-06-11 18:16 ` Dirk Behme
2013-06-13 11:05 ` Russell King - ARM Linux
2013-06-13 12:47 ` Arnd Bergmann
2013-06-13 17:13 ` Russell King - ARM Linux
2013-06-23 6:46 ` Dirk Behme
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=201209281336.30728.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.