linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Renesas R-Car DMAC fixes
@ 2015-01-27 17:25 Laurent Pinchart
       [not found] ` <1422379516-1633-1-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Laurent Pinchart @ 2015-01-27 17:25 UTC (permalink / raw)
  To: linux-sh

Hello,

Here are a couple of fixes for the rcar-dmac driver. They're based on the next
branch of the dmaengine tree.

The first four patches fix driver bugs, while the last two work around two
hardware issues. Patch 5 works around a documented errata, while patch 6
handles a data corruption issue that was noticed during test but not yet
confirmed to be a hardware bug by Renesas. When more information about the
issue will be available a better fix could possibly be developed.

Laurent Pinchart (6):
  dmaengine: rcar-dmac: Fix uninitialized variable usage
  dmaengine: rcar-dmac: Fix spinlock issues in interrupt
  dmaengine: rcar-dmac: Fix oops due to unintialized list in error ISR
  dmaengine: rcar-dmac: Allocate hardware descriptors with DMAC device
  dmaengine: rcar-dmac: Work around descriptor mode IOMMU errata
  dmaengine: rcar-dmac: Disable channel 0 when using IOMMU

 drivers/dma/sh/rcar-dmac.c | 147 ++++++++++++++++++++++++++-------------------
 1 file changed, 86 insertions(+), 61 deletions(-)

-- 
Regards,

Laurent Pinchart


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

* [PATCH 6/6] dmaengine: rcar-dmac: Disable channel 0 when using IOMMU
       [not found] ` <1422379516-1633-1-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2015-01-27 17:25   ` Laurent Pinchart
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2015-01-27 17:25 UTC (permalink / raw)
  To: dmaengine-u79uwXL29TY76Z2rM5mHXA
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Magnus Damm,
	linux-sh-u79uwXL29TY76Z2rM5mHXA

A still unconfirmed hardware bug prevents the IPMMU microTLB 0 to be
flushed correctly, resulting in memory corruption. DMAC 0 channel 0 is
connected to microTLB 0 on currently supported platforms, so we can't
use it with the IPMMU. As the IOMMU API operates at the device level we
can't disable it selectively, so ignore channel 0 for now if the device
is part of an IOMMU group.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/dma/sh/rcar-dmac.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

As this patch works around an IOMMU bug in a DMA engine driver it would
benefit from review from IOMMU developers.

Cc: iommu@lists.linux-foundation.org
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Magnus Damm <magnus.damm@gmail.com>

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index d345d3d81813..e0bf38a7284e 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1595,6 +1595,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
 		DMA_SLAVE_BUSWIDTH_2_BYTES | DMA_SLAVE_BUSWIDTH_4_BYTES |
 		DMA_SLAVE_BUSWIDTH_8_BYTES | DMA_SLAVE_BUSWIDTH_16_BYTES |
 		DMA_SLAVE_BUSWIDTH_32_BYTES | DMA_SLAVE_BUSWIDTH_64_BYTES;
+	unsigned int channels_offset = 0;
 	struct dma_device *engine;
 	struct rcar_dmac *dmac;
 	struct resource *mem;
@@ -1614,6 +1615,19 @@ static int rcar_dmac_probe(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;
 
+	/*
+	 * A still unconfirmed hardware bug prevents the IPMMU microTLB 0 to be
+	 * flushed correctly, resulting in memory corruption. DMAC 0 channel 0
+	 * is connected to microTLB 0 on currently supported platforms, so we
+	 * can't use it with the IPMMU. As the IOMMU API operates at the device
+	 * level we can't disable it selectively, so ignore channel 0 for now if
+	 * the device is part of an IOMMU group.
+	 */
+	if (pdev->dev.iommu_group) {
+		dmac->n_channels--;
+		channels_offset = 1;
+	}
+
 	dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels,
 				      sizeof(*dmac->channels), GFP_KERNEL);
 	if (!dmac->channels)
@@ -1664,7 +1678,8 @@ static int rcar_dmac_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&dmac->engine.channels);
 
 	for (i = 0; i < dmac->n_channels; ++i) {
-		ret = rcar_dmac_chan_probe(dmac, &dmac->channels[i], i);
+		ret = rcar_dmac_chan_probe(dmac, &dmac->channels[i],
+					   i + channels_offset);
 		if (ret < 0)
 			goto error;
 	}
-- 
2.0.5


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

* Re: [PATCH 0/6] Renesas R-Car DMAC fixes
  2015-01-27 17:25 [PATCH 0/6] Renesas R-Car DMAC fixes Laurent Pinchart
       [not found] ` <1422379516-1633-1-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2015-01-27 17:42 ` Geert Uytterhoeven
  2015-01-27 17:48 ` Laurent Pinchart
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-01-27 17:42 UTC (permalink / raw)
  To: linux-sh

