From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Eric Auger <eric.auger@redhat.com>
Cc: eric.auger.pro@gmail.com, marc.zyngier@arm.com,
christoffer.dall@linaro.org, andre.przywara@arm.com,
drjones@redhat.com, kvmarm@lists.cs.columbia.edu,
kvm@vger.kernel.org, pbonzini@redhat.com
Subject: Re: [RFC v8 5/7] KVM: arm/arm64: Enable irqchip routing
Date: Fri, 22 Jul 2016 16:24:02 +0200 [thread overview]
Message-ID: <20160722142401.GC9019@potion> (raw)
In-Reply-To: <1469195200-6498-6-git-send-email-eric.auger@redhat.com>
2016-07-22 13:46+0000, Eric Auger:
> This patch adds compilation and link against irqchip.
>
> Main motivation behind using irqchip code is to enable MSI
> routing code. In the future irqchip routing may also be useful
> when targeting multiple irqchips.
>
> Routing standard callbacks now are implemented in vgic-irqfd:
> - kvm_set_routing_entry
> - kvm_set_irq
> - kvm_set_msi
>
> They only are supported with new_vgic code.
>
> Both HAVE_KVM_IRQCHIP and HAVE_KVM_IRQ_ROUTING are defined.
> KVM_CAP_IRQ_ROUTING is advertised and KVM_SET_GSI_ROUTING is allowed.
>
> So from now on IRQCHIP routing is enabled and a routing table entry
> must exist for irqfd injection to succeed for a given SPI. This patch
> builds a default flat irqchip routing table (gsi=irqchip.pin) covering
> all the VGIC SPI indexes. This routing table is overwritten by the
> first first user-space call to KVM_SET_GSI_ROUTING ioctl.
>
> MSI routing setup is not yet allowed.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>
> ---
> diff --git a/virt/kvm/arm/vgic/vgic-irqfd.c b/virt/kvm/arm/vgic/vgic-irqfd.c
> @@ -17,36 +17,101 @@
> #include <linux/kvm.h>
> #include <linux/kvm_host.h>
> #include <trace/events/kvm.h>
> +#include <kvm/arm_vgic.h>
> +#include "vgic.h"
>
> -int kvm_irq_map_gsi(struct kvm *kvm,
> - struct kvm_kernel_irq_routing_entry *entries,
> - int gsi)
> +/**
> + * vgic_irqfd_set_irq: inject the IRQ corresponding to the
> + * irqchip routing entry
> + *
> + * This is the entry point for irqfd IRQ injection
> + */
> +static int vgic_irqfd_set_irq(struct kvm_kernel_irq_routing_entry *e,
> + struct kvm *kvm, int irq_source_id,
> + int level, bool line_status)
> {
> - return 0;
> + unsigned int spi_id = e->irqchip.pin + VGIC_NR_PRIVATE_IRQS;
> + struct vgic_dist *dist = &kvm->arch.vgic;
> +
> + if (spi_id > min(dist->nr_spis, VGIC_MAX_SPI))
This is more strict that vgic_valid_spi(), because spi_id between
"dist->nr_spis" and "dist->nr_spis + VGIC_NR_PRIVATE_IRQS" is not
allowed, which probably wasn't intended.
And shouldn't nr_spis always be less that VGIC_MAX_SPI?
Thanks.
> + return -EINVAL;
> + return kvm_vgic_inject_irq(kvm, 0, spi_id, level);
> }
next prev parent reply other threads:[~2016-07-22 14:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 13:46 [RFC v8 0/7] KVM: arm/arm64: gsi routing support Eric Auger
2016-07-22 13:46 ` [RFC v8 1/7] KVM: api: Pass the devid in the msi routing entry Eric Auger
2016-07-22 13:46 ` [RFC v8 2/7] KVM: Add devid in kvm_kernel_irq_routing_entry Eric Auger
2016-07-22 13:46 ` [RFC v8 3/7] KVM: irqchip: Convey devid to kvm_set_msi Eric Auger
2016-07-22 13:46 ` [RFC v8 4/7] KVM: Move kvm_setup_default/empty_irq_routing declaration in arch specific header Eric Auger
2016-07-22 13:46 ` [RFC v8 5/7] KVM: arm/arm64: Enable irqchip routing Eric Auger
2016-07-22 14:24 ` Radim Krčmář [this message]
2016-07-22 14:45 ` Auger Eric
2016-07-22 13:46 ` [RFC v8 6/7] KVM: arm/arm64: Enable MSI routing Eric Auger
2016-07-22 14:14 ` Radim Krčmář
2016-07-22 14:46 ` Auger Eric
2016-07-22 13:46 ` [RFC v8 7/7] KVM: arm: Enable KVM_SIGNAL_MSI and " 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=20160722142401.GC9019@potion \
--to=rkrcmar@redhat.com \
--cc=andre.przywara@arm.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=marc.zyngier@arm.com \
--cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.