Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2015 19:40:30 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r291083 - in stable: 10/sys/dev/cxgbe 9/sys/dev/cxgbe
Message-ID:  <201511191940.tAJJeUHY061347@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Nov 19 19:40:30 2015
New Revision: 291083
URL: https://svnweb.freebsd.org/changeset/base/291083

Log:
  MFC 290416:
  Chelsio T5 chips do not properly echo the No Snoop and Relaxed Ordering
  attributes when replying to a TLP from a Root Port.  As a workaround,
  disable No Snoop and Relaxed Ordering in the Root Port of each T5 adapter
  during attach so that CPU-initiated requests do not contain these flags.
  
  Note that this affects CPU-initiated requests to all devices under this
  root port.
  
  Sponsored by:	Chelsio

Modified:
  stable/10/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/9/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/10/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/10/sys/dev/cxgbe/t4_main.c	Thu Nov 19 18:33:20 2015	(r291082)
+++ stable/10/sys/dev/cxgbe/t4_main.c	Thu Nov 19 19:40:30 2015	(r291083)
@@ -570,6 +570,33 @@ t5_probe(device_t dev)
 	return (ENXIO);
 }
 
+static void
+t5_attribute_workaround(device_t dev)
+{
+	device_t root_port;
+	uint32_t v;
+
+	/*
+	 * The T5 chips do not properly echo the No Snoop and Relaxed
+	 * Ordering attributes when replying to a TLP from a Root
+	 * Port.  As a workaround, find the parent Root Port and
+	 * disable No Snoop and Relaxed Ordering.  Note that this
+	 * affects all devices under this root port.
+	 */
+	root_port = pci_find_pcie_root_port(dev);
+	if (root_port == NULL) {
+		device_printf(dev, "Unable to find parent root port\n");
+		return;
+	}
+
+	v = pcie_adjust_config(root_port, PCIER_DEVICE_CTL,
+	    PCIEM_CTL_RELAXED_ORD_ENABLE | PCIEM_CTL_NOSNOOP_ENABLE, 0, 2);
+	if ((v & (PCIEM_CTL_RELAXED_ORD_ENABLE | PCIEM_CTL_NOSNOOP_ENABLE)) !=
+	    0)
+		device_printf(dev, "Disabled No Snoop/Relaxed Ordering on %s\n",
+		    device_get_nameunit(root_port));
+}
+
 static int
 t4_attach(device_t dev)
 {
@@ -588,6 +615,8 @@ t4_attach(device_t dev)
 	sc->dev = dev;
 	TUNABLE_INT_FETCH("hw.cxgbe.debug_flags", &sc->debug_flags);
 
+	if ((pci_get_device(dev) & 0xff00) == 0x5400)
+		t5_attribute_workaround(dev);
 	pci_enable_busmaster(dev);
 	if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) {
 		uint32_t v;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511191940.tAJJeUHY061347>