linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [stable patch 2.6.20 1/3] Missing critical phys_to_virt in lib/swiotlb.c
@ 2007-02-09 23:40 Stefan Richter
  2007-02-09 23:41 ` [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix Stefan Richter
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Richter @ 2007-02-09 23:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, linux1394-devel

Date: Sun, 04 Feb 2007 13:39:40 -0500
From: David Moore <dcm@acm.org>

Adds missing call to phys_to_virt() in the
lib/swiotlb.c:swiotlb_sync_sg() function.  Without this change, a kernel
panic will always occur whenever a SWIOTLB bounce buffer from a
scatter-gather list gets synced.

Signed-off-by: David Moore <dcm@acm.org>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---

This is a fraction of patch "[IA64] swiotlb bug fixes" in 2.6.20-git#,
commit cde14bbfb3aa79b479db35bd29e6c083513d8614.  Unlike its heading
suggests, it is also important for EM64T.

Example crashes caused by swiotlb_sync_sg:
http://lists.opensuse.org/opensuse-bugs/2006-12/msg02943.html
http://qa.mandriva.com/show_bug.cgi?id=28224
http://www.pchdtv.com/forum/viewtopic.php?t=2063&sid=a959a14a4c2db0eebaab7b0df56103ce

--- linux-2.6.20.orig/lib/swiotlb.c	2007-02-04 13:18:41.000000000 -0500
+++ linux-2.6.20/lib/swiotlb.c	2007-02-04 13:19:43.000000000 -0500
@@ -750,7 +750,7 @@ swiotlb_sync_sg(struct device *hwdev, st
 
 	for (i = 0; i < nelems; i++, sg++)
 		if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
-			sync_single(hwdev, (void *) sg->dma_address,
+			sync_single(hwdev, phys_to_virt(sg->dma_address),
 				    sg->dma_length, dir, target);
 }
 

-- 
Stefan Richter
-=====-=-=== --=- -=-=-
http://arcgraph.de/sr/


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

* [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix
  2007-02-09 23:40 [stable patch 2.6.20 1/3] Missing critical phys_to_virt in lib/swiotlb.c Stefan Richter
@ 2007-02-09 23:41 ` Stefan Richter
  2007-02-09 23:44   ` [stable patch 2.6.20 3/3] ieee1394: fix host device registering when nodemgr disabled Stefan Richter
  2007-02-10  9:51   ` [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix Stefan Richter
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Richter @ 2007-02-09 23:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, linux1394-devel

Date: Sat, 03 Feb 2007 03:09:09 -0500
From: David Moore <dcm@acm.org>

This together with the phys_to_virt fix in lib/swiotlb.c::swiotlb_sync_sg
fixes video1394 DMA on machines with DMA bounce buffers, especially Intel
x86-64 machines with > 3GB RAM.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: David Moore <dcm@acm.org>
Tested-by: Nicolas Turro <Nicolas.Turro@inrialpes.fr>
---
 drivers/ieee1394/video1394.c |    8 ++++++++
 1 file changed, 8 insertions(+)

same as commit a5782010b4e75cba571357efaa27df22a89427c2 in linux-2.6.20-git#

Index: linux-2.6.20/drivers/ieee1394/video1394.c
===================================================================
--- linux-2.6.20.orig/drivers/ieee1394/video1394.c
+++ linux-2.6.20/drivers/ieee1394/video1394.c
@@ -489,6 +489,9 @@ static void wakeup_dma_ir_ctx(unsigned l
 			reset_ir_status(d, i);
 			d->buffer_status[d->buffer_prg_assignment[i]] = VIDEO1394_BUFFER_READY;
 			do_gettimeofday(&d->buffer_time[d->buffer_prg_assignment[i]]);
+			dma_region_sync_for_cpu(&d->dma,
+				d->buffer_prg_assignment[i] * d->buf_size,
+				d->buf_size);
 		}
 	}
 
@@ -1096,6 +1099,8 @@ static long video1394_ioctl(struct file 
 			DBGMSG(ohci->host->id, "Starting iso transmit DMA ctx=%d",
 			       d->ctx);
 			put_timestamp(ohci, d, d->last_buffer);
+			dma_region_sync_for_device(&d->dma,
+				v.buffer * d->buf_size, d->buf_size);
 
 			/* Tell the controller where the first program is */
 			reg_write(ohci, d->cmdPtr,
@@ -1111,6 +1116,9 @@ static long video1394_ioctl(struct file 
 				      "Waking up iso transmit dma ctx=%d",
 				      d->ctx);
 				put_timestamp(ohci, d, d->last_buffer);
+				dma_region_sync_for_device(&d->dma,
+					v.buffer * d->buf_size, d->buf_size);
+
 				reg_write(ohci, d->ctrlSet, 0x1000);
 			}
 		}


