public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma/imx-sdma: add wmb before enable/run a channel
@ 2012-01-01  3:27 Richard Zhao
  2012-01-01  7:14 ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Zhao @ 2012-01-01  3:27 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: kernel, shawn.guo, vinod.koul, dan.j.williams, eric.miao, patches,
	Richard Zhao

dma_alloc_coherent memory may be bufferable. We need to add
nececcary memory barrier.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 drivers/dma/imx-sdma.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 2ebb2bc..8cd9492 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -403,6 +403,7 @@ static int sdma_run_channel(struct sdma_channel *sdmac)
 
 	init_completion(&sdmac->done);
 
+	wmb();
 	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
 
 	ret = wait_for_completion_timeout(&sdmac->done, HZ);
@@ -809,6 +810,7 @@ out:
 
 static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
 {
+	wmb();
 	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
 }
 
-- 
1.7.4.1


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

* Re: [PATCH] dma/imx-sdma: add wmb before enable/run a channel
  2012-01-01  3:27 [PATCH] dma/imx-sdma: add wmb before enable/run a channel Richard Zhao
@ 2012-01-01  7:14 ` Uwe Kleine-König
  2012-01-01 13:29   ` Richard Zhao
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2012-01-01  7:14 UTC (permalink / raw)
  To: Richard Zhao
  Cc: linux-kernel, linux-arm-kernel, kernel, shawn.guo, vinod.koul,
	dan.j.williams, eric.miao, patches

Hello Richard,

On Sun, Jan 01, 2012 at 11:27:40AM +0800, Richard Zhao wrote:
> dma_alloc_coherent memory may be bufferable. We need to add
> nececcary memory barrier.
necessary

> 
> Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> ---
>  drivers/dma/imx-sdma.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 2ebb2bc..8cd9492 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -403,6 +403,7 @@ static int sdma_run_channel(struct sdma_channel *sdmac)
>  
>  	init_completion(&sdmac->done);
>  
> +	wmb();
>  	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
>  
>  	ret = wait_for_completion_timeout(&sdmac->done, HZ);
> @@ -809,6 +810,7 @@ out:
>  
>  static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
>  {
> +	wmb();
>  	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
>  }
I don't know the sdma code very well, but wouldn't it be nice to call
sdma_enable_channel() in sdma_run_channel() instead of open coding it?

As you probably need some rearrangements to have sdma_enable_channel()
declared in sdma_run_channel() this might be better done with a seperate
patch.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH] dma/imx-sdma: add wmb before enable/run a channel
  2012-01-01  7:14 ` Uwe Kleine-König
@ 2012-01-01 13:29   ` Richard Zhao
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Zhao @ 2012-01-01 13:29 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-kernel, linux-arm-kernel, kernel, shawn.guo, vinod.koul,
	dan.j.williams, eric.miao, patches

On Sun, Jan 01, 2012 at 08:14:25AM +0100, Uwe Kleine-König wrote:
> Hello Richard,
> 
> On Sun, Jan 01, 2012 at 11:27:40AM +0800, Richard Zhao wrote:
> > dma_alloc_coherent memory may be bufferable. We need to add
> > nececcary memory barrier.
> necessary
> 
> > 
> > Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> > ---
> >  drivers/dma/imx-sdma.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> > index 2ebb2bc..8cd9492 100644
> > --- a/drivers/dma/imx-sdma.c
> > +++ b/drivers/dma/imx-sdma.c
> > @@ -403,6 +403,7 @@ static int sdma_run_channel(struct sdma_channel *sdmac)
> >  
> >  	init_completion(&sdmac->done);
> >  
> > +	wmb();
> >  	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
> >  
> >  	ret = wait_for_completion_timeout(&sdmac->done, HZ);
> > @@ -809,6 +810,7 @@ out:
> >  
> >  static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
> >  {
> > +	wmb();
> >  	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
> >  }
> I don't know the sdma code very well, but wouldn't it be nice to call
> sdma_enable_channel() in sdma_run_channel() instead of open coding it?
right.
> 
> As you probably need some rearrangements to have sdma_enable_channel()
> declared in sdma_run_channel() this might be better done with a seperate
> patch.
It'll save one wmb.

Thanks
Richard
> 
> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-König            |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2012-01-01 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-01  3:27 [PATCH] dma/imx-sdma: add wmb before enable/run a channel Richard Zhao
2012-01-01  7:14 ` Uwe Kleine-König
2012-01-01 13:29   ` Richard Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox