From: Wei Wang Subject: [PATCH RFC] kvm/hypercall: Add the PVI hypercall support Date: Fri, 14 Oct 2016 20:30:59 +0800 Message-ID: <1476448259-99631-1-git-send-email-wei.w.wang@intel.com> Cc: Wei Wang To: kvm@vger.kernel.org, mst@redhat.com, marcandre.lureau@gmail.com, stefanha@redhat.com, pbonzini@redhat.com Return-path: Received: from mga05.intel.com ([192.55.52.43]:15290 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755616AbcJNMbC (ORCPT ); Fri, 14 Oct 2016 08:31:02 -0400 Sender: kvm-owner@vger.kernel.org List-ID: 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. + -- 1.9.1