From: Eric Auger <eric.auger@linaro.org>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass
Date: Fri, 16 Oct 2015 16:03:11 +0200 [thread overview]
Message-ID: <5621039F.50609@linaro.org> (raw)
In-Reply-To: <20151015205046.28129.50479.stgit@gimli.home>
Hi Alex,
On 10/15/2015 10:52 PM, Alex Williamson wrote:
> We can only provide isolation if DMA is forced through the IOMMU
> aperture. Don't allow type1 to be used if this is not the case.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>
> Eric, I see a number of IOMMU drivers enable this, do the ones you
> care about for ARM set geometry.force_aperture? Thanks,
I am currently using arm-smmu.c. I don't see force_aperture being set.
Best Regards
Eric
>
> Alex
>
> drivers/vfio/vfio_iommu_type1.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 57d8c37..6afa9d4 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -728,6 +728,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
> struct vfio_group *group, *g;
> struct vfio_domain *domain, *d;
> struct bus_type *bus = NULL;
> + struct iommu_domain_geometry geometry;
> int ret;
>
> mutex_lock(&iommu->lock);
> @@ -762,6 +763,17 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
> goto out_free;
> }
>
> + /*
> + * If a domain does not force DMA within the aperture, devices are not
> + * isolated and type1 is not an appropriate IOMMU model.
> + */
> + ret = iommu_domain_get_attr(domain->domain,
> + DOMAIN_ATTR_GEOMETRY, &geometry);
> + if (ret || !geometry.force_aperture) {
> + ret = -EPERM;
> + goto out_domain;
> + }
> +
> if (iommu->nesting) {
> int attr = 1;
>
>
next prev parent reply other threads:[~2015-10-16 14:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 20:52 [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass Alex Williamson
2015-10-16 14:03 ` Eric Auger [this message]
2015-10-16 15:51 ` Alex Williamson
2015-10-27 15:40 ` Will Deacon
[not found] ` <20151027154043.GF1689-5wv7dgnIgG8@public.gmane.org>
2015-10-27 16:00 ` Alex Williamson
[not found] ` <1445961611.8018.269.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-29 18:28 ` Will Deacon
[not found] ` <20151029182819.GJ3440-5wv7dgnIgG8@public.gmane.org>
2015-10-29 18:42 ` Robin Murphy
[not found] ` <56326882.10109-5wv7dgnIgG8@public.gmane.org>
2015-10-29 18:50 ` Will Deacon
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=5621039F.50609@linaro.org \
--to=eric.auger@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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).