E100: another PCI problem on IXP4xx (guess all ARM)

From: khc@pm.waw.pl (Krzysztof Halasa)
Date: 2010-08-16 23:31:07
Subsystem: arm port, the rest · Maintainers: Russell King, Linus Torvalds

Hi,

I also found another PCI issue: e100 driver (to be precise, my own fix
to e100: 6ff9c2e7fa8ca63a575792534b63c5092099c286) doesn't play nice
with dma-mapping BIDIRECTIONAL direction checks. How about copying
42d53b4ff7d61487d18274ebdf1f70c1aef6f122 to ARM?

I know E100 isn't exactly designed as per DMA-API document, but given
the inner workings of cache management and DMA bouncing code, this is
the only workable solution (well, maybe using that other descriptor ring
mode is another).

Comments?

ARM: fix DMA-bounce code to allow sync from_device and to_device with
bidirectional mappings.

Signed-off-by: Krzysztof Ha?asa <khc@pm.waw.pl>
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index cc0a932..7c6ad2b 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -402,7 +402,7 @@ int dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr,
 	if (!buf)
 		return 1;
 
-	BUG_ON(buf->direction != dir);
+	BUG_ON(buf->direction != dir && buf->direction != DMA_BIDIRECTIONAL);
 
 	dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n",
 		__func__, buf->ptr, virt_to_dma(dev, buf->ptr),
@@ -431,7 +431,7 @@ int dmabounce_sync_for_device(struct device *dev, dma_addr_t addr,
 	if (!buf)
 		return 1;
 
-	BUG_ON(buf->direction != dir);
+	BUG_ON(buf->direction != dir && buf->direction != DMA_BIDIRECTIONAL);
 
 	dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n",
 		__func__, buf->ptr, virt_to_dma(dev, buf->ptr),

-- 
Krzysztof Halasa
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help