linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 8/8] arm: dma-mapping: plumb our iommu mapping ops into arch_setup_dma_ops
Date: Tue, 20 Jan 2015 17:14:01 +0200	[thread overview]
Message-ID: <2060841.mOvatXFir7@avalon> (raw)
In-Reply-To: <20150119123058.GA7312@ulmo.nvidia.com>

Hi Thierry and Will,

On Monday 19 January 2015 13:31:00 Thierry Reding wrote:
> On Mon, Jan 19, 2015 at 01:34:24PM +0200, Laurent Pinchart wrote:
> > On Monday 19 January 2015 11:12:02 Will Deacon wrote:
> >> On Sun, Jan 18, 2015 at 11:18:51AM +0000, Laurent Pinchart wrote:
> >>> On Sunday 18 January 2015 15:54:34 Alexandre Courbot wrote:
> >>>> On 01/16/2015 08:18 AM, Laurent Pinchart wrote:
> >>>>> On Thursday 15 January 2015 11:12:17 Will Deacon wrote:

[snip]

> >>>> I am arriving late in this discussion, but what is wrong with asking
> >>>> drivers to explicitly state that they want the DMA API to be backed
> >>>> by the IOMMU instead of forcibly making it work that way?
> >>> 
> >>> The vast majority of the drivers are not IOMMU-aware. We would thus
> >>> need to add a call at the beginning of the probe function of nearly
> >>> every driver that can perform DMA to state that the driver doesn't need
> >>> to handle any IOMMU that might be present in the system itself. I don't
> >>> think that's a better solution.
> >>> 
> >>> Explicitly tearing down mappings in drivers that want to manage IOMMUs
> >>> isn't a solution I like either. A possibly better solution would be to
> >>> call a function to state that the DMA mapping API shouldn't not handle
> >>> IOMMUs. Something like
> >>> 
> >>> 	dma_mapping_ignore_iommu(dev);
> >>> 
> >>> at the beginning of the probe function of such drivers could do. The
> >>> function would perform behind the scene all operations needed to tear
> >>> down everything that shouldn't have been set up.
> >> 
> >> An alternative would be to add a flag to platform_driver, like we have
> >> for "prevent_deferred_probe" which is something like
> >> "prevent_dma_configure".
> > 
> > That's a solution I have proposed (albeit as a struct device_driver field,
> > but that's a small detail), so I'm fine with it :-)
> 
> I think Marek had proposed something similar initially as well. I don't
> see an immediate downside to that solution. It's still somewhat ugly in
> that a lot of stuff is set up before it's known to actually be used at
> all, but it seems like there's some consensus that this can be improved
> later on, so I have no objections to such a patch.
> 
> Of course that doesn't solve the current breakage for the Rockchip DRM
> and OMAP ISP drivers.

And, as I came to realize after a long bisect yesternight, the Renesas IPMMU 
driver :-/ Basically any platform that relied on arm_iommu_attach_device() to 
set the IOMMU DMA ops is now broken.

> There's an additional issue with this automatic type of setting up
> mapping: on Tegra quite a few devices can use the IOMMU. Among those are
> SD/MMC controllers, HDA, SATA and things like the AHB bus. Creating a
> separate domain (== address space) for each of those devices is wasteful
> and there's currently no way to make them use a single virtual address
> space. Each of them really has no use for a full 4 GiB of address space.
> My earliest attempt to implement that was as a policy decision within
> the IOMMU driver, but that wasn't very well received.

A similar discussion started at http://www.spinics.net/lists/arm-kernel/msg385805.html but didn't go very far.

In the end it's really a policy decision. The question is how to express that 
policy. As policies in DT are frowned upon we have several subsystems 
currently hacking around similar issues by implementing heuristics or defaults 
that nobody really complained about so far. We might be able to do the same 
for IOMMUs as a first step.

