linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MMC: at91_mci: modify cache flush routines
       [not found] <20100511134409.GB27201@n2100.arm.linux.org.uk>
@ 2010-05-11 17:09 ` Nicolas Ferre
  2010-05-12 21:19   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Ferre @ 2010-05-11 17:09 UTC (permalink / raw)
  To: linux-arm-kernel, akpm, linux-mmc, avictor.za, linux
  Cc: linux-kernel, Nicolas Ferre

As we were using an internal dma flushing routine, this patch changes to the
DMA API flush_kernel_dcache_page(). Driver is able to compile now.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/mmc/host/at91_mci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index a6dd7da..813d208 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -315,7 +315,7 @@ static void at91_mci_post_dma_read(struct at91mci_host *host)
 		}
 
 		kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
-		dmac_flush_range((void *)sgbuffer, ((void *)sgbuffer) + amount);
+		flush_kernel_dcache_page(sg_page(sg));
 		data->bytes_xfered += amount;
 		if (size == 0)
 			break;
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] MMC: at91_mci: modify cache flush routines
  2010-05-11 17:09 ` [PATCH] MMC: at91_mci: modify cache flush routines Nicolas Ferre
@ 2010-05-12 21:19   ` Andrew Morton
  2010-05-12 21:30     ` Russell King - ARM Linux
  2010-05-19 11:04     ` Nicolas Ferre
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2010-05-12 21:19 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: linux-arm-kernel, linux-mmc, avictor.za, linux, linux-kernel,
	James Bottomley

On Tue, 11 May 2010 19:09:53 +0200
Nicolas Ferre <nicolas.ferre@atmel.com> wrote:

> As we were using an internal dma flushing routine, this patch changes to the
> DMA API flush_kernel_dcache_page(). Driver is able to compile now.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  drivers/mmc/host/at91_mci.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
> index a6dd7da..813d208 100644
> --- a/drivers/mmc/host/at91_mci.c
> +++ b/drivers/mmc/host/at91_mci.c
> @@ -315,7 +315,7 @@ static void at91_mci_post_dma_read(struct at91mci_host *host)
>  		}
>  
>  		kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
> -		dmac_flush_range((void *)sgbuffer, ((void *)sgbuffer) + amount);
> +		flush_kernel_dcache_page(sg_page(sg));
>  		data->bytes_xfered += amount;
>  		if (size == 0)
>  			break;

The flush_kernel_dcache_page() documentation specifically says that
thou shalt run flush_kernel_dcache_page() _prior_ to kunmapping the
page.

I don't know if that makes a difference in the real world, but heck why
not:

--- a/drivers/mmc/host/at91_mci.c~mmc-at91_mci-modify-cache-flush-routines-fix
+++ a/drivers/mmc/host/at91_mci.c
@@ -314,8 +314,8 @@ static void at91_mci_post_dma_read(struc
 			dmabuf = (unsigned *)tmpv;
 		}
 
-		kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
 		flush_kernel_dcache_page(sg_page(sg));
+		kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
 		data->bytes_xfered += amount;
 		if (size == 0)
 			break;
_

However, I'm wondering why you chose flush_kernel_dcache_page() instead
of plain old flush_dcache_page().  Is this a pagecache or possibly
direct-io page we're dealing with here?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MMC: at91_mci: modify cache flush routines
  2010-05-12 21:19   ` Andrew Morton
@ 2010-05-12 21:30     ` Russell King - ARM Linux
  2010-05-19 11:04     ` Nicolas Ferre
  1 sibling, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2010-05-12 21:30 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Nicolas Ferre, linux-arm-kernel, linux-mmc, avictor.za,
	linux-kernel, James Bottomley

On Wed, May 12, 2010 at 02:19:29PM -0700, Andrew Morton wrote:
> The flush_kernel_dcache_page() documentation specifically says that
> thou shalt run flush_kernel_dcache_page() _prior_ to kunmapping the
> page.

Hmm, interesting - I can't see why that would be, but it doesn't make
any difference for ARM (and this is an ARM only driver).

> I don't know if that makes a difference in the real world, but heck why
> not:

In the interests of stopping cut'n'paste bugs into other drivers, I'd
say this is a good idea even if it makes no difference to ARM.

> However, I'm wondering why you chose flush_kernel_dcache_page() instead
> of plain old flush_dcache_page().  Is this a pagecache or possibly
> direct-io page we're dealing with here?

It's whatever the block layers hand us - which would be page cache pages,
and I'd assume also DIO pages (I'm not up on DIO stuff though.)

It's also my understanding that the preferred interface for drivers which
write to page cache pages is flush_kernel_dcache_page() rather than
flush_dcache_page().

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MMC: at91_mci: modify cache flush routines
  2010-05-12 21:19   ` Andrew Morton
  2010-05-12 21:30     ` Russell King - ARM Linux
@ 2010-05-19 11:04     ` Nicolas Ferre
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Ferre @ 2010-05-19 11:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arm-kernel, linux-mmc, avictor.za, linux, linux-kernel

Le 12/05/2010 23:19, Andrew Morton :
> On Tue, 11 May 2010 19:09:53 +0200
> Nicolas Ferre <nicolas.ferre@atmel.com> wrote:
> 
>> As we were using an internal dma flushing routine, this patch changes to the
>> DMA API flush_kernel_dcache_page(). Driver is able to compile now.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> ---
>>  drivers/mmc/host/at91_mci.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
>> index a6dd7da..813d208 100644
>> --- a/drivers/mmc/host/at91_mci.c
>> +++ b/drivers/mmc/host/at91_mci.c
>> @@ -315,7 +315,7 @@ static void at91_mci_post_dma_read(struct at91mci_host *host)
>>  		}
>>  
>>  		kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
>> -		dmac_flush_range((void *)sgbuffer, ((void *)sgbuffer) + amount);
>> +		flush_kernel_dcache_page(sg_page(sg));
>>  		data->bytes_xfered += amount;
>>  		if (size == 0)
>>  			break;
> 
> The flush_kernel_dcache_page() documentation specifically says that
> thou shalt run flush_kernel_dcache_page() _prior_ to kunmapping the
> page.
> 
> I don't know if that makes a difference in the real world, but heck why
> not:
> 
> --- a/drivers/mmc/host/at91_mci.c~mmc-at91_mci-modify-cache-flush-routines-fix
> +++ a/drivers/mmc/host/at91_mci.c
> @@ -314,8 +314,8 @@ static void at91_mci_post_dma_read(struc
>  			dmabuf = (unsigned *)tmpv;
>  		}
>  
> -		kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
>  		flush_kernel_dcache_page(sg_page(sg));
> +		kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
>  		data->bytes_xfered += amount;
>  		if (size == 0)
>  			break;
> _

Andrew, thanks a lot for folding this in my patch.
I had no access to my emails last days and it was good to learn that
this patch went to 2.6.34-final.

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-19 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20100511134409.GB27201@n2100.arm.linux.org.uk>
2010-05-11 17:09 ` [PATCH] MMC: at91_mci: modify cache flush routines Nicolas Ferre
2010-05-12 21:19   ` Andrew Morton
2010-05-12 21:30     ` Russell King - ARM Linux
2010-05-19 11:04     ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).