From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] arm64: do not set dma masks that device connection can't handle
Date: Tue, 10 Jan 2017 11:51:33 +0000 [thread overview]
Message-ID: <20170110115132.GD21598@arm.com> (raw)
In-Reply-To: <1483947002-16410-1-git-send-email-nikita.yoush@cogentembedded.com>
On Mon, Jan 09, 2017 at 10:30:02AM +0300, Nikita Yushchenko wrote:
> It is possible that device is capable of 64-bit DMA addresses, and
> device driver tries to set wide DMA mask, but bridge or bus used to
> connect device to the system can't handle wide addresses.
>
> With swiotlb, memory above 4G still can be used by drivers for streaming
> DMA, but *dev->mask and dev->dma_coherent_mask must still keep values
> that hardware handles physically.
>
> This patch enforces that. Based on original version by
> Arnd Bergmann <arnd@arndb.de>, extended with coherent mask hadnling.
>
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> CC: Arnd Bergmann <arnd@arndb.de>
> ---
> Changes since v1:
> - fixed issues noted by Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> - save mask, not size
> - remove doube empty line
>
> arch/arm64/Kconfig | 3 +++
> arch/arm64/include/asm/device.h | 1 +
> arch/arm64/mm/dma-mapping.c | 51 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 55 insertions(+)
I still don't think this patch is general enough. The problem you're seeing
with swiotlb seems to be exactly the same problem reported by Feng Kan over
at:
http://lkml.kernel.org/r/CAL85gmA_SSCwM80TKdkZqEe+S1beWzDEvdki1kpkmUTDRmSP7g at mail.gmail.com
[read on; it was initially thought to be a hardware erratum, but it's
actually the inability to restrict the DMA mask of the endpoint that's
the problem]
The point here is that an IOMMU doesn't solve your issue, and the
IOMMU-backed DMA ops need the same treatment. In light of that, it really
feels to me like the DMA masks should be restricted in of_dma_configure
so that the parent mask is taken into account there, rather than hook
into each set of DMA ops to intercept set_dma_mask. We'd still need to
do something to stop dma_set_mask widening the mask if it was restricted
by of_dma_configure, but I think Robin (cc'd) was playing with that.
Will
next prev parent reply other threads:[~2017-01-10 11:51 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-09 7:30 [PATCH v2] arm64: do not set dma masks that device connection can't handle Nikita Yushchenko
2017-01-10 11:51 ` Will Deacon [this message]
2017-01-10 12:47 ` Nikita Yushchenko
2017-01-10 13:12 ` Arnd Bergmann
2017-01-10 13:25 ` Robin Murphy
2017-01-10 13:42 ` Arnd Bergmann
2017-01-10 14:16 ` Robin Murphy
2017-01-10 15:06 ` Arnd Bergmann
2017-01-11 12:37 ` Nikita Yushchenko
2017-01-11 16:21 ` Arnd Bergmann
2017-01-11 18:28 ` Robin Murphy
2017-01-10 14:59 ` Christoph Hellwig
2017-01-10 14:00 ` [PATCH] arm64: avoid increasing DMA masks above what hardware supports Nikita Yushchenko
2017-01-10 17:14 ` Robin Murphy
2017-01-11 7:59 ` Nikita Yushchenko
2017-01-11 11:54 ` Robin Murphy
2017-01-11 13:41 ` Nikita Yushchenko
2017-01-11 14:50 ` Robin Murphy
2017-01-11 16:03 ` Nikita Yushchenko
2017-01-11 16:50 ` Robin Murphy
2017-01-11 18:31 ` [PATCH 0/2] arm64: fix handling of DMA masks wider than bus supports Nikita Yushchenko
2017-01-11 18:31 ` [PATCH 1/2] dma-mapping: let arch know origin of dma range passed to arch_setup_dma_ops() Nikita Yushchenko
2017-01-11 21:08 ` Arnd Bergmann
2017-01-12 5:52 ` Nikita Yushchenko
2017-01-12 6:33 ` Nikita Yushchenko
2017-01-12 13:28 ` Arnd Bergmann
2017-01-12 13:39 ` Nikita Yushchenko
2017-01-12 12:16 ` Will Deacon
2017-01-12 13:25 ` Arnd Bergmann
2017-01-12 13:43 ` Robin Murphy
2017-01-13 10:40 ` kbuild test robot
2017-01-11 18:31 ` [PATCH 2/2] arm64: avoid increasing DMA masks above what hardware supports Nikita Yushchenko
2017-01-11 21:11 ` Arnd Bergmann
2017-01-12 5:53 ` Nikita Yushchenko
2017-01-13 10:16 ` kbuild test robot
2017-01-10 14:01 ` [PATCH v2] arm64: do not set dma masks that device connection can't handle Nikita Yushchenko
2017-01-10 14:57 ` Christoph Hellwig
2017-01-10 14:51 ` Christoph Hellwig
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=20170110115132.GD21598@arm.com \
--to=will.deacon@arm.com \
--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).