From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: in-kernel interrupt controller steering Date: Wed, 6 Mar 2013 05:38:33 -0500 (EST) Message-ID: <2032322197.3144778.1362566313469.JavaMail.root@redhat.com> References: <20130306095835.GL11223@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Alexander Graf , kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Stuart Yoder , Scott Wood , Paul Mackerras , Peter Maydell To: Gleb Natapov Return-path: In-Reply-To: <20130306095835.GL11223@redhat.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org ----- Messaggio originale ----- > Da: "Gleb Natapov" > A: "Paolo Bonzini" > Cc: "Alexander Graf" , kvm@vger.kernel.org, kvm-ppc@vg= er.kernel.org, "Stuart Yoder" > , "Scott Wood" ,= "Paul Mackerras" , "Peter > Maydell" > Inviato: Mercoled=C3=AC, 6 marzo 2013 10:58:35 > Oggetto: Re: in-kernel interrupt controller steering >=20 > On Wed, Mar 06, 2013 at 10:40:18AM +0100, Paolo Bonzini wrote: > > Il 05/03/2013 16:25, Gleb Natapov ha scritto: > > >> 1) We need to set the generic interrupt type of the system > > >> before we create vcpus. > > >> > > >> This is a new ioctl that sets the overall system interrupt > > >> controller type to a specific model. This used so that when we > > >> create vcpus, we can create the appended "local interrupt > > >> controller" state without the actual interrupt controller > > >> device available yet. It is also used later to switch between > > >> interrupt controller implementations. > > >> > > >> This interrupt type is write once and frozen after the first > > >> vcpu got created. > > > > > > Why explicit ioctl is needed? Why not require specific irqchip to > > > be > > > created before first vcpu. The device created determines system > > > interrupt > > > controller type. > >=20 > > QEMU creates CPUs before devices, and CPUs need to know what kind o= f > > local interrupt controller to create. Similar to how in-kernel LAP= IC > > state is created long before the userspace device that proxies the > > LAPIC. > > So what is the difference between calling this special ioctl before > creating vcpus and calling create device ioctl instead and create > QEMU proxy device at whatever point in time QEMU wants to create it? Because you'd have to stash the handle that KVM_CREATE_DEVICE returns somewhere, waiting for the QEMU device to be created. Perhaps it's just a problem of naming, and KVM_CREATE_DEVICE is simply not the right name for the interface. Once both KVM_CREATE_IRQCHIP_ARG= S and KVM_CREATE_DEVICE are added, it really will not create the device a= nymore. Devices will be created by KVM_CREATE_IRQCHIP_ARGS, and possibly by KVM_CREATE_VCPU. KVM_CREATE_DEVICE is really only returning an id. So we can have this instead: - KVM_CREATE_IRQCHIP_ARGS becomes KVM_SET_IRQCHIP_TYPE (and "none" can be a valid irqchip type). - KVM_CREATE_DEVICE becomes KVM_GET_IRQCHIP_DEVICE, and you pass it a device type and possibly a VCPU number. It's mostly about names, but one important property is that KVM_GET_IRQCHIP_DEVICE can be called at any time and, in fact, multiple times. Gleb, do you like this more? Paolo