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


Groups > linux.kernel > #1163678

RE: [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From "Wu, Feng" <feng.wu@intel.com>
Newsgroups linux.kernel
Subject RE: [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding
Date Fri, 12 Jun 2015 02:30:02 +0200
Message-ID <pAl18-5rb-3@gated-at.bofh.it> (permalink)
References <pA8wV-3OV-5@gated-at.bofh.it> <pA8wV-3OV-13@gated-at.bofh.it> <pAaS6-7au-29@gated-at.bofh.it>
X-Original-To Eric Auger <eric.auger@linaro.org>, "kvm@vger.kernel.org" <kvm@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Extloop1 1
X-Ironport-Av E=Sophos;i="5.13,598,1427785200"; d="scan'208";a="741830693"
Thread-Topic [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding
Thread-Index AQHQpEvXR3w+0qLqw0yRsCkYZz7Gk52oAl8Q
Accept-Language en-US
Content-Language en-US
X-Originating-IP [10.239.127.40]
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding 8BIT
MIME-Version 1.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 136
Organization linux.* mail to news gateway
X-Original-Cc "pbonzini@redhat.com" <pbonzini@redhat.com>, "mtosatti@redhat.com" <mtosatti@redhat.com>, "alex.williamson@redhat.com" <alex.williamson@redhat.com>, "Wu, Feng" <feng.wu@intel.com>
X-Original-Date Fri, 12 Jun 2015 00:20:43 +0000
X-Original-Message-ID <E959C4978C3B6342920538CF579893F00259D0C6@SHSMSX104.ccr.corp.intel.com>
X-Original-References <1434019912-15423-1-git-send-email-feng.wu@intel.com> <1434019912-15423-9-git-send-email-feng.wu@intel.com> <55798F1F.1010103@linaro.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1163678

Show key headers only | View raw



> -----Original Message-----
> From: Eric Auger [mailto:eric.auger@linaro.org]
> Sent: Thursday, June 11, 2015 9:38 PM
> To: Wu, Feng; kvm@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: pbonzini@redhat.com; mtosatti@redhat.com;
> alex.williamson@redhat.com
> Subject: Re: [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding
> 
> Hi Feng,
> On 06/11/2015 12:51 PM, Feng Wu wrote:
> > From: Eric Auger <eric.auger@linaro.org>
> >
> > This patch adds and documents a new KVM_DEV_VFIO_DEVICE group
> > and 2 device attributes: KVM_DEV_VFIO_DEVICE_FORWARD_IRQ,
> > KVM_DEV_VFIO_DEVICE_UNFORWARD_IRQ. The purpose is to be able
> > to set a VFIO device IRQ as forwarded or not forwarded.
> > the command takes as argument a handle to a new struct named
> > kvm_vfio_dev_irq.
> >
> > Signed-off-by: Eric Auger <eric.auger@linaro.org>
> > ---
> >  Documentation/virtual/kvm/devices/vfio.txt | 34
> ++++++++++++++++++++++++------
> >  include/uapi/linux/kvm.h                   | 12 +++++++++++
> >  2 files changed, 40 insertions(+), 6 deletions(-)
> >
> > diff --git a/Documentation/virtual/kvm/devices/vfio.txt
> b/Documentation/virtual/kvm/devices/vfio.txt
> > index ef51740..6186e6d 100644
> > --- a/Documentation/virtual/kvm/devices/vfio.txt
> > +++ b/Documentation/virtual/kvm/devices/vfio.txt
> > @@ -4,15 +4,20 @@ VFIO virtual device
> >  Device types supported:
> >    KVM_DEV_TYPE_VFIO
> >
> > -Only one VFIO instance may be created per VM.  The created device
> > -tracks VFIO groups in use by the VM and features of those groups
> > -important to the correctness and acceleration of the VM.  As groups
> > -are enabled and disabled for use by the VM, KVM should be updated
> > -about their presence.  When registered with KVM, a reference to the
> > -VFIO-group is held by KVM.
> > +Only one VFIO instance may be created per VM.
> > +
> > +The created device tracks VFIO groups in use by the VM and features
> > +of those groups important to the correctness and acceleration of
> > +the VM.  As groups are enabled and disabled for use by the VM, KVM
> > +should be updated about their presence.  When registered with KVM,
> > +a reference to the VFIO-group is held by KVM.
> > +
> > +The device also enables to control some IRQ settings of VFIO devices:
> > +forwarding/posting.
> >
> >  Groups:
> >    KVM_DEV_VFIO_GROUP
> > +  KVM_DEV_VFIO_DEVICE
> >
> >  KVM_DEV_VFIO_GROUP attributes:
> >    KVM_DEV_VFIO_GROUP_ADD: Add a VFIO group to VFIO-KVM device
> tracking
> > @@ -20,3 +25,20 @@ KVM_DEV_VFIO_GROUP attributes:
> >
> >  For each, kvm_device_attr.addr points to an int32_t file descriptor
> >  for the VFIO group.
> > +
> > +KVM_DEV_VFIO_DEVICE attributes:
> > +  KVM_DEV_VFIO_DEVICE_FORWARD_IRQ: set a VFIO device IRQ as
> forwarded
> > +  KVM_DEV_VFIO_DEVICE_UNFORWARD_IRQ: set a VFIO device IRQ as
> not forwarded
> > +
> > +For each, kvm_device_attr.addr points to a kvm_vfio_dev_irq struct.
> > +
> > +When forwarded, a physical IRQ is completed by the guest and not by the
> > +host. This requires HW support in the interrupt controller.
> > +
> > +Forwarding can only be set when the corresponding VFIO IRQ is not masked
> > +(would it be through VFIO_DEVICE_SET_IRQS command or as a consequence
> of this
> > +IRQ being currently handled) or active at interrupt controller level.
> > +In such a situation, -EAGAIN is returned. It is advised to to set the
> > +forwarding before the VFIO signaling is set up, this avoids trial and errors.
> > +
> > +Unforwarding can happen at any time.
> Unfortunately the above text is out of context of your series. If it
> simplifies things take the ownership of that patch file and remove my
> description of KVM_DEV_VFIO_DEVICE_FORWARD_IRQ.

Oh, I didn't notice that. It is a good suggestion, Eric!

Thanks,
Feng


> > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> > index 4b60056..798f3e4 100644
> > --- a/include/uapi/linux/kvm.h
> > +++ b/include/uapi/linux/kvm.h
> > @@ -999,6 +999,9 @@ struct kvm_device_attr {
> >  #define  KVM_DEV_VFIO_GROUP			1
> >  #define   KVM_DEV_VFIO_GROUP_ADD			1
> >  #define   KVM_DEV_VFIO_GROUP_DEL			2
> > +#define  KVM_DEV_VFIO_DEVICE			2
> > +#define   KVM_DEV_VFIO_DEVICE_FORWARD_IRQ			1
> > +#define   KVM_DEV_VFIO_DEVICE_UNFORWARD_IRQ			2
> same here
> Best Regards
> 
> Eric
> >
> >  enum kvm_device_type {
> >  	KVM_DEV_TYPE_FSL_MPIC_20	= 1,
> > @@ -1018,6 +1021,15 @@ enum kvm_device_type {
> >  	KVM_DEV_TYPE_MAX,
> >  };
> >
> > +struct kvm_vfio_dev_irq {
> > +	__u32	argsz;		/* structure length */
> > +	__u32	fd;		/* file descriptor of the VFIO device */
> > +	__u32	index;		/* VFIO device IRQ index */
> > +	__u32	start;		/* start of subindex range */
> > +	__u32	count;		/* size of subindex range */
> > +	__u32	gsi[];		/* gsi, ie. virtual IRQ number */
> > +};
> > +
> >  /*
> >   * ioctls for VM fds
> >   */
> >

--
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/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding Feng Wu <feng.wu@intel.com> - 2015-06-11 13:10 +0200
  RE: [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding "Wu, Feng" <feng.wu@intel.com> - 2015-06-12 02:30 +0200
  RE: [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding "Wu, Feng" <feng.wu@intel.com> - 2015-06-12 02:30 +0200
    RE: [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding "Wu, Feng" <feng.wu@intel.com> - 2015-06-15 08:50 +0200
    Re: [v4 08/16] KVM: kvm-vfio: User API for IRQ forwarding Alex Williamson <alex.williamson@redhat.com> - 2015-06-18 22:10 +0200

csiph-web