From: Bjorn Helgaas <bhelgaas@google.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-doc@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joerg Roedel <joro@8bytes.org>,
Randy Dunlap <rdunlap@infradead.org>,
Liviu Dudau <Liviu.Dudau@arm.com>,
linux-kernel@vger.kernel.org,
James Bottomley <jbottomley@parallels.com>,
linux-pci@vger.kernel.org, David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v2 4/5] iommu: Use dma_addr_t for IOVA arguments
Date: Thu, 8 May 2014 14:30:53 -0600 [thread overview]
Message-ID: <20140508203053.GA14448@google.com> (raw)
In-Reply-To: <15249748.Q2CaU9aBE9@wuerfel>
On Thu, May 08, 2014 at 12:44:12PM +0200, Arnd Bergmann wrote:
> On Wednesday 07 May 2014 18:18:14 Bjorn Helgaas wrote:
> > On Wed, May 07, 2014 at 09:58:58AM +0200, Arnd Bergmann wrote:
> > > On Tuesday 06 May 2014 16:48:40 Bjorn Helgaas wrote:
> > > > Convert the "iova" arguments of iommu_map(), iommu_unmap(), etc., from
> > > > "unsigned long" to dma_addr_t.
> > > >
> > > > bb5547acfcd8 ("iommu/fsl: Make iova dma_addr_t in the iommu_iova_to_phys
> > > > API") did this for iommu_iova_to_phys(), but didn't fix the rest of the
> > > > IOMMU API.
> > >
> > > This patch looks 100% correct, but I'm not convinced it's a good idea:
> > > On 32-bit platforms (i.e. most of the ones you change), doing 64-bit
> > > arithmetic has a noticeable overhead. I am not aware of an IOMMU that
> > > actually uses 64-bit DMA addresses on its slave side, usually they
> > > are used to translate addresses from 32-bit masters into 64-bit
> > > memory addresses, so using 'unsigned long' seems better from a practical
> > > point of view as opposed to the strict type correctness.
> >
> > The current x86 IOMMUs support DMA addresses larger than 32 bits, but
> > obviously those platforms usually run 64-bit kernels so "unsigned
> > long" is already 64 bits.
> >
> > I guess you're thinking about cases where "unsigned long" is 32 bits,
> > the IOMMU only supports 32 bit DMA addresses, and dma_addr_t is 64
> > bits. If the IOMMU only supports 32-bit DMA addresses, is there any
> > value in having a 64-bit dma_addr_t?
>
> Two cases:
>
> a) You can have a system with some DMA masters that are 64-bit capable,
> and other masters that can only do 32-bit DMA and for this reason
> use an IOMMU. I expect to see more of these in the future.
>
> b) We build kernels that run on a multitude of ARM32 platforms these
> days. We have some that require a 32-bit dma_addr_t and some that
> don't (because they always use swiotlb or an IOMMU).
Those both make sense (I assume you meant some ARM32 platforms require
a *64-bit* dma_addr_t, i.e., you might want to build an ILP32 kernel
with a 64-bit dma_addr_t).
I doubt there would be a noticeable performance effect since these are
relatively low-frequency interfaces (map, unmap, report_fault), but I
don't have any numbers, so I'll drop this for now.
Bjorn
next prev parent reply other threads:[~2014-05-08 20:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 22:48 [PATCH v2 0/5] Clean up DMA API & IOMMU dma_addr_t usage Bjorn Helgaas
2014-05-06 22:48 ` [PATCH v2 1/5] DMA-API: Clarify physical/bus address distinction Bjorn Helgaas
2014-05-07 7:37 ` Arnd Bergmann
2014-05-07 18:43 ` Bjorn Helgaas
2014-05-08 9:24 ` Greg Kroah-Hartman
2014-05-06 22:48 ` [PATCH v2 2/5] DMA-API: Change dma_declare_coherent_memory() CPU address to phys_addr_t Bjorn Helgaas
2014-05-07 7:38 ` Arnd Bergmann
2014-05-06 22:48 ` [PATCH v2 3/5] sh/PCI: Pass GAPSPCI_DMA_BASE CPU address to dma_declare_coherent_memory() Bjorn Helgaas
2014-05-07 7:55 ` Arnd Bergmann
2014-05-07 8:15 ` Arnd Bergmann
2014-05-07 23:18 ` Bjorn Helgaas
2014-05-08 11:36 ` Arnd Bergmann
2014-05-06 22:48 ` [PATCH v2 4/5] iommu: Use dma_addr_t for IOVA arguments Bjorn Helgaas
2014-05-07 7:58 ` Arnd Bergmann
2014-05-08 0:18 ` Bjorn Helgaas
2014-05-08 10:44 ` Arnd Bergmann
2014-05-08 20:30 ` Bjorn Helgaas [this message]
2014-05-09 9:58 ` David Woodhouse
2014-05-09 15:32 ` Bjorn Helgaas
2014-05-09 19:52 ` Arnd Bergmann
2014-05-09 20:19 ` Bjorn Helgaas
2014-05-09 20:25 ` James Bottomley
2014-05-06 22:48 ` [PATCH v2 5/5] iommu/exynos: Remove unnecessary "&" from function pointers Bjorn Helgaas
2014-05-07 7:59 ` 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=20140508203053.GA14448@google.com \
--to=bhelgaas@google.com \
--cc=Liviu.Dudau@arm.com \
--cc=arnd@arndb.de \
--cc=dwmw2@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbottomley@parallels.com \
--cc=joro@8bytes.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rdunlap@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).