All of lore.kernel.org
 help / color / mirror / Atom feed
* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18  2:39 ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2013-06-18  2:39 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
  Cc: linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	catalin.marinas-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	Arnd-r2nGTMty4D4

Hi,

Currently ARM64 supports swiotlb only as below[1]. AFAIU, swiotlb
provides some kind of bounce buffer for some restricted H/Ws, and it
cannot replace IOMMU H/W completely. So I'm wondering that we would
need the IOMMU versions of dma_map_ops as Marek did for ARM32. If my
understanding is correct, do you guys have any idea how it's going to
be implemented? Can we reuse the current version of "iommu_ops" in
"arch/arm/mm/dma-mapping.c" for ARM64 as well? Or do we need to
rewrite 64bit version of iommu_ops completely in the same file as one
with swiotlb, "arch/arm64/mm/dma-mapping.c"?

Any feedback would be really appreciated.

[1]:
commit 09b55412469dfe6797244dc5836c17ed0c2f191b
Author: Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>
Date:   Mon Mar 5 11:49:30 2012 +0000

    arm64: DMA mapping API
    
    This patch adds support for the DMA mapping API. It uses dma_map_ops for
    flexibility and it currently supports swiotlb. This patch could be
    simplified further if the DMA accesses are coherent (not mandated by the
    architecture) or if corresponding hooks are placed in the generic
    swiotlb code to deal with cache maintenance.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18  2:39 ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2013-06-18  2:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Currently ARM64 supports swiotlb only as below[1]. AFAIU, swiotlb
provides some kind of bounce buffer for some restricted H/Ws, and it
cannot replace IOMMU H/W completely. So I'm wondering that we would
need the IOMMU versions of dma_map_ops as Marek did for ARM32. If my
understanding is correct, do you guys have any idea how it's going to
be implemented? Can we reuse the current version of "iommu_ops" in
"arch/arm/mm/dma-mapping.c" for ARM64 as well? Or do we need to
rewrite 64bit version of iommu_ops completely in the same file as one
with swiotlb, "arch/arm64/mm/dma-mapping.c"?

Any feedback would be really appreciated.

[1]:
commit 09b55412469dfe6797244dc5836c17ed0c2f191b
Author: Catalin Marinas <catalin.marinas@arm.com>
Date:   Mon Mar 5 11:49:30 2012 +0000

    arm64: DMA mapping API
    
    This patch adds support for the DMA mapping API. It uses dma_map_ops for
    flexibility and it currently supports swiotlb. This patch could be
    simplified further if the DMA accesses are coherent (not mandated by the
    architecture) or if corresponding hooks are placed in the generic
    swiotlb code to deal with cache maintenance.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18  2:39 ` Hiroshi Doyu
@ 2013-06-18 10:19     ` Will Deacon
  -1 siblings, 0 replies; 25+ messages in thread
From: Will Deacon @ 2013-06-18 10:19 UTC (permalink / raw)
  To: Hiroshi Doyu
  Cc: Arnd-r2nGTMty4D4, Catalin Marinas,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Jun 18, 2013 at 03:39:55AM +0100, Hiroshi Doyu wrote:
> Hi,

Hello Hiroshi,

> Currently ARM64 supports swiotlb only as below[1]. AFAIU, swiotlb
> provides some kind of bounce buffer for some restricted H/Ws, and it
> cannot replace IOMMU H/W completely. So I'm wondering that we would
> need the IOMMU versions of dma_map_ops as Marek did for ARM32. If my
> understanding is correct, do you guys have any idea how it's going to
> be implemented? Can we reuse the current version of "iommu_ops" in
> "arch/arm/mm/dma-mapping.c" for ARM64 as well? Or do we need to
> rewrite 64bit version of iommu_ops completely in the same file as one
> with swiotlb, "arch/arm64/mm/dma-mapping.c"?
> 
> Any feedback would be really appreciated.

I've spoken briefly with Catalin about this and it seems like there might be
*some* scope for sharing common dma-mapping code between architectures.
There doesn't really need to be any architecture-specific details in
allocating iova space and the interface to the iommu drivers is
well-defined. The arch-specific stuff is bogged down in the non-coherent
buffer management, but that doesn't necessarily equate to lots of code.

So, the best bet would be to figure out how to split up what we have under
arch/arm/ so that it can be re-used by arm64 and potentially other
architectures (powerpc has some simple stuff for coherent mappings and some
less-simple stuff for non-coherent buffers).

