From patchwork Tue Mar 3 07:49:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 9652 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 n237nSlK011102 for ; Tue, 3 Mar 2009 07:49:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750768AbZCCHtZ (ORCPT ); Tue, 3 Mar 2009 02:49:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751664AbZCCHtZ (ORCPT ); Tue, 3 Mar 2009 02:49:25 -0500 Received: from mga11.intel.com ([192.55.52.93]:57868 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbZCCHtZ (ORCPT ); Tue, 3 Mar 2009 02:49:25 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 02 Mar 2009 23:47:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,295,1233561600"; d="scan'208";a="435651211" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.189]) by fmsmga002.fm.intel.com with ESMTP; 02 Mar 2009 23:45:08 -0800 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1LePNP-0003EP-A4; Tue, 03 Mar 2009 15:49:19 +0800 From: Sheng Yang To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, Sheng Yang Subject: [PATCH] KVM: Fix assigned device with no irq Date: Tue, 3 Mar 2009 15:49:19 +0800 Message-Id: <1236066559-12403-1-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.5.6.3 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Some device like VF of SRIOV only support MSI-X. With this patch, SRIOV can be enabled with KVM assigned device(all kernel space patches are ready). Signed-off-by: Sheng Yang --- virt/kvm/kvm_main.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 4d2be16..5dc6423 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -308,6 +308,10 @@ static int assigned_device_update_intx(struct kvm *kvm, if (adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_INTX) return 0; + /* IRQ 0 means uninitialized */ + if (adev->host_irq == 0) + return 0; + if (irqchip_in_kernel(kvm)) { if (!msi2intx && (adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI)) { @@ -529,9 +533,8 @@ static int kvm_vm_ioctl_assign_irq(struct kvm *kvm, r = 0; } else { printk(KERN_WARNING - "kvm: failed to enable MSI device!\n"); - r = -ENOTTY; - goto out_release; + "kvm: device didn't support INTx or MSI!\n"); + r = 0; } } else { /* Non-sharing INTx mode */