From: Christoffer Dall <cdall@linaro.org>
To: Eric Auger <eric.auger@redhat.com>
Cc: eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
alex.williamson@redhat.com, b.reynal@virtualopensystems.com,
pbonzini@redhat.com, marc.zyngier@arm.com,
christoffer.dall@linaro.org, drjones@redhat.com, wei@redhat.com
Subject: Re: [PATCH v2 8/8] KVM: arm/arm64: register DEOI irq bypass consumer on ARM/ARM64
Date: Fri, 21 Jul 2017 15:25:06 +0200 [thread overview]
Message-ID: <20170721132506.GI16350@cbox> (raw)
In-Reply-To: <1497531160-29162-9-git-send-email-eric.auger@redhat.com>
On Thu, Jun 15, 2017 at 02:52:40PM +0200, Eric Auger wrote:
> This patch selects IRQ_BYPASS_MANAGER and HAVE_KVM_IRQ_BYPASS
> configs for ARM/ARM64.
>
> kvm_arch_has_irq_bypass() now is implemented and returns true.
> As a consequence the irq bypass consumer will be registered for
> ARM/ARM64 with Direct EOI/IRQ forwarding callbacks:
>
> - stop/start: halt/resume guest execution
> - add/del_producer: set/unset forwarding/DEOI at vgic/irqchip level
>
> The consumer currently only works with a VFIO_PLATFORM producer.
> In other cases, start/stop do nothing and return without error
> to avoid outputting a spurious warning.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>
> ---
>
> v1 -> v2:
> - check the type of the producer to avoid attachement with VFIO-PCI
> dummy MSI producer
> ---
> arch/arm/kvm/Kconfig | 3 +++
> arch/arm64/kvm/Kconfig | 3 +++
> virt/kvm/arm/arm.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 54 insertions(+)
>
> diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
> index 90d0176..4e2b192 100644
> --- a/arch/arm/kvm/Kconfig
> +++ b/arch/arm/kvm/Kconfig
> @@ -3,6 +3,7 @@
> #
>
> source "virt/kvm/Kconfig"
> +source "virt/lib/Kconfig"
>
> menuconfig VIRTUALIZATION
> bool "Virtualization"
> @@ -35,6 +36,8 @@ config KVM
> select HAVE_KVM_IRQCHIP
> select HAVE_KVM_IRQ_ROUTING
> select HAVE_KVM_MSI
> + select IRQ_BYPASS_MANAGER
> + select HAVE_KVM_IRQ_BYPASS
> depends on ARM_VIRT_EXT && ARM_LPAE && ARM_ARCH_TIMER
> ---help---
> Support hosting virtualized guest machines.
> diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
> index 52cb7ad..7e0d6e6 100644
> --- a/arch/arm64/kvm/Kconfig
> +++ b/arch/arm64/kvm/Kconfig
> @@ -3,6 +3,7 @@
> #
>
> source "virt/kvm/Kconfig"
> +source "virt/lib/Kconfig"
>
> menuconfig VIRTUALIZATION
> bool "Virtualization"
> @@ -35,6 +36,8 @@ config KVM
> select HAVE_KVM_MSI
> select HAVE_KVM_IRQCHIP
> select HAVE_KVM_IRQ_ROUTING
> + select IRQ_BYPASS_MANAGER
> + select HAVE_KVM_IRQ_BYPASS
> ---help---
> Support hosting virtualized guest machines.
> We don't support KVM with 16K page tables yet, due to the multiple
> diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
> index 3417e18..58871f8 100644
> --- a/virt/kvm/arm/arm.c
> +++ b/virt/kvm/arm/arm.c
> @@ -27,6 +27,8 @@
> #include <linux/mman.h>
> #include <linux/sched.h>
> #include <linux/kvm.h>
> +#include <linux/kvm_irqfd.h>
> +#include <linux/irqbypass.h>
> #include <trace/events/kvm.h>
> #include <kvm/arm_pmu.h>
>
> @@ -1420,6 +1422,52 @@ struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr)
> return NULL;
> }
>
> +bool kvm_arch_has_irq_bypass(void)
> +{
> + return true;
> +}
> +
> +int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *cons,
> + struct irq_bypass_producer *prod)
> +{
> + struct kvm_kernel_irqfd *irqfd =
> + container_of(cons, struct kvm_kernel_irqfd, consumer);
> +
> + if (prod->type != IRQ_BYPASS_VFIO_PLATFORM)
> + return 0;
> +
> + return kvm_vgic_set_forwarding(irqfd->kvm, prod->irq,
> + irqfd->gsi + VGIC_NR_PRIVATE_IRQS);
> +}
> +void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
> + struct irq_bypass_producer *prod)
> +{
> + struct kvm_kernel_irqfd *irqfd =
> + container_of(cons, struct kvm_kernel_irqfd, consumer);
> +
> + if (prod->type != IRQ_BYPASS_VFIO_PLATFORM)
> + return;
> +
> + kvm_vgic_unset_forwarding(irqfd->kvm, prod->irq,
> + irqfd->gsi + VGIC_NR_PRIVATE_IRQS);
> +}
> +
> +void kvm_arch_irq_bypass_stop(struct irq_bypass_consumer *cons)
> +{
> + struct kvm_kernel_irqfd *irqfd =
> + container_of(cons, struct kvm_kernel_irqfd, consumer);
> +
> + kvm_arm_halt_guest(irqfd->kvm);
> +}
> +
> +void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *cons)
> +{
> + struct kvm_kernel_irqfd *irqfd =
> + container_of(cons, struct kvm_kernel_irqfd, consumer);
> +
> + kvm_arm_resume_guest(irqfd->kvm);
> +}
> +
> /**
> * Initialize Hyp-mode and memory mappings on all CPUs.
> */
> --
> 2.5.5
Nit: I'm wondering if this should go in a different file, like
virt/kvm/arm/irqbypass.c, or virt/kvm/arm/vgic/vgic-irqbypass.c ?
Thanks,
-Christoffer
prev parent reply other threads:[~2017-07-21 13:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-15 12:52 [PATCH v2 0/8] ARM/ARM64 Direct EOI setup for VFIO platform interrupts Eric Auger
2017-06-15 12:52 ` [PATCH v2 1/8] VFIO: platform: Differentiate auto-masking from user masking Eric Auger
2017-06-15 12:52 ` [PATCH v2 2/8] VFIO: platform: Introduce direct EOI interrupt handler Eric Auger
2017-06-15 12:52 ` [PATCH v2 3/8] VFIO: platform: Direct EOI irq bypass for ARM/ARM64 Eric Auger
2017-06-15 12:52 ` [PATCH v2 4/8] KVM: arm/arm64: vgic: restructure kvm_vgic_(un)map_phys_irq Eric Auger
2017-07-21 11:44 ` Christoffer Dall
2017-08-22 14:33 ` Auger Eric
2017-06-15 12:52 ` [PATCH v2 5/8] KVM: arm/arm64: vgic: Handle mapped level sensitive SPIs Eric Auger
2017-07-04 12:15 ` Marc Zyngier
2017-07-07 7:41 ` Auger Eric
2017-07-21 13:03 ` Christoffer Dall
2017-07-25 13:47 ` Marc Zyngier
2017-07-25 14:48 ` Christoffer Dall
2017-07-25 15:41 ` Marc Zyngier
2017-07-26 9:37 ` Christoffer Dall
2017-08-22 14:35 ` Auger Eric
2017-08-24 14:56 ` Christoffer Dall
2017-08-23 7:25 ` Auger Eric
2017-07-21 12:11 ` Christoffer Dall
2017-08-22 14:33 ` Auger Eric
2017-08-29 6:45 ` Christoffer Dall
2017-08-29 6:58 ` Auger Eric
2017-06-15 12:52 ` [PATCH v2 6/8] KVM: arm/arm64: vgic: Implement forwarding setting Eric Auger
2017-07-21 13:13 ` Christoffer Dall
2017-08-23 8:58 ` Auger Eric
2017-08-29 7:08 ` Christoffer Dall
2017-06-15 12:52 ` [PATCH v2 7/8] virt: irqbypass: Add a type field to the irqbypass producer Eric Auger
2017-06-15 12:52 ` [PATCH v2 8/8] KVM: arm/arm64: register DEOI irq bypass consumer on ARM/ARM64 Eric Auger
2017-07-21 13:25 ` Christoffer Dall [this message]
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=20170721132506.GI16350@cbox \
--to=cdall@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=b.reynal@virtualopensystems.com \
--cc=christoffer.dall@linaro.org \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=pbonzini@redhat.com \
--cc=wei@redhat.com \
/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).