From: Gavin Shan Date: Fri, 30 May 2014 17:35:54 +0000 (-0600) Subject: drivers/vfio/pci: Fix wrong MSI interrupt count X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fd49c81f080a997aad4b0e73541cd42772b6a772;p=linux-beck.git drivers/vfio/pci: Fix wrong MSI interrupt count According PCI local bus specification, the register of Message Control for MSI (offset: 2, length: 2) has bit#0 to enable or disable MSI logic and it shouldn't be part contributing to the calculation of MSI interrupt count. The patch fixes the issue. Signed-off-by: Gavin Shan Signed-off-by: Alex Williamson --- diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 85063f1c12d7..010e0f8b8e4f 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -197,8 +197,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) if (pos) { pci_read_config_word(vdev->pdev, pos + PCI_MSI_FLAGS, &flags); - - return 1 << (flags & PCI_MSI_FLAGS_QMASK); + return 1 << ((flags & PCI_MSI_FLAGS_QMASK) >> 1); } } else if (irq_type == VFIO_PCI_MSIX_IRQ_INDEX) { u8 pos;