Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 2781

kernel-2.6.18-194.11.1.el5.src.rpm

From: Doug Ledford <dledford@redhat.com>
Date: Thu, 3 Apr 2008 13:48:41 -0400
Subject: [pci] fix MSI interrupts on HT1000 based machines
Message-id: 47F51879.2050106@redhat.com
O-Subject: [Patch RHEL5.2] Fix PCI-e MSI interrupts on HT1000 based machines
Bugzilla: 438776

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This patch, shamelessly stolen from Andy Gospodarek's list of
experimental patches on his people page, has been confirmed to solve bug
#438776 which has blocker status for RHEL5.2.

This is in need of Tony Camuso's review since it possibly side steps
some of his recent MMCONFIG/PCI patches and we need to know for sure if
it's the right thing to do.

- --
Doug Ledford <dledford@redhat.com>
              GPG KeyID: CFBFF194
	      http://people.redhat.com/dledford

This patch combines the following 3 upstream commits:

commit 6bae1d96c6d7dde078994f6cb98235fd46f8736b
Author: Sebastien Dugue <sebastien.dugue@bull.net>
Date:   Thu Dec 13 16:09:25 2007 -0800

    PCI: quirk: enable MSI Mapping on HT1000

    Add a quirk to enable the MSI mapping capability on HyperTransport bridges.

commit 2cc31879f8cfa0efc74fe7e58ab4e01ef5908730
Author: David Miller <davem@davemloft.net>
Date:   Thu Oct 25 01:15:24 2007 -0700

    PCI: Revert "PCI: disable MSI by default on systems with Serverworks HT1000 chips"

commit 1d84b5424efbcce69a1c955ba181147d23d43a14
Author: David Miller <davem@davemloft.net>
Date:   Thu Oct 25 01:15:53 2007 -0700

    PCI: Add MSI quirk for ServerWorks HT1000 PCIX bridge.

but that one will not be used since it appears to be a kabi breaker and
since tg3 is currently the only driver needing the workaround it seems
reasonable to keep the changes there.

Acked-by: Jeff Garzik <jgarzik@redhat.com>

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index a2fce08..ca70481 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1759,7 +1759,6 @@ static void __init quirk_disable_all_msi(struct pci_dev *dev)
 	printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n");
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
@@ -1814,6 +1813,33 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
 			quirk_msi_ht_cap);
 
+
+/*
+ *  Force enable MSI mapping capability on HT bridges
+ */
+static void __devinit quirk_msi_ht_cap_enable(struct pci_dev *dev)
+{
+	int pos, ttl = 48;
+
+	pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
+	while (pos && ttl--) {
+		u8 flags;
+
+		if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, &flags) == 0) {
+			printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n",
+			       pci_name(dev));
+
+			pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
+					      flags | HT_MSI_FLAGS_ENABLE);
+		}
+		pos = pci_find_next_ht_capability(dev, pos,
+						  HT_CAPTYPE_MSI_MAPPING);
+	}
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
+			 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
+			 quirk_msi_ht_cap_enable);
+
 /* The nVidia CK804 chipset may have 2 HT MSI mappings.
  * MSI are supported if the MSI capability set in any of these mappings.
  */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1a2ed93..a136c63 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1431,8 +1431,8 @@
 #define PCI_DEVICE_ID_SERVERWORKS_HE	  0x0008
 #define PCI_DEVICE_ID_SERVERWORKS_LE	  0x0009
 #define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
+#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB	0x0036
 #define PCI_DEVICE_ID_SERVERWORKS_EPB	  0x0103
-#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX	0x0104
 #define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE	0x0132
 #define PCI_DEVICE_ID_SERVERWORKS_OSB4	  0x0200
 #define PCI_DEVICE_ID_SERVERWORKS_CSB5	  0x0201