From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: [PATCH v2 2/2] pci-assign: Fix MSI-X capability test Date: Thu, 22 Sep 2011 12:09:07 -0600 Message-ID: <20110922180907.13603.15531.stgit@s20.home> References: <20110922180823.13603.57187.stgit@s20.home> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: jan.kiszka@siemens.com, avi@redhat.com, yongjie.ren@intel.com, alex.williamson@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:19738 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670Ab1IVSJK (ORCPT ); Thu, 22 Sep 2011 14:09:10 -0400 In-Reply-To: <20110922180823.13603.57187.stgit@s20.home> Sender: kvm-owner@vger.kernel.org List-ID: Commit c4525754 added a capability check for KVM_CAP_DEVICE_MSIX, which is unfortunately not exposed, resulting in MSIX never being listed as a capability. This breaks anything depending on MSIX, such as igbvf. Instead let's use a dummy call to KVM_ASSIGN_SET_MSIX_NR which will return -EFAULT if the call exists. Signed-off-by: Alex Williamson --- hw/device-assignment.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 137c409..f0a6ca9 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -1212,7 +1212,10 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) } /* Expose MSI-X capability */ pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_MSIX, 0); - if (pos != 0 && kvm_check_extension(kvm_state, KVM_CAP_DEVICE_MSIX)) { + /* Would really like to test kvm_check_extension(, KVM_CAP_DEVICE_MSIX), + * but the kernel doesn't expose it. Instead do a dummy call to + * KVM_ASSIGN_SET_MSIX_NR to see if it exists. */ + if (pos != 0 && kvm_assign_set_msix_nr(kvm_state, NULL) == -EFAULT) { int bar_nr; uint32_t msix_table_entry;