mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jon Mason <mason@myri.com>
To: Avi Kivity <avi@redhat.com>
Cc: Sven Schnelle <svens@stackframe.org>,
	Simon Kirby <sim@hostway.ca>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Niels Ole Salscheider <niels_ole@salscheider-online.de>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Ben Hutchings <bhutchings@solarflare.com>
Subject: Workaround for Intel MPS errata
Date: Thu, 29 Sep 2011 19:16:34 -0500	[thread overview]
Message-ID: <20110930001633.GA11436@myri.com> (raw)
In-Reply-To: <4E8215B6.1020108@redhat.com>

Hey Avi,
Can you try this patch?  It should resolve the issue you are seeing.

Thanks,
Jon

    PCI: Workaround for Intel MPS errata
    
    Intel 5000 and 5100 series memory controllers have a known issue if read
    completion coalescing is enabled (the default setting) and the PCI-E
    Maximum Payload Size is set to 256B.  To work around this issue, disable
    read completion coalescing if the MPS is 256B.
    
    http://www.intel.com/content/dam/doc/specification-update/5000-chipset-memory-controller-hub-specification-update.pdf
    http://www.intel.com/content/dam/doc/specification-update/5100-memory-controller-hub-chipset-specification-update.pdf
    
    Reported-by: Avi Kivity <avi@redhat.com>
    Signed-off-by: Jon Mason <mason@myri.com>

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a919db2..13c733a 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1361,6 +1361,80 @@ static int pcie_find_smpss(struct pci_dev *dev, void *data)
 	return 0;
 }
 
+static void pcie_errata_check(int mps)
+{
+	struct pci_dev *dev = NULL;
+	static bool done = false;
+
+	if (done)
+		return;
+
+	/* Intel 5000 and 5100 Memory controllers have an errata with read
+	 * completion coalescing (which is enabled by default) and MPS of 256B.
+	 */
+	/* 5000X Chipset Memory Controller Hub */
+	dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x25C0, NULL);
+	if (dev)
+		goto fixup;
+
+	/* 5000Z Chipset Memory Controller Hub */
+	dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x25D0, NULL);
+	if (dev)
+		goto fixup;
+
+	/* 5000V Chipset Memory Controller Hub */
+	dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x25D4, NULL);
+	if (dev)
+		goto fixup;
+
+	/* 5000P Chipset Memory Controller Hub */
+	dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x25D8, NULL);
+	if (dev)
+		goto fixup;
+
+	/* 5100 Chipset Memory Controller Hub */
+	dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x65C0, NULL);
+	if (dev)
+		goto fixup;
+
+	/* No Intel 5000 or 5100 Memory controller in the system, no need to
+	 * check again
+	 */
+	if (!dev) {
+		done = true;
+		return;
+	}
+
+fixup:
+	/* Disable read completion coalescing to allow an MPS of 256 */
+	if (mps == 256) {
+		int err;
+		u16 rcc;
+
+		/* Intel errata specifies bits to change but does not say what
+		 * they are.  Keeping them magical until such time as the
+		 * registers and values can be explained.
+		 */
+		err = pci_read_config_word(dev, 0x48, &rcc);
+		if (err) {
+			dev_err(&dev->dev, "Error attempting to read the read "
+				"completion coalescing register.\n");
+			return;
+		}
+
+		rcc &= ~(1 << 10);
+
+		err = pci_write_config_word(dev, 0x48, rcc);
+		if (err) {
+			dev_err(&dev->dev, "Error attempting to read the read "
+				"completion coalescing register.\n");
+			return;
+		}
+
+		done = true;
+	}
+}
+
 static void pcie_write_mps(struct pci_dev *dev, int mps)
 {
 	int rc;
@@ -1384,6 +1458,8 @@ static void pcie_write_mps(struct pci_dev *dev, int mps)
 			mps = min(mps, pcie_get_mps(dev->bus->self));
 	}
 
+	pcie_errata_check(mps);
+
 	rc = pcie_set_mps(dev, mps);
 	if (rc)
 		dev_err(&dev->dev, "Failed attempting to set the MPS\n");
@@ -1445,7 +1521,7 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data)
 	return 0;
 }
 
-/* pcie_bus_configure_mps requires that pci_walk_bus work in a top-down,
+/* pcie_bus_configure_settings requires that pci_walk_bus work in a top-down,
  * parents then children fashion.  If this changes, then this code will not
  * work as designed.
  */

  parent reply	other threads:[~2011-09-30  0:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 17:01 [REGRESSION] e1000e failure triggered by "PCI: Remove MRRS modification from MPS setting code" Avi Kivity
2011-09-27 17:59 ` Jon Mason
2011-09-27 18:28   ` Avi Kivity
2011-09-27 20:11     ` Jon Mason
2011-09-29  4:33       ` Benjamin Herrenschmidt
2011-09-29 13:53         ` Jon Mason
2011-09-30  0:16     ` Jon Mason [this message]
2011-09-30  2:21       ` Workaround for Intel MPS errata Jesse Brandeburg
2011-09-30  2:51         ` Jon Mason
2011-09-30  5:01       ` Bjorn Helgaas
2011-09-30 15:35         ` Jon Mason
2011-09-30 17:17           ` Bjorn Helgaas
2011-09-30 17:38             ` Jon Mason
2011-09-30 17:57               ` Bjorn Helgaas
2011-09-30  7:03       ` Rolf Eike Beer
2011-09-30 15:39         ` Jon Mason
2011-10-02  9:26       ` Avi Kivity
2011-10-03  4:58         ` Jon Mason
2011-10-03 10:11           ` Avi Kivity
2011-10-03 15:12             ` Jon Mason
2011-10-04  9:46               ` Avi Kivity
2011-10-04 13:06                 ` Avi Kivity
2011-10-04 13:11                   ` Jon Mason
2011-10-04 20:12                   ` Jon Mason
2011-10-05  3:46                   ` Jon Mason
2011-10-05 12:09                     ` Avi Kivity

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=20110930001633.GA11436@myri.com \
    --to=mason@myri.com \
    --cc=avi@redhat.com \
    --cc=bhutchings@solarflare.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=niels_ole@salscheider-online.de \
    --cc=sim@hostway.ca \
    --cc=svens@stackframe.org \
    --cc=torvalds@linux-foundation.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

Powered by JetHome