kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Christoffer Dall <c.dall@virtualopensystems.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Alexander Graf <agraf@suse.de>,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	kvm-ppc <kvm-ppc@vger.kernel.org>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [kvmarm] [RFC PATCH 0/3] KVM: ARM: Get rid of hardcoded VGIC addresses
Date: Wed, 24 Oct 2012 11:50:17 +1100	[thread overview]
Message-ID: <20121024005017.GA17834@bloggs.ozlabs.ibm.com> (raw)
In-Reply-To: <508675FC.7090901@siemens.com>

On Tue, Oct 23, 2012 at 12:48:28PM +0200, Jan Kiszka wrote:

> The current irqchip API is like this:
> 
> KVM_CREATE_IRQCHIP (without any parameters)
> ...
> KVM_CREATE_VCPU
> KVM_SET_IRQCHIP (or the other way around)
> ...
> KVM_RUN
> 
> The arguments you cannot pass via KVM_CREATE_IRQCHIP - which is more
> like a "Hey, there will be an IRQ chip!" - could be passed via
> KVM_SET_IRQCHIP (it has 512 bytes space). Provided there are sane
> configuration defaults, at least after KVM_CREATE_VCPU, KVM_SET_IRQCHIP
> becomes optional. Then you don't need the a check on KVM_RUN.

Interesting.  How many times do you call KVM_CREATE_IRQCHIP per VM?
Just once?

> What do we need in addition to this in any of the non-x86 archs?

What we have with the XICS, and to some extent with the OpenPIC, is a
separation between "source" and "presentation" controllers, with a
message-passing fabric between them.  The source controllers handle
the details of some number of interrupt sources, such as the priority
and destination of each interrupt source, and the presentation
controllers handle the interface to the CPUs, so there is one
presentation controller per CPU.  The presentation controller for a
CPU has registers for the CPU priority, IPI request priority, and
pending interrupt status.

So we could indeed use the existing KVM_CREATE_IRQCHIP to tell KVM to
create a presentation controller per vcpu.  But then how do we tell
KVM how many source controllers we want and how many interrupts each
source controller should handle?  The source controllers are not tied
to any particular vcpu, and a source controller could potentially have
100s of interrupts or more (particularly with MSIs).  Configuration of
each source fits into 64 bits, so if we tried to use KVM_SET_IRQCHIP
for configuring a source controller we'd be limited to 64 interrupts
per source controller.