Will

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 10:19     ` Will Deacon
  0 siblings, 0 replies; 25+ messages in thread
From: Will Deacon @ 2013-06-18 10:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 18, 2013 at 03:39:55AM +0100, Hiroshi Doyu wrote:
> Hi,

Hello Hiroshi,

> Currently ARM64 supports swiotlb only as below[1]. AFAIU, swiotlb
> provides some kind of bounce buffer for some restricted H/Ws, and it
> cannot replace IOMMU H/W completely. So I'm wondering that we would
> need the IOMMU versions of dma_map_ops as Marek did for ARM32. If my
> understanding is correct, do you guys have any idea how it's going to
> be implemented? Can we reuse the current version of "iommu_ops" in
> "arch/arm/mm/dma-mapping.c" for ARM64 as well? Or do we need to
> rewrite 64bit version of iommu_ops completely in the same file as one
> with swiotlb, "arch/arm64/mm/dma-mapping.c"?
> 
> Any feedback would be really appreciated.

I've spoken briefly with Catalin about this and it seems like there might be
*some* scope for sharing common dma-mapping code between architectures.
There doesn't really need to be any architecture-specific details in
allocating iova space and the interface to the iommu drivers is
well-defined. The arch-specific stuff is bogged down in the non-coherent
buffer management, but that doesn't necessarily equate to lots of code.

So, the best bet would be to figure out how to split up what we have under
arch/arm/ so that it can be re-used by arm64 and potentially other
architectures (powerpc has some simple stuff for coherent mappings and some
less-simple stuff for non-coherent buffers).

Will

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 10:19     ` Will Deacon
@ 2013-06-18 10:32         ` Arnd Bergmann
  -1 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2013-06-18 10:32 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Catalin Marinas, Will Deacon,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> 
> I've spoken briefly with Catalin about this and it seems like there might be
> *some* scope for sharing common dma-mapping code between architectures.
> There doesn't really need to be any architecture-specific details in
> allocating iova space and the interface to the iommu drivers is
> well-defined. The arch-specific stuff is bogged down in the non-coherent
> buffer management, but that doesn't necessarily equate to lots of code.
> 
> So, the best bet would be to figure out how to split up what we have under
> arch/arm/ so that it can be re-used by arm64 and potentially other
> architectures (powerpc has some simple stuff for coherent mappings and some
> less-simple stuff for non-coherent buffers).

I'm sure that other architectures are interested in sharing the code.
Best move it into the global mm/ directory, at least the version for
coherent mappings.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 10:32         ` Arnd Bergmann
  0 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2013-06-18 10:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> 
> I've spoken briefly with Catalin about this and it seems like there might be
> *some* scope for sharing common dma-mapping code between architectures.
> There doesn't really need to be any architecture-specific details in
> allocating iova space and the interface to the iommu drivers is
> well-defined. The arch-specific stuff is bogged down in the non-coherent
> buffer management, but that doesn't necessarily equate to lots of code.
> 
> So, the best bet would be to figure out how to split up what we have under
> arch/arm/ so that it can be re-used by arm64 and potentially other
> architectures (powerpc has some simple stuff for coherent mappings and some
> less-simple stuff for non-coherent buffers).

I'm sure that other architectures are interested in sharing the code.
Best move it into the global mm/ directory, at least the version for
coherent mappings.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 10:32         ` Arnd Bergmann
@ 2013-06-18 10:38           ` Catalin Marinas
  -1 siblings, 0 replies; 25+ messages in thread
From: Catalin Marinas @ 2013-06-18 10:38 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Will Deacon, linaro-mm-sig, iommu, Hiroshi Doyu,
	linux-arm-kernel, m.szyprowski

On Tue, Jun 18, 2013 at 11:32:44AM +0100, Arnd Bergmann wrote:
> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > I've spoken briefly with Catalin about this and it seems like there might be
> > *some* scope for sharing common dma-mapping code between architectures.
> > There doesn't really need to be any architecture-specific details in
> > allocating iova space and the interface to the iommu drivers is
> > well-defined. The arch-specific stuff is bogged down in the non-coherent
> > buffer management, but that doesn't necessarily equate to lots of code.
> > 
> > So, the best bet would be to figure out how to split up what we have under
> > arch/arm/ so that it can be re-used by arm64 and potentially other
> > architectures (powerpc has some simple stuff for coherent mappings and some
> > less-simple stuff for non-coherent buffers).
> 
> I'm sure that other architectures are interested in sharing the code.
> Best move it into the global mm/ directory, at least the version for
> coherent mappings.

Or we could extend the lib/iommu-helper.c or add another file in there
(we already have lib/swiotlb.c).

