Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754633AbaAGVlA (ORCPT ); Tue, 7 Jan 2014 16:41:00 -0500 Received: from 6.77.broadband6.iol.cz ([88.101.77.6]:50128 "EHLO dhcp-26-207.brq.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753774AbaAGVjN (ORCPT ); Tue, 7 Jan 2014 16:39:13 -0500 X-Greylist: delayed 624 seconds by postgrey-1.27 at vger.kernel.org; Tue, 07 Jan 2014 16:39:13 EST From: Alexander Gordeev To: linux-kernel@vger.kernel.org Cc: Alexander Gordeev , Alex Williamson , kvm@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH 5/7] vfio: Use new interfaces for MSI/MSI-X enablement Date: Tue, 7 Jan 2014 19:05:40 +0100 Message-Id: <1c2ab7cdd9f18f98ee86c73b182f4ee0697f7495.1389103215.git.agordeev@redhat.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This update also fixes a bug when deprecated pci_enable_msix() and pci_enable_msi_block() functions return a positive return value which indicats the number of interrupts that could have been allocated rather than a successful allocation. The driver misinterpreted this value and assumed MSI-X/MSIs are enabled, although in fact it were not. Signed-off-by: Alexander Gordeev --- drivers/vfio/pci/vfio_pci_intrs.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 641bc87..66d1746 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -482,15 +482,15 @@ static int vfio_msi_enable(struct vfio_pci_device *vdev, int nvec, bool msix) for (i = 0; i < nvec; i++) vdev->msix[i].entry = i; - ret = pci_enable_msix(pdev, vdev->msix, nvec); - if (ret) { + ret = pci_enable_msix_range(pdev, vdev->msix, nvec, nvec); + if (ret < 0) { kfree(vdev->msix); kfree(vdev->ctx); return ret; } } else { - ret = pci_enable_msi_block(pdev, nvec); - if (ret) { + ret = pci_enable_msi_range(pdev, nvec, nvec); + if (ret < 0) { kfree(vdev->ctx); return ret; } -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/