From: Will Deacon <will.deacon@arm.com>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Sasha Levin <sasha.levin@oracle.com>,
Pekka Enberg <penberg@kernel.org>,
kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] irq: move IRQ routing into irq.c
Date: Wed, 2 Mar 2016 00:37:02 +0000 [thread overview]
Message-ID: <20160302003702.GD14022@arm.com> (raw)
In-Reply-To: <1456850978-14091-2-git-send-email-andre.przywara@arm.com>
Hi Andre,
On Tue, Mar 01, 2016 at 04:49:36PM +0000, Andre Przywara wrote:
> The current IRQ routing code in x86/irq.c is mostly implementing a
> generic KVM interface which other architectures may use too.
> Move the code to set up an MSI route into the generic irq.c file and
> guard it with the KVM_CAP_IRQ_ROUTING capability to return an error
> if the kernel does not support interrupt routing.
> This also removes the dummy implementations for all other
> architectures and only leaves the x86 specific code in x86/irq.c.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> Makefile | 4 +--
> arm/irq.c | 9 ------
> hw/pci-shmem.c | 2 ++
> include/kvm/irq.h | 5 ++++
> irq.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> mips/irq.c | 10 -------
> powerpc/irq.c | 31 ---------------------
> virtio/pci.c | 18 ++++++++----
> x86/irq.c | 45 ++++--------------------------
> 9 files changed, 108 insertions(+), 99 deletions(-)
> delete mode 100644 arm/irq.c
> delete mode 100644 mips/irq.c
> delete mode 100644 powerpc/irq.c
[...]
> diff --git a/x86/irq.c b/x86/irq.c
> index 72177e7..49b2e90 100644
> --- a/x86/irq.c
> +++ b/x86/irq.c
> @@ -11,20 +11,15 @@
> #include <stddef.h>
> #include <stdlib.h>
>
> -#define IRQ_MAX_GSI 64
> #define IRQCHIP_MASTER 0
> #define IRQCHIP_SLAVE 1
> #define IRQCHIP_IOAPIC 2
>
> -/* First 24 GSIs are routed between IRQCHIPs and IOAPICs */
> -static u32 gsi = 24;
> -
> -struct kvm_irq_routing *irq_routing;
> -
> static int irq__add_routing(u32 gsi, u32 type, u32 irqchip, u32 pin)
> {
> - if (gsi >= IRQ_MAX_GSI)
> - return -ENOSPC;
> + int r = irq__allocate_routing_entry();
> + if (r)
> + return r;
>
> irq_routing->entries[irq_routing->nr++] =
> (struct kvm_irq_routing_entry) {
> @@ -41,11 +36,6 @@ int irq__init(struct kvm *kvm)
> {
> int i, r;
>
> - irq_routing = calloc(sizeof(struct kvm_irq_routing) +
> - IRQ_MAX_GSI * sizeof(struct kvm_irq_routing_entry), 1);
> - if (irq_routing == NULL)
> - return -ENOMEM;
> -
> /* Hook first 8 GSIs to master IRQCHIP */
> for (i = 0; i < 8; i++)
> if (i != 2)
> @@ -69,33 +59,8 @@ int irq__init(struct kvm *kvm)
> return errno;
> }
>
> - return 0;
> -}
> -dev_base_init(irq__init);
> + next_gsi = 24;
Can we not just have an arch-specific initialiser that defaults to zero,
like we do for wired interrupts? (e.g. KVM_MSI_OFFSET). That way, we can
keep next_gsi private to the common irq routing code.
Will
next prev parent reply other threads:[~2016-03-02 0:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 16:49 [PATCH 0/3] kvmtool: fix vhost-net support Andre Przywara
2016-03-01 16:49 ` [PATCH 1/3] irq: move IRQ routing into irq.c Andre Przywara
2016-03-02 0:37 ` Will Deacon [this message]
2016-03-01 16:49 ` [PATCH 2/3] MSI-X: update GSI routing after changed MSI-X configuration Andre Przywara
2016-03-02 1:16 ` Will Deacon
2016-03-02 22:20 ` André Przywara
2016-03-01 16:49 ` [PATCH 3/3] virtio: fix endianness check for vhost support Andre Przywara
2016-03-02 1:27 ` Will Deacon
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=20160302003702.GD14022@arm.com \
--to=will.deacon@arm.com \
--cc=andre.przywara@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=sasha.levin@oracle.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