kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio: Depend on MMU
@ 2021-03-05  1:30 Jason Gunthorpe
  2021-03-05  8:46 ` Cornelia Huck
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2021-03-05  1:30 UTC (permalink / raw)
  To: Alex Williamson, kvm; +Cc: Cornelia Huck

VFIO_IOMMU_TYPE1 does not compile with !MMU:

../drivers/vfio/vfio_iommu_type1.c: In function 'follow_fault_pfn':
../drivers/vfio/vfio_iommu_type1.c:536:22: error: implicit declaration of function 'pte_write'; did you mean 'vfs_write'? [-Werror=implicit-function-declaration]

So require it.

Suggested-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/vfio/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
index 90c0525b1e0cf4..67d0bf4efa1606 100644
--- a/drivers/vfio/Kconfig
+++ b/drivers/vfio/Kconfig
@@ -22,7 +22,7 @@ config VFIO_VIRQFD
 menuconfig VFIO
 	tristate "VFIO Non-Privileged userspace driver framework"
 	select IOMMU_API
-	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
+	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
 	help
 	  VFIO provides a framework for secure userspace device drivers.
 	  See Documentation/driver-api/vfio.rst for more details.
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] vfio: Depend on MMU
  2021-03-05  1:30 [PATCH] vfio: Depend on MMU Jason Gunthorpe
@ 2021-03-05  8:46 ` Cornelia Huck
  2021-03-05 23:11   ` Jason Gunthorpe
  2021-03-08 17:59   ` Alex Williamson
  0 siblings, 2 replies; 7+ messages in thread
From: Cornelia Huck @ 2021-03-05  8:46 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Alex Williamson, kvm

On Thu, 4 Mar 2021 21:30:03 -0400
Jason Gunthorpe <jgg@nvidia.com> wrote:

> VFIO_IOMMU_TYPE1 does not compile with !MMU:
> 
> ../drivers/vfio/vfio_iommu_type1.c: In function 'follow_fault_pfn':
> ../drivers/vfio/vfio_iommu_type1.c:536:22: error: implicit declaration of function 'pte_write'; did you mean 'vfs_write'? [-Werror=implicit-function-declaration]
> 
> So require it.
> 
> Suggested-by: Cornelia Huck <cohuck@redhat.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/vfio/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
> index 90c0525b1e0cf4..67d0bf4efa1606 100644
> --- a/drivers/vfio/Kconfig
> +++ b/drivers/vfio/Kconfig
> @@ -22,7 +22,7 @@ config VFIO_VIRQFD
>  menuconfig VFIO
>  	tristate "VFIO Non-Privileged userspace driver framework"
>  	select IOMMU_API
> -	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
> +	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
>  	help
>  	  VFIO provides a framework for secure userspace device drivers.
>  	  See Documentation/driver-api/vfio.rst for more details.

Actually, I'm wondering how much sense vfio makes on !MMU at all? (And
maybe just merge this with your patch that switches IOMMU_API from a
depend to a select, because that is the change that makes the MMU
dependency required?)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vfio: Depend on MMU
  2021-03-05  8:46 ` Cornelia Huck
@ 2021-03-05 23:11   ` Jason Gunthorpe
  2021-03-08 18:14     ` Cornelia Huck
  2021-03-08 17:59   ` Alex Williamson
  1 sibling, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2021-03-05 23:11 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: Alex Williamson, kvm

