All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: fix Oops in the serial SCI driver
@ 2010-05-21 15:22     ` Guennadi Liakhovetski
  0 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-21 15:22 UTC (permalink / raw)
  To: linux-sh@vger.kernel.org; +Cc: linux-serial

Fix an Oops, triggering, if the DMA buffer allocation for the Rx channel in
sh-sci.c fails.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/serial/sh-sci.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 304a877..7b273c9 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1007,8 +1007,9 @@ static void sci_rx_dma_release(struct sci_port *s, bool enable_pio)
 	s->chan_rx = NULL;
 	s->cookie_rx[0] = s->cookie_rx[1] = -EINVAL;
 	dma_release_channel(chan);
-	dma_free_coherent(port->dev, s->buf_len_rx * 2,
-			  sg_virt(&s->sg_rx[0]), sg_dma_address(&s->sg_rx[0]));
+	if (sg_dma_address(&s->sg_rx[0]))
+		dma_free_coherent(port->dev, s->buf_len_rx * 2,
+				  sg_virt(&s->sg_rx[0]), sg_dma_address(&s->sg_rx[0]));
 	if (enable_pio)
 		sci_start_rx(port);
 }
-- 
1.6.2.4


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

* [PATCH] sh: fix Oops in the serial SCI driver
@ 2010-05-21 15:22     ` Guennadi Liakhovetski
  0 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-21 15:22 UTC (permalink / raw)
  To: linux-sh@vger.kernel.org; +Cc: linux-serial

Fix an Oops, triggering, if the DMA buffer allocation for the Rx channel in
sh-sci.c fails.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/serial/sh-sci.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 304a877..7b273c9 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1007,8 +1007,9 @@ static void sci_rx_dma_release(struct sci_port *s, bool enable_pio)
 	s->chan_rx = NULL;
 	s->cookie_rx[0] = s->cookie_rx[1] = -EINVAL;
 	dma_release_channel(chan);
-	dma_free_coherent(port->dev, s->buf_len_rx * 2,
-			  sg_virt(&s->sg_rx[0]), sg_dma_address(&s->sg_rx[0]));
+	if (sg_dma_address(&s->sg_rx[0]))
+		dma_free_coherent(port->dev, s->buf_len_rx * 2,
+				  sg_virt(&s->sg_rx[0]), sg_dma_address(&s->sg_rx[0]));
 	if (enable_pio)
 		sci_start_rx(port);
 }
-- 
1.6.2.4


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

* [PATCH] sh: prevent the DMA driver from unloading, while in use
@ 2010-05-21 15:28 ` Guennadi Liakhovetski
  2010-05-21 15:22     ` Guennadi Liakhovetski
  0 siblings, 1 reply; 6+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-21 15:28 UTC (permalink / raw)
  To: linux-sh

This prevents the driver from unloading, while it is in use. Unloading of the
driver, while its DMA channels are held, leads to a kernel Oops.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/dma/shdma.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 25ddb1e..58563a0 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -1186,6 +1186,7 @@ static struct platform_driver sh_dmae_driver = {
 	.remove		= __exit_p(sh_dmae_remove),
 	.shutdown	= sh_dmae_shutdown,
 	.driver = {
+		.owner	= THIS_MODULE,
 		.name	= "sh-dma-engine",
 	},
 };
-- 
1.6.2.4


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

* [PATCH] sh: guard cookie consistency across termination in the DMA
@ 2010-05-21 15:30 Guennadi Liakhovetski
  2010-05-21 15:28 ` [PATCH] sh: prevent the DMA driver from unloading, while in use Guennadi Liakhovetski
  0 siblings, 1 reply; 6+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-21 15:30 UTC (permalink / raw)
  To: linux-sh

If all descriptors on a channel are terminated or the channel is released,
update the completed cookie counter to match the last cookie. This prevents
inconsistency warning on resumed DMA operation.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/dma/shdma.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 58563a0..041c6a3 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -714,6 +714,10 @@ static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
 {
 	while (__ld_cleanup(sh_chan, all))
 		;
+
+	if (all)
+		/* Terminating - forgive uncompleted cookies */
+		sh_chan->completed_cookie = sh_chan->common.cookie;
 }
 
 static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan)
-- 
1.6.2.4


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

* Re: [PATCH] sh: fix Oops in the serial SCI driver
  2010-05-21 15:22     ` Guennadi Liakhovetski
@ 2010-05-22  8:10       ` Paul Mundt
  -1 siblings, 0 replies; 6+ messages in thread
From: Paul Mundt @ 2010-05-22  8:10 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-sh@vger.kernel.org, linux-serial, Dan Williams

On Fri, May 21, 2010 at 05:22:40PM +0200, Guennadi Liakhovetski wrote:
> Fix an Oops, triggering, if the DMA buffer allocation for the Rx channel in
> sh-sci.c fails.

On Fri, May 21, 2010 at 05:28:51PM +0200, Guennadi Liakhovetski wrote:
> This prevents the driver from unloading, while it is in use. Unloading of the
> driver, while its DMA channels are held, leads to a kernel Oops.

On Fri, May 21, 2010 at 05:30:12PM +0200, Guennadi Liakhovetski wrote:
> If all descriptors on a channel are terminated or the channel is released,
> update the completed cookie counter to match the last cookie. This prevents
> inconsistency warning on resumed DMA operation.

Applied, thanks.

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

* Re: [PATCH] sh: fix Oops in the serial SCI driver
@ 2010-05-22  8:10       ` Paul Mundt
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Mundt @ 2010-05-22  8:10 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-sh@vger.kernel.org, linux-serial, Dan Williams

On Fri, May 21, 2010 at 05:22:40PM +0200, Guennadi Liakhovetski wrote:
> Fix an Oops, triggering, if the DMA buffer allocation for the Rx channel in
> sh-sci.c fails.

On Fri, May 21, 2010 at 05:28:51PM +0200, Guennadi Liakhovetski wrote:
> This prevents the driver from unloading, while it is in use. Unloading of the
> driver, while its DMA channels are held, leads to a kernel Oops.

On Fri, May 21, 2010 at 05:30:12PM +0200, Guennadi Liakhovetski wrote:
> If all descriptors on a channel are terminated or the channel is released,
> update the completed cookie counter to match the last cookie. This prevents
> inconsistency warning on resumed DMA operation.

Applied, thanks.

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

end of thread, other threads:[~2010-05-22  8:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 15:30 [PATCH] sh: guard cookie consistency across termination in the DMA Guennadi Liakhovetski
2010-05-21 15:28 ` [PATCH] sh: prevent the DMA driver from unloading, while in use Guennadi Liakhovetski
2010-05-21 15:22   ` [PATCH] sh: fix Oops in the serial SCI driver Guennadi Liakhovetski
2010-05-21 15:22     ` Guennadi Liakhovetski
2010-05-22  8:10     ` Paul Mundt
2010-05-22  8:10       ` Paul Mundt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.