Workaround for USB DMA bugs

David Gibson david at
Wed Apr 3 12:43:22 EST 2002

Well, I'm not sure I'd want to pollute the tree with this sort of
hack, but on the other hand it makes things work that wouldn't

Does anyone think it's a good idea to commit the following patch:

diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/mm/cachemap.c linux-grinch/arch/ppc/mm/cachemap.c
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/mm/cachemap.c	Thu Mar 14 13:49:01 2002
+++ linux-grinch/arch/ppc/mm/cachemap.c	Wed Apr  3 11:51:30 2002
@@ -137,7 +137,18 @@
 	case PCI_DMA_NONE:
 	case PCI_DMA_FROMDEVICE:	/* invalidate only */
+#ifdef CONFIG_USB
+		/* The USB stack is broken in that it uses DMA buffers
+                   on the stack which are on the stack and not
+                   cacheline aligned.  That means cache invalidates
+                   before DMA transfers corrupt the stack on machines
+                   without DMA-consistent cache.  This is a nasty
+                   workaround until the USB layer is fixed (apparently
+                   done in 2.5). */
+		flush_dcache_range(start, end);
 		invalidate_dcache_range(start, end);
 	case PCI_DMA_TODEVICE:		/* writeback only */
 		clean_dcache_range(start, end);

David Gibson			| For every complex problem there is a
david at	| solution which is simple, neat and
				| wrong.  -- H.L. Mencken

** Sent via the linuxppc-embedded mail list. See

More information about the Linuxppc-embedded mailing list