All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roedel, Joerg" <Joerg.Roedel@amd.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
	Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, Tony Lindgren <tony@atomide.com>,
	linux-arm <linux-arm-kernel@lists.infradead.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>
Subject: Re: [PATCH] iommu: omap_iovmm: support non page-aligned buffers in iommu_vmap
Date: Thu, 1 Sep 2011 11:35:18 +0200	[thread overview]
Message-ID: <20110901093518.GC15287@amd.com> (raw)
In-Reply-To: <201108311856.26969.laurent.pinchart@ideasonboard.com>

On Wed, Aug 31, 2011 at 12:56:26PM -0400, Laurent Pinchart wrote:
> True, but if we implement address rounding transparently in the IOMMU layer 
> Ohad's concern can be valid, depending on whether the device is trusted. If we 
> decide to push address rounding to the drivers that decision can be made on a 
> per-device basis. However, drivers are usually not aware of what granularity 
> the IOMMU works on, so that wouldn't be straightforward and clean.

Drivers usually just use the DMA-API, so they can not assume at all that
any protection happens. The problem also can't be really solved without
changing/breaking the DMA-API. It is defined to work on byte granularity
while the hardware only works with pages.

The only way to work around this it to implement the driver in a way so
that they only map page-aligned buffers where the size is also a
multiple of a page-size.

In this case you can assume the page-size you are working on because you
already assume in the driver that an iommu is in use.

	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


WARNING: multiple messages have this Message-ID (diff)
From: Joerg.Roedel@amd.com (Roedel, Joerg)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] iommu: omap_iovmm: support non page-aligned buffers in iommu_vmap
Date: Thu, 1 Sep 2011 11:35:18 +0200	[thread overview]
Message-ID: <20110901093518.GC15287@amd.com> (raw)
In-Reply-To: <201108311856.26969.laurent.pinchart@ideasonboard.com>

On Wed, Aug 31, 2011 at 12:56:26PM -0400, Laurent Pinchart wrote:
> True, but if we implement address rounding transparently in the IOMMU layer 
> Ohad's concern can be valid, depending on whether the device is trusted. If we 
> decide to push address rounding to the drivers that decision can be made on a 
> per-device basis. However, drivers are usually not aware of what granularity 
> the IOMMU works on, so that wouldn't be straightforward and clean.

Drivers usually just use the DMA-API, so they can not assume at all that
any protection happens. The problem also can't be really solved without
changing/breaking the DMA-API. It is defined to work on byte granularity
while the hardware only works with pages.

The only way to work around this it to implement the driver in a way so
that they only map page-aligned buffers where the size is also a
multiple of a page-size.

In this case you can assume the page-size you are working on because you
already assume in the driver that an iommu is in use.

	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

  parent reply	other threads:[~2011-09-01  9:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-29 19:36 [PATCH] iommu: omap_iovmm: support non page-aligned buffers in iommu_vmap Ohad Ben-Cohen
2011-08-31 10:52 ` Ohad Ben-Cohen
2011-08-31 10:52   ` Ohad Ben-Cohen
2011-08-31 11:27   ` Laurent Pinchart
2011-08-31 11:27     ` Laurent Pinchart
2011-08-31 13:06   ` Roedel, Joerg
2011-08-31 13:06     ` Roedel, Joerg
2011-08-31 16:56     ` Laurent Pinchart
2011-08-31 16:56       ` Laurent Pinchart
2011-08-31 17:16       ` Ohad Ben-Cohen
2011-08-31 17:16         ` Ohad Ben-Cohen
2011-09-01  9:35       ` Roedel, Joerg [this message]
2011-09-01  9:35         ` Roedel, Joerg
2011-09-01 11:47   ` Ohad Ben-Cohen
2011-09-01 11:47     ` Ohad Ben-Cohen
2011-09-01 13:31     ` Laurent Pinchart
2011-09-01 13:31       ` Laurent Pinchart
2011-09-01 13:42       ` Roedel, Joerg
2011-09-01 13:42         ` Roedel, Joerg
2011-09-01 13:59     ` Laurent Pinchart
2011-09-01 13:59       ` Laurent Pinchart
2011-09-01 14:02       ` Ohad Ben-Cohen
2011-09-01 14:02         ` Ohad Ben-Cohen
2011-09-01 14:15         ` Laurent Pinchart
2011-09-01 14:15           ` 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=20110901093518.GC15287@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=arnd@arndb.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ohad@wizery.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.