Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4878003pjb; Mon, 27 Jul 2020 07:25:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/+dnCpWCj791+3Jz52ilrzMO+r7eY9OnHmeSajIm08AeronZPoS3semez3yhiWX+4zJES X-Received: by 2002:aa7:da8a:: with SMTP id q10mr21661971eds.139.1595859929389; Mon, 27 Jul 2020 07:25:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595859929; cv=none; d=google.com; s=arc-20160816; b=vG4c1Y2EK14Ey1rKvrht3VrxyWMdNCvam419AdNB7u+9Lb0Pg3eZpdh97VEaoZBQ0v fCNWJ+Q4GtiJG6RDexEaJnX7iu+5yyT/bJGsE8MKr25YdQgqyKckMtoK4yQQ/EeGORdX 6GX1iqWWctetx/zosv1VlmfQojDQ3htp4CaMtAZriHcBEnjX+vK2gTMqJYuvfk4+xpg0 Z5xsNmQm/jRT9C/2D7KSXEpOs1XZlSbXGBvAeTpF0LLRigh6dYOCmcdpyonmxYTXsJ64 xEHbSU4VTCIf4uW8Tjf/4FeLfjSkJL7F2bTQq/fUDyqo4X9caKltrFIFz6NUZNEo+ExB cKZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WDuIc0mx+S4EElza5JeDTpnjtHhgiuCyWQFDD8Zvnso=; b=m+xrE0p7CQ/ks5djO1hamGleaKohJIpYvINulr6rVj3Y1JvlEoEC5DreI26R1RA0n+ DFnIK/ZCMLpYdzslDRMEN/4v8O1nfjsOticjm4rZALb+WiOjqNCN58Y44SOecBtshwCA bfVtzDBtiwiiCXuqjs1ricG8v+PS0rARytNvfnIyA8U7ZNU/HvDwvV1u8MTytQLZLWgb cqseiDc6rbR5IDboslmhMhxCiiu23AdPo5jqNhDOkuDhQ4yg0saTL++jA7xgMAB68apK kkoh2OBLkdxQ3Nzh/sixGcwWE+2RIdnh5gs/NkVF61i04Yw/wzE4nyIKCDx6O0MFC4Gw GFzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vYWYLx8j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id va2si4453449ejb.14.2020.07.27.07.25.07; Mon, 27 Jul 2020 07:25:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vYWYLx8j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732154AbgG0OXt (ORCPT + 99 others); Mon, 27 Jul 2020 10:23:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:53000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732118AbgG0OXm (ORCPT ); Mon, 27 Jul 2020 10:23:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 27E3B2083E; Mon, 27 Jul 2020 14:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859821; bh=uTzKu8227IvK2neuOEG36qM3bzCod7rBoHzbc5aDt0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vYWYLx8joNRlyI0EhMj2UZ+dCnMcbtJUCQFYsrpudh5l5v4YJN3BP9zF/JhizKKIn vkDa15bJQIVz2wgPzng+tjT0KjIrUWgkdPHXaNerfDqVzPYRwrE7hEqUIGFsHxFgDW f7tQ2ij21APG3TA2MoO1RXaKt1UllQOLylP+5Iz4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Volkerding , Karol Herbst , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.7 088/179] Revert "PCI/PM: Assume ports without DLL Link Active train links in 100 ms" Date: Mon, 27 Jul 2020 16:04:23 +0200 Message-Id: <20200727134936.962434071@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Helgaas [ Upstream commit d08c30d7a0d1826f771f16cde32bd86e48401791 ] This reverts commit ec411e02b7a2e785a4ed9ed283207cd14f48699d. Patrick reported that this commit broke hybrid graphics on a ThinkPad X1 Extreme 2nd with Intel UHD Graphics 630 and NVIDIA GeForce GTX 1650 Mobile: nouveau 0000:01:00.0: fifo: PBDMA0: 01000000 [] ch 0 [00ff992000 DRM] subc 0 mthd 0008 data 00000000 Karol reported that this commit broke Nouveau firmware loading on a Lenovo P1G2 with Intel UHD Graphics 630 and NVIDIA TU117GLM [Quadro T1000 Mobile]: nouveau 0000:01:00.0: acr: AHESASC binary failed In both cases, reverting ec411e02b7a2 solved the problem. Unfortunately, this revert will reintroduce the "Thunderbolt bridges take long time to resume from D3cold" problem: https://bugzilla.kernel.org/show_bug.cgi?id=206837 Link: https://lore.kernel.org/r/CAErSpo5sTeK_my1dEhWp7aHD0xOp87+oHYWkTjbL7ALgDbXo-Q@mail.gmail.com Link: https://lore.kernel.org/r/CACO55tsAEa5GXw5oeJPG=mcn+qxNvspXreJYWDJGZBy5v82JDA@mail.gmail.com Link: https://bugzilla.kernel.org/show_bug.cgi?id=208597 Reported-by: Patrick Volkerding Reported-by: Karol Herbst Fixes: ec411e02b7a2 ("PCI/PM: Assume ports without DLL Link Active train links in 100 ms") Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- drivers/pci/pci.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d4758518a97bd..a4efc7e0061f5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4662,8 +4662,7 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) * pcie_wait_for_link_delay - Wait until link is active or inactive * @pdev: Bridge device * @active: waiting for active or inactive? - * @delay: Delay to wait after link has become active (in ms). Specify %0 - * for no delay. + * @delay: Delay to wait after link has become active (in ms) * * Use this to wait till link becomes active or inactive. */ @@ -4704,7 +4703,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, msleep(10); timeout -= 10; } - if (active && ret && delay) + if (active && ret) msleep(delay); else if (ret != active) pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n", @@ -4825,28 +4824,17 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev) if (!pcie_downstream_port(dev)) return; - /* - * Per PCIe r5.0, sec 6.6.1, for downstream ports that support - * speeds > 5 GT/s, we must wait for link training to complete - * before the mandatory delay. - * - * We can only tell when link training completes via DLL Link - * Active, which is required for downstream ports that support - * speeds > 5 GT/s (sec 7.5.3.6). Unfortunately some common - * devices do not implement Link Active reporting even when it's - * required, so we'll check for that directly instead of checking - * the supported link speed. We assume devices without Link Active - * reporting can train in 100 ms regardless of speed. - */ - if (dev->link_active_reporting) { - pci_dbg(dev, "waiting for link to train\n"); - if (!pcie_wait_for_link_delay(dev, true, 0)) { + if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) { + pci_dbg(dev, "waiting %d ms for downstream link\n", delay); + msleep(delay); + } else { + pci_dbg(dev, "waiting %d ms for downstream link, after activation\n", + delay); + if (!pcie_wait_for_link_delay(dev, true, delay)) { /* Did not train, no need to wait any further */ return; } } - pci_dbg(child, "waiting %d ms to become accessible\n", delay); - msleep(delay); if (!pci_device_is_present(child)) { pci_dbg(child, "waiting additional %d ms to become accessible\n", delay); -- 2.25.1