diff mbox

[v6] RFT: mmc: sdhci: Implement an SDHCI-specific bounce buffer

Message ID CACRpkdatPkr0Y-FvegwXMJB41nmN-KArXhwpZj0nR9f7SyyvmQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Linus Walleij Jan. 22, 2018, 8:53 a.m. UTC
On Mon, Jan 22, 2018 at 9:33 AM, Benjamin Beckmeyer
<beckmeyer.b@rittal.de> wrote:
> Hey Linus,
>
>> Annoying ... since the i.MX and x86 PCI version so clearly differs
>> here I'm left to trial and error over the mailing list.
>
> I know, can I do something that it makes it easier for you?

It's just how it is. Let's use mails and brains for debugging :D

>> Could you try this on top of the patch?
>
> Built in and here is the output. I think, it's what you want,
> but it doesn't work either.

OK that doesn't work. Scratch that patch. What about this instead?



Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Benjamin Beckmeyer Jan. 22, 2018, 9:59 a.m. UTC | #1
> OK that doesn't work. Scratch that patch. What about this instead?

That is working.
I did some quick testing with time and dd again.

#time dd if=/dev/zero of=test bs=1M count=4
real	0m1.898s
user	0m0.002s
sys	0m0.392s

#time dd if=/dev/zero of=test bs=1M count=8
real	0m5.292s
user	0m0.004s
sys	0m0.772s

#time dd if=/dev/zero of=test bs=1M count=16
real	0m10.130s
user	0m0.009s
sys	0m1.479s

#time dd if=/dev/zero of=test bs=1M count=32
real	0m18.752s
user	0m0.001s
sys	0m2.934s

Looks good to me. So far.

Kind regards,
Benjamin Beckmeyer
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Jan. 22, 2018, 10:36 a.m. UTC | #2
On Mon, Jan 22, 2018 at 10:59 AM, Benjamin Beckmeyer
<beckmeyer.b@rittal.de> wrote:
>> OK that doesn't work. Scratch that patch. What about this instead?
>
> That is working.

OK so it was just my random abuse of the DMA API.
Sorry for my shitty code that of course works fine on
the DMA-coherent x86...

> I did some quick testing with time and dd again.

OK :)

I'll fold this patch into the original, tag with your Tested-by
and send out as non-RFC.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 25b5e598ee6d..416e94dead4f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -523,7 +523,7 @@  static int sdhci_pre_dma_transfer(struct sdhci_host *host,
         dma_sync_single_for_device(host->mmc->parent,
                        host->bounce_addr,
                        host->bounce_buffer_size,
-                       DMA_TO_DEVICE);
+                       mmc_get_dma_dir(data));
         /* Just a dummy value */
         sg_count = 1;
     } else {
@@ -2422,6 +2422,12 @@  static bool sdhci_request_done(struct sdhci_host *host)
                         data->sg_len,
                         host->bounce_buffer,
                         length);
+                } else {
+                    dma_sync_single_for_cpu(
+                        host->mmc->parent,
+                        host->bounce_addr,
+                        host->bounce_buffer_size,
+                        mmc_get_dma_dir(data));
                 }
             } else {
                 /* Unmap the raw data */