-- 
Catalin

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 10:38           ` Catalin Marinas
  0 siblings, 0 replies; 25+ messages in thread
From: Catalin Marinas @ 2013-06-18 10:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 18, 2013 at 11:32:44AM +0100, Arnd Bergmann wrote:
> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > I've spoken briefly with Catalin about this and it seems like there might be
> > *some* scope for sharing common dma-mapping code between architectures.
> > There doesn't really need to be any architecture-specific details in
> > allocating iova space and the interface to the iommu drivers is
> > well-defined. The arch-specific stuff is bogged down in the non-coherent
> > buffer management, but that doesn't necessarily equate to lots of code.
> > 
> > So, the best bet would be to figure out how to split up what we have under
> > arch/arm/ so that it can be re-used by arm64 and potentially other
> > architectures (powerpc has some simple stuff for coherent mappings and some
> > less-simple stuff for non-coherent buffers).
> 
> I'm sure that other architectures are interested in sharing the code.
> Best move it into the global mm/ directory, at least the version for
> coherent mappings.

Or we could extend the lib/iommu-helper.c or add another file in there
(we already have lib/swiotlb.c).

-- 
Catalin

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 10:32         ` Arnd Bergmann
@ 2013-06-18 11:01           ` Hiroshi Doyu
  -1 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2013-06-18 11:01 UTC (permalink / raw)
  To: will.deacon-5wv7dgnIgG8, arnd-r2nGTMty4D4
  Cc: Catalin.Marinas-5wv7dgnIgG8,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote @ Tue, 18 Jun 2013 12:32:44 +0200:

> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > 
> > I've spoken briefly with Catalin about this and it seems like there might be
> > *some* scope for sharing common dma-mapping code between architectures.
> > There doesn't really need to be any architecture-specific details in
> > allocating iova space and the interface to the iommu drivers is
> > well-defined. The arch-specific stuff is bogged down in the non-coherent
> > buffer management, but that doesn't necessarily equate to lots of code.
> > 
> > So, the best bet would be to figure out how to split up what we have under
> > arch/arm/ so that it can be re-used by arm64 and potentially other
> > architectures (powerpc has some simple stuff for coherent mappings and some
> > less-simple stuff for non-coherent buffers).
> 
> I'm sure that other architectures are interested in sharing the code.
> Best move it into the global mm/ directory, at least the version for
> coherent mappings.

I'm guessing that this kind of unification usually takes some time
since we need to factor out the common code from the different
${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
it. So if we want to develop our 64-bit ARM with working DMA mapping
API during this transition, the step to take would be:

1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
3, Factor out the common code from them into mm/dma-mapping.c

Also I guess that there may be the possibility that some of DMA
mapping API may be added/tweaked to satisfy requirements from multiple
${ARCH}. We have already had some of such modifications which didn't
succeed to be upstreamed yet.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 11:01           ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2013-06-18 11:01 UTC (permalink / raw)
  To: linux-arm-kernel

Arnd Bergmann <arnd@arndb.de> wrote @ Tue, 18 Jun 2013 12:32:44 +0200:

> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > 
> > I've spoken briefly with Catalin about this and it seems like there might be
> > *some* scope for sharing common dma-mapping code between architectures.
> > There doesn't really need to be any architecture-specific details in
> > allocating iova space and the interface to the iommu drivers is
> > well-defined. The arch-specific stuff is bogged down in the non-coherent
> > buffer management, but that doesn't necessarily equate to lots of code.
> > 
> > So, the best bet would be to figure out how to split up what we have under
> > arch/arm/ so that it can be re-used by arm64 and potentially other
> > architectures (powerpc has some simple stuff for coherent mappings and some
> > less-simple stuff for non-coherent buffers).
> 
> I'm sure that other architectures are interested in sharing the code.
> Best move it into the global mm/ directory, at least the version for
> coherent mappings.

I'm guessing that this kind of unification usually takes some time
since we need to factor out the common code from the different
${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
it. So if we want to develop our 64-bit ARM with working DMA mapping
API during this transition, the step to take would be:

1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
3, Factor out the common code from them into mm/dma-mapping.c

Also I guess that there may be the possibility that some of DMA
mapping API may be added/tweaked to satisfy requirements from multiple
${ARCH}. We have already had some of such modifications which didn't
succeed to be upstreamed yet.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 11:01           ` Hiroshi Doyu
@ 2013-06-18 12:50             ` Catalin Marinas
  -1 siblings, 0 replies; 25+ messages in thread
From: Catalin Marinas @ 2013-06-18 12:50 UTC (permalink / raw)
  To: Hiroshi Doyu
  Cc: arnd, Will Deacon, linaro-mm-sig, iommu, linux-tegra,
	linux-arm-kernel, m.szyprowski

On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
> Arnd Bergmann <arnd@arndb.de> wrote @ Tue, 18 Jun 2013 12:32:44 +0200:
> > On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > > I've spoken briefly with Catalin about this and it seems like there might be
> > > *some* scope for sharing common dma-mapping code between architectures.
> > > There doesn't really need to be any architecture-specific details in
> > > allocating iova space and the interface to the iommu drivers is
> > > well-defined. The arch-specific stuff is bogged down in the non-coherent
> > > buffer management, but that doesn't necessarily equate to lots of code.
> > > 
> > > So, the best bet would be to figure out how to split up what we have under
> > > arch/arm/ so that it can be re-used by arm64 and potentially other
> > > architectures (powerpc has some simple stuff for coherent mappings and some
> > > less-simple stuff for non-coherent buffers).
> > 
> > I'm sure that other architectures are interested in sharing the code.
> > Best move it into the global mm/ directory, at least the version for
> > coherent mappings.
> 
> I'm guessing that this kind of unification usually takes some time
> since we need to factor out the common code from the different
> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> it. So if we want to develop our 64-bit ARM with working DMA mapping
> API during this transition, the step to take would be:
> 
> 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> 3, Factor out the common code from them into mm/dma-mapping.c

Or add the relevant code to something like lib/iommu-helper.c, convert
arm64 to use that and we can work on converting arm and other
architectures afterwards.

-- 
Catalin

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 12:50             ` Catalin Marinas
  0 siblings, 0 replies; 25+ messages in thread