> I'm now wondering whether the same could be done using this new type of
> flag. Perhaps it can be assumed that every driver that doesn't want its
> IOMMU master hooked up to the DMA API can (and will) manually manage the
> virtual address space. Conversely every driver that wants to use the DMA
> API to abstract away the existence of an IOMMU could be considered part
> of the group where a separate domain isn't necessary.

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2015-01-20 15:14 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 16:57 [PATCH v6 0/8] Introduce automatic DMA configuration for IOMMU masters Will Deacon
2014-12-01 16:57 ` [PATCH v6 1/8] iommu: provide early initialisation hook for IOMMU drivers Will Deacon
2014-12-01 23:54   ` Rob Herring
2014-12-02  9:23     ` Marek Szyprowski
2014-12-02  9:36       ` Arnd Bergmann
2014-12-02  9:43         ` Will Deacon
2014-12-02 12:05         ` Thierry Reding
2014-12-02 10:30     ` Pantelis Antoniou
2014-12-02 14:16     ` Grant Likely
2014-12-03 19:57       ` Arnd Bergmann
2014-12-04  9:49         ` Will Deacon
2014-12-04 10:10           ` Arnd Bergmann
2014-12-04 10:21             ` Will Deacon
2014-12-04 11:19               ` Arnd Bergmann
2014-12-04 11:25                 ` Grant Likely
2014-12-04 11:52                   ` Will Deacon
2014-12-04 12:43                     ` Grant Likely
2014-12-04 12:26         ` Robin Murphy
2014-12-04 12:42           ` Grant Likely
2014-12-04 13:43             ` Robin Murphy
2014-12-04 13:58               ` Grant Likely
2014-12-04 14:49               ` Thierry Reding
2014-12-04 17:42                 ` Robin Murphy
2014-12-04 17:58                   ` Grant Likely
2014-12-04 19:42                     ` Robin Murphy
2014-12-05 12:10                       ` Will Deacon
2014-12-05 12:21                         ` Arnd Bergmann
2014-12-05 12:35                         ` Robin Murphy
2014-12-05 13:06                           ` Grant Likely
2014-12-05 13:18                             ` Thierry Reding
2014-12-05 13:21                               ` Grant Likely
2014-12-05 13:31                                 ` Thierry Reding
2014-12-05 13:49                               ` Marek Szyprowski
2014-12-04 12:51           ` Arnd Bergmann
2014-12-01 16:57 ` [PATCH v6 2/8] dma-mapping: replace set_arch_dma_coherent_ops with arch_setup_dma_ops Will Deacon
2014-12-01 22:58   ` Rob Herring
2014-12-02  9:16     ` Arnd Bergmann
2014-12-01 16:57 ` [PATCH v6 3/8] iommu: add new iommu_ops callback for adding an OF device Will Deacon
2014-12-01 16:57 ` [PATCH v6 4/8] iommu: provide helper function to configure an IOMMU for an of master Will Deacon
2014-12-01 16:57 ` [PATCH v6 5/8] iommu: fix initialization without 'add_device' callback Will Deacon
2014-12-01 16:57 ` [PATCH v6 6/8] dma-mapping: detect and configure IOMMU in of_dma_configure Will Deacon
2014-12-01 23:06   ` Rob Herring
2014-12-10 14:52   ` Rob Clark
2014-12-10 15:08     ` Will Deacon
2014-12-10 15:54       ` Robin Murphy
2014-12-10 15:56         ` Laurent Pinchart
2014-12-14 15:49       ` Laurent Pinchart
2014-12-14 15:59         ` Laurent Pinchart
2014-12-15 17:10           ` Will Deacon
2014-12-15 16:40         ` Will Deacon
2014-12-15 17:16           ` Laurent Pinchart
2014-12-15 18:09             ` Will Deacon
2014-12-16 12:08               ` Arnd Bergmann
2014-12-17 12:09                 ` Will Deacon
2014-12-17 14:15                   ` Arnd Bergmann
2014-12-17 14:45                     ` Will Deacon
2014-12-17 15:35                       ` Arnd Bergmann
2014-12-17 17:17                         ` Will Deacon
2014-12-17 19:48                           ` Arnd Bergmann
2014-12-21 10:04                             ` Will Deacon
2014-12-22 13:36                               ` Arnd Bergmann
2015-01-07 18:57                                 ` Will Deacon
2015-01-07 19:29                                   ` Arnd Bergmann
2015-01-08 10:53                                     ` Will Deacon
2014-12-17 14:27                   ` Robin Murphy
2014-12-17 15:01                     ` Will Deacon
2014-12-17 15:38                       ` Arnd Bergmann
2014-12-17 17:20                         ` Will Deacon
2014-12-17  0:05               ` Laurent Pinchart
2014-12-14 15:51   ` Laurent Pinchart
2014-12-15 11:32     ` Will Deacon
2014-12-17  0:19       ` Laurent Pinchart
2014-12-17 11:14         ` Will Deacon
2014-12-01 16:57 ` [PATCH v6 7/8] arm: call iommu_init before of_platform_populate Will Deacon
2014-12-01 16:57 ` [PATCH v6 8/8] arm: dma-mapping: plumb our iommu mapping ops into arch_setup_dma_ops Will Deacon
2015-01-14  9:00   ` Alexandre Courbot
2015-01-14 10:46     ` Will Deacon
2015-01-14 13:51       ` Heiko Stübner
2015-01-14 19:17         ` Will Deacon
2015-01-15  8:30           ` Thierry Reding
2015-01-15 11:13             ` Will Deacon
2015-01-15  2:57       ` Alexandre Courbot
2015-01-15  8:28       ` Thierry Reding
2015-01-15 11:12         ` Will Deacon
2015-01-15 23:18           ` Laurent Pinchart
2015-01-18  6:54             ` Alexandre Courbot
2015-01-18 11:18               ` Laurent Pinchart
2015-01-19 11:12                 ` Will Deacon
2015-01-19 11:34                   ` Laurent Pinchart
2015-01-19 12:31                     ` Thierry Reding
2015-01-20 15:14                       ` Laurent Pinchart [this message]
2015-01-20 15:19                         ` Will Deacon
2015-01-20 15:21                           ` Will Deacon
2015-01-20 15:35                           ` Laurent Pinchart
2015-01-19 12:43                 ` Thierry Reding
2015-01-19 12:50                   ` Will Deacon
2015-01-19 13:36                     ` Thierry Reding
2015-01-20 13:50                       ` Laurent Pinchart
2015-01-19 16:13                 ` Arnd Bergmann
2015-01-20 16:41                   ` Laurent Pinchart
2015-01-19 12:36             ` Thierry Reding
2015-01-19 15:52               ` Arnd Bergmann
2015-01-19 16:21                 ` Thierry Reding
2015-01-19 17:02                   ` Arnd Bergmann
2015-01-20 13:47                   ` Laurent Pinchart
2015-01-19 12:49             ` Thierry Reding
2015-01-20 14:05               ` Laurent Pinchart
2014-12-05  7:12 ` [PATCH v6 0/8] Introduce automatic DMA configuration for IOMMU masters Olof Johansson
2014-12-05 12:11   ` Will Deacon
2014-12-15  0:24 ` [PATCH/RFC] iommu/ipmmu-vmsa: Use DT-based instantiation Laurent Pinchart

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=2060841.mOvatXFir7@avalon \
    --to=laurent.pinchart@ideasonboard.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).