On Fri, Mar 05, 2021 at 09:46:49AM +0100, Cornelia Huck wrote:
> On Thu, 4 Mar 2021 21:30:03 -0400
> Jason Gunthorpe <jgg@nvidia.com> wrote:
> 
> > VFIO_IOMMU_TYPE1 does not compile with !MMU:
> > 
> > ../drivers/vfio/vfio_iommu_type1.c: In function 'follow_fault_pfn':
> > ../drivers/vfio/vfio_iommu_type1.c:536:22: error: implicit declaration of function 'pte_write'; did you mean 'vfs_write'? [-Werror=implicit-function-declaration]
> > 
> > So require it.
> > 
> > Suggested-by: Cornelia Huck <cohuck@redhat.com>
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> >  drivers/vfio/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
> > index 90c0525b1e0cf4..67d0bf4efa1606 100644
> > +++ b/drivers/vfio/Kconfig
> > @@ -22,7 +22,7 @@ config VFIO_VIRQFD
> >  menuconfig VFIO
> >  	tristate "VFIO Non-Privileged userspace driver framework"
> >  	select IOMMU_API
> > -	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
> > +	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
> >  	help
> >  	  VFIO provides a framework for secure userspace device drivers.
> >  	  See Documentation/driver-api/vfio.rst for more details.
> 
> Actually, I'm wondering how much sense vfio makes on !MMU at all? (And
> maybe just merge this with your patch that switches IOMMU_API from a
> depend to a select, because that is the change that makes the MMU
> dependency required?)

Why does changing depend to select affect MMU vs !MMU? Am I missing
something?

It looks like IOMMU_API can be turned with ARM !MMU here, for
instance:

config MSM_IOMMU
        bool "MSM IOMMU Support"
        depends on ARM
        depends on ARCH_MSM8X60 || ARCH_MSM8960 || COMPILE_TEST
        select IOMMU_API

Generally with !MMU I try to ignore it as much as possible unless
things don't compile, as I have no idea what people use it for :)

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vfio: Depend on MMU
  2021-03-05  8:46 ` Cornelia Huck
  2021-03-05 23:11   ` Jason Gunthorpe
@ 2021-03-08 17:59   ` Alex Williamson
  2021-03-08 18:12     ` Cornelia Huck
  1 sibling, 1 reply; 7+ messages in thread
From: Alex Williamson @ 2021-03-08 17:59 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: Jason Gunthorpe, kvm

On Fri, 5 Mar 2021 09:46:49 +0100
Cornelia Huck <cohuck@redhat.com> wrote:

> On Thu, 4 Mar 2021 21:30:03 -0400
> Jason Gunthorpe <jgg@nvidia.com> wrote:
> 
> > VFIO_IOMMU_TYPE1 does not compile with !MMU:
> > 
> > ../drivers/vfio/vfio_iommu_type1.c: In function 'follow_fault_pfn':
> > ../drivers/vfio/vfio_iommu_type1.c:536:22: error: implicit declaration of function 'pte_write'; did you mean 'vfs_write'? [-Werror=implicit-function-declaration]
> > 
> > So require it.
> > 
> > Suggested-by: Cornelia Huck <cohuck@redhat.com>
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> >  drivers/vfio/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
> > index 90c0525b1e0cf4..67d0bf4efa1606 100644
> > --- a/drivers/vfio/Kconfig
> > +++ b/drivers/vfio/Kconfig
> > @@ -22,7 +22,7 @@ config VFIO_VIRQFD
> >  menuconfig VFIO
> >  	tristate "VFIO Non-Privileged userspace driver framework"
> >  	select IOMMU_API
> > -	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
> > +	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
> >  	help
> >  	  VFIO provides a framework for secure userspace device drivers.
> >  	  See Documentation/driver-api/vfio.rst for more details.  
> 
> Actually, I'm wondering how much sense vfio makes on !MMU at all? (And
> maybe just merge this with your patch that switches IOMMU_API from a
> depend to a select, because that is the change that makes the MMU
> dependency required?)

We do have the no-iommu code in vfio, potentially it's useful for !MMU,
I guess.  It seems a little arbitrary to remove it without a known
breakage at this point.  Thanks,

Alex


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vfio: Depend on MMU
  2021-03-08 17:59   ` Alex Williamson
@ 2021-03-08 18:12     ` Cornelia Huck
  0 siblings, 0 replies; 7+ messages in thread
From: Cornelia Huck @ 2021-03-08 18:12 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Jason Gunthorpe, kvm

On Mon, 8 Mar 2021 10:59:13 -0700
Alex Williamson <alex.williamson@redhat.com> wrote:

> On Fri, 5 Mar 2021 09:46:49 +0100
> Cornelia Huck <cohuck@redhat.com> wrote:
> 
> > On Thu, 4 Mar 2021 21:30:03 -0400
> > Jason Gunthorpe <jgg@nvidia.com> wrote:
> >   
> > > VFIO_IOMMU_TYPE1 does not compile with !MMU:
> > > 
> > > ../drivers/vfio/vfio_iommu_type1.c: In function 'follow_fault_pfn':
> > > ../drivers/vfio/vfio_iommu_type1.c:536:22: error: implicit declaration of function 'pte_write'; did you mean 'vfs_write'? [-Werror=implicit-function-declaration]
> > > 
> > > So require it.
> > > 
> > > Suggested-by: Cornelia Huck <cohuck@redhat.com>
> > > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > > ---
> > >  drivers/vfio/Kconfig | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
> > > index 90c0525b1e0cf4..67d0bf4efa1606 100644
> > > --- a/drivers/vfio/Kconfig
> > > +++ b/drivers/vfio/Kconfig
> > > @@ -22,7 +22,7 @@ config VFIO_VIRQFD
> > >  menuconfig VFIO
> > >  	tristate "VFIO Non-Privileged userspace driver framework"
> > >  	select IOMMU_API
> > > -	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
> > > +	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
> > >  	help
> > >  	  VFIO provides a framework for secure userspace device drivers.
> > >  	  See Documentation/driver-api/vfio.rst for more details.    
> > 
> > Actually, I'm wondering how much sense vfio makes on !MMU at all? (And
> > maybe just merge this with your patch that switches IOMMU_API from a
> > depend to a select, because that is the change that makes the MMU
> > dependency required?)  
> 
> We do have the no-iommu code in vfio, potentially it's useful for !MMU,
> I guess.  It seems a little arbitrary to remove it without a known
> breakage at this point.  Thanks,
> 
> Alex

Well, in practice, I think we had an implicit dependency on MMU before
(everything selecting IOMMU_API depended on MMU.) If we think !MMU
would be useful for the no-iommu use case, we can certainly restrict
the dependency to VFIO_IOMMU_TYPE1.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vfio: Depend on MMU
  2021-03-05 23:11   ` Jason Gunthorpe
@ 2021-03-08 18:14     ` Cornelia Huck
  2021-03-08 18:23       ` Jason Gunthorpe
  0 siblings, 1 reply; 7+ messages in thread
From: Cornelia Huck @ 2021-03-08 18:14 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Alex Williamson, kvm

On Fri, 5 Mar 2021 19:11:41 -0400
Jason Gunthorpe <jgg@nvidia.com> wrote:

> On Fri, Mar 05, 2021 at 09:46:49AM +0100, Cornelia Huck wrote:
> > On Thu, 4 Mar 2021 21:30:03 -0400
> > Jason Gunthorpe <jgg@nvidia.com> wrote:
> >   
> > > VFIO_IOMMU_TYPE1 does not compile with !MMU:
> > > 
> > > ../drivers/vfio/vfio_iommu_type1.c: In function 'follow_fault_pfn':
> > > ../drivers/vfio/vfio_iommu_type1.c:536:22: error: implicit declaration of function 'pte_write'; did you mean 'vfs_write'? [-Werror=implicit-function-declaration]
> > > 
> > > So require it.
> > > 
> > > Suggested-by: Cornelia Huck <cohuck@redhat.com>
> > > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > >  drivers/vfio/Kconfig | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
> > > index 90c0525b1e0cf4..67d0bf4efa1606 100644
> > > +++ b/drivers/vfio/Kconfig
> > > @@ -22,7 +22,7 @@ config VFIO_VIRQFD
> > >  menuconfig VFIO
> > >  	tristate "VFIO Non-Privileged userspace driver framework"
> > >  	select IOMMU_API
> > > -	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
> > > +	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
> > >  	help
> > >  	  VFIO provides a framework for secure userspace device drivers.
> > >  	  See Documentation/driver-api/vfio.rst for more details.  
> > 
> > Actually, I'm wondering how much sense vfio makes on !MMU at all? (And
> > maybe just merge this with your patch that switches IOMMU_API from a
> > depend to a select, because that is the change that makes the MMU
> > dependency required?)  
> 
> Why does changing depend to select affect MMU vs !MMU? Am I missing
> something?
> 
> It looks like IOMMU_API can be turned with ARM !MMU here, for
> instance:
> 
> config MSM_IOMMU
>         bool "MSM IOMMU Support"
>         depends on ARM
>         depends on ARCH_MSM8X60 || ARCH_MSM8960 || COMPILE_TEST
>         select IOMMU_API

But that one is sitting under a menu depending on MMU, isn't it?

> 
> Generally with !MMU I try to ignore it as much as possible unless
> things don't compile, as I have no idea what people use it for :)
> 
> Jason
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vfio: Depend on MMU
  2021-03-08 18:14     ` Cornelia Huck
