public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: tom.l.nguyen@intel.com, linux-kernel@vger.kernel.org, greg@kroah.com
Subject: [PATCH] Fix MSI-X setup
Date: Mon, 21 Jun 2004 21:35:24 -0700	[thread overview]
Message-ID: <52smcop5v7.fsf_-_@topspin.com> (raw)
In-Reply-To: <521xk8qlx1.fsf@topspin.com> (Roland Dreier's message of "Mon, 21 Jun 2004 21:03:22 -0700")

msix_capability_init() puts the offset of the MSI-X capability into
pos, then uses pos as a loop index to clear the MSI-X vector table,
and then tries to use pos as the offset again, which results in
writing the MSI-X enable bit off into space.

This patch fixes that by adding a new loop index variable and using
that to clear the vector table.

 - Roland

Signed-off-by: Roland Dreier <roland@tospin.com>

Index: linux-2.6.7/drivers/pci/msi.c
===================================================================
--- linux-2.6.7.orig/drivers/pci/msi.c	2004-06-21 20:51:33.000000000 -0700
+++ linux-2.6.7/drivers/pci/msi.c	2004-06-21 21:30:05.000000000 -0700
@@ -569,7 +569,7 @@
 	struct msi_desc *entry;
 	struct msg_address address;
 	struct msg_data data;
-	int vector = 0, pos, dev_msi_cap;
+	int vector = 0, pos, dev_msi_cap, i;
 	u32 phys_addr, table_offset;
 	u32 control;
 	u8 bir;
@@ -629,12 +629,12 @@
 	writel(address.hi_address, base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET);
 	writel(*(u32*)&data, base + PCI_MSIX_ENTRY_DATA_OFFSET);
 	/* Initialize all entries from 1 up to 0 */
-	for (pos = 1; pos < dev_msi_cap; pos++) {
-		writel(0, base + pos * PCI_MSIX_ENTRY_SIZE +
+	for (i = 1; i < dev_msi_cap; i++) {
+		writel(0, base + i * PCI_MSIX_ENTRY_SIZE +
 			PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET);
-		writel(0, base + pos * PCI_MSIX_ENTRY_SIZE +
+		writel(0, base + i * PCI_MSIX_ENTRY_SIZE +
 			PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET);
-		writel(0, base + pos * PCI_MSIX_ENTRY_SIZE +
+		writel(0, base + i * PCI_MSIX_ENTRY_SIZE +
 			PCI_MSIX_ENTRY_DATA_OFFSET);
 	}
 	attach_msi_entry(entry, vector);

  reply	other threads:[~2004-06-22  4:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-22  2:22 Question on using MSI in PCI driver Roland Dreier
2004-06-22  3:50 ` Jeff Garzik
2004-06-22  3:54   ` Roland Dreier
2004-06-22  4:01     ` Jeff Garzik
2004-06-22  4:04       ` Roland Dreier
2004-06-22  4:03 ` [PATCH] Export msi_remove_pci_irq_vectors Roland Dreier
2004-06-22  4:35   ` Roland Dreier [this message]
2004-06-22 23:23     ` [PATCH] Fix MSI-X setup Greg KH
2004-06-22 23:57       ` Roland Dreier
2004-06-23  0:04         ` Greg KH
2004-06-22  8:45   ` [PATCH] Export msi_remove_pci_irq_vectors Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2004-06-22 16:21 [PATCH] Fix MSI-X setup Nguyen, Tom L

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=52smcop5v7.fsf_-_@topspin.com \
    --to=roland@topspin.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tom.l.nguyen@intel.com \
    /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