All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Tony Lindgren <tony@atomide.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Fernando Guzman Lugo <fernando.lugo@ti.com>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Ramesh Gupta <grgupta@ti.com>,
	Hari Kanigeri <h-kanigeri2@ti.com>,
	Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Subject: Re: [PATCH] OMAP: iommu flush page table entries from L1 and L2 cache
Date: Mon, 18 Apr 2011 13:58:53 +0200	[thread overview]
Message-ID: <201104181358.53521.arnd@arndb.de> (raw)
In-Reply-To: <20110418110502.GI12272@atomide.com>

On Monday 18 April 2011, Tony Lindgren wrote:
> * Arnd Bergmann <arnd@arndb.de> [110418 10:26]:
> > On Friday 15 April 2011, Russell King - ARM Linux wrote:
> > > On Thu, Apr 14, 2011 at 04:52:48PM -0500, Fernando Guzman Lugo wrote:
> > > > From: Ramesh Gupta <grgupta@ti.com>
> > > > 
> > > > This patch is to flush the iommu page table entries from L1 and L2
> > > > caches using dma_map_single. This also simplifies the implementation
> > > > by removing the functions  flush_iopgd_range/flush_iopte_range.
> > > 
> > > No.  This usage is just wrong.  If you're going to use the DMA API then
> > > unmap it, otherwise the DMA API debugging will go awol.
> > 
> > 
> > It's also completely upside-down: The iommu support should provide interfaces
> > using the dma-mapping API, not use that API to provide a machine specific
> > version of the generic interface.
> > 
> > As far as I can tell, nothing actually uses these drivers, maybe we should just
> > remove them before we get any code in the mainline kernel that depends on it.
> 
> There is drivers/media/video/omap3isp/isp.c.

Ah, I didn't see that, was looking at an older version.

> But if we now have a generic replacement for this code we should start
> using it.

To give some background:

Historically, the dma-mapping API has been used for all IOMMUs on
architectures that need it. This interface is rather flexible,
but ARM currently only uses it for managing static mappings.
One thing that it cannot do is mapping memory to an arbitrary
(driver-chosen) bus address. The generic iommu API was added in order
to do that, and is mostly used for virtual machines with KVM.

The MSM platform in ARM also added support for the generic iommu
API, and now the exynos4 is gaining support for it as well.

One missing piece is still a way for a platform to provide both
the iommu and the dma-mapping API in a unified driver. Right now,
you have to export both interface for a generic solution.

On ARM, we don't yet use include/asm-generic/dma-mapping-common.h,
which allows overriding the dma-mapping API per device. This would
have to change if you want to export the IOMMU functionality using
the dma-mapping API, but that would also allow abstracting the
various ways we currently have (dmabounce, swiotlb, linear map,
custom __arch_page_to_dma, iommu, coherent or noncoherent DMA)
in a nicer way per device.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] OMAP: iommu flush page table entries from L1 and L2 cache
Date: Mon, 18 Apr 2011 13:58:53 +0200	[thread overview]
Message-ID: <201104181358.53521.arnd@arndb.de> (raw)
In-Reply-To: <20110418110502.GI12272@atomide.com>

On Monday 18 April 2011, Tony Lindgren wrote:
> * Arnd Bergmann <arnd@arndb.de> [110418 10:26]:
> > On Friday 15 April 2011, Russell King - ARM Linux wrote:
> > > On Thu, Apr 14, 2011 at 04:52:48PM -0500, Fernando Guzman Lugo wrote:
> > > > From: Ramesh Gupta <grgupta@ti.com>
> > > > 
> > > > This patch is to flush the iommu page table entries from L1 and L2
> > > > caches using dma_map_single. This also simplifies the implementation
> > > > by removing the functions  flush_iopgd_range/flush_iopte_range.
> > > 
> > > No.  This usage is just wrong.  If you're going to use the DMA API then
> > > unmap it, otherwise the DMA API debugging will go awol.
> > 
> > 
> > It's also completely upside-down: The iommu support should provide interfaces
> > using the dma-mapping API, not use that API to provide a machine specific
> > version of the generic interface.
> > 
> > As far as I can tell, nothing actually uses these drivers, maybe we should just
> > remove them before we get any code in the mainline kernel that depends on it.
> 
> There is drivers/media/video/omap3isp/isp.c.

Ah, I didn't see that, was looking at an older version.

> But if we now have a generic replacement for this code we should start
> using it.

To give some background:

