From patchwork Mon Mar 2 08:29:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 9502 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n228Tjw1011310 for ; Mon, 2 Mar 2009 08:29:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756045AbZCBI3o (ORCPT ); Mon, 2 Mar 2009 03:29:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756342AbZCBI3o (ORCPT ); Mon, 2 Mar 2009 03:29:44 -0500 Received: from mga11.intel.com ([192.55.52.93]:33048 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756045AbZCBI3j (ORCPT ); Mon, 2 Mar 2009 03:29:39 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 02 Mar 2009 00:27:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,288,1233561600"; d="scan'208";a="435277311" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.189]) by fmsmga002.fm.intel.com with ESMTP; 02 Mar 2009 00:25:23 -0800 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1Le3Wo-0001oZ-53; Mon, 02 Mar 2009 16:29:34 +0800 From: Sheng Yang To: Avi Kivity , Marcelo Tosatti , Anthony Liguori Cc: kvm@vger.kernel.org, Sheng Yang Subject: [PATCH 09/10] kvm: add ioctl KVM_SET_MSIX_ENTRY_NR and KVM_SET_MSIX_ENTRY Date: Mon, 2 Mar 2009 16:29:32 +0800 Message-Id: <1235982573-6932-10-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1235982573-6932-1-git-send-email-sheng@linux.intel.com> References: <1235982573-6932-1-git-send-email-sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Sheng Yang --- libkvm/libkvm.c | 25 +++++++++++++++++++++++++ libkvm/libkvm.h | 7 +++++++ 2 files changed, 32 insertions(+), 0 deletions(-) diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c index 58ac995..bec1d4a 100644 --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -1369,3 +1369,28 @@ int kvm_get_irq_route_gsi(kvm_context_t kvm) (kvm->max_used_gsi + 1) : KVM_IOAPIC_NUM_PINS; } +#ifdef KVM_CAP_DEVICE_MSIX +int kvm_assign_set_msix_nr(kvm_context_t kvm, + struct kvm_assigned_msix_nr *msix_nr) +{ + int ret; + + ret = ioctl(kvm->vm_fd, KVM_ASSIGN_SET_MSIX_NR, msix_nr); + if (ret < 0) + return -errno; + + return ret; +} + +int kvm_assign_set_msix_entry(kvm_context_t kvm, + struct kvm_assigned_msix_entry *entry) +{ + int ret; + + ret = ioctl(kvm->vm_fd, KVM_ASSIGN_SET_MSIX_ENTRY, entry); + if (ret < 0) + return -errno; + + return ret; +} +#endif diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h index 65c4e75..f288dad 100644 --- a/libkvm/libkvm.h +++ b/libkvm/libkvm.h @@ -841,4 +841,11 @@ int kvm_commit_irq_routes(kvm_context_t kvm); * \param kvm Pointer to the current kvm_context */ int kvm_get_irq_route_gsi(kvm_context_t kvm); + +#ifdef KVM_CAP_DEVICE_MSIX +int kvm_assign_set_msix_nr(kvm_context_t kvm, + struct kvm_assigned_msix_nr *msix_nr); +int kvm_assign_set_msix_entry(kvm_context_t kvm, + struct kvm_assigned_msix_entry *entry); +#endif #endif