kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: kvm: vfio: Require call KVM_DEV_VFIO_GROUP_ADD before VFIO_GROUP_GET_DEVICE_FD
@ 2023-02-21  3:41 Yi Liu
  2023-02-21  4:39 ` Alex Williamson
  0 siblings, 1 reply; 4+ messages in thread
From: Yi Liu @ 2023-02-21  3:41 UTC (permalink / raw)
  To: alex.williamson, jgg, kevin.tian
  Cc: cohuck, eric.auger, nicolinc, kvm, mjrosato, chao.p.peng,
	yi.l.liu, yi.y.sun, pbonzini

as some vfio_device's open_device op requires kvm pointer and kvm pointer
set is part of GROUP_ADD.

Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
 Documentation/virt/kvm/devices/vfio.rst | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/virt/kvm/devices/vfio.rst b/Documentation/virt/kvm/devices/vfio.rst
index 2d20dc561069..5722e283f1b5 100644
--- a/Documentation/virt/kvm/devices/vfio.rst
+++ b/Documentation/virt/kvm/devices/vfio.rst
@@ -39,3 +39,8 @@ KVM_DEV_VFIO_GROUP attributes:
 	- @groupfd is a file descriptor for a VFIO group;
 	- @tablefd is a file descriptor for a TCE table allocated via
 	  KVM_CREATE_SPAPR_TCE.
+
+::
+
+The GROUP_ADD operation above should be invoked before vfio_device's
+open_device op which is called in the ioctl VFIO_GROUP_GET_DEVICE_FD.
-- 
2.34.1


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

* Re: [PATCH] docs: kvm: vfio: Require call KVM_DEV_VFIO_GROUP_ADD before VFIO_GROUP_GET_DEVICE_FD
  2023-02-21  3:41 [PATCH] docs: kvm: vfio: Require call KVM_DEV_VFIO_GROUP_ADD before VFIO_GROUP_GET_DEVICE_FD Yi Liu
@ 2023-02-21  4:39 ` Alex Williamson
  2023-02-21  5:07   ` Liu, Yi L
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Williamson @ 2023-02-21  4:39 UTC (permalink / raw)
  To: Yi Liu
  Cc: jgg, kevin.tian, cohuck, eric.auger, nicolinc, kvm, mjrosato,
	chao.p.peng, yi.y.sun, pbonzini

On Mon, 20 Feb 2023 19:41:14 -0800
Yi Liu <yi.l.liu@intel.com> wrote:

> as some vfio_device's open_device op requires kvm pointer and kvm pointer
> set is part of GROUP_ADD.
> 
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> ---
>  Documentation/virt/kvm/devices/vfio.rst | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/virt/kvm/devices/vfio.rst b/Documentation/virt/kvm/devices/vfio.rst
> index 2d20dc561069..5722e283f1b5 100644
> --- a/Documentation/virt/kvm/devices/vfio.rst
> +++ b/Documentation/virt/kvm/devices/vfio.rst
> @@ -39,3 +39,8 @@ KVM_DEV_VFIO_GROUP attributes:
>  	- @groupfd is a file descriptor for a VFIO group;
>  	- @tablefd is a file descriptor for a TCE table allocated via
>  	  KVM_CREATE_SPAPR_TCE.
> +
> +::
> +
> +The GROUP_ADD operation above should be invoked before vfio_device's
> +open_device op which is called in the ioctl VFIO_GROUP_GET_DEVICE_FD.

Why only include the reasoning in the commit log and not the docs?
Thanks,

Alex


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

* RE: [PATCH] docs: kvm: vfio: Require call KVM_DEV_VFIO_GROUP_ADD before VFIO_GROUP_GET_DEVICE_FD
  2023-02-21  4:39 ` Alex Williamson
@ 2023-02-21  5:07   ` Liu, Yi L
  2023-02-21 18:03     ` Alex Williamson
  0 siblings, 1 reply; 4+ messages in thread
From: Liu, Yi L @ 2023-02-21  5:07 UTC (permalink / raw)
  To: Alex Williamson
  Cc: jgg, Tian, Kevin, cohuck, eric.auger, nicolinc, kvm, mjrosato,
	chao.p.peng, yi.y.sun, pbonzini

> From: Alex Williamson <alex.williamson@redhat.com>
> Sent: Tuesday, February 21, 2023 12:39 PM
> 
> On Mon, 20 Feb 2023 19:41:14 -0800
> Yi Liu <yi.l.liu@intel.com> wrote:
> 
> > as some vfio_device's open_device op requires kvm pointer and kvm
> pointer
> > set is part of GROUP_ADD.
> >
> > Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> > ---
> >  Documentation/virt/kvm/devices/vfio.rst | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/Documentation/virt/kvm/devices/vfio.rst
> b/Documentation/virt/kvm/devices/vfio.rst
> > index 2d20dc561069..5722e283f1b5 100644
> > --- a/Documentation/virt/kvm/devices/vfio.rst
> > +++ b/Documentation/virt/kvm/devices/vfio.rst
> > @@ -39,3 +39,8 @@ KVM_DEV_VFIO_GROUP attributes:
> >  	- @groupfd is a file descriptor for a VFIO group;
> >  	- @tablefd is a file descriptor for a TCE table allocated via
> >  	  KVM_CREATE_SPAPR_TCE.
> > +
> > +::
> > +
> > +The GROUP_ADD operation above should be invoked before
> vfio_device's
> > +open_device op which is called in the ioctl
> VFIO_GROUP_GET_DEVICE_FD.
> 
> Why only include the reasoning in the commit log and not the docs?

Oops, sure. How about below?

KVM_DEV_VFIO_GROUP_ADD has a duty to set the kvm pointer to VFIO as some
vfio_devices require kvm pointer to open_device. Like gvt-g, vfio-ap and etc.
Meanwhile, open_device is part of VFIO_GROUP_GET_DEVICE_FD. Hence user should
invoke KVM_DEV_VFIO_GROUP_ADD before VFIO_GROUP_GET_DEVICE_FD.

Regards,
Yi Liu


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

* Re: [PATCH] docs: kvm: vfio: Require call KVM_DEV_VFIO_GROUP_ADD before VFIO_GROUP_GET_DEVICE_FD
  2023-02-21  5:07   ` Liu, Yi L
@ 2023-02-21 18:03     ` Alex Williamson
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Williamson @ 2023-02-21 18:03 UTC (permalink / raw)
  To: Liu, Yi L
  Cc: jgg, Tian, Kevin, cohuck, eric.auger, nicolinc, kvm, mjrosato,
	chao.p.peng, yi.y.sun, pbonzini

On Tue, 21 Feb 2023 05:07:36 +0000
"Liu, Yi L" <yi.l.liu@intel.com> wrote:

> > From: Alex Williamson <alex.williamson@redhat.com>
> > Sent: Tuesday, February 21, 2023 12:39 PM
> > 
> > On Mon, 20 Feb 2023 19:41:14 -0800
> > Yi Liu <yi.l.liu@intel.com> wrote:
> >   
> > > as some vfio_device's open_device op requires kvm pointer and kvm  
> > pointer  
> > > set is part of GROUP_ADD.
> > >
> > > Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> > > ---
> > >  Documentation/virt/kvm/devices/vfio.rst | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/Documentation/virt/kvm/devices/vfio.rst  
> > b/Documentation/virt/kvm/devices/vfio.rst  
> > > index 2d20dc561069..5722e283f1b5 100644
> > > --- a/Documentation/virt/kvm/devices/vfio.rst
> > > +++ b/Documentation/virt/kvm/devices/vfio.rst
> > > @@ -39,3 +39,8 @@ KVM_DEV_VFIO_GROUP attributes:
> > >  	- @groupfd is a file descriptor for a VFIO group;
> > >  	- @tablefd is a file descriptor for a TCE table allocated via
> > >  	  KVM_CREATE_SPAPR_TCE.
> > > +
> > > +::
> > > +
> > > +The GROUP_ADD operation above should be invoked before  
> > vfio_device's  
> > > +open_device op which is called in the ioctl  
> > VFIO_GROUP_GET_DEVICE_FD.
> > 
> > Why only include the reasoning in the commit log and not the docs?  
> 
> Oops, sure. How about below?
> 
> KVM_DEV_VFIO_GROUP_ADD has a duty to set the kvm pointer to VFIO as some
> vfio_devices require kvm pointer to open_device. Like gvt-g, vfio-ap and etc.
> Meanwhile, open_device is part of VFIO_GROUP_GET_DEVICE_FD. Hence user should
> invoke KVM_DEV_VFIO_GROUP_ADD before VFIO_GROUP_GET_DEVICE_FD.

How about:

The GROUP_ADD operation above should be invoked prior to accessing the
device file descriptor via VFIO_GROUP_GET_DEVICE_FD in order to support
drivers which require a kvm pointer to be set in their .open_device()
callback.

Thanks,
Alex


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

end of thread, other threads:[~2023-02-21 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21  3:41 [PATCH] docs: kvm: vfio: Require call KVM_DEV_VFIO_GROUP_ADD before VFIO_GROUP_GET_DEVICE_FD Yi Liu
2023-02-21  4:39 ` Alex Williamson
2023-02-21  5:07   ` Liu, Yi L
2023-02-21 18:03     ` Alex Williamson

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