What I have in my patches to do XICS emulation in the kernel is a new
KVM_CREATE_IRQCHIP_ARGS ioctl, which takes an argument struct with a
type, and for source controllers, an identifying number ("bus unit ID"
or BUID, since that's what the hardware calls it) and the number of
sources.  Then for saving/restoring the presentation controller state
there's a register identifier for the KVM_GET/SET_ONE_REG ioctls, and
for the source controllers there are new KVM_IRQCHIP_GET/SET_SOURCES
ioctls that take an argument struct like this:

struct kvm_irq_sources {
	__u32 start_irq_number;
	__u32 nr_irqs;
	__u64 *irqbuf;
};

OpenPIC also can handle 100s or 1000s of interrupt sources and can
have the sources divided up into blocks (which tends to make it
desirable to have multiple source controllers).  It also has per-CPU
interrupt delivery registers and per-source interrupt source
registers.

So I think all this could be shoehorned into KVM_CREATE/GET/SET_IRQCHIP
for small configurations, but it seems like it would run out of space
for larger configurations.

Paul.

  parent reply	other threads:[~2012-10-24  0:50 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-14  0:04 [RFC PATCH 0/3] KVM: ARM: Get rid of hardcoded VGIC addresses Christoffer Dall
2012-10-14  0:04 ` [RFC PATCH 1/3] KVM: ARM: Introduce KVM_INIT_IRQCHIP ioctl Christoffer Dall
2012-10-17 20:21   ` Peter Maydell
2012-10-17 20:23     ` Christoffer Dall
2012-10-17 20:31       ` Peter Maydell
2012-10-17 20:39         ` Christoffer Dall
2012-10-18 12:20   ` Avi Kivity
2012-10-19 18:42     ` Christoffer Dall
2012-10-14  0:04 ` [RFC PATCH 2/3] KVM: ARM: Introduce KVM_SET_DEVICE_ADDRESS ioctl Christoffer Dall
2012-10-17 20:29   ` Peter Maydell
2012-10-19 18:46     ` Christoffer Dall
2012-10-19 20:24       ` Peter Maydell
2012-10-19 20:27         ` Christoffer Dall
2012-10-19 20:33           ` Christoffer Dall
2012-10-14  0:04 ` [RFC PATCH 3/3] KVM: ARM: Split KVM_CREATE_IRQCHIP and KVM_INIT_IRQCHIP Christoffer Dall
2012-10-18 11:15   ` Peter Maydell
2012-10-17 20:38 ` [kvmarm] [RFC PATCH 0/3] KVM: ARM: Get rid of hardcoded VGIC addresses Alexander Graf
2012-10-17 20:39   ` Christoffer Dall
2012-10-17 21:19     ` Benjamin Herrenschmidt
2012-10-17 22:10     ` Paul Mackerras
2012-10-17 23:58       ` Benjamin Herrenschmidt
2012-10-18 13:48         ` Christoffer Dall
2012-10-18 13:49           ` Alexander Graf
2012-10-18 15:25             ` Avi Kivity
2012-10-23 10:48           ` Jan Kiszka
2012-10-23 10:52             ` Peter Maydell
2012-10-23 11:00               ` Jan Kiszka
2012-10-23 11:04                 ` Peter Maydell
2012-10-23 11:08                   ` Jan Kiszka
2012-10-24  0:50             ` Paul Mackerras [this message]
2012-10-25 11:57               ` Jan Kiszka
2012-10-25 16:14               ` Paolo Bonzini
2012-10-25 16:32                 ` Jan Kiszka
2012-10-25 18:27                   ` Paolo Bonzini
2012-10-25 19:40                     ` Benjamin Herrenschmidt
2012-10-26  9:58                       ` Paolo Bonzini
2012-10-26 10:09                         ` Peter Maydell
2012-10-26 10:15                           ` Paolo Bonzini
2012-10-26 10:22                             ` Jan Kiszka
2012-10-26 10:44                             ` Benjamin Herrenschmidt
2012-10-26 11:00                               ` Jan Kiszka
2012-10-26 11:09                                 ` Benjamin Herrenschmidt
2012-10-26 11:57                                   ` Paolo Bonzini
2012-10-26 12:08                                     ` Peter Maydell
2012-10-26 12:41                                       ` Jan Kiszka
2012-10-26 20:21                                     ` Benjamin Herrenschmidt
2012-10-26 11:17                               ` Peter Maydell
2012-10-26 11:39                                 ` Benjamin Herrenschmidt
2012-10-26 12:39                                   ` Jan Kiszka
2012-10-26 20:45                                     ` Benjamin Herrenschmidt
2012-10-26 22:03                                       ` Benjamin Herrenschmidt
2012-10-27  8:06                                         ` Jan Kiszka
2012-10-27 10:01                                         ` Peter Maydell
2012-10-28 22:19                                           ` Benjamin Herrenschmidt
2012-10-26 10:37                         ` Benjamin Herrenschmidt
2012-10-26 10:40                           ` Paolo Bonzini
2012-10-26 10:47                             ` Benjamin Herrenschmidt
2012-10-26 11:47                               ` Paolo Bonzini
2012-10-25 19:39                 ` Benjamin Herrenschmidt

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=20121024005017.GA17834@bloggs.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=agraf@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=c.dall@virtualopensystems.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=peter.maydell@linaro.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).