From: Catalin Marinas @ 2013-06-18 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
> Arnd Bergmann <arnd@arndb.de> wrote @ Tue, 18 Jun 2013 12:32:44 +0200:
> > On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > > I've spoken briefly with Catalin about this and it seems like there might be
> > > *some* scope for sharing common dma-mapping code between architectures.
> > > There doesn't really need to be any architecture-specific details in
> > > allocating iova space and the interface to the iommu drivers is
> > > well-defined. The arch-specific stuff is bogged down in the non-coherent
> > > buffer management, but that doesn't necessarily equate to lots of code.
> > > 
> > > So, the best bet would be to figure out how to split up what we have under
> > > arch/arm/ so that it can be re-used by arm64 and potentially other
> > > architectures (powerpc has some simple stuff for coherent mappings and some
> > > less-simple stuff for non-coherent buffers).
> > 
> > I'm sure that other architectures are interested in sharing the code.
> > Best move it into the global mm/ directory, at least the version for
> > coherent mappings.
> 
> I'm guessing that this kind of unification usually takes some time
> since we need to factor out the common code from the different
> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> it. So if we want to develop our 64-bit ARM with working DMA mapping
> API during this transition, the step to take would be:
> 
> 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> 3, Factor out the common code from them into mm/dma-mapping.c

Or add the relevant code to something like lib/iommu-helper.c, convert
arm64 to use that and we can work on converting arm and other
architectures afterwards.

-- 
Catalin

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 11:01           ` Hiroshi Doyu
@ 2013-06-18 12:51               ` Arnd Bergmann
  -1 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2013-06-18 12:51 UTC (permalink / raw)
  To: Hiroshi Doyu
  Cc: will.deacon-5wv7dgnIgG8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Catalin.Marinas-5wv7dgnIgG8,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Tuesday 18 June 2013, Hiroshi Doyu wrote:
> I'm guessing that this kind of unification usually takes some time
> since we need to factor out the common code from the different
> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> it. So if we want to develop our 64-bit ARM with working DMA mapping
> API during this transition, the step to take would be:
> 
> 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)

Please don't.

> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> 3, Factor out the common code from them into mm/dma-mapping.c

I would suggest moving the ARM dma-mapping.c code to /mm or /lib
right away and then generalizing it there. Whoever wants to add
support for their architecture can modify the code to add whatever
changes they require.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 12:51               ` Arnd Bergmann
  0 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2013-06-18 12:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 18 June 2013, Hiroshi Doyu wrote:
> I'm guessing that this kind of unification usually takes some time
> since we need to factor out the common code from the different
> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> it. So if we want to develop our 64-bit ARM with working DMA mapping
> API during this transition, the step to take would be:
> 
> 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)

Please don't.

> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> 3, Factor out the common code from them into mm/dma-mapping.c

I would suggest moving the ARM dma-mapping.c code to /mm or /lib
right away and then generalizing it there. Whoever wants to add
support for their architecture can modify the code to add whatever
changes they require.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 12:50             ` Catalin Marinas
@ 2013-06-18 14:15                 ` Arnd Bergmann
  -1 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2013-06-18 14:15 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Hiroshi Doyu, Will Deacon,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Tuesday 18 June 2013, Catalin Marinas wrote:
> > 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> > 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> > 3, Factor out the common code from them into mm/dma-mapping.c
> 
> Or add the relevant code to something like lib/iommu-helper.c, convert
> arm64 to use that and we can work on converting arm and other
> architectures afterwards.

Yes, that would work too.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 14:15                 ` Arnd Bergmann
  0 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2013-06-18 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 18 June 2013, Catalin Marinas wrote:
> > 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> > 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> > 3, Factor out the common code from them into mm/dma-mapping.c
> 
> Or add the relevant code to something like lib/iommu-helper.c, convert
> arm64 to use that and we can work on converting arm and other
> architectures afterwards.

Yes, that would work too.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 14:15                 ` Arnd Bergmann
@ 2013-06-18 15:20                     ` Hiroshi Doyu
  -1 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2013-06-18 15:20 UTC (permalink / raw)
  To: catalin.marinas-5wv7dgnIgG8, arnd-r2nGTMty4D4
  Cc: Will.Deacon-5wv7dgnIgG8, linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote @ Tue, 18 Jun 2013 16:15:27 +0200:

> On Tuesday 18 June 2013, Catalin Marinas wrote:
> > > 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> > > 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> > > 3, Factor out the common code from them into mm/dma-mapping.c
> > 
> > Or add the relevant code to something like lib/iommu-helper.c, convert
> > arm64 to use that and we can work on converting arm and other
> > architectures afterwards.
> 
> Yes, that would work too.

