linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: kvm@vger.kernel.org
Cc: alex.williamson@redhat.com, bhelgaas@google.com,
	linux-pci@vger.kernel.org, Gavin Shan <gwshan@linux.vnet.ibm.com>
Subject: [PATCH 3/4] drivers/vfio/pci: Fix wrong MSI interrupt count
Date: Mon, 19 May 2014 13:01:09 +1000	[thread overview]
Message-ID: <1400468470-11262-4-git-send-email-gwshan@linux.vnet.ibm.com> (raw)
In-Reply-To: <1400468470-11262-1-git-send-email-gwshan@linux.vnet.ibm.com>

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 <gwshan@linux.vnet.ibm.com>
---
 drivers/vfio/pci/vfio_pci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 7ba0424..6b8cd07 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -196,8 +196,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;
-- 
1.8.3.2


  parent reply	other threads:[~2014-05-19  3:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19  3:01 [PATCH 0/4] VFIO Misc fixes Gavin Shan
2014-05-19  3:01 ` [PATCH 1/4] PCI: Export MSI message relevant functions Gavin Shan
2014-05-22  5:10   ` Gavin Shan
2014-09-04 22:57   ` Bjorn Helgaas
2014-09-05  0:15     ` Gavin Shan
2014-05-19  3:01 ` [PATCH 2/4] drivers/vfio: Rework offsetofend() Gavin Shan
2014-05-19  3:01 ` Gavin Shan [this message]
2014-05-19  3:01 ` [PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling Gavin Shan
2014-05-30 22:12   ` Bjorn Helgaas
2014-05-31 11:42     ` Gavin Shan
2014-06-02 16:57       ` Bjorn Helgaas
2014-06-05  5:51         ` Gavin Shan
2014-09-10  8:13   ` Gavin Shan
2014-09-26  3:19     ` Gavin Shan
2014-09-26  3:46       ` Alex Williamson
2014-09-27  5:33         ` Gavin Shan
2014-05-19 21:37 ` [PATCH 0/4] VFIO Misc fixes Alex Williamson
2014-05-30 21:06   ` Alex Williamson
  -- strict thread matches above, loose matches on Subject: below --
2014-05-13  1:35 [PATCH v2 " Gavin Shan
2014-05-13  1:35 ` [PATCH 3/4] drivers/vfio/pci: Fix wrong MSI interrupt count Gavin Shan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400468470-11262-4-git-send-email-gwshan@linux.vnet.ibm.com \
    --to=gwshan@linux.vnet.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).