From: ben@fluff.org.uk
To: linux-kernel@vger.kernel.org
Cc: drzeus-mmc@drzeus.cx, Ben Dooks <ben-linux@fluff.org>
Subject: [patch 4/5] s3cmci: fix continual accesses to host->pio_ptr
Date: Wed, 15 Oct 2008 00:17:18 +0100 [thread overview]
Message-ID: <20081014231810.755306687@fluff.org.uk> (raw)
In-Reply-To: 20081014231714.739345038@fluff.org.uk
[-- Attachment #1: simtec/s3c24xx-mmc-faster-transfer-core.patch --]
[-- Type: text/plain, Size: 2146 bytes --]
The s3cmci driver uses the host->pio_ptr field to
point to the current position into the buffer for data
transfer. During the transfers it does the following:
while (fifo_words--)
*(host->pio_ptr++) = readl(from_ptr);
This is inefficent, as host->pio_ptr is not used in any
other part of the transfer but the compiler emits code
which does the following:
while (fifo_words--) {
u32 *ptr = host->pio_ptr;
*ptr = readl(from_ptr);
ptr++;
host->pio_ptr = ptr;
}
This is obviously a waste of a load and store each time
around the loop, which could be up to 16 times depending
on how much needs to be transfered.
Move the ptr accesses to outside the while loop so that
we do not end up reloading/re-writing the pointer.
Note, this seems to make the code 16 bytes larger.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Index: linux-2.6.27-rc5-quilt1/drivers/mmc/host/s3cmci.c
===================================================================
--- linux-2.6.27-rc5-quilt1.orig/drivers/mmc/host/s3cmci.c 2008-09-08 16:50:27.000000000 +0100
+++ linux-2.6.27-rc5-quilt1/drivers/mmc/host/s3cmci.c 2008-09-08 16:52:21.000000000 +0100
@@ -238,6 +238,7 @@ static void do_pio_read(struct s3cmci_ho
{
int res;
u32 fifo;
+ u32 *ptr;
u32 fifo_words;
void __iomem *from_ptr;
@@ -283,8 +284,10 @@ static void do_pio_read(struct s3cmci_ho
host->pio_count += fifo;
fifo_words = fifo >> 2;
+ ptr = host->pio_ptr;
while (fifo_words--)
- *(host->pio_ptr++) = readl(from_ptr);
+ *ptr++ = readl(from_ptr);
+ host->pio_ptr = ptr;
if (fifo & 3) {
u32 n = fifo & 3;
@@ -319,6 +322,7 @@ static void do_pio_write(struct s3cmci_h
void __iomem *to_ptr;
int res;
u32 fifo;
+ u32 *ptr;
to_ptr = host->base + host->sdidata;
@@ -353,8 +357,10 @@ static void do_pio_write(struct s3cmci_h
host->pio_count += fifo;
fifo = (fifo + 3) >> 2;
+ ptr = host->pio_ptr;
while (fifo--)
- writel(*(host->pio_ptr++), to_ptr);
+ writel(*ptr++, to_ptr);
+ host->pio_ptr = ptr;
}
enable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF);
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
next prev parent reply other threads:[~2008-10-14 23:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-14 23:17 [patch 0/5] S3C24XX SD/MMC updates for 2.6.28-rc1 ben
2008-10-14 23:17 ` [patch 1/5] s3cmci: Make general protocol errors less noisy ben
2008-10-14 23:17 ` [patch 2/5] s3cmci: cpufreq support ben
2008-10-14 23:17 ` [patch 3/5] s3cmci: Support transfers which are not multiple of 32 bits ben
2008-10-14 23:17 ` ben [this message]
2008-10-14 23:17 ` [patch 5/5] s3cmci: Add Ben Dooks/Simtec Electronics to header & copyright ben
2008-10-15 16:06 ` [patch 0/5] S3C24XX SD/MMC updates for 2.6.28-rc1 Pierre Ossman
-- strict thread matches above, loose matches on Subject: below --
2008-10-10 10:32 [patch 0/5] MMC: S3C24XX updates for s3cmci driver Ben Dooks
2008-10-10 10:32 ` [patch 4/5] s3cmci: fix continual accesses to host->pio_ptr Ben Dooks
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=20081014231810.755306687@fluff.org.uk \
--to=ben@fluff.org.uk \
--cc=ben-linux@fluff.org \
--cc=drzeus-mmc@drzeus.cx \
--cc=linux-kernel@vger.kernel.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