Ok, this seems to be the way to go. Thank you for the guide.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 15:20                     ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2013-06-18 15:20 UTC (permalink / raw)
  To: linux-arm-kernel

Arnd Bergmann <arnd@arndb.de> wrote @ Tue, 18 Jun 2013 16:15:27 +0200:

> On Tuesday 18 June 2013, Catalin Marinas wrote:
> > > 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> > > 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> > > 3, Factor out the common code from them into mm/dma-mapping.c
> > 
> > Or add the relevant code to something like lib/iommu-helper.c, convert
> > arm64 to use that and we can work on converting arm and other
> > architectures afterwards.
> 
> Yes, that would work too.

Ok, this seems to be the way to go. Thank you for the guide.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 12:50             ` Catalin Marinas
@ 2013-06-18 22:08               ` Don Dutile
  -1 siblings, 0 replies; 25+ messages in thread
From: Don Dutile @ 2013-06-18 22:08 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: arnd, Will Deacon, linaro-mm-sig, iommu, linux-tegra,
	linux-arm-kernel, Hiroshi Doyu

On 06/18/2013 08:50 AM, Catalin Marinas wrote:
> On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
>> Arnd Bergmann<arnd@arndb.de>  wrote @ Tue, 18 Jun 2013 12:32:44 +0200:
>>> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
>>>> I've spoken briefly with Catalin about this and it seems like there might be
>>>> *some* scope for sharing common dma-mapping code between architectures.
>>>> There doesn't really need to be any architecture-specific details in
>>>> allocating iova space and the interface to the iommu drivers is
>>>> well-defined. The arch-specific stuff is bogged down in the non-coherent
>>>> buffer management, but that doesn't necessarily equate to lots of code.
>>>>
>>>> So, the best bet would be to figure out how to split up what we have under
>>>> arch/arm/ so that it can be re-used by arm64 and potentially other
>>>> architectures (powerpc has some simple stuff for coherent mappings and some
>>>> less-simple stuff for non-coherent buffers).
>>>
>>> I'm sure that other architectures are interested in sharing the code.
>>> Best move it into the global mm/ directory, at least the version for
>>> coherent mappings.
>>
>> I'm guessing that this kind of unification usually takes some time
>> since we need to factor out the common code from the different
>> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
>> it. So if we want to develop our 64-bit ARM with working DMA mapping
>> API during this transition, the step to take would be:
>>
>> 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
>> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
>> 3, Factor out the common code from them into mm/dma-mapping.c
>
> Or add the relevant code to something like lib/iommu-helper.c, convert
> arm64 to use that and we can work on converting arm and other
> architectures afterwards.
>
why not in current drivers/iommu directory ?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-18 22:08               ` Don Dutile
  0 siblings, 0 replies; 25+ messages in thread
From: Don Dutile @ 2013-06-18 22:08 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/18/2013 08:50 AM, Catalin Marinas wrote:
> On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
>> Arnd Bergmann<arnd@arndb.de>  wrote @ Tue, 18 Jun 2013 12:32:44 +0200:
>>> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
>>>> I've spoken briefly with Catalin about this and it seems like there might be
>>>> *some* scope for sharing common dma-mapping code between architectures.
>>>> There doesn't really need to be any architecture-specific details in
>>>> allocating iova space and the interface to the iommu drivers is
>>>> well-defined. The arch-specific stuff is bogged down in the non-coherent
>>>> buffer management, but that doesn't necessarily equate to lots of code.
>>>>
>>>> So, the best bet would be to figure out how to split up what we have under
>>>> arch/arm/ so that it can be re-used by arm64 and potentially other
>>>> architectures (powerpc has some simple stuff for coherent mappings and some
>>>> less-simple stuff for non-coherent buffers).
>>>
>>> I'm sure that other architectures are interested in sharing the code.
>>> Best move it into the global mm/ directory, at least the version for
>>> coherent mappings.
>>
>> I'm guessing that this kind of unification usually takes some time
>> since we need to factor out the common code from the different
>> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
>> it. So if we want to develop our 64-bit ARM with working DMA mapping
>> API during this transition, the step to take would be:
>>
>> 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
>> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
>> 3, Factor out the common code from them into mm/dma-mapping.c
>
> Or add the relevant code to something like lib/iommu-helper.c, convert
> arm64 to use that and we can work on converting arm and other
> architectures afterwards.
>
why not in current drivers/iommu directory ?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 12:50             ` Catalin Marinas
@ 2013-06-19  9:29                 ` Marek Szyprowski
  -1 siblings, 0 replies; 25+ messages in thread
From: Marek Szyprowski @ 2013-06-19  9:29 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: arnd-r2nGTMty4D4, Will Deacon,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hello,

On 6/18/2013 2:50 PM, Catalin Marinas wrote:
> On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
> > Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote @ Tue, 18 Jun 2013 12:32:44 +0200:
> > > On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > > > I've spoken briefly with Catalin about this and it seems like there might be
> > > > *some* scope for sharing common dma-mapping code between architectures.
> > > > There doesn't really need to be any architecture-specific details in
> > > > allocating iova space and the interface to the iommu drivers is
> > > > well-defined. The arch-specific stuff is bogged down in the non-coherent
> > > > buffer management, but that doesn't necessarily equate to lots of code.
> > > >
> > > > So, the best bet would be to figure out how to split up what we have under
> > > > arch/arm/ so that it can be re-used by arm64 and potentially other
> > > > architectures (powerpc has some simple stuff for coherent mappings and some
> > > > less-simple stuff for non-coherent buffers).
> > >
> > > I'm sure that other architectures are interested in sharing the code.
> > > Best move it into the global mm/ directory, at least the version for
> > > coherent mappings.
> >
> > I'm guessing that this kind of unification usually takes some time
> > since we need to factor out the common code from the different
> > ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> > it. So if we want to develop our 64-bit ARM with working DMA mapping
> > API during this transition, the step to take would be:
> >
> > 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> > 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> > 3, Factor out the common code from them into mm/dma-mapping.c
>
> Or add the relevant code to something like lib/iommu-helper.c, convert
> arm64 to use that and we can work on converting arm and other
> architectures afterwards.

I think that this would be the best way of providing iommu support for 
dma mapping
subsystem(s). I initially put it in arm/mm/dma-mapping.c because it was 
the first
approach of integrating generic IOMMU with DMA-mapping and it was simply 
easier to
have all the code in one place. Now, when second client of such approach 
comes, it
should be much easier to identify which part of the code is common and 
which one is
specific to particular implementation. Feel free to ask any questions if 
you need
help. I don't have access to any ARM64 machine or simulator, so I can 
only review
the code.

Best regards
-- 
Marek Szyprowski
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-19  9:29                 ` Marek Szyprowski
  0 siblings, 0 replies; 25+ messages in thread
