Skip to contentSkip to conversation

dmaengine: shdma: fix a build failure on platforms with no DMA support

PATCH New Simon Horman 5 participants 10 messages Jul 10, 2013 – Jul 31, 2013 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: shdma: fix a build failure on platforms with no DMA support

From: Guennadi Liakhovetski <[email protected]>

On platforms with no support for the shdma dmaengine driver build is currently failing with

drivers/built-in.o: In function `sh_mobile_sdhi_probe':
drivers/mmc/host/sh_mobile_sdhi.c:170: undefined reference to`shdma_chan_filter'

Fix the breakage by defining shdma_chan_filter to NULL in such configurations.

[horms+renesas at verge.net.au: Apply change to shdma-base.h instead of sh_dma.h]
---
 include/linux/shdma-base.h | 4 ++++
 1 file changed, 4 insertions(+)

Hi Vinod,

please consider this fix from Guennadi for v3.11 which I have rebased on top of next-20130709. It fixes a build problem on a number of shmobile defconfigs including bockw.

include/linux/shdma-base.h +4 -0
index 382cf71..5b1c984 100644
@@ -124,6 +124,10 @@ void shdma_chan_remove(struct shdma_chan *schan);
 int shdma_init(struct device *dev, struct shdma_dev *sdev,
 		    int chan_num);
 void shdma_cleanup(struct shdma_dev *sdev);
+#if IS_ENABLED(CONFIG_SH_DMAE_BASE)
 bool shdma_chan_filter(struct dma_chan *chan, void *arg);
+#else
+#define shdma_chan_filter NULL
+#endif
 
 #endif
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH 1/1 dmaengine: shdma: fix a build failure on platforms with no DMA support

Quoted 19 lines · Simon Horman

From: Guennadi Liakhovetski <[email protected]>

On platforms with no support for the shdma dmaengine driver build is currently failing with

drivers/built-in.o: In function `sh_mobile_sdhi_probe':
drivers/mmc/host/sh_mobile_sdhi.c:170: undefined reference to`shdma_chan_filter'

Fix the breakage by defining shdma_chan_filter to NULL in such configurations.

[horms+renesas at verge.net.au: Apply change to shdma-base.h instead of sh_dma.h]
---
 include/linux/shdma-base.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 5 lines

Hi Vinod,

please consider this fix from Guennadi for v3.11 which I have rebased on top of next-20130709. It fixes a build problem on a number of shmobile defconfigs including bockw.

Ping.

Would it be appropriate for me to take this change through my tree? It seems to resolve a regression in v3.11-rc1.

Quoted 23 lines
include/linux/shdma-base.h +4 -0
index 382cf71..5b1c984 100644
@@ -124,6 +124,10 @@ void shdma_chan_remove(struct shdma_chan *schan);
 int shdma_init(struct device *dev, struct shdma_dev *sdev,
 		    int chan_num);
 void shdma_cleanup(struct shdma_dev *sdev);
+#if IS_ENABLED(CONFIG_SH_DMAE_BASE)
 bool shdma_chan_filter(struct dma_chan *chan, void *arg);
+#else
+#define shdma_chan_filter NULL
+#endif
 
 #endif
Signature · 6 lines
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH 1/1 dmaengine: shdma: fix a build failure on platforms with no DMA support

Quoted 22 lines · Simon Horman
Quoted 21 lines · Simon Horman

From: Guennadi Liakhovetski <[email protected]>

On platforms with no support for the shdma dmaengine driver build is currently failing with

drivers/built-in.o: In function `sh_mobile_sdhi_probe':
drivers/mmc/host/sh_mobile_sdhi.c:170: undefined reference to`shdma_chan_filter'

Fix the breakage by defining shdma_chan_filter to NULL in such configurations.

[horms+renesas at verge.net.au: Apply change to shdma-base.h instead of sh_dma.h]
---
 include/linux/shdma-base.h | 4 ++++
 1 file changed, 4 insertions(+)

Hi Vinod,

Quoted 8 lines
Quoted 3 lines

please consider this fix from Guennadi for v3.11 which I have rebased on top of next-20130709. It fixes a build problem on a number of shmobile defconfigs including bockw.

Ping.

Would it be appropriate for me to take this change through my tree? It seems to resolve a regression in v3.11-rc1.

I'll take it through arm-soc since there's no response from Vinod. I've applied it in the fixes branch we have.

-Olof

#3 lore raw

