diff mbox

[for,2.6.30?,1/1] pci: fix MSI-X with NIU cards

Message ID 200905122047.n4CKlp8w029647@imap1.linux-foundation.org (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Andrew Morton May 12, 2009, 8:28 p.m. UTC
From: Matthew Wilcox <matthew@wil.cx>

The NIU device refuses to allow accesses to MSI-X registers before MSI-X
is enabled.  This patch fixes the problem by moving the read of the mask
register to after MSI-X is enabled.

Reported-by: David S. Miller <davem@davemloft.net>
Tested-by: David S. Miller <davem@davemloft.net>
Reviewed-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/pci/msi.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox

Patch

diff -puN drivers/pci/msi.c~pci-fix-msi-x-with-niu-cards drivers/pci/msi.c
--- a/drivers/pci/msi.c~pci-fix-msi-x-with-niu-cards
+++ a/drivers/pci/msi.c
@@ -455,8 +455,6 @@  static int msix_capability_init(struct p
 		entry->msi_attrib.default_irq = dev->irq;
 		entry->msi_attrib.pos = pos;
 		entry->mask_base = base;
-		entry->masked = readl(base + j * PCI_MSIX_ENTRY_SIZE +
-					PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
 		msix_mask_irq(entry, 1);
 
 		list_add_tail(&entry->list, &dev->msi_list);
@@ -493,6 +491,12 @@  static int msix_capability_init(struct p
 	msix_set_enable(dev, 1);
 	dev->msix_enabled = 1;
 
+	list_for_each_entry(entry, &dev->msi_list, list) {
+		int vector = entry->msi_attrib.entry_nr;
+		entry->masked = readl(base + vector * PCI_MSIX_ENTRY_SIZE +
+					PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
+	}
+
 	return 0;
 }