From: alex.williamson@redhat.com (Alex Williamson)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC v5 08/13] KVM: kvm-vfio: wrappers for vfio_external_{mask|is_active|set_automasked}
Date: Tue, 31 Mar 2015 11:20:18 -0600 [thread overview]
Message-ID: <1427822418.5567.166.camel@redhat.com> (raw)
In-Reply-To: <1426776951-24901-9-git-send-email-eric.auger@linaro.org>
On Thu, 2015-03-19 at 15:55 +0100, Eric Auger wrote:
> Those 3 new wrapper functions call the respective VFIO external
> functions.
>
> Signed-off-by: Eric Auger <eric.auger@linaro.org>
>
> ---
>
> v4: creation
> ---
> include/linux/vfio.h | 8 +++-----
> virt/kvm/vfio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 47 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/vfio.h b/include/linux/vfio.h
> index 7aa6330..78c1202 100644
> --- a/include/linux/vfio.h
> +++ b/include/linux/vfio.h
> @@ -108,14 +108,12 @@ extern struct device *vfio_external_base_device(struct vfio_device *vdev);
> struct vfio_platform_device;
> extern void vfio_external_mask(struct vfio_platform_device *vdev, int index);
> /*
> - * returns whether the VFIO IRQ is active:
> - * true if not yet deactivated at interrupt controller level or if
> - * automasked (level sensitive IRQ). Unfortunately there is no way to
> - * discriminate between handler auto-masking and user-space masking
> + * returns whether the VFIO IRQ is active at interrupt controller level
> + * or VFIO-masked. Note that if the use-space masked the IRQ index it
> + * cannot be discriminated from automasked handler situation.
> */
> extern bool vfio_external_is_active(struct vfio_platform_device *vdev,
> int index);
> -
> extern void vfio_external_set_automasked(struct vfio_platform_device *vdev,
> int index, bool automasked);
>
> diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
> index 80a45e4..c995e51 100644
> --- a/virt/kvm/vfio.c
> +++ b/virt/kvm/vfio.c
> @@ -134,6 +134,50 @@ static void kvm_vfio_put_vfio_device(struct vfio_device *vdev)
> kvm_vfio_device_put_external_user(vdev);
> }
>
> +bool kvm_vfio_external_is_active(struct vfio_platform_device *vpdev,
> + int index)
> +{
> + bool (*fn)(struct vfio_platform_device *, int index);
> + bool active;
> +
> + fn = symbol_get(vfio_external_is_active);
> + if (!fn)
> + return -1;
> +
> + active = fn(vpdev, index);
> +
> + symbol_put(vfio_external_is_active);
> + return active;
> +}
> +
> +void kvm_vfio_external_mask(struct vfio_platform_device *vpdev,
> + int index)
> +{
> + void (*fn)(struct vfio_platform_device *, int index);
> +
> + fn = symbol_get(vfio_external_mask);
> + if (!fn)
> + return;
> +
> + fn(vpdev, index);
> +
> + symbol_put(vfio_external_mask);
> +}
> +
> +void kvm_vfio_external_set_automasked(struct vfio_platform_device *vpdev,
> + int index, bool automasked)
> +{
> + void (*fn)(struct vfio_platform_device *, int index, bool automasked);
> +
> + fn = symbol_get(vfio_external_set_automasked);
> + if (!fn)
> + return;
> +
> + fn(vpdev, index, automasked);
> +
> + symbol_put(vfio_external_set_automasked);
> +}
> +
I think we'd really prefer not to be dealing with vfio_platform_devices
here.
> static bool kvm_vfio_group_is_coherent(struct vfio_group *vfio_group)
> {
> long (*fn)(struct vfio_group *, unsigned long);
next prev parent reply other threads:[~2015-03-31 17:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-19 14:55 [RFC v5 00/13] KVM-VFIO IRQ forward control Eric Auger
2015-03-19 14:55 ` [RFC v5 01/13] KVM: arm/arm64: Enable the KVM-VFIO device Eric Auger
2015-03-19 14:55 ` [RFC v5 02/13] VFIO: platform: test forwarded state when selecting IRQ handler Eric Auger
2015-03-19 14:55 ` [RFC v5 03/13] VFIO: platform: single handler using function pointer Eric Auger
2015-03-19 14:55 ` [RFC v5 04/13] KVM: kvm-vfio: User API for IRQ forwarding Eric Auger
2015-03-19 14:55 ` [RFC v5 05/13] VFIO: external user API for interaction with vfio devices Eric Auger
2015-03-19 14:55 ` [RFC v5 06/13] VFIO: platform: add vfio_external_{mask|is_active|set_automasked} Eric Auger
2015-03-31 17:20 ` Alex Williamson
2015-04-01 12:20 ` Eric Auger
2015-03-19 14:55 ` [RFC v5 07/13] KVM: kvm-vfio: wrappers to VFIO external API device helpers Eric Auger
2015-03-19 14:55 ` [RFC v5 08/13] KVM: kvm-vfio: wrappers for vfio_external_{mask|is_active|set_automasked} Eric Auger
2015-03-31 17:20 ` Alex Williamson [this message]
2015-03-19 14:55 ` [RFC v5 09/13] KVM: arm: rename pause into power_off Eric Auger
2015-03-19 14:55 ` [RFC v5 10/13] kvm: introduce kvm_arch_halt_guest and kvm_arch_resume_guest Eric Auger
2015-03-19 14:55 ` [RFC v5 11/13] kvm: arm/arm64: implement " Eric Auger
2015-03-19 14:55 ` [RFC v5 12/13] KVM: kvm-vfio: generic forwarding control Eric Auger
2015-03-31 17:20 ` Alex Williamson
2015-03-19 14:55 ` [RFC v5 13/13] KVM: arm/arm64: vgic: " Eric Auger
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=1427822418.5567.166.camel@redhat.com \
--to=alex.williamson@redhat.com \
--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).