Re: [PATCH] PCI fixes for 2.6.7

From: Greg KH
Date: Thu Jun 24 2004 - 17:40:40 EST


ChangeSet 1.1823.1.7, 2004/06/22 16:57:06-07:00, roland@xxxxxxxxxxx

[PATCH] PCI: Fix MSI-X setup

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.

Signed-off-by: Roland Dreier <roland@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


drivers/pci/msi.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)


diff -Nru a/drivers/pci/msi.c b/drivers/pci/msi.c
--- a/drivers/pci/msi.c 2004-06-24 13:50:17 -07:00
+++ b/drivers/pci/msi.c 2004-06-24 13:50:17 -07:00
@@ -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);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/