From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 4/8] KVM: kvm-vfio: User API for IRQ forwarding
Date: Sun, 30 Nov 2014 13:53:14 +0100 [thread overview]
Message-ID: <20141130125314.GE82106@macair> (raw)
In-Reply-To: <1416767760-14487-5-git-send-email-eric.auger@linaro.org>
On Sun, Nov 23, 2014 at 07:35:56PM +0100, Eric Auger wrote:
> This patch adds and document a new KVM_DEV_VFIO_DEVICE group
documents
> 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_arch_forwarded_irq.
>
> Signed-off-by: Eric Auger <eric.auger@linaro.org>
>
> ---
>
> v2 -> v3:
> - rework vfio kvm device documentation
> - reword commit message and title
> - add subindex in kvm_arch_forwarded_irq to be closer to VFIO API
> - forwarding state can only be changed with VFIO IRQ signaling is off
>
> v1 -> v2:
> - struct kvm_arch_forwarded_irq moved from arch/arm/include/uapi/asm/kvm.h
> to include/uapi/linux/kvm.h
> also irq_index renamed into index and guest_irq renamed into gsi
> - ASSIGN/DEASSIGN renamed into FORWARD/UNFORWARD
> ---
> Documentation/virtual/kvm/devices/vfio.txt | 34 ++++++++++++++++++++++++------
> include/uapi/linux/kvm.h | 10 +++++++++
> 2 files changed, 38 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/virtual/kvm/devices/vfio.txt b/Documentation/virtual/kvm/devices/vfio.txt
> index ef51740..f7aff29 100644
> --- a/Documentation/virtual/kvm/devices/vfio.txt
> +++ b/Documentation/virtual/kvm/devices/vfio.txt
> @@ -4,15 +4,24 @@ 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 tracks & enable VFIO device forwarded IRQs, if any.
s/tracks & enable/tracks and enables/
> +A physical forwarded IRQ is directly completed by the guest. This
> +requires HW support in the interrupt controller which must be able
> +to automatically complete the physical IRQ when it detects the guest
> +has completed the corresponding virtual IRQ. The modality sometimes
> +is named direct EOI.
this last sentence is a bit floating out there; perhaps you want to be
more specific and say what it is on ARM.
>
> 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 +29,16 @@ 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_arch_forwarded_irq struct.
> +
> +The forwarded state can only be changed when the VFIO signaling mechanism
> +for this physical IRQ is not set. In other words, forwarding must be
> +activated before VFIO_DEVICE_SET_IRQS has been called to trigger the IRQ
> +or associate an eventfd to it. Unforwarding can only be called while the
> +signaling has been disabled with VFIO_DEVICE_SET_IRQS. If this condition is
> +not satisfied, the command returns an -EBUSY.
s/command/ioctl/
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index 6076882..a269a42 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -946,6 +946,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
>
> enum kvm_device_type {
> KVM_DEV_TYPE_FSL_MPIC_20 = 1,
> @@ -963,6 +966,13 @@ enum kvm_device_type {
> KVM_DEV_TYPE_MAX,
> };
>
> +struct kvm_arch_forwarded_irq {
> + __u32 fd; /* file desciptor of the VFIO device */
> + __u32 index; /* VFIO device IRQ index */
> + __u32 subindex; /* VFIO device IRQ subindex */
> + __u32 gsi; /* gsi, ie. virtual IRQ number */
> +};
> +
> /*
> * ioctls for VM fds
> */
> --
> 1.9.1
>
otherwise this looks reasonable.
next prev parent reply other threads:[~2014-11-30 12:53 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-23 18:35 [PATCH v3 0/8] KVM-VFIO IRQ forward control Eric Auger
2014-11-23 18:35 ` [PATCH v3 1/8] KVM: arm: Enable the KVM-VFIO device Eric Auger
2014-11-23 18:35 ` [PATCH v3 2/8] KVM: arm64: " Eric Auger
2014-11-30 12:14 ` Christoffer Dall
2014-12-01 14:55 ` Eric Auger
2014-11-23 18:35 ` [PATCH v3 3/8] VFIO: platform: forwarded state tested when selecting IRQ handler Eric Auger
2014-11-30 12:47 ` Christoffer Dall
2014-12-01 14:39 ` Eric Auger
2014-12-01 20:10 ` Christoffer Dall
2014-12-01 21:15 ` Eric Auger
2014-11-23 18:35 ` [PATCH v3 4/8] KVM: kvm-vfio: User API for IRQ forwarding Eric Auger
2014-11-30 12:53 ` Christoffer Dall [this message]
2014-12-01 14:46 ` Eric Auger
2014-11-23 18:35 ` [PATCH v3 5/8] VFIO: External user API device helpers Eric Auger
2014-11-23 18:35 ` [PATCH v3 6/8] KVM: kvm-vfio: wrapper to VFIO external " Eric Auger
2014-11-24 20:56 ` Alex Williamson
2014-11-30 13:01 ` Christoffer Dall
2014-11-23 18:35 ` [PATCH v3 7/8] KVM: kvm-vfio: generic forwarding control Eric Auger
2014-11-24 20:56 ` Alex Williamson
2014-11-25 18:20 ` Eric Auger
2014-11-25 19:00 ` Alex Williamson
2014-12-08 12:22 ` Eric Auger
2014-12-08 16:54 ` Alex Williamson
2014-12-08 17:13 ` Eric Auger
2014-12-09 16:19 ` Eric Auger
2014-12-09 17:20 ` Alex Williamson
2014-11-25 4:33 ` Wu, Feng
2014-11-25 13:39 ` Eric Auger
2014-11-23 18:36 ` [PATCH v3 8/8] KVM: arm: kvm-vfio: " Eric Auger
2014-11-24 20:56 ` Alex Williamson
2014-11-24 8:14 ` [PATCH v3 0/8] KVM-VFIO IRQ forward control Wu, Feng
2014-11-24 8:27 ` Eric Auger
2014-11-24 8:34 ` Wu, Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141130125314.GE82106@macair \
--to=christoffer.dall@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).