@ 2021-03-08 18:23       ` Jason Gunthorpe
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Gunthorpe @ 2021-03-08 18:23 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: Alex Williamson, kvm

On Mon, Mar 08, 2021 at 07:14:21PM +0100, Cornelia Huck wrote:
> On Fri, 5 Mar 2021 19:11:41 -0400
> Jason Gunthorpe <jgg@nvidia.com> wrote:
> 
> > On Fri, Mar 05, 2021 at 09:46:49AM +0100, Cornelia Huck wrote:
> > > On Thu, 4 Mar 2021 21:30:03 -0400
> > > Jason Gunthorpe <jgg@nvidia.com> wrote:
> > >   
> > > > VFIO_IOMMU_TYPE1 does not compile with !MMU:
> > > > 
> > > > ../drivers/vfio/vfio_iommu_type1.c: In function 'follow_fault_pfn':
> > > > ../drivers/vfio/vfio_iommu_type1.c:536:22: error: implicit declaration of function 'pte_write'; did you mean 'vfs_write'? [-Werror=implicit-function-declaration]
> > > > 
> > > > So require it.
> > > > 
> > > > Suggested-by: Cornelia Huck <cohuck@redhat.com>
> > > > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > > >  drivers/vfio/Kconfig | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
> > > > index 90c0525b1e0cf4..67d0bf4efa1606 100644
> > > > +++ b/drivers/vfio/Kconfig
> > > > @@ -22,7 +22,7 @@ config VFIO_VIRQFD
> > > >  menuconfig VFIO
> > > >  	tristate "VFIO Non-Privileged userspace driver framework"
> > > >  	select IOMMU_API
> > > > -	select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
> > > > +	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
> > > >  	help
> > > >  	  VFIO provides a framework for secure userspace device drivers.
> > > >  	  See Documentation/driver-api/vfio.rst for more details.  
> > > 
> > > Actually, I'm wondering how much sense vfio makes on !MMU at all? (And
> > > maybe just merge this with your patch that switches IOMMU_API from a
> > > depend to a select, because that is the change that makes the MMU
> > > dependency required?)  
> > 
> > Why does changing depend to select affect MMU vs !MMU? Am I missing
> > something?
> > 
> > It looks like IOMMU_API can be turned with ARM !MMU here, for
> > instance:
> > 
> > config MSM_IOMMU
> >         bool "MSM IOMMU Support"
> >         depends on ARM
> >         depends on ARCH_MSM8X60 || ARCH_MSM8960 || COMPILE_TEST
> >         select IOMMU_API
> 
> But that one is sitting under a menu depending on MMU, isn't it?

Yep.

Still, I'd keep the two ideas as two patches - order this one first.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-08 18:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  1:30 [PATCH] vfio: Depend on MMU Jason Gunthorpe
2021-03-05  8:46 ` Cornelia Huck
2021-03-05 23:11   ` Jason Gunthorpe
2021-03-08 18:14     ` Cornelia Huck
2021-03-08 18:23       ` Jason Gunthorpe
2021-03-08 17:59   ` Alex Williamson
2021-03-08 18:12     ` Cornelia Huck

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).