diff mbox

[1/7] dmaengine: at_xdmac: prefer usage of readl/writel_relaxed

Message ID 1415875965-6905-2-git-send-email-ludovic.desroches@atmel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ludovic Desroches Nov. 13, 2014, 10:52 a.m. UTC
_relaxed version of readl and writel are not implemented on all
architecture so COMPILE_TEST has to be removed in order to not cause
some build failures.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/dma/Kconfig    | 2 +-
 drivers/dma/at_xdmac.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Arnd Bergmann Nov. 13, 2014, 11:01 a.m. UTC | #1
On Thursday 13 November 2014 11:52:39 Ludovic Desroches wrote:
> _relaxed version of readl and writel are not implemented on all
> architecture so COMPILE_TEST has to be removed in order to not cause
> some build failures.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> ---
> 

I've queued up Will Deacon's series to enable the relaxed accessors
on all architectures, so the Kconfig change should no longer
be required in 3.19.

	Arnd
Ludovic Desroches Nov. 13, 2014, 2:21 p.m. UTC | #2
On Thu, Nov 13, 2014 at 12:01:49PM +0100, Arnd Bergmann wrote:
> On Thursday 13 November 2014 11:52:39 Ludovic Desroches wrote:
> > _relaxed version of readl and writel are not implemented on all
> > architecture so COMPILE_TEST has to be removed in order to not cause
> > some build failures.
> > 
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > ---
> > 
> 
> I've queued up Will Deacon's series to enable the relaxed accessors
> on all architectures, so the Kconfig change should no longer
> be required in 3.19.

Good news.

Vinod, I can send a v2 if you want.


Ludovic
Vinod Koul Nov. 13, 2014, 3:34 p.m. UTC | #3
On Thu, Nov 13, 2014 at 12:01:49PM +0100, Arnd Bergmann wrote:
> On Thursday 13 November 2014 11:52:39 Ludovic Desroches wrote:
> > _relaxed version of readl and writel are not implemented on all
> > architecture so COMPILE_TEST has to be removed in order to not cause
> > some build failures.
> > 
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > ---
> > 
> 
> I've queued up Will Deacon's series to enable the relaxed accessors
> on all architectures, so the Kconfig change should no longer
> be required in 3.19.
And why is _relaxed() version required for thsi driver. Why cant readl(),
writel() with barriers do?
Ludovic Desroches Nov. 13, 2014, 3:45 p.m. UTC | #4
On Thu, Nov 13, 2014 at 09:04:49PM +0530, Vinod Koul wrote:
> On Thu, Nov 13, 2014 at 12:01:49PM +0100, Arnd Bergmann wrote:
> > On Thursday 13 November 2014 11:52:39 Ludovic Desroches wrote:
> > > _relaxed version of readl and writel are not implemented on all
> > > architecture so COMPILE_TEST has to be removed in order to not cause
> > > some build failures.
> > > 
> > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > > ---
> > > 
> > 
> > I've queued up Will Deacon's series to enable the relaxed accessors
> > on all architectures, so the Kconfig change should no longer
> > be required in 3.19.
> And why is _relaxed() version required for thsi driver. Why cant readl(),
> writel() with barriers do?

Required not but preferred to my mind. I don't need a barrier for all
read and write I am performing. Barriers have been added when needed.

When you have fixed my code because of the compilation breakage on other
architecture, you only change the read and write macros. Currently, there are
some redundancies because of the barriers added in the code.

To be honest, I have no idea about the performance impact between the
use of read/write and read/write_relaxed. Then two choices:
- go back to relaxed version, good new can keep COMPILE_TEST thanks to
  Will Deacon
- remove barrier since they are no more needed if using readl/writel


Ludovic

> 
> -- 
> ~Vinod
> 
> --
> To unsubscribe from this list: send the line "unsubscribe dmaengine" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul Nov. 17, 2014, 8:34 a.m. UTC | #5
On Thu, Nov 13, 2014 at 04:45:51PM +0100, Ludovic Desroches wrote:
> On Thu, Nov 13, 2014 at 09:04:49PM +0530, Vinod Koul wrote:
> > On Thu, Nov 13, 2014 at 12:01:49PM +0100, Arnd Bergmann wrote:
> > > On Thursday 13 November 2014 11:52:39 Ludovic Desroches wrote:
> > > > _relaxed version of readl and writel are not implemented on all
> > > > architecture so COMPILE_TEST has to be removed in order to not cause
> > > > some build failures.
> > > > 
> > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > > > ---
> > > > 
> > > 
> > > I've queued up Will Deacon's series to enable the relaxed accessors
> > > on all architectures, so the Kconfig change should no longer
> > > be required in 3.19.
> > And why is _relaxed() version required for thsi driver. Why cant readl(),
> > writel() with barriers do?
> 
> Required not but preferred to my mind. I don't need a barrier for all
> read and write I am performing. Barriers have been added when needed.
> 
> When you have fixed my code because of the compilation breakage on other
> architecture, you only change the read and write macros. Currently, there are
> some redundancies because of the barriers added in the code.
> 
> To be honest, I have no idea about the performance impact between the
> use of read/write and read/write_relaxed. Then two choices:
> - go back to relaxed version, good new can keep COMPILE_TEST thanks to
>   Will Deacon
But that would merged after merge window. This was also reported on next.
So lets keep this patch for now and you can enabled COMPILE_TEST after next
merge window.
> - remove barrier since they are no more needed if using readl/writel
I think that should be right fix along with checking performance of driver and
optimize/stress it

So for now, I am applying this whole series.
diff mbox

Patch

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index aef8b9d..f2b2c4e 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -109,7 +109,7 @@  config AT_HDMAC
 
 config AT_XDMAC
 	tristate "Atmel XDMA support"
-	depends on (ARCH_AT91 || COMPILE_TEST)
+	depends on ARCH_AT91
 	select DMA_ENGINE
 	help
 	  Support the Atmel XDMA controller.
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index 89c43be..1f53d92 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -248,12 +248,12 @@  static inline void __iomem *at_xdmac_chan_reg_base(struct at_xdmac *atxdmac, uns
 	return atxdmac->regs + (AT_XDMAC_CHAN_REG_BASE + chan_nb * 0x40);
 }
 
-#define at_xdmac_read(atxdmac, reg) readl((atxdmac)->regs + (reg))
+#define at_xdmac_read(atxdmac, reg) readl_relaxed((atxdmac)->regs + (reg))
 #define at_xdmac_write(atxdmac, reg, value) \
-	writel((value), (atxdmac)->regs + (reg))
+	writel_relaxed((value), (atxdmac)->regs + (reg))
 
-#define at_xdmac_chan_read(atchan, reg) readl((atchan)->ch_regs + (reg))
-#define at_xdmac_chan_write(atchan, reg, value) writel((value), (atchan)->ch_regs + (reg))
+#define at_xdmac_chan_read(atchan, reg) readl_relaxed((atchan)->ch_regs + (reg))
+#define at_xdmac_chan_write(atchan, reg, value) writel_relaxed((value), (atchan)->ch_regs + (reg))
 
 static inline struct at_xdmac_chan *to_at_xdmac_chan(struct dma_chan *dchan)
 {