From: Paolo Bonzini Subject: Re: [PATCH RFC] kvm/hypercall: Add the PVI hypercall support Date: Fri, 14 Oct 2016 14:59:02 +0200 Message-ID: <98c0bfa2-1fd2-493d-3aef-c2a74d8282c3@redhat.com> References: <1476448259-99631-1-git-send-email-wei.w.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Wei Wang , kvm@vger.kernel.org, mst@redhat.com, marcandre.lureau@gmail.com, stefanha@redhat.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40040 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753500AbcJNNIS (ORCPT ); Fri, 14 Oct 2016 09:08:18 -0400 In-Reply-To: <1476448259-99631-1-git-send-email-wei.w.wang@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 14/10/2016 14:30, Wei Wang wrote: > PV interrupts (PVI) enables a guest to send interrupts to another via > hypercalls. > > Signed-off-by: Wei Wang > --- > pv_interrupt_controller.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > create mode 100644 pv_interrupt_controller.c > > diff --git a/pv_interrupt_controller.c b/pv_interrupt_controller.c > new file mode 100644 > index 0000000..5f2431d > --- /dev/null > +++ b/pv_interrupt_controller.c > @@ -0,0 +1,27 @@ > + > +The pv interrupt (PVI) hypercall is proposed to support one guest sending > +interrupts to another guest using hypercalls. The following pseduocode shows how > +a PVI is sent from the guest: > + > +#define KVM_HC_PVI 9 > +kvm_hypercall2(KVM_HC_PVI, guest_uuid, guest_gsi); > + > +The new hypercall number, KVM_HC_PVI, is used for the purpose of sending PVIs. > +guest_uuid is used to identify the guest that the interrupt will be sent to. > +guest_gsi identifies the interrupt source of that guest. > + > +The PVI hypercall handler in KVM iterates the VM list (the vm_list field in > +the kvm struct), finds the guest with the passed guest_uuid, and injects an > +interrupt to the guest with the guest_gsi number. > + > +Finally, it's about the permission of sending PVI from one guest to another. > +In the PVI setup phase, the PVI receiver should get the sender's UUID (e.g. via > +the vhost-user protocol extension implemented between QEMUs), and pass it to KVM. > +Two new fields will be added to the struct kvm{ }: > + > ++uuid_t uuid; // the guest uuid > ++uuid_t pvi_sender_uuid[MAX_NUM]; // the sender's uuid should be registered here > + > +PVI will not be injected to the receiver guest if the sender's uuid does not appear > +in the receiver's pvi_sender_uuid table. > + > Why would you do that instead of just using the local APIC?... Paolo