From c482c49b11f0db2db2a5c665b2e031285525a95f Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Thu, 22 Sep 2011 12:09:07 -0600 Subject: [PATCH] pci-assign: Fix MSI-X capability test 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 Signed-off-by: Marcelo Tosatti --- hw/device-assignment.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 137c409c34..f0a6ca9b24 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; -- 2.11.4.GIT