PATCH 1/1 dmaengine: shdma: fix a build failure on platforms with no DMA support

Quoted 27 lines · Olof Johansson
Quoted 26 lines · Simon Horman
Quoted 24 lines · Simon Horman

From: Guennadi Liakhovetski <[email protected]>

On platforms with no support for the shdma dmaengine driver build is currently failing with

drivers/built-in.o: In function `sh_mobile_sdhi_probe':
drivers/mmc/host/sh_mobile_sdhi.c:170: undefined reference to`shdma_chan_filter'

Fix the breakage by defining shdma_chan_filter to NULL in such configurations.

[horms+renesas at verge.net.au: Apply change to shdma-base.h instead of sh_dma.h]
---
 include/linux/shdma-base.h | 4 ++++
 1 file changed, 4 insertions(+)

Hi Vinod,

please consider this fix from Guennadi for v3.11 which I have rebased on top of next-20130709. It fixes a build problem on a number of shmobile defconfigs including bockw.

Quoted 7 lines
Quoted 4 lines

Ping.

Would it be appropriate for me to take this change through my tree? It seems to resolve a regression in v3.11-rc1.

I'll take it through arm-soc since there's no response from Vinod. I've applied it in the fixes branch we have.

Thanks!

Very much appreciated.

A message that is not in the archive (sent off-list or not yet received): 87zjtddgtg.wl%[email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 87d2q8v6fs.wl%[email protected]

#7 lore raw

PATCH RESEND 1/1 shdma: fixup sh_dmae_get_partial() calculation error

sh_desc->hw.tcr is controlling real data size,
and, register TCR is controlling data transfer count which was xmit_shifted value of hw.tcr.
Current sh_dmae_get_partial() is calculating in different unit. This patch fixes it.

---

Quoted 1 line
Quoted 1 line

Guennadi

Could you please check this patch, and give it your Acked-by ?

 drivers/dma/sh/shdma.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/sh/shdma.c +2 -2
index b70709b..d670b8b 100644
@@ -388,8 +388,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan,
 						    shdma_chan);
 	struct sh_dmae_desc *sh_desc = container_of(sdesc,
 					struct sh_dmae_desc, shdma_desc);
-	return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) <<
-		sh_chan->xmit_shift;
+	return sh_desc->hw.tcr -
+		(sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift);
 }
 
 /* Called from error IRQ or NMI */
Signature · 1 line
1.7.9.5
Acked-by on v1 1/1
#8 lore raw

Re: [PATCH resend] shdma: fixup sh_dmae_get_partial() calculation error

Hi Morimoto-san

Quoted 7 lines · Kuninori Morimoto

sh_desc->hw.tcr is controlling real data size,
and, register TCR is controlling data transfer count which was xmit_shifted value of hw.tcr.
Current sh_dmae_get_partial() is calculating in different unit. This patch fixes it.

Looks right to me

Thanks
Guennadi

Quoted 26 lines

---

Quoted 1 line
Quoted 1 line

Guennadi

Could you please check this patch, and give it your Acked-by ?

 drivers/dma/sh/shdma.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/sh/shdma.c +2 -2
index b70709b..d670b8b 100644
@@ -388,8 +388,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan,
 						    shdma_chan);
 	struct sh_dmae_desc *sh_desc = container_of(sdesc,
 					struct sh_dmae_desc, shdma_desc);
-	return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) <<
-		sh_chan->xmit_shift;
+	return sh_desc->hw.tcr -
+		(sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift);
 }
 
 /* Called from error IRQ or NMI */
Signature · 1 line
1.7.9.5

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#9 lore raw

Re: [PATCH resend] shdma: fixup sh_dmae_get_partial() calculation error

Quoted 10 lines · Guennadi Liakhovetski

Hi Morimoto-san

Quoted 6 lines · Kuninori Morimoto

sh_desc->hw.tcr is controlling real data size,
and, register TCR is controlling data transfer count which was xmit_shifted value of hw.tcr.
Current sh_dmae_get_partial() is calculating in different unit. This patch fixes it.

Quoted 5 lines
Quoted 1 line

Looks right to me

Thanks, I will queue this up for v3.11 in the fixes-for-v3.11 branch.

#10 lore raw

Re: [PATCH resend] shdma: fixup sh_dmae_get_partial() calculation error

In reply to Kuninori Morimoto

[ Cc Vinod ]

Quoted 7 lines · Kuninori Morimoto

