linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] devicetree: Add generic IOMMU device tree bindings
Date: Wed, 21 May 2014 18:01:06 +0200	[thread overview]
Message-ID: <4376848.aihqtRyYDl@wuerfel> (raw)
In-Reply-To: <CANEJEGvhEsC9wKqX_pYmOg7LwsQkoN9=jjXJuW0UeEa9XywSPw@mail.gmail.com>

On Wednesday 21 May 2014 08:44:42 Grant Grundler wrote:
> On Wed, May 21, 2014 at 2:32 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Wednesday 21 May 2014 11:02:45 Thierry Reding wrote:
> >> On Wed, May 21, 2014 at 10:54:42AM +0200, Arnd Bergmann wrote:
> >>
> >> > Right. As long as we always unmap the buffers from the IOMMU after they
> >> > have stopped being in use, it's very unlikely that even a broken device
> >> > driver causes a DMA into some bus address that happens to be mapped for
> >> > another device.
> >>
> >> I think that if buffers remain mapped in the IOMMU when they have been
> >> deallocated that should be considered a bug.
> 
> There is currently no general requirement to tear down mappings immediately.
> An option to enforce immediate tear down might be useful since I agree
> Virtual Guests sharing host memory through shared physical devices
> will want that. ie there should be no opportunity for a shared device
> to be able to access another guests memory through "stale" (but live)
> DMA mappings. I don't think that's the case but I'd ask someone like
> Alex Williamson for a more certain answer.

I believe powerpc has a boot-time option to enforce the immediate
IOTLB flush, which is very useful for device driver debugging when
something goes wrong with stale DMAs.

> > Obviously you have to maintain the IO page tables correctly.
> 
> To be clear, "Correctly" in this case just means until the IOTLB is
> flushed, the given IOMMU Pdir entries are marked "in use" even though
> the driver has handed "ownership" back to the IOMMU driver.

I don't know what a Pdir is, but I guess strictly speaking we have
to ensure that all IO page table entries that have been unmapped by
a driver are marked as invalid at least by the time the IOTLB is flushed,
plus we have to flush each entry before it gets reused for a different
page.

	Arnd

  reply	other threads:[~2014-05-21 16:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 12:23 [PATCH] devicetree: Add generic IOMMU device tree bindings Thierry Reding
2014-05-17  8:04 ` Cho KyongHo
2014-05-17 20:48   ` Thierry Reding
2014-05-19 10:26 ` Arnd Bergmann
2014-05-19 12:53   ` Thierry Reding
2014-05-19 17:22     ` Dave Martin
2014-05-19 20:32       ` Thierry Reding
2014-05-20 10:08         ` Arnd Bergmann
2014-05-20 13:07           ` Dave Martin
2014-05-20 13:23             ` Arnd Bergmann
2014-05-20 15:26               ` Will Deacon
2014-05-20 16:39                 ` Dave Martin
2014-05-20 20:40                   ` Arnd Bergmann
2014-05-19 18:34     ` Arnd Bergmann
2014-05-19 20:59       ` Thierry Reding
2014-05-20 10:04         ` Arnd Bergmann
2014-05-20 11:05           ` Thierry Reding
2014-05-20 11:15             ` Arnd Bergmann
2014-05-20 12:02               ` Thierry Reding
2014-05-20 12:41                 ` Arnd Bergmann
2014-05-20 13:17                   ` Thierry Reding
2014-05-20 13:34                     ` Arnd Bergmann
2014-05-20 14:00                       ` Thierry Reding
2014-05-20 20:31                         ` Arnd Bergmann
2014-05-21  8:16                           ` Thierry Reding
2014-05-21  8:54                             ` Arnd Bergmann
2014-05-21  9:02                               ` Thierry Reding
2014-05-21  9:32                                 ` Arnd Bergmann
2014-05-21 15:44                                   ` Grant Grundler
2014-05-21 16:01                                     ` Arnd Bergmann [this message]
2014-05-20 15:24                   ` Dave Martin
2014-05-20 20:26                     ` Arnd Bergmann
2014-05-21  8:26                       ` Thierry Reding
2014-05-21  8:50                         ` Arnd Bergmann
2014-05-21  9:00                           ` Thierry Reding
2014-05-21  9:36                             ` Arnd Bergmann
2014-05-21 10:50                               ` Thierry Reding
2014-05-21 14:01                                 ` Arnd Bergmann
2014-05-21 17:09                             ` Dave Martin
2014-05-21 18: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=4376848.aihqtRyYDl@wuerfel \
    --to=arnd@arndb.de \
    --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).