Re: [PATCH v5 0/8] In-kernel XICS interrupt controller emulation

Paul Mackerras
2013-04-28T12:05:11Z

On Sun, Apr 28, 2013 at 11:50:49AM +0200, Alexander Graf wrote:
>
> On 27.04.2013, at 10:36, Paul Mackerras wrote:
>
> > On Fri, Apr 26, 2013 at 04:30:37PM +0200, Alexander Graf wrote:
> >> Very nice patch set. I've applie 1-7 of it to kvm-ppc-queue. So they will hopefully make it to 3.10.
> >>
> >> Please check for 8/8 whether
> >>
> >> a) You want to have a released kernel version without irq routing (irqfd) support. It makes user space's life harder, because you need to maintain backwards compatibility.
> >
> > If we do a version without irq routing and later add it, old userspace
> > should still work, since KVM_IRQ_LINE still works, right? New
> > userspace on an old kernel can test the KVM_CAP_IRQ_ROUTING capability
> > to see if it can use irqfd. So on the whole, I would like to get it
>
> User space would have to know about 2 different ways of setting interrupts, one through IRQ_LINE and one through whatever XICS device specific ioctl you create :).

Ummm, no, userspace uses KVM_IRQ_LINE either way. Since I don't
define CONFIG_HAVE_KVM_IRQCHIP or CONFIG_HAVE_KVM_IRQ_ROUTING, we
don't compile in virt/kvm/irqchip.c and thus we don't get a definition
of kvm_set_irq() (note that in your tree as it stands, it's only by
grace of gcc's optimizations that we don't get a link error when
CONFIG_KVM_MPIC=n, since we have the code in
arch/powerpc/kvm/powerpc.c that calls kvm_set_irq() unconditionally).

So I added a definition of kvm_set_irq() to book3s_xics.c in the patch
I posted recently, meaning that userspace can in fact use KVM_IRQ_LINE
even though I don't yet support irqfd or irq routing.

> > OK, I've done that, but I need to grab David Gibson to get a qemu that
> > knows about the new API so I can test it.
>
> Yeah, please sync with him on this whole thing too. Someone will have to write the compat code ;).

I have a version of qemu from him that uses KVM_CREATE_DEVICE to
create the XICS and KVM_IRQ_LINE to control the interrupt inputs, and
it all works just fine.

Regards,
Paul.