sh_desc->hw.tcr is controlling real data size,
and, register TCR is controlling data transfer count which was xmit_shifted value of hw.tcr.
Current sh_dmae_get_partial() is calculating in different unit. This patch fixes it.

Can I confirm that this was a regression introduced by 4f46f8ac80416b0e8fd3aba6a0d842205fb29140 ("dmaengine: shdma: restore partial transfer calculation") ?

Quoted 31 lines

---

Quoted 1 line
Quoted 1 line

Guennadi

Could you please check this patch, and give it your Acked-by ?

 drivers/dma/sh/shdma.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/sh/shdma.c +2 -2
index b70709b..d670b8b 100644
@@ -388,8 +388,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan,
 						    shdma_chan);
 	struct sh_dmae_desc *sh_desc = container_of(sdesc,
 					struct sh_dmae_desc, shdma_desc);
-	return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) <<
-		sh_chan->xmit_shift;
+	return sh_desc->hw.tcr -
+		(sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift);
 }
 
 /* Called from error IRQ or NMI */
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#11 lore raw

Re: [PATCH resend] shdma: fixup sh_dmae_get_partial() calculation error

Hi Simon

Quoted 9 lines · Simon Horman

[ Cc Vinod ]

Quoted 6 lines · Kuninori Morimoto

sh_desc->hw.tcr is controlling real data size,
and, register TCR is controlling data transfer count which was xmit_shifted value of hw.tcr.
Current sh_dmae_get_partial() is calculating in different unit. This patch fixes it.

Quoted 5 lines
Quoted 1 line

Can I confirm that this was a regression introduced by 4f46f8ac80416b0e8fd3aba6a0d842205fb29140 ("dmaengine: shdma: restore partial transfer calculation") ?

No, don't think so. That patch only restores what was accidentally deleted from the driver before. So, you cannot say, that before that patch the calculation was correct. And even the way it restores it was already wrong before. The error goes back to the original implementation:

commit c014906a870ce70e009def0c9d170ccabeb0be63

Author: Guennadi Liakhovetski <[email protected]>
Date:   Thu Feb 18 16:30:02 2010 +0000

dmaengine: shdma: extend .device_terminate_all() to record partial transfer

Thanks
Guennadi

Quoted 27 lines
Quoted 27 lines

---

Quoted 1 line
Quoted 1 line

Guennadi

Could you please check this patch, and give it your Acked-by ?

 drivers/dma/sh/shdma.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/sh/shdma.c +2 -2
index b70709b..d670b8b 100644
@@ -388,8 +388,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan,
 						    shdma_chan);
 	struct sh_dmae_desc *sh_desc = container_of(sdesc,
 					struct sh_dmae_desc, shdma_desc);
-	return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) <<
-		sh_chan->xmit_shift;
+	return sh_desc->hw.tcr -
+		(sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift);
 }
 
 /* Called from error IRQ or NMI */
Signature · 1 line
1.7.9.5
Quoted 6 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#12 lore raw

Re: [PATCH resend] shdma: fixup sh_dmae_get_partial() calculation error

Quoted 24 lines · Guennadi Liakhovetski

Hi Simon

Quoted 9 lines · Simon Horman

[ Cc Vinod ]

Quoted 6 lines · Kuninori Morimoto

sh_desc->hw.tcr is controlling real data size,
and, register TCR is controlling data transfer count which was xmit_shifted value of hw.tcr.
Current sh_dmae_get_partial() is calculating in different unit. This patch fixes it.

Quoted 5 lines
Quoted 1 line

Can I confirm that this was a regression introduced by 4f46f8ac80416b0e8fd3aba6a0d842205fb29140 ("dmaengine: shdma: restore partial transfer calculation") ?

No, don't think so. That patch only restores what was accidentally deleted from the driver before. So, you cannot say, that before that patch the calculation was correct. And even the way it restores it was already wrong before. The error goes back to the original implementation:

Quoted 5 lines

commit c014906a870ce70e009def0c9d170ccabeb0be63

Author: Guennadi Liakhovetski <[email protected]>
Date:   Thu Feb 18 16:30:02 2010 +0000

dmaengine: shdma: extend .device_terminate_all() to record partial transfer

Thanks, I will add the following to the changelog:

This bug has been present since c014906a870ce70e009def0c9d170ccabeb0be63 ("dmaengine: shdma: extend .device_terminate_all() to record partial transfer"), which was added in 2.6.34-rc1.