linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: Workaround for USB DMA bugs
@ 2002-04-04  4:19 Jeremy Rosen
  2002-04-04  6:16 ` Dan Malek
  0 siblings, 1 reply; 24+ messages in thread
From: Jeremy Rosen @ 2002-04-04  4:19 UTC (permalink / raw)
  To: linuxppc-embedded


>I guess if we can ensure a DMA-only pool, simple alignment will work.
>You just can't kmalloc() because you don't know what may follow
something
>that isn't modulo cache line size.  You also have to be careful of
code
>that allocates a large object, then uses part of it for DMA and other
>parts for processor core data.  I'm not sure we want to require
kmalloc()
>to always cache align due to the potential for wasted memory space.

can't we use the __GFP_DMA flag to specify that the area must have
algnment enforced ?
or did I misunderstand the use of this flag ?

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: Workaround for USB DMA bugs
@ 2002-04-04  6:40 Rosen Jeremy
  2002-04-04  6:52 ` David Gibson
  0 siblings, 1 reply; 24+ messages in thread
From: Rosen Jeremy @ 2002-04-04  6:40 UTC (permalink / raw)
  To: linuxppc-embedded


>
> This flag is used on architectures that have memory only accessible
> from the processor, not from a DMA device, to ensure a DMA device
> gets a memory bank that it can access.

so it specifies that the kmalloc()ed region must be usable for DMA
transfer.... which is exactly what we want.

except that for us it has impact on boudries instead of location.

TIA
Jeremy


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Workaround for USB DMA bugs
@ 2002-04-03  2:43 David Gibson
  2002-04-03  8:17 ` Armin
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: David Gibson @ 2002-04-03  2:43 UTC (permalink / raw)
  To: linuxppc-embedded


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

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:
 		BUG();
 	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);
+#else
 		invalidate_dcache_range(start, end);
+#endif
 		break;
 	case PCI_DMA_TODEVICE:		/* writeback only */
 		clean_dcache_range(start, end);


--
David Gibson			| For every complex problem there is a
david@gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.  -- H.L. Mencken
http://www.ozlabs.org/people/dgibson


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2002-04-04 20:21 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-04  4:19 Workaround for USB DMA bugs Jeremy Rosen
2002-04-04  6:16 ` Dan Malek
2002-04-04  6:32   ` David Gibson
  -- strict thread matches above, loose matches on Subject: below --
2002-04-04  6:40 Rosen Jeremy
2002-04-04  6:52 ` David Gibson
2002-04-03  2:43 David Gibson
2002-04-03  8:17 ` Armin
2002-04-03 17:39   ` Frank Rowand
2002-04-03 17:49   ` Dan Malek
2002-04-03 20:43     ` David Blythe
2002-04-03 23:34       ` David Gibson
2002-04-03  9:45 ` "David Müller (ELSOFT AG)"
2002-04-03 23:35   ` David Gibson
2002-04-03 17:42 ` Dan Malek
2002-04-03 23:40   ` David Gibson
2002-04-04  2:54     ` Dan Malek
2002-04-04  3:48       ` David Gibson
2002-04-04  4:09         ` Dan Malek
2002-04-04  5:23           ` David Gibson
2002-04-04  6:08             ` Dan Malek
2002-04-04  6:30               ` David Gibson
2002-04-04 20:21                 ` David Blythe
2002-04-04 12:35       ` Brad Parker
2002-04-04 14:12         ` Dan Malek

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