Hi Laurent,

On Tue, Jan 27, 2015 at 6:25 PM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> Here are a couple of fixes for the rcar-dmac driver. They're based on the next
> branch of the dmaengine tree.
>
> The first four patches fix driver bugs, while the last two work around two
> hardware issues. Patch 5 works around a documented errata, while patch 6
> handles a data corruption issue that was noticed during test but not yet
> confirmed to be a hardware bug by Renesas. When more information about the
> issue will be available a better fix could possibly be developed.

Thanks for this series!

BTW, do you have a pointer to the IOMMU errata?

> Laurent Pinchart (6):
>   dmaengine: rcar-dmac: Fix uninitialized variable usage
>   dmaengine: rcar-dmac: Fix spinlock issues in interrupt
>   dmaengine: rcar-dmac: Fix oops due to unintialized list in error ISR
>   dmaengine: rcar-dmac: Allocate hardware descriptors with DMAC device
>   dmaengine: rcar-dmac: Work around descriptor mode IOMMU errata
>   dmaengine: rcar-dmac: Disable channel 0 when using IOMMU

Look all good to me, so
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/6] Renesas R-Car DMAC fixes
  2015-01-27 17:25 [PATCH 0/6] Renesas R-Car DMAC fixes Laurent Pinchart
       [not found] ` <1422379516-1633-1-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  2015-01-27 17:42 ` [PATCH 0/6] Renesas R-Car DMAC fixes Geert Uytterhoeven
@ 2015-01-27 17:48 ` Laurent Pinchart
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2015-01-27 17:48 UTC (permalink / raw)
  To: linux-sh

Hi Geert,

On Tuesday 27 January 2015 18:42:54 Geert Uytterhoeven wrote:
> On Tue, Jan 27, 2015 at 6:25 PM, Laurent Pinchart wrote:
> > Here are a couple of fixes for the rcar-dmac driver. They're based on the
> > next branch of the dmaengine tree.
> > 
> > The first four patches fix driver bugs, while the last two work around two
> > hardware issues. Patch 5 works around a documented errata, while patch 6
> > handles a data corruption issue that was noticed during test but not yet
> > confirmed to be a hardware bug by Renesas. When more information about the
> > issue will be available a better fix could possibly be developed.
> 
> Thanks for this series!
> 
> BTW, do you have a pointer to the IOMMU errata?

It's a DMAC errata, and all I have is short explanation received in an e-mail 
I'm afraid.

> > Laurent Pinchart (6):
> >   dmaengine: rcar-dmac: Fix uninitialized variable usage
> >   dmaengine: rcar-dmac: Fix spinlock issues in interrupt
> >   dmaengine: rcar-dmac: Fix oops due to unintialized list in error ISR
> >   dmaengine: rcar-dmac: Allocate hardware descriptors with DMAC device
> >   dmaengine: rcar-dmac: Work around descriptor mode IOMMU errata
> >   dmaengine: rcar-dmac: Disable channel 0 when using IOMMU
> 
> Look all good to me, so
> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thank you.

-- 
Regards,

Laurent Pinchart


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

end of thread, other threads:[~2015-01-27 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-27 17:25 [PATCH 0/6] Renesas R-Car DMAC fixes Laurent Pinchart
     [not found] ` <1422379516-1633-1-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2015-01-27 17:25   ` [PATCH 6/6] dmaengine: rcar-dmac: Disable channel 0 when using IOMMU Laurent Pinchart
2015-01-27 17:42 ` [PATCH 0/6] Renesas R-Car DMAC fixes Geert Uytterhoeven
2015-01-27 17:48 ` Laurent Pinchart

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