Re: USB and DMA on Alpha with 2.6.0-test7

From: David Brownell
Date: Fri Oct 10 2003 - 14:37:40 EST


David Brownell wrote:
The BUG_ON at include/asm-generic/dma-mapping.h:19 is a
bug in that "generic DMA" code ... and I've seen the
same BUG reported from PPC folk too.

Something like this should be correct even on x86, but
there may be some cases where a platform_dma_supported()
is necessary.

IMO this needs an all-architectures patch. Not many
will need a platform_dma_supported() ... but almost
every implementation of that simple call is broken.

- Dave


--- 1.4/include/asm-generic/dma-mapping.h Mon Jan 13 14:37:47 2003
+++ edited/include/asm-generic/dma-mapping.h Fri Oct 10 10:53:25 2003
@@ -13,12 +13,13 @@
/* need struct page definitions */
#include <linux/mm.h>

+/* FIXME use this everywhere there's no platform_dma_supported() */
static inline int
dma_supported(struct device *dev, u64 mask)
{
- BUG_ON(dev->bus != &pci_bus_type);
-
- return pci_dma_supported(to_pci_dev(dev), mask);
+ /* device can dma, using those address bits */
+ return dev->dma_mask
+ && (mask & *dev->dma_mask) == *dev->dma_mask;
}

static inline int