Historically, the dma-mapping API has been used for all IOMMUs on
architectures that need it. This interface is rather flexible,
but ARM currently only uses it for managing static mappings.
One thing that it cannot do is mapping memory to an arbitrary
(driver-chosen) bus address. The generic iommu API was added in order
to do that, and is mostly used for virtual machines with KVM.

The MSM platform in ARM also added support for the generic iommu
API, and now the exynos4 is gaining support for it as well.

One missing piece is still a way for a platform to provide both
the iommu and the dma-mapping API in a unified driver. Right now,
you have to export both interface for a generic solution.

On ARM, we don't yet use include/asm-generic/dma-mapping-common.h,
which allows overriding the dma-mapping API per device. This would
have to change if you want to export the IOMMU functionality using
the dma-mapping API, but that would also allow abstracting the
various ways we currently have (dmabounce, swiotlb, linear map,
custom __arch_page_to_dma, iommu, coherent or noncoherent DMA)
in a nicer way per device.

	Arnd

  parent reply	other threads:[~2011-04-18 11:59 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14 21:52 [PATCH] OMAP: iommu flush page table entries from L1 and L2 cache Fernando Guzman Lugo
2011-04-14 21:52 ` Fernando Guzman Lugo
2011-04-14 21:52 ` Fernando Guzman Lugo
2011-04-14 22:30 ` Russell King - ARM Linux
2011-04-14 22:30   ` Russell King - ARM Linux
2011-04-15  2:24   ` KyongHo Cho
2011-04-15  2:24     ` KyongHo Cho
2011-04-15  8:12     ` Russell King - ARM Linux
2011-04-15  8:12       ` Russell King - ARM Linux
2011-04-15 11:26   ` Gupta, Ramesh
2011-04-15 11:26     ` Gupta, Ramesh
2011-04-28 13:40     ` Russell King - ARM Linux
2011-04-28 13:40       ` Russell King - ARM Linux
2011-04-28 13:40       ` Russell King - ARM Linux
2011-04-28 16:48       ` Gupta, Ramesh
2011-04-28 16:48         ` Gupta, Ramesh
2011-08-11 19:28         ` Gupta, Ramesh
2011-08-11 19:28           ` Gupta, Ramesh
2011-08-11 22:29           ` Russell King - ARM Linux
2011-08-11 22:29             ` Russell King - ARM Linux
2011-08-11 22:29             ` Russell King - ARM Linux
2011-08-12 16:05             ` Gupta, Ramesh
2011-08-12 16:05               ` Gupta, Ramesh
2011-08-12 16:05               ` Gupta, Ramesh
2011-10-16 18:32               ` C.A, Subramaniam
2011-10-16 18:32                 ` C.A, Subramaniam
2012-05-29 15:53               ` Gupta, Ramesh
2012-05-29 15:53                 ` Gupta, Ramesh
2011-04-18  7:29   ` Arnd Bergmann
2011-04-18  7:29     ` Arnd Bergmann
2011-04-18 11:05     ` Tony Lindgren
2011-04-18 11:05       ` Tony Lindgren
2011-04-18 11:42       ` Hiroshi DOYU
2011-04-18 11:42         ` Hiroshi DOYU
2011-04-18 13:25         ` Arnd Bergmann
2011-04-18 13:25           ` Arnd Bergmann
2011-04-18 11:58       ` Arnd Bergmann [this message]
2011-04-18 11:58         ` Arnd Bergmann
2011-04-18 12:55         ` Kyungmin Park
2011-04-18 12:55           ` Kyungmin Park
2011-04-18 12:55           ` Kyungmin Park
2011-04-18 14:13           ` Arnd Bergmann
2011-04-18 14:13             ` Arnd Bergmann
2011-04-19  9:11             ` Kyungmin Park
2011-04-19  9:11               ` Kyungmin Park
2011-04-19 12:01               ` Arnd Bergmann
2011-04-19 12:01                 ` Arnd Bergmann
2011-04-19 12:35                 ` Kyungmin Park
2011-04-19 12:35                   ` Kyungmin Park
2011-04-19 13:02                   ` Russell King - ARM Linux
2011-04-19 13:02                     ` Russell King - ARM Linux
2011-04-19 13:11                   ` Arnd Bergmann
2011-04-19 13:11                     ` 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=201104181358.53521.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=andrzej.p@samsung.com \
    --cc=fernando.lugo@ti.com \
    --cc=grgupta@ti.com \
    --cc=h-kanigeri2@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=tony@atomide.com \
    /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 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.