From patchwork Fri Oct 14 12:30:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Wei W" X-Patchwork-Id: 9376641 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E11A36022E for ; Fri, 14 Oct 2016 12:31:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCC1E2A5FE for ; Fri, 14 Oct 2016 12:31:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C16362A635; Fri, 14 Oct 2016 12:31:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A7702A5FE for ; Fri, 14 Oct 2016 12:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756253AbcJNMbU (ORCPT ); Fri, 14 Oct 2016 08:31:20 -0400 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 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP; 14 Oct 2016 05:31:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,344,1473145200"; d="scan'208";a="772584206" Received: from ww-bdw.sh.intel.com ([10.239.48.149]) by FMSMGA003.fm.intel.com with ESMTP; 14 Oct 2016 05:30:59 -0700 From: Wei Wang To: kvm@vger.kernel.org, mst@redhat.com, marcandre.lureau@gmail.com, stefanha@redhat.com, pbonzini@redhat.com Cc: 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> X-Mailer: git-send-email 1.9.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. +