From: khc@pm.waw.pl (Krzysztof Halasa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ARM: Fix DMA-bounce code to allow sync from_device and to_device with bidirectional mappings.
Date: Sun, 23 Mar 2014 01:38:41 +0100 [thread overview]
Message-ID: <m338i9iwa6.fsf@intrepid.localdomain> (raw)
In-Reply-To: <m3siq9iyt2.fsf@intrepid.localdomain> (Krzysztof Halasa's message of "Sun, 23 Mar 2014 00:44:09 +0100")
This is equivalent of a more generic change to lib/dma-debug.c which is
present since v2.6.33:
commit 42d53b4ff7d61487d18274ebdf1f70c1aef6f122
dma-debug: allow DMA_BIDIRECTIONAL mappings to be synced with DMA_FROM_DEVICE
and DMA_TO_DEVICE.
There is no need to perform full BIDIR sync (copying the buffers in case
of swiotlb and similar schemes) if we know that the owner (CPU or device)
hasn't altered the data.
Addresses the false-positive reported at
http://bugzilla.kernel.org/show_bug.cgi?id=14169
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 1143c4d..b4c17cf 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -375,7 +375,7 @@ static int __dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr,
off = addr - buf->safe_dma_addr;
- BUG_ON(buf->direction != dir);
+ BUG_ON(buf->direction != dir && buf->direction != DMA_BIDIRECTIONAL);
dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x off=%#lx) mapped to %p (dma=%#x)\n",
__func__, buf->ptr, virt_to_dma(dev, buf->ptr), off,
@@ -415,7 +415,7 @@ static int __dmabounce_sync_for_device(struct device *dev, dma_addr_t addr,
off = addr - buf->safe_dma_addr;
- BUG_ON(buf->direction != dir);
+ BUG_ON(buf->direction != dir && buf->direction != DMA_BIDIRECTIONAL);
dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x off=%#lx) mapped to %p (dma=%#x)\n",
__func__, buf->ptr, virt_to_dma(dev, buf->ptr), off,
next prev parent reply other threads:[~2014-03-23 0:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-22 23:44 IXP4xx fixes Krzysztof Halasa
2014-03-23 0:34 ` [PATCH 1/3] IXP4xx: Fix Goramo Multilink GPIO conversion Krzysztof Halasa
2014-03-24 15:27 ` Linus Walleij
2014-03-24 20:36 ` Krzysztof Halasa
2014-03-26 22:06 ` Arnd Bergmann
2014-03-23 0:36 ` [PATCH 2/3] IXP4xx: Fix DMA masks Krzysztof Halasa
2014-03-24 13:50 ` Simon Kågström
2014-03-24 20:30 ` Krzysztof Halasa
2014-03-26 22:08 ` Arnd Bergmann
2014-03-23 0:38 ` Krzysztof Halasa [this message]
2014-03-24 13:51 ` [PATCH 3/3] ARM: Fix DMA-bounce code to allow sync from_device and to_device with bidirectional mappings Simon Kågström
2014-03-26 22:10 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m338i9iwa6.fsf@intrepid.localdomain \
--to=khc@pm.waw.pl \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox