On Wed, Mar 06, 2013 at 02:41:04PM +0100, Paolo Bonzini wrote:
> Il 06/03/2013 14:14, Gleb Natapov ha scritto:
> >>>> The problem would only start if KVM_SET_IRQCHIP_TYPE (new name of
> >>>> KVM_CREATE_IRQCHIP_ARGS) forced you to later call KVM_CREATE_DEVICE.
> >>> 
> >>> Ah, I see. I don't see why it would. The fact that there is a
> >>> "LAPIC" doesn't mean that the per-vcpu SET_INTERRUPT ioctl stops
> >>> working. So if SET_IRQCHIP_TYPE(!none) breaks user-space interrupt
> >>> controller emulation I would consider that a bug.
> >> 
> > For x86 this is the case though. I do not see how it can't be. If
> > LAPIC is emulated in userspace SET_INTERRUPT is used to pass IRQ
> > vector that should be handled as a result of LAPIC emulation.
> 
> SET_IRQCHIP_TYPE creates the LAPICs; it would indeed break userspace
> LAPIC emulation because the LAPICs would not cause userspace exits anymore.
> 
The reason it will break userspace is much more fundamental than that.
There is not interface suitable for communication between userspace
PIC/IOAPIC and in-kernel LAPIC right now.

Why LAPICs should cause userspace exit? The reason we exit to userspace
without in kernel irqchip is because we need LAPIC emulation to run.
 
> However, it need not mandate the usage of an in-kernel IOAPIC or PIC
> though. 
There is no such need, its just how things are implemented right now. To
allow IOAPIC/PIC to be in userspace and LAPIC in kernel additional
interfaces are needed and since we need to keep current way for
foreseeable feature the value of doing the work is not clear.

>          KVM_INTERRUPT, the docs say, "is only useful if in-kernel local
> APIC or equivalent is not used", but it is really only useful for if
> in-kernel *IOAPIC* is not used.  The userspace IOAPIC can use it to
> inject the interrupts to the in-kernel LAPIC.
KVM_INTERRUPT is synchronous. There is no reason for userspace
IOAPIC<->kernel space LAPIC interface to be synchronous. KVM_IRQ_LINE is
much better fit.

> 
> So, it would be possible to create the IOAPIC or PIC separately with
> KVM_CREATE_DEVICE, and have the userspace devices inject the interrupts
> with KVM_IRQ_LINE_STATUS (PIC->IOAPIC) or KVM_INTERRUPT (IOAPIC->LAPIC).
> 
PIC never injects into IOAPIC. Some GSIs are handled by both.

--
                        Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to