* [PATCH v3 0/2] imx-sdma: memory barrier fix @ 2012-01-05 7:59 Richard Zhao 2012-01-05 7:59 ` [PATCH v3 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel Richard Zhao 2012-01-05 7:59 ` [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel Richard Zhao 0 siblings, 2 replies; 8+ messages in thread From: Richard Zhao @ 2012-01-05 7:59 UTC (permalink / raw) To: linux-arm-kernel Changes in v3: - use writel instead of explicitly call wmb. Changes in v2: - add "let sdma_run_channel call sdma_enable_channel" [PATCH v3 1/2] dma/imx-sdma: let sdma_run_channel call [PATCH v3 2/2] dma/imx-sdma: use writel to write register when Thanks Richard ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel 2012-01-05 7:59 [PATCH v3 0/2] imx-sdma: memory barrier fix Richard Zhao @ 2012-01-05 7:59 ` Richard Zhao 2012-01-05 9:14 ` Shawn Guo 2012-01-05 7:59 ` [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel Richard Zhao 1 sibling, 1 reply; 8+ messages in thread From: Richard Zhao @ 2012-01-05 7:59 UTC (permalink / raw) To: linux-arm-kernel 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 f59fd8f..c2bc4f1 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -394,6 +394,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 */ @@ -405,7 +410,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); @@ -811,11 +816,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.5.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel 2012-01-05 7:59 ` [PATCH v3 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel Richard Zhao @ 2012-01-05 9:14 ` Shawn Guo 0 siblings, 0 replies; 8+ messages in thread From: Shawn Guo @ 2012-01-05 9:14 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jan 05, 2012 at 03:59:21PM +0800, Richard Zhao wrote: > Let all enable channel code call sdma_enable_channel. > > Signed-off-by: Richard Zhao <richard.zhao@linaro.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> -- Regards, Shawn ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel 2012-01-05 7:59 [PATCH v3 0/2] imx-sdma: memory barrier fix Richard Zhao 2012-01-05 7:59 ` [PATCH v3 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel Richard Zhao @ 2012-01-05 7:59 ` Richard Zhao 2012-01-05 9:23 ` Shawn Guo 1 sibling, 1 reply; 8+ messages in thread From: Richard Zhao @ 2012-01-05 7:59 UTC (permalink / raw) To: linux-arm-kernel dma_alloc_coherent memory may be bufferable when set CONFIG_ARM_DMA_MEM_BUFFERABLE. We need to add nececcary memory barrier. writel implicitly call wmb in such case. Signed-off-by: Richard Zhao <richard.zhao@linaro.org> --- drivers/dma/imx-sdma.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index c2bc4f1..e987468 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -396,7 +396,7 @@ static int sdma_config_ownership(struct sdma_channel *sdmac, static void sdma_enable_channel(struct sdma_engine *sdma, int channel) { - __raw_writel(1 << channel, sdma->regs + SDMA_H_START); + writel(1 << channel, sdma->regs + SDMA_H_START); } /* -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel 2012-01-05 7:59 ` [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel Richard Zhao @ 2012-01-05 9:23 ` Shawn Guo 2012-01-05 9:19 ` Richard Zhao 0 siblings, 1 reply; 8+ messages in thread From: Shawn Guo @ 2012-01-05 9:23 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jan 05, 2012 at 03:59:22PM +0800, Richard Zhao wrote: > dma_alloc_coherent memory may be bufferable when set > CONFIG_ARM_DMA_MEM_BUFFERABLE. We need to add nececcary > memory barrier. writel implicitly call wmb in such case. > > Signed-off-by: Richard Zhao <richard.zhao@linaro.org> > --- > drivers/dma/imx-sdma.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c > index c2bc4f1..e987468 100644 > --- a/drivers/dma/imx-sdma.c > +++ b/drivers/dma/imx-sdma.c > @@ -396,7 +396,7 @@ static int sdma_config_ownership(struct sdma_channel *sdmac, > > static void sdma_enable_channel(struct sdma_engine *sdma, int channel) > { > - __raw_writel(1 << channel, sdma->regs + SDMA_H_START); > + writel(1 << channel, sdma->regs + SDMA_H_START); > } > As educated by Arnd, generally it's safer to use pair of readl/writel than __raw_readl/__raw_writel in driver. I'm wondering if it's a good opportunity for us to change the pair all over this driver. -- Regards, Shawn ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel 2012-01-05 9:23 ` Shawn Guo @ 2012-01-05 9:19 ` Richard Zhao 2012-01-05 9:34 ` Eric Miao 2012-01-05 9:54 ` Shawn Guo 0 siblings, 2 replies; 8+ messages in thread From: Richard Zhao @ 2012-01-05 9:19 UTC (permalink / raw) To: linux-arm-kernel Hi Shawn, On Thu, Jan 05, 2012 at 05:23:17PM +0800, Shawn Guo wrote: > On Thu, Jan 05, 2012 at 03:59:22PM +0800, Richard Zhao wrote: > > dma_alloc_coherent memory may be bufferable when set > > CONFIG_ARM_DMA_MEM_BUFFERABLE. We need to add nececcary > > memory barrier. writel implicitly call wmb in such case. > > > > Signed-off-by: Richard Zhao <richard.zhao@linaro.org> > > --- > > drivers/dma/imx-sdma.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c > > index c2bc4f1..e987468 100644 > > --- a/drivers/dma/imx-sdma.c > > +++ b/drivers/dma/imx-sdma.c > > @@ -396,7 +396,7 @@ static int sdma_config_ownership(struct sdma_channel *sdmac, > > > > static void sdma_enable_channel(struct sdma_engine *sdma, int channel) > > { > > - __raw_writel(1 << channel, sdma->regs + SDMA_H_START); > > + writel(1 << channel, sdma->regs + SDMA_H_START); > > } > > > > As educated by Arnd, generally it's safer to use pair of readl/writel > than __raw_readl/__raw_writel in driver. I'm wondering if it's a good > opportunity for us to change the pair all over this driver. Russel mentioned that too. But I cannot understand. If CONFIG_ARM_DMA_MEM_BUFFERABLE, readl/writel always call rmb/wmb. Do we realy need it? It might affect performance. Du to the concern, I didn't convert all the readl/writel. Thanks Richard > > -- > Regards, > Shawn > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel 2012-01-05 9:19 ` Richard Zhao @ 2012-01-05 9:34 ` Eric Miao 2012-01-05 9:54 ` Shawn Guo 1 sibling, 0 replies; 8+ messages in thread From: Eric Miao @ 2012-01-05 9:34 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jan 5, 2012 at 5:19 PM, Richard Zhao <richard.zhao@freescale.com> wrote: > Hi Shawn, > > On Thu, Jan 05, 2012 at 05:23:17PM +0800, Shawn Guo wrote: >> On Thu, Jan 05, 2012 at 03:59:22PM +0800, Richard Zhao wrote: >> > dma_alloc_coherent memory may be bufferable when set >> > CONFIG_ARM_DMA_MEM_BUFFERABLE. We need to add nececcary >> > memory barrier. writel implicitly call wmb in such case. >> > >> > Signed-off-by: Richard Zhao <richard.zhao@linaro.org> >> > --- >> > ?drivers/dma/imx-sdma.c | ? ?2 +- >> > ?1 files changed, 1 insertions(+), 1 deletions(-) >> > >> > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c >> > index c2bc4f1..e987468 100644 >> > --- a/drivers/dma/imx-sdma.c >> > +++ b/drivers/dma/imx-sdma.c >> > @@ -396,7 +396,7 @@ static int sdma_config_ownership(struct sdma_channel *sdmac, >> > >> > ?static void sdma_enable_channel(struct sdma_engine *sdma, int channel) >> > ?{ >> > - ? __raw_writel(1 << channel, sdma->regs + SDMA_H_START); >> > + ? writel(1 << channel, sdma->regs + SDMA_H_START); >> > ?} >> > >> >> As educated by Arnd, generally it's safer to use pair of readl/writel >> than __raw_readl/__raw_writel in driver. ?I'm wondering if it's a good >> opportunity for us to change the pair all over this driver. > Russel mentioned that too. But I cannot understand. > If CONFIG_ARM_DMA_MEM_BUFFERABLE, readl/writel always call rmb/wmb. Do > we realy need it? It might affect performance. It's generally a good idea to use readl() and writel() unless it's performance critical, e.g. where endian conversion is not necessary and IO read/write order doesn't matter. As MT_DEVICE is strongly ordered, I think it'll be OK for __raw_{read,write}l() to be used for those ioremap() register accesses, not necessarily to those ioremap_*() version though. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel 2012-01-05 9:19 ` Richard Zhao 2012-01-05 9:34 ` Eric Miao @ 2012-01-05 9:54 ` Shawn Guo 1 sibling, 0 replies; 8+ messages in thread From: Shawn Guo @ 2012-01-05 9:54 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jan 05, 2012 at 05:19:05PM +0800, Richard Zhao wrote: > Russel mentioned that too. But I cannot understand. > If CONFIG_ARM_DMA_MEM_BUFFERABLE, readl/writel always call rmb/wmb. Do > we realy need it? It might affect performance. > For safety, I think we need it. The operations should be really fast. -- Regards, Shawn ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-01-05 9:54 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-01-05 7:59 [PATCH v3 0/2] imx-sdma: memory barrier fix Richard Zhao 2012-01-05 7:59 ` [PATCH v3 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel Richard Zhao 2012-01-05 9:14 ` Shawn Guo 2012-01-05 7:59 ` [PATCH v3 2/2] dma/imx-sdma: use writel to write register when enable a channel Richard Zhao 2012-01-05 9:23 ` Shawn Guo 2012-01-05 9:19 ` Richard Zhao 2012-01-05 9:34 ` Eric Miao 2012-01-05 9:54 ` Shawn Guo
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).