From: Marek Szyprowski @ 2013-06-19  9:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On 6/18/2013 2:50 PM, Catalin Marinas wrote:
> On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
> > Arnd Bergmann <arnd@arndb.de> wrote @ Tue, 18 Jun 2013 12:32:44 +0200:
> > > On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > > > I've spoken briefly with Catalin about this and it seems like there might be
> > > > *some* scope for sharing common dma-mapping code between architectures.
> > > > There doesn't really need to be any architecture-specific details in
> > > > allocating iova space and the interface to the iommu drivers is
> > > > well-defined. The arch-specific stuff is bogged down in the non-coherent
> > > > buffer management, but that doesn't necessarily equate to lots of code.
> > > >
> > > > So, the best bet would be to figure out how to split up what we have under
> > > > arch/arm/ so that it can be re-used by arm64 and potentially other
> > > > architectures (powerpc has some simple stuff for coherent mappings and some
> > > > less-simple stuff for non-coherent buffers).
> > >
> > > I'm sure that other architectures are interested in sharing the code.
> > > Best move it into the global mm/ directory, at least the version for
> > > coherent mappings.
> >
> > I'm guessing that this kind of unification usually takes some time
> > since we need to factor out the common code from the different
> > ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> > it. So if we want to develop our 64-bit ARM with working DMA mapping
> > API during this transition, the step to take would be:
> >
> > 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> > 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> > 3, Factor out the common code from them into mm/dma-mapping.c
>
> Or add the relevant code to something like lib/iommu-helper.c, convert
> arm64 to use that and we can work on converting arm and other
> architectures afterwards.

I think that this would be the best way of providing iommu support for 
dma mapping
subsystem(s). I initially put it in arm/mm/dma-mapping.c because it was 
the first
approach of integrating generic IOMMU with DMA-mapping and it was simply 
easier to
have all the code in one place. Now, when second client of such approach 
comes, it
should be much easier to identify which part of the code is common and 
which one is
specific to particular implementation. Feel free to ask any questions if 
you need
help. I don't have access to any ARM64 machine or simulator, so I can 
only review
the code.

Best regards
-- 
Marek Szyprowski
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: DMA mapping API(IOMMU) for ARM64?
  2013-06-18 22:08               ` Don Dutile
@ 2013-06-19 11:11                   ` Catalin Marinas
  -1 siblings, 0 replies; 25+ messages in thread
From: Catalin Marinas @ 2013-06-19 11:11 UTC (permalink / raw)
  To: Don Dutile
  Cc: arnd-r2nGTMty4D4, Will Deacon,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Jun 18, 2013 at 11:08:15PM +0100, Don Dutile wrote:
