Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1692403 > unrolled thread

[PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present()

Started byAnup Patel <anup.patel@broadcom.com>
First post2017-07-20 06:40 +0200
Last post2017-07-24 19:30 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present() Anup Patel <anup.patel@broadcom.com> - 2017-07-20 06:40 +0200
    Re: [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking  iommu_present() Will Deacon <will.deacon@arm.com> - 2017-07-20 11:20 +0200
    Re: [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking  iommu_present() Alex Williamson <alex.williamson@redhat.com> - 2017-07-24 19:30 +0200

#1692403 — [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present()

FromAnup Patel <anup.patel@broadcom.com>
Date2017-07-20 06:40 +0200
Subject[PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present()
Message-ID<u5bpL-28h-5@gated-at.bofh.it>
Not allowing No-IOMMU mode for devices already having
iommu_ops on their bus is very conservative.

We now have IOMMU (such as ARM SMMU) which can bypass
transcations when IOMMU is not configured for a given
device. In addition, it is not necessary to have all
devices on bus to be upstream to an IOMMU on that bus.

Due above reasons, having iommu_present() check for
VFIO No-IOMMU mode is not appropriate.

Signed-off-by: Anup Patel <anup.patel@broadcom.com>
---
 drivers/vfio/vfio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 330d505..9d90de7 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -124,11 +124,10 @@ struct iommu_group *vfio_iommu_group_get(struct device *dev)
 #ifdef CONFIG_VFIO_NOIOMMU
 	/*
 	 * With noiommu enabled, an IOMMU group will be created for a device
-	 * that doesn't already have one and doesn't have an iommu_ops on their
-	 * bus.  We set iommudata simply to be able to identify these groups
-	 * as special use and for reclamation later.
+	 * that doesn't already have one.  We set iommudata simply to be able
+	 * to identify these groups as special use and for reclamation later.
 	 */
-	if (group || !noiommu || iommu_present(dev->bus))
+	if (group || !noiommu)
 		return group;
 
 	group = iommu_group_alloc();
-- 
2.7.4

[toc] | [next] | [standalone]


#1692674 — Re: [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present()

FromWill Deacon <will.deacon@arm.com>
Date2017-07-20 11:20 +0200
SubjectRe: [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present()
Message-ID<u5fMK-5hG-27@gated-at.bofh.it>
In reply to#1692403
On Thu, Jul 20, 2017 at 10:02:33AM +0530, Anup Patel wrote:
> Not allowing No-IOMMU mode for devices already having
> iommu_ops on their bus is very conservative.
> 
> We now have IOMMU (such as ARM SMMU) which can bypass
> transcations when IOMMU is not configured for a given
> device. In addition, it is not necessary to have all
> devices on bus to be upstream to an IOMMU on that bus.

How does the SMMU know to bypass in these cases? As I explained before, the
driver-specific command line option is the wrong way to go about arranging
this.

Will

[toc] | [prev] | [next] | [standalone]


#1694916 — Re: [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present()

FromAlex Williamson <alex.williamson@redhat.com>
Date2017-07-24 19:30 +0200
SubjectRe: [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present()
Message-ID<u6Pl7-7Zl-15@gated-at.bofh.it>
In reply to#1692403
On Thu, 20 Jul 2017 10:02:33 +0530
Anup Patel <anup.patel@broadcom.com> wrote:

> Not allowing No-IOMMU mode for devices already having
> iommu_ops on their bus is very conservative.
> 
> We now have IOMMU (such as ARM SMMU) which can bypass
> transcations when IOMMU is not configured for a given
> device. In addition, it is not necessary to have all
> devices on bus to be upstream to an IOMMU on that bus.
> 
> Due above reasons, having iommu_present() check for
> VFIO No-IOMMU mode is not appropriate.
> 
> Signed-off-by: Anup Patel <anup.patel@broadcom.com>
> ---
>  drivers/vfio/vfio.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 330d505..9d90de7 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -124,11 +124,10 @@ struct iommu_group *vfio_iommu_group_get(struct device *dev)
>  #ifdef CONFIG_VFIO_NOIOMMU
>  	/*
>  	 * With noiommu enabled, an IOMMU group will be created for a device
> -	 * that doesn't already have one and doesn't have an iommu_ops on their
> -	 * bus.  We set iommudata simply to be able to identify these groups
> -	 * as special use and for reclamation later.
> +	 * that doesn't already have one.  We set iommudata simply to be able
> +	 * to identify these groups as special use and for reclamation later.
>  	 */
> -	if (group || !noiommu || iommu_present(dev->bus))
> +	if (group || !noiommu)
>  		return group;
>  
>  	group = iommu_group_alloc();

Nak, no-iommu is intentionally conservative.  How do we tell the
difference between the iommu_ops available to us with a fake group vs
a proper group created by the iommu if we ignore iommu_present()?  If
an iommu exists, use it.  Thanks,

Alex

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web