From owner-svn-src-head@freebsd.org Thu Nov 5 21:33:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 496CFA27A6B; Thu, 5 Nov 2015 21:33:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E598D15B1; Thu, 5 Nov 2015 21:33:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tA5LXFQD039094; Thu, 5 Nov 2015 21:33:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tA5LXF0n039093; Thu, 5 Nov 2015 21:33:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201511052133.tA5LXF0n039093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 5 Nov 2015 21:33:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290416 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2015 21:33:17 -0000 Author: jhb Date: Thu Nov 5 21:33:15 2015 New Revision: 290416 URL: https://svnweb.freebsd.org/changeset/base/290416 Log: 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. Reviewed by: np MFC after: 1 week Sponsored by: Chelsio Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Nov 5 21:27:25 2015 (r290415) +++ head/sys/dev/cxgbe/t4_main.c Thu Nov 5 21:33:15 2015 (r290416) @@ -573,6 +573,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) { @@ -591,6 +618,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;