> On 06/18/2013 08:50 AM, Catalin Marinas wrote:
> > On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
> >> Arnd Bergmann<arnd-r2nGTMty4D4@public.gmane.org>  wrote @ Tue, 18 Jun 2013 12:32:44 +0200:
> >>> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> >>>> I've spoken briefly with Catalin about this and it seems like there might be
> >>>> *some* scope for sharing common dma-mapping code between architectures.
> >>>> There doesn't really need to be any architecture-specific details in
> >>>> allocating iova space and the interface to the iommu drivers is
> >>>> well-defined. The arch-specific stuff is bogged down in the non-coherent
> >>>> buffer management, but that doesn't necessarily equate to lots of code.
> >>>>
> >>>> So, the best bet would be to figure out how to split up what we have under
> >>>> arch/arm/ so that it can be re-used by arm64 and potentially other
> >>>> architectures (powerpc has some simple stuff for coherent mappings and some
> >>>> less-simple stuff for non-coherent buffers).
> >>>
> >>> I'm sure that other architectures are interested in sharing the code.
> >>> Best move it into the global mm/ directory, at least the version for
> >>> coherent mappings.
> >>
> >> I'm guessing that this kind of unification usually takes some time
> >> since we need to factor out the common code from the different
> >> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> >> it. So if we want to develop our 64-bit ARM with working DMA mapping
> >> API during this transition, the step to take would be:
> >>
> >> 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> >> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> >> 3, Factor out the common code from them into mm/dma-mapping.c
> >
> > Or add the relevant code to something like lib/iommu-helper.c, convert
> > arm64 to use that and we can work on converting arm and other
> > architectures afterwards.
> >
> why not in current drivers/iommu directory ?

That's not really specific to the iommu driver implementation, they have
a clearly defined interface. For similarity with swiotlb and given that
we already have iommu-helper.c, lib/ looks best to me. Anyway, let's
first see how the code looks like, it can be moved later.

-- 
Catalin

^ permalink raw reply	[flat|nested] 25+ messages in thread

* DMA mapping API(IOMMU) for ARM64?
@ 2013-06-19 11:11                   ` Catalin Marinas
  0 siblings, 0 replies; 25+ messages in thread
From: Catalin Marinas @ 2013-06-19 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 18, 2013 at 11:08:15PM +0100, Don Dutile wrote:
> On 06/18/2013 08:50 AM, Catalin Marinas wrote:
> > On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
> >> Arnd Bergmann<arnd@arndb.de>  wrote @ Tue, 18 Jun 2013 12:32:44 +0200:
> >>> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> >>>> I've spoken briefly with Catalin about this and it seems like there might be
> >>>> *some* scope for sharing common dma-mapping code between architectures.
> >>>> There doesn't really need to be any architecture-specific details in
> >>>> allocating iova space and the interface to the iommu drivers is
> >>>> well-defined. The arch-specific stuff is bogged down in the non-coherent
> >>>> buffer management, but that doesn't necessarily equate to lots of code.
> >>>>
> >>>> So, the best bet would be to figure out how to split up what we have under
> >>>> arch/arm/ so that it can be re-used by arm64 and potentially other
> >>>> architectures (powerpc has some simple stuff for coherent mappings and some
> >>>> less-simple stuff for non-coherent buffers).
> >>>
> >>> I'm sure that other architectures are interested in sharing the code.
> >>> Best move it into the global mm/ directory, at least the version for
> >>> coherent mappings.
> >>
> >> I'm guessing that this kind of unification usually takes some time
> >> since we need to factor out the common code from the different
> >> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> >> it. So if we want to develop our 64-bit ARM with working DMA mapping
> >> API during this transition, the step to take would be:
> >>
> >> 1, Copy arch/arm/mm/dma-mapping.c arch/arm64/mm/dma-mapping.c(+swiotlb)
> >> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> >> 3, Factor out the common code from them into mm/dma-mapping.c
> >
> > Or add the relevant code to something like lib/iommu-helper.c, convert
> > arm64 to use that and we can work on converting arm and other
> > architectures afterwards.
> >
> why not in current drivers/iommu directory ?

That's not really specific to the iommu driver implementation, they have
a clearly defined interface. For similarity with swiotlb and given that
we already have iommu-helper.c, lib/ looks best to me. Anyway, let's
first see how the code looks like, it can be moved later.

-- 
Catalin

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Linaro-mm-sig] DMA mapping API(IOMMU) for ARM64?
       [not found]                   ` <20130619111137.GJ9261-jF64zX8BO082Zs7wWoiTUGZHpeb/A1Y/@public.gmane.org>