-- 
Stefan Richter
-=====-=-=== --=- -=-=-
http://arcgraph.de/sr/


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

* [stable patch 2.6.20 3/3] ieee1394: fix host device registering when nodemgr disabled
  2007-02-09 23:41 ` [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix Stefan Richter
@ 2007-02-09 23:44   ` Stefan Richter
  2007-02-10  9:51   ` [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix Stefan Richter
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Richter @ 2007-02-09 23:44 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, linux1394-devel

Date: Tue, 6 Feb 2007 02:34:45 +0100 (CET)
From: Stefan Richter <stefanr@s5r6.in-berlin.de>

Since my commit 8252bbb1363b7fe963a3eb6f8a36da619a6f5a65 in 2.6.20-rc1,
host devices have a dummy driver attached.  Alas the driver was not
registered before use if ieee1394 was loaded with disable_nodemgr=1.

This resulted in non-functional FireWire drivers or kernel lockup.
http://bugzilla.kernel.org/show_bug.cgi?id=7942

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/ieee1394/nodemgr.c |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

same as commit 91efa462054d44ae52b0c6c8325ed5e899f2cd17 in linux-2.6.20-git#

(Side note:  The parameter disable_nodemgr=1 is merely an optional
tuning parameter for people who know what they are doing and who don't
need device discovery and bus management.)

Index: linux-2.6.20/drivers/ieee1394/nodemgr.c
===================================================================
--- linux-2.6.20.orig/drivers/ieee1394/nodemgr.c
+++ linux-2.6.20/drivers/ieee1394/nodemgr.c
@@ -274,7 +274,6 @@ static struct device_driver nodemgr_mid_
 struct device nodemgr_dev_template_host = {
 	.bus		= &ieee1394_bus_type,
 	.release	= nodemgr_release_host,
-	.driver		= &nodemgr_mid_layer_driver,
 };
 
 
@@ -1889,22 +1888,31 @@ int init_ieee1394_nodemgr(void)
 
 	error = class_register(&nodemgr_ne_class);
 	if (error)
-		return error;
-
+		goto fail_ne;
 	error = class_register(&nodemgr_ud_class);
-	if (error) {
-		class_unregister(&nodemgr_ne_class);
-		return error;
-	}
+	if (error)
+		goto fail_ud;
 	error = driver_register(&nodemgr_mid_layer_driver);
+	if (error)
+		goto fail_ml;
+	/* This driver is not used if nodemgr is off (disable_nodemgr=1). */
+	nodemgr_dev_template_host.driver = &nodemgr_mid_layer_driver;
+
 	hpsb_register_highlevel(&nodemgr_highlevel);
 	return 0;
+
+fail_ml:
+	class_unregister(&nodemgr_ud_class);
+fail_ud:
+	class_unregister(&nodemgr_ne_class);
+fail_ne:
+	return error;
 }
 
 void cleanup_ieee1394_nodemgr(void)
 {
 	hpsb_unregister_highlevel(&nodemgr_highlevel);
-
+	driver_unregister(&nodemgr_mid_layer_driver);
 	class_unregister(&nodemgr_ud_class);
 	class_unregister(&nodemgr_ne_class);
 }


-- 
Stefan Richter
-=====-=-=== --=- -=-=-
http://arcgraph.de/sr/


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

* Re: [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix
  2007-02-09 23:41 ` [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix Stefan Richter
  2007-02-09 23:44   ` [stable patch 2.6.20 3/3] ieee1394: fix host device registering when nodemgr disabled Stefan Richter
@ 2007-02-10  9:51   ` Stefan Richter
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Richter @ 2007-02-10  9:51 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, linux1394-devel

PS: 1/3 "Missing critical phys_to_virt in lib/swiotlb.c"
and 2/3 "ieee1394: video1394: DMA fix"
are applicable to older kernels too.
-- 
Stefan Richter
-=====-=-=== --=- -=-=-
http://arcgraph.de/sr/

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

end of thread, other threads:[~2007-02-10  9:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-09 23:40 [stable patch 2.6.20 1/3] Missing critical phys_to_virt in lib/swiotlb.c Stefan Richter
2007-02-09 23:41 ` [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix Stefan Richter
2007-02-09 23:44   ` [stable patch 2.6.20 3/3] ieee1394: fix host device registering when nodemgr disabled Stefan Richter
2007-02-10  9:51   ` [stable patch 2.6.20 2/3] ieee1394: video1394: DMA fix Stefan Richter

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