On Friday, October 14, 2016 11:08 PM, Paolo Bonzini wrote: > On 14/10/2016 16:56, Wang, Wei W wrote: > > > > On Friday, October 14, 2016 10:13 PM, Paolo Bonzini wrote: > >> On 14/10/2016 16:00, Wang, Wei W wrote: > >>>> Why would you do that instead of just using the local APIC?... > >>> > >>> The interrupt will be delivered to LAPIC - the hypercall hander > >>> injects the interrupt via kvm_set_irq(kvm, GSI,..), which finally > >>> uses LAPIC, right? > >> > >> But why do you need that? You can just deliver it to the appropriate > >> local APIC interrupt, there's no need to know the GSI. > >> The guest knows how it has configured the GSIs. > >> > >> You haven't explained the use case. > > > > Sure. One example here is to send an interrupt from a virtio driver > > (e.g. the vhost-pci-net that we are working on) on a guest to a > > virtio-net device on another guest. In terms of injecting an interrupt > > to the virtio-net device, should we give the sender the related GSI > > assigned to the virtio-net device (i.e. the GSI of an RX queue, to > > notify the virtio-net driver to receive packets from that RX queue)? > > In terms of vhost-pci, a write to an MMIO register on the vhost side (the guest- > >host doorbell) would trigger an irq on the virtio side (the > host->guest doorbell). Yes, that's the traditional mechanism - ioeventfd and irqfd. they're fine for the current "guest virtio <->host" notification. But when it comes to the "guest virtio<-->guest virtio" notification case, it should be clear where the interrupt should go to (e.g. which specific device interrupt it is), rather than just trapping to the host. So, instead of simply trapping to the host by an MMIO write, hypercall gives us the flexibility to pass some parameters. > There is no need to know GSIs, they are entirely hidden in QEMU. The GSI number is assigned in QEMU. By making use of the traditional irqfd implementation code in QEMU, a virtq's GSI is stored in the irqfd struct - "VirtIOIRQFD->virq", we can pass it or them(the multi-queue case) to the sender. I prefer GSI, because the KVM irq routing table is indexed by GSI. Would this be acceptable? Alternatively, we can pass the vector of the virtq. Best, Wei ��.n��������+%������w��{.n�����o�^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