@ 2014-02-05 16:10                     ` Ritesh Harjani
  0 siblings, 0 replies; 25+ messages in thread
From: Ritesh Harjani @ 2014-02-05 16:10 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	arnd-r2nGTMty4D4


[-- Attachment #1.1: Type: text/plain, Size: 3080 bytes --]

Hi All,

Frankly speaking, I didn't follow up this discussion until this point where
I wanted to know whether we have iommu ops support in dma-mapping API for
64BIT ARM Arch.
If anyone can please provide some more info as what is the current status
on this and is it completely supported now ?



Thanks
Ritesh





On Wed, Jun 19, 2013 at 4:41 PM, Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>wrote:

> On Tue, Jun 18, 2013 at 11:08:15PM +0100, Don Dutile wrote:
> > On 06/18/2013 08:50 AM, Catalin Marinas wrote:
> > > On Tue, Jun 18, 2013 at 12:01:37PM +0100, Hiroshi Doyu wrote:
> > >> Arnd Bergmann<arnd-r2nGTMty4D4@public.gmane.org>  wrote @ Tue, 18 Jun 2013 12:32:44
> +0200:
> > >>> On Tuesday 18 June 2013 11:19:14 Will Deacon wrote:
> > >>>> I've spoken briefly with Catalin about this and it seems like there
> might be
> > >>>> *some* scope for sharing common dma-mapping code between
> architectures.
> > >>>> There doesn't really need to be any architecture-specific details in
> > >>>> allocating iova space and the interface to the iommu drivers is
> > >>>> well-defined. The arch-specific stuff is bogged down in the
> non-coherent
> > >>>> buffer management, but that doesn't necessarily equate to lots of
> code.
> > >>>>
> > >>>> So, the best bet would be to figure out how to split up what we
> have under
> > >>>> arch/arm/ so that it can be re-used by arm64 and potentially other
> > >>>> architectures (powerpc has some simple stuff for coherent mappings
> and some
> > >>>> less-simple stuff for non-coherent buffers).
> > >>>
> > >>> I'm sure that other architectures are interested in sharing the code.
> > >>> Best move it into the global mm/ directory, at least the version for
> > >>> coherent mappings.
> > >>
> > >> I'm guessing that this kind of unification usually takes some time
> > >> since we need to factor out the common code from the different
> > >> ${ARCH}/mm/dma-mapping.c. Also some of ${ARCH} has IOMMU support in
> > >> it. So if we want to develop our 64-bit ARM with working DMA mapping
> > >> API during this transition, the step to take would be:
> > >>
> > >> 1, Copy arch/arm/mm/dma-mapping.c
> arch/arm64/mm/dma-mapping.c(+swiotlb)
> > >> 2, Adapt arch/arm64/mm/dma-mapping.c(+swiotlb) to 64bit compatible.
> > >> 3, Factor out the common code from them into mm/dma-mapping.c
> > >
> > > Or add the relevant code to something like lib/iommu-helper.c, convert
> > > arm64 to use that and we can work on converting arm and other
> > > architectures afterwards.
> > >
> > why not in current drivers/iommu directory ?
>
> That's not really specific to the iommu driver implementation, they have
> a clearly defined interface. For similarity with swiotlb and given that
> we already have iommu-helper.c, lib/ looks best to me. Anyway, let's
> first see how the code looks like, it can be moved later.
>
> --
> Catalin
>
> _______________________________________________
> Linaro-mm-sig mailing list
> Linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org
> http://lists.linaro.org/mailman/listinfo/linaro-mm-sig
>

[-- Attachment #1.2: Type: text/html, Size: 4395 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2014-02-05 16:10 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18  2:39 DMA mapping API(IOMMU) for ARM64? Hiroshi Doyu
2013-06-18  2:39 ` Hiroshi Doyu
     [not found] ` <20130618.053955.305832937374936961.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-06-18 10:19   ` Will Deacon
2013-06-18 10:19     ` Will Deacon
     [not found]     ` <20130618101914.GB3539-MRww78TxoiP5vMa5CHWGZ34zcgK1vI+I0E9HWUfgJXw@public.gmane.org>
2013-06-18 10:32       ` Arnd Bergmann
2013-06-18 10:32         ` Arnd Bergmann
2013-06-18 10:38         ` Catalin Marinas
2013-06-18 10:38           ` Catalin Marinas
2013-06-18 11:01         ` Hiroshi Doyu
2013-06-18 11:01           ` Hiroshi Doyu
2013-06-18 12:50           ` Catalin Marinas
2013-06-18 12:50             ` Catalin Marinas
     [not found]             ` <20130618125054.GL9930-5wv7dgnIgG8@public.gmane.org>
2013-06-18 14:15               ` Arnd Bergmann
2013-06-18 14:15                 ` Arnd Bergmann
     [not found]                 ` <201306181615.27341.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-18 15:20                   ` Hiroshi Doyu
2013-06-18 15:20                     ` Hiroshi Doyu
2013-06-19  9:29               ` Marek Szyprowski
2013-06-19  9:29                 ` Marek Szyprowski
2013-06-18 22:08             ` Don Dutile
2013-06-18 22:08               ` Don Dutile
     [not found]               ` <51C0DA4F.1010405-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-06-19 11:11                 ` Catalin Marinas
2013-06-19 11:11                   ` Catalin Marinas
     [not found]                   ` <20130619111137.GJ9261-jF64zX8BO082Zs7wWoiTUGZHpeb/A1Y/@public.gmane.org>
2014-02-05 16:10                     ` [Linaro-mm-sig] " Ritesh Harjani
     [not found]           ` <20130618.140137.1551430695673122122.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-06-18 12:51             ` Arnd Bergmann
2013-06-18 12:51               ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.