linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: simon.kagstrom@netinsight.net (Simon Kågström)
To: linux-arm-kernel@lists.infradead.org
Subject: BUG_ON for DMA-bounce and bidirectional mappings (e100 on IXP4xx)
Date: Tue, 4 Mar 2014 11:32:33 +0100	[thread overview]
Message-ID: <20140304113233.14c95fe0@marrow.netinsight.se> (raw)

(Sorry, sent to wrong mailing list address)

Hi!

We have a IXP4xx-based board which has an e100 NIC. During bootup, we
trigger a BUG_ON in dmabounce.c because the mapped direction doesn't
match the synced one. e100.c maps buffers bidirectional, but the sync
is done fromdevice.

Krzysztof Ha?asa sent a patch 2012-09-20 which excludes bidirectional
mappings from the sync BUG_ONs, as seen below. We need that patch for
our board to boot. The patch in full is available at

  http://patchwork.ozlabs.org/patch/185486/

This was never applied, but also received no comments. Does the patch
make sense?


For further reference, the e100 BUG_ON was discussed here a few years
ago:

  http://comments.gmane.org/gmane.linux.ports.arm.kernel/48922

there is a e100 patch there from Jesse Brandeburg which changes the
mapping, however with that patch the NIC stops receiving traffic after
a while.

Thanks,
// Simon

--- 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,

             reply	other threads:[~2014-03-04 10:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 10:32 Simon Kågström [this message]
     [not found] <20140304112459.354f0980@marrow.netinsight.se>
     [not found] ` <20140304104528.GQ21483@n2100.arm.linux.org.uk>
2014-03-04 11:37   ` BUG_ON for DMA-bounce and bidirectional mappings (e100 on IXP4xx) Simon Kågström
2014-03-17  9:43     ` Simon Kågström

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=20140304113233.14c95fe0@marrow.netinsight.se \
    --to=simon.kagstrom@netinsight.net \
    --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;
as well as URLs for NNTP newsgroup(s).