[RFC 5/8] vfio: IOMMUFD relax requirement for noiommu mode

Jacob Pan posted 8 patches 2 months, 1 week ago
[RFC 5/8] vfio: IOMMUFD relax requirement for noiommu mode
Posted by Jacob Pan 2 months, 1 week ago
noiommu device only has auto domain, does not need to attach to other ioas.

Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com>
---
 drivers/vfio/vfio_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 38c8e9350a60..805d30b0b82f 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -317,9 +317,7 @@ static int __vfio_register_dev(struct vfio_device *device,
 
 	if (WARN_ON(IS_ENABLED(CONFIG_IOMMUFD) &&
 		    (!device->ops->bind_iommufd ||
-		     !device->ops->unbind_iommufd ||
-		     !device->ops->attach_ioas ||
-		     !device->ops->detach_ioas)))
+		     !device->ops->unbind_iommufd)))
 		return -EINVAL;
 
 	/*
-- 
2.34.1
RE: [RFC 5/8] vfio: IOMMUFD relax requirement for noiommu mode
Posted by Tian, Kevin 1 month, 3 weeks ago
> From: Jacob Pan <jacob.pan@linux.microsoft.com>
> Sent: Tuesday, December 2, 2025 1:30 AM
> 
> noiommu device only has auto domain, does not need to attach to other ioas.
> 
> Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com>
> ---
>  drivers/vfio/vfio_main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
> index 38c8e9350a60..805d30b0b82f 100644
> --- a/drivers/vfio/vfio_main.c
> +++ b/drivers/vfio/vfio_main.c
> @@ -317,9 +317,7 @@ static int __vfio_register_dev(struct vfio_device
> *device,
> 
>  	if (WARN_ON(IS_ENABLED(CONFIG_IOMMUFD) &&
>  		    (!device->ops->bind_iommufd ||
> -		     !device->ops->unbind_iommufd ||
> -		     !device->ops->attach_ioas ||
> -		     !device->ops->detach_ioas)))
> +		     !device->ops->unbind_iommufd)))
>  		return -EINVAL;
> 

the subject says to relax for noiommu, but above actually relax
the check for all configs...
Re: [RFC 5/8] vfio: IOMMUFD relax requirement for noiommu mode
Posted by Jacob Pan 1 month, 3 weeks ago
Hi Kevin,

On Fri, 12 Dec 2025 04:05:06 +0000
"Tian, Kevin" <kevin.tian@intel.com> wrote:

> > From: Jacob Pan <jacob.pan@linux.microsoft.com>
> > Sent: Tuesday, December 2, 2025 1:30 AM
> > 
> > noiommu device only has auto domain, does not need to attach to
> > other ioas.
> > 
> > Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com>
> > ---
> >  drivers/vfio/vfio_main.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
> > index 38c8e9350a60..805d30b0b82f 100644
> > --- a/drivers/vfio/vfio_main.c
> > +++ b/drivers/vfio/vfio_main.c
> > @@ -317,9 +317,7 @@ static int __vfio_register_dev(struct
> > vfio_device *device,
> > 
> >  	if (WARN_ON(IS_ENABLED(CONFIG_IOMMUFD) &&
> >  		    (!device->ops->bind_iommufd ||
> > -		     !device->ops->unbind_iommufd ||
> > -		     !device->ops->attach_ioas ||
> > -		     !device->ops->detach_ioas)))
> > +		     !device->ops->unbind_iommufd)))
> >  		return -EINVAL;
> >   
> 
> the subject says to relax for noiommu, but above actually relax
> the check for all configs...

I will add a check here for noiommu mode.

Thanks,

Jacob