From: "Bryan O'Sullivan" <bos@pathscale.com>
To: Andrew Morton <akpm@osdl.org>, Roland Dreier <rdreier@cisco.com>
Cc: sam@ravnborg.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [RFC] Generic 32-bit MMIO copy, out of line
Date: Tue, 10 Jan 2006 08:56:05 -0800 [thread overview]
Message-ID: <1136912166.32183.45.camel@serpentine.pathscale.com> (raw)
In-Reply-To: <1136909276.32183.28.camel@serpentine.pathscale.com>
On Tue, 2006-01-10 at 08:07 -0800, Bryan O'Sullivan wrote:
> The only problem with this is that it's an unusual approach, so I don't
> have any obvious examples to copy.
It was easy to hack up a quick patch to try the idea out.
This single-arch patch is for review purposes only; I compile-tested it
on i386, and it has no obvious problems at compile- or link-time.
If it looks OK, I have a complete patch set that affects all arches.
The parts that affect arch/*/lib/Makefile and include/asm-*/io.h are
essentially identical in all cases.
<b
diff -r 48616306e7bd include/asm-generic/raw_memcpy_toio32.h
--- /dev/null Thu Jan 1 00:00:00 1970 +0000
+++ b/include/asm-generic/raw_memcpy_toio32.h Tue Jan 10 08:44:30 2006 -0800
@@ -0,0 +1,16 @@
+#ifndef _ASM_GENERIC_RAW_MEMCPYTOIO32_H
+#define _ASM_GENERIC_RAW_MEMCPYTOIO32_H
+
+/*
+ * __raw_memcpy_toio32 - copy data to MMIO space, in 32-bit units
+ *
+ * Order of access is not guaranteed, nor is a memory barrier performed
+ * afterwards. This is an arch-independent generic implementation.
+ *
+ * @to: destination, in MMIO space (must be 32-bit aligned)
+ * @from: source (must be 32-bit aligned)
+ * @count: number of 32-bit quantities to copy
+ */
+void __raw_memcpy_toio32(void __iomem *to, const void *from, size_t count);
+
+#endif // _ASM_GENERIC_RAW_MEMCPYTOIO32_H
--- /dev/null Thu Jan 1 00:00:00 1970 +0000
+++ b/lib/raw_memcpy_toio32.c Tue Jan 10 08:44:30 2006 -0800
@@ -0,0 +1,13 @@
+#include <linux/types.h>
+#include <asm/io.h>
+#include <asm-generic/raw_memcpy_toio32.h>
+
+void __raw_memcpy_toio32(void __iomem *to, const void *from, size_t count)
+{
+ u32 __iomem *dst = to;
+ const u32 *src = from;
+ size_t i;
+
+ for (i = 0; i < count; i++)
+ __raw_writel(*src++, dst++);
+}
--- a/arch/i386/lib/Makefile Tue Jan 10 08:44:35 2006 -0800
+++ b/arch/i386/lib/Makefile Tue Jan 10 08:44:44 2006 -0800
@@ -5,5 +5,6 @@
lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \
bitops.o
+lib-y += ../../../lib/raw_memcpy_toio32.o
lib-$(CONFIG_X86_USE_3DNOW) += mmx.o
--- a/include/asm-i386/io.h Tue Jan 10 08:44:35 2006 -0800
+++ b/include/asm-i386/io.h Tue Jan 10 08:44:44 2006 -0800
@@ -203,6 +203,8 @@
{
__memcpy((void __force *) dst, src, count);
}
+
+#include <asm-generic/raw_memcpy_toio32.h>
/*
* ISA space is 'always mapped' on a typical x86 system, no need to
next prev parent reply other threads:[~2006-01-10 16:56 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-06 20:26 [PATCH 0 of 3] 32-bit MMIO copy routine Bryan O'Sullivan
2006-01-06 20:26 ` [PATCH 1 of 3] Introduce __raw_memcpy_toio32 Bryan O'Sullivan
2006-01-10 9:18 ` Andrew Morton
2006-01-10 14:55 ` Roland Dreier
2006-01-10 16:07 ` Bryan O'Sullivan
2006-01-10 16:56 ` Bryan O'Sullivan [this message]
2006-01-10 17:07 ` Christoph Hellwig
2006-01-10 17:13 ` Bryan O'Sullivan
2006-01-10 17:49 ` Bryan O'Sullivan
2006-01-10 17:51 ` Christoph Hellwig
2006-01-10 17:55 ` Bryan O'Sullivan
2006-01-10 22:05 ` Andrew Morton
2006-01-10 22:29 ` Bryan O'Sullivan
2006-01-10 23:32 ` Andrew Morton
2006-01-11 17:20 ` Bryan O'Sullivan
2006-01-11 17:22 ` Sam Ravnborg
2006-01-11 17:30 ` Andrew Morton
2006-01-11 17:43 ` Bryan O'Sullivan
2006-01-11 18:49 ` Roland Dreier
2006-01-11 18:57 ` Bryan O'Sullivan
2006-01-11 19:01 ` Roland Dreier
2006-01-11 19:08 ` Bryan O'Sullivan
2006-01-13 15:19 ` Adrian Bunk
2006-01-10 18:02 ` Randy.Dunlap
2006-01-10 20:04 ` Sam Ravnborg
2006-01-10 15:59 ` Bryan O'Sullivan
2006-01-06 20:26 ` [PATCH 2 of 3] memcpy32 for x86_64 Bryan O'Sullivan
2006-01-06 20:26 ` [PATCH 3 of 3] Add __raw_memcpy_toio32 to each arch Bryan O'Sullivan
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=1136912166.32183.45.camel@serpentine.pathscale.com \
--to=bos@pathscale.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdreier@cisco.com \
--cc=sam@ravnborg.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.