linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] imx-sdma: memory barrier fix
@ 2012-01-01 14:38 Richard Zhao
  2012-01-01 14:38 ` [PATCH v2 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel Richard Zhao
  2012-01-01 14:38 ` [PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel Richard Zhao
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Zhao @ 2012-01-01 14:38 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: kernel, shawn.guo, vinod.koul, dan.j.williams, eric.miao, patches

Changes in v2:
 - add "let sdma_run_channel call sdma_enable_channel"

[PATCH v2 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel
[PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel

Thanks
Richard

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

* [PATCH v2 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel
  2012-01-01 14:38 [PATCH v2 0/2] imx-sdma: memory barrier fix Richard Zhao
@ 2012-01-01 14:38 ` Richard Zhao
  2012-01-01 14:38 ` [PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel Richard Zhao
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Zhao @ 2012-01-01 14:38 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: kernel, shawn.guo, vinod.koul, dan.j.williams, eric.miao,
	patches, Richard Zhao

Let all enable channel code call sdma_enable_channel.

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

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 2ebb2bc..f8e87b5 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -392,6 +392,11 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
 	return 0;
 }
 
+static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
+{
+	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
+}
+
 /*
  * sdma_run_channel - run a channel and wait till it's done
  */
@@ -403,7 +408,7 @@ static int sdma_run_channel(struct sdma_channel *sdmac)
 
 	init_completion(&sdmac->done);
 
-	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
+	sdma_enable_channel(sdma, channel);
 
 	ret = wait_for_completion_timeout(&sdmac->done, HZ);
 
@@ -807,11 +812,6 @@ out:
 	return ret;
 }
 
-static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
-{
-	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
-}
-
 static dma_cookie_t sdma_assign_cookie(struct sdma_channel *sdmac)
 {
 	dma_cookie_t cookie = sdmac->chan.cookie;
-- 
1.7.4.1


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

* [PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel
  2012-01-01 14:38 [PATCH v2 0/2] imx-sdma: memory barrier fix Richard Zhao
  2012-01-01 14:38 ` [PATCH v2 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel Richard Zhao
@ 2012-01-01 14:38 ` Richard Zhao
  2012-01-03 17:46   ` Russell King - ARM Linux
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Zhao @ 2012-01-01 14:38 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 |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index f8e87b5..9301bff 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -394,6 +394,7 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
 
 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] 6+ messages in thread

* Re: [PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel
  2012-01-01 14:38 ` [PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel Richard Zhao
@ 2012-01-03 17:46   ` Russell King - ARM Linux
  2012-01-04  2:31     ` Richard Zhao
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2012-01-03 17:46 UTC (permalink / raw)
  To: Richard Zhao
  Cc: linux-kernel, linux-arm-kernel, patches, vinod.koul, eric.miao,
	kernel, dan.j.williams, shawn.guo

On Sun, Jan 01, 2012 at 10:38:12PM +0800, Richard Zhao wrote:
> 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 |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index f8e87b5..9301bff 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -394,6 +394,7 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
>  
>  static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
>  {
> +	wmb();
>  	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);

Use writel().  That's what it's there for:

#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
#define __iowmb()               wmb()
#endif
#define writel_relaxed(v,c)     ((void)__raw_writel((__force u32) \
                                        cpu_to_le32(v),__mem_pci(c)))
#define writel(v,c)             ({ __iowmb(); writel_relaxed(v,c); })

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

* Re: [PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel
  2012-01-03 17:46   ` Russell King - ARM Linux
@ 2012-01-04  2:31     ` Richard Zhao
  2012-01-05  1:56       ` Richard Zhao
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Zhao @ 2012-01-04  2:31 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Richard Zhao, patches, vinod.koul, linux-kernel, eric.miao,
	kernel, dan.j.williams, shawn.guo, linux-arm-kernel

On Tue, Jan 03, 2012 at 05:46:39PM +0000, Russell King - ARM Linux wrote:
> On Sun, Jan 01, 2012 at 10:38:12PM +0800, Richard Zhao wrote:
> > 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 |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> > index f8e87b5..9301bff 100644
> > --- a/drivers/dma/imx-sdma.c
> > +++ b/drivers/dma/imx-sdma.c
> > @@ -394,6 +394,7 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
> >  
> >  static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
> >  {
> > +	wmb();
> >  	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
> 
> Use writel().  That's what it's there for:
> 
> #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
> #define __iowmb()               wmb()
> #endif
> #define writel_relaxed(v,c)     ((void)__raw_writel((__force u32) \
>                                         cpu_to_le32(v),__mem_pci(c)))
> #define writel(v,c)             ({ __iowmb(); writel_relaxed(v,c); })
Why does writel always call wmb? ioremap memory needs mb too?
Isn't it supposed to be when there's prior touch of dma memory? 

Thanks
Richard
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


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

* Re: [PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel
  2012-01-04  2:31     ` Richard Zhao
@ 2012-01-05  1:56       ` Richard Zhao
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Zhao @ 2012-01-05  1:56 UTC (permalink / raw)
  To: s.hauer, Russell King - ARM Linux
  Cc: patches, vinod.koul, linux-kernel, eric.miao, kernel,
	dan.j.williams, shawn.guo, Richard Zhao, linux-arm-kernel

Hi Sascha,

On Wed, Jan 04, 2012 at 10:31:58AM +0800, Richard Zhao wrote:
> On Tue, Jan 03, 2012 at 05:46:39PM +0000, Russell King - ARM Linux wrote:
> > On Sun, Jan 01, 2012 at 10:38:12PM +0800, Richard Zhao wrote:
> > > 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 |    1 +
> > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> > > index f8e87b5..9301bff 100644
> > > --- a/drivers/dma/imx-sdma.c
> > > +++ b/drivers/dma/imx-sdma.c
> > > @@ -394,6 +394,7 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
> > >  
> > >  static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
> > >  {
> > > +	wmb();
> > >  	__raw_writel(1 << channel, sdma->regs + SDMA_H_START);
> > 
> > Use writel().  That's what it's there for:
> > 
> > #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
> > #define __iowmb()               wmb()
> > #endif
> > #define writel_relaxed(v,c)     ((void)__raw_writel((__force u32) \
> >                                         cpu_to_le32(v),__mem_pci(c)))
> > #define writel(v,c)             ({ __iowmb(); writel_relaxed(v,c); })
> Why does writel always call wmb? ioremap memory needs mb too?
> Isn't it supposed to be when there's prior touch of dma memory? 
What do you think?

Thanks
Richard
> 
> Thanks
> Richard
> > 
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> > 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


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

end of thread, other threads:[~2012-01-05  1:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-01 14:38 [PATCH v2 0/2] imx-sdma: memory barrier fix Richard Zhao
2012-01-01 14:38 ` [PATCH v2 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel Richard Zhao
2012-01-01 14:38 ` [PATCH v2 2/2] dma/imx-sdma: add wmb before enable a channel Richard Zhao
2012-01-03 17:46   ` Russell King - ARM Linux
2012-01-04  2:31     ` Richard Zhao
2012-01-05  1:56       ` Richard Zhao

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).