Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1248172 > unrolled thread
| Started by | Alex Williamson <alex.williamson@redhat.com> |
|---|---|
| First post | 2015-10-15 23:00 +0200 |
| Last post | 2015-10-16 18:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass Alex Williamson <alex.williamson@redhat.com> - 2015-10-15 23:00 +0200
Re: [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass Eric Auger <eric.auger@linaro.org> - 2015-10-16 16:10 +0200
Re: [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass Alex Williamson <alex.williamson@redhat.com> - 2015-10-16 18:00 +0200
| From | Alex Williamson <alex.williamson@redhat.com> |
|---|---|
| Date | 2015-10-15 23:00 +0200 |
| Subject | [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass |
| Message-ID | <qjXN1-1dR-27@gated-at.bofh.it> |
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,
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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Eric Auger <eric.auger@linaro.org> |
|---|---|
| Date | 2015-10-16 16:10 +0200 |
| Message-ID | <qkdRM-8a-21@gated-at.bofh.it> |
| In reply to | #1248172 |
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;
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Alex Williamson <alex.williamson@redhat.com> |
|---|---|
| Date | 2015-10-16 18:00 +0200 |
| Message-ID | <qkfAe-2um-37@gated-at.bofh.it> |
| In reply to | #1248789 |
On Fri, 2015-10-16 at 16:03 +0200, Eric Auger wrote:
> 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.
Hi Will,
Would it be possible to add iommu_domain_geometry support to arm-smmu.c?
In addition to this test to verify that DMA cannot bypass the IOMMU, I'd
eventually like to pass the aperture information out through the VFIO
API. Thanks,
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;
> >
> >
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web