From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=52.101.43.42 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796258623; b=nVJWrcGnNrExWacOfxnjst/woksJhcdpb0WMP9Cnpl2nA+fZ2Uzft1/QNu9ZfGT5CNAw W0/b4B04Rz0lA0godin259k1mPMfSeYbYUoNhAuKIPWlewATmnF4z2VEE8P2hDwWc3o1W G+7TMqpr/hGcfgJg1ZjgSy1GHfT+eMYrfpxPoTG75M9PydFRyAvgD2X6lTtEWFOPd4tKj XVvOwccwxXo3KYGo2PS4fiq9VCalqZTu09aIyE1BmnJzQJR5zv7pInyH+i9oBBoKjwNb0 HeytnluGH4NTO1HbPshb2wXSrRdWRpuwBwbO1YGsC0cvnXVDsknfsVPsKAIFVMYTsUQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796258623; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-ID:References:In-Reply-To:To:CC:X-Mailer:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=tlXQt99yc8uUvbMmH32xFYwHiGdDAXSSWLdVDq9FS9E=; b=tiVVI+iy6uNwBGSMxDC+bpJ/kXjI0ac3xrb4DwURtGK7fc5nl22g5240ouUHCvEkDGSr EhRzV6qJ0pC6JB4lzDwhXeCB5WNMeSdsOnjCVQdeOueHF7fPAqew2aJoRJA32NrDFNedH GfSAAPx3yQu86gr51bHoHTt/8E9PtA0Ik9eafWfFBbQQpi8gEsaluVespDq1TJ1fWr5GI K4lpAMdSjeOtb5JDeDEAegBHjq7CJhTuhwe0Gi4mj/YZIggQpxmTgmC0+eePRsfeJpaTS 05r2Piz4h5J85pZhIyNActkuV/918EHNodltnxeXmIUx5pRcfARJ6oAgVD9Y1enUjAg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=uqnrEZZ+; arc=fail smtp.remote-ip=52.101.43.42 Received: from SJ2PR03CU001.outbound.protection.outlook.com (mail-westusazon11012042.outbound.protection.outlook.com [52.101.43.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2927D606A688; Thu, 3 Dec 2026 00:43:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2927D606A688 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=uqnrEZZ+ ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RFB94P36a3OWTOkqAjEnvUI0Mosn7YFaRiLwnsvRMm1rDNQkVR3PbU35QzFFsbO2W4KSGrIlgEBUXKYsQO2Dh/mmgQHOgdR3WzdbmilzvNWizifx9oPjo9nKZNg38rFvfXUFXLki29Q5pHTo2GuR3fufhexClHvExDp2lmsU+pVrjv4i/Dz/4v/vrvst/xpuLXuSJgLy59Ats3cMXHWdgljWFzuR1DNlWu11YQmIL9rM4uYQnZeI4r4u+6ysb+5jtx9F0GeH7hkWftrgcQcwcsc303qw6pgn8ytga4UDNbGo21aGvEZz79ZdZh4yLfF7fXVvxEwgg0VblwYIwu3CPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tlXQt99yc8uUvbMmH32xFYwHiGdDAXSSWLdVDq9FS9E=; b=AqJvAV0l8eWBwaAPtsPx3dlP3P/snrBRZcc2YjtFl2JpbDy4SsCV9YFHpq4a216hi2+jWU/k0ZiBICg4sXEtB8vJcEK9DbeGfRfPKmpU9tGKtK/LH7SWrr1uo2lISGH5JfaUXXH7X990/X2TfVuIq4ACO6POhOP7NM7NNbuBtEmrILZVjZbgw+bfTsDNEyEOz6s735L7+piIkRFQXZQFKFwLsUK9MjAyiVqMqXh5UYn+wR4AD8SYX9NSESTgT8Pufz9VnG0cZs2wgMCCaxpxphiaH+OZ8bO1JfqCN0u+rYX7Zryq87JtqkKNSDUOkePm8v1fdR/mkKh0HssgLyZURw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tlXQt99yc8uUvbMmH32xFYwHiGdDAXSSWLdVDq9FS9E=; b=uqnrEZZ+ATFegiuv8z+T5dPspPKuaAdnWGtekVNH0YwAAPSIGIAfYVWaa1HZNhmJj/+agOWXqIEbGvpYZgzGlT+Z1iFyl+5dWn+ywzQfGz5J51HxGMI4XgN7pnKrSeX19h0dBqD7iTL4Yz4l8Am5HdLicMAzvvANSsNsK4WJjIY= Received: from BN9P220CA0008.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::13) by DM6PR12MB4218.namprd12.prod.outlook.com (2603:10b6:5:21b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Thu, 3 Dec 2026 00:43:39 +0000 Received: from BN1PEPF00018070.namprd04.prod.outlook.com (2603:10b6:408:13e:cafe::ae) by BN9P220CA0008.outlook.office365.com (2603:10b6:408:13e::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Thu, 3 Dec 2026 00:43:38 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BN1PEPF00018070.mail.protection.outlook.com (10.167.245.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Thu, 3 Dec 2026 00:43:38 +0000 Received: from BELBCREELEY01.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 18:43:34 -0600 From: Brett Creeley Date: Wed, 2 Dec 2026 16:43:27 -0800 Subject: [PATCH RFC 2/3] PCI: Allow quirks to extend the link-up wait after reset X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20261202-b4-pci-link-up-timeout-v1-2-04fba0824d63@amd.com> References: <20261202-b4-pci-link-up-timeout-v1-0-04fba0824d63@amd.com> In-Reply-To: <20261202-b4-pci-link-up-timeout-v1-0-04fba0824d63@amd.com> To: Bjorn Helgaas CC: , , Lukas Wunner , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Eric Joyner , "Nikhil P. Rao" , Brett Creeley X-Mailer: b4 0.15.2 X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00018070:EE_|DM6PR12MB4218:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cd94760-d1d9-4399-975c-08df50d678a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|376014|23010399003|82310400026|22082099003|56012099006|10067099003|261021123027099003|261022075727099003|261102123227099003|261021121427099003|261026140227099003|261022105027099003|261028144727099003|261026121527099003|261013131602099003|261009223027099003|18002099003|11063799006|6133799003; X-Microsoft-Antispam-Message-Info: zRvMbWgv21FdKIjIE366mtsPrmDbB4gv6vDi7yurbzC5Nj9VNgiPg1cdLDMeNhrApTTr1uMg02DGE5P2GGNcvk/4ZMvds8GMfPYULIeUap9A6qIJlHXSC2cdEpE11KN13CFLXldEUUkODb6WTcRldcOkRDM0pJqW1Co5o2tdeIPlBRIImPfHN9ITePPMNuhJrt425A3UGQpqoujKYpK2fKqTTieeLxwFzwNaD+uUUCdac+E+1CtIrRqSPoM7HD6d/aZsrInyEeiTxbUdpntSMVsZdK+Hq7mmOKFLeHMAjw2/7hZ0xw/GNYKRWcbX9n+5ByF/hAa4AJajSJNaodQDaD2wPz98IjxcQnPFDPTO3P0/PNxYVu6/ZNfuzEU/VziZWTUfbRZg8RwA5TX1/swo3obw8k47qc469LRZFqqwMrRjbwR5JhKqepMHROk76gmxd6Y2FHLCOHaSskgGLzD8enaoLeebLb4IByvFn9D0zZwCf0QHZKQddnevgZQU64pSuyxTGMwsBRd1+jAILzte/nPC5Ri18QJdzlRkEclZ9fXBaqTSOMX79/6sOuqI+9M20RWRfGMFmA9qrHf9I1Pb3aFJE3CKlp3VCqGfCWytqEDKA+TN3B6FWjsKPZ8bnG9QXjMm7OTAKKWTsKMYsOkLzSMDhHE4FcNL7tKVfXqZfffseNuh7+nZ/O1tv8CHoQrylm7acBuwC2oaX+jbeFdPjw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(1800799024)(376014)(23010399003)(82310400026)(22082099003)(56012099006)(10067099003)(261021123027099003)(261022075727099003)(261102123227099003)(261021121427099003)(261026140227099003)(261022105027099003)(261028144727099003)(261026121527099003)(261013131602099003)(261009223027099003)(18002099003)(11063799006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o8boMsNGoYZZ1xPHTzo1BHRjErCLtGSd+SHkUFYqhKeSXWYbyVn5L3k09UQQf3YzQ0q9VnQWFSOOWDQ/o39dd5xUj+gWw2gYS630Pxo2AiAekxvvw7q6GDNDI99H+we4aqcmQsz9jbWW6+7bgpoxySlasDbPc8u5wm0cAtqt2S7wQYhCsavn2BuPTUGUCspAXy2/GaZXnbfk7Owh6q8/p8YXRUzbcTJquYG1d/ZNsoXJcZD+WkJTvs7V62kyVPdiZu7LetaNTZMYyfx95kCCZQSz5ivWvBi7S7fB1t1kBx/heAeHXIstSBcPYQEv8nyOv2HDv2rpqpSXvtQ64Mywhgb4o0HexxCpAPP/qn1+u5+Ah9Pf56c5GJzNrH26/AU9tXOT2mLbr9ivQJAmLHCq/6jAqwcbOK1QA77c2uCQ/ZQkO+day8WIsNAL8zV8FtRL X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 00:43:38.6881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8cd94760-d1d9-4399-975c-08df50d678a6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00018070.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4218 After a DPC event, Secondary Bus Reset or D3cold->D0 transition, pci_bridge_wait_for_secondary_bus() waits for the link below the Downstream Port to become active again. On ports faster than 5 GT/s, the wait is bounded by PCIE_LINK_RETRAIN_TIMEOUT_MS (1 s). If the link has not trained by then, the device is considered gone and, for DPC, error recovery fails with PCI_ERS_RESULT_DISCONNECT. PCIe r5.0 sec 6.6.1 requires that, within 1.0 s of a Conventional Reset, a device can receive a Configuration Request and return a Successful Completion, independent of how quickly link training completes, so 1 s is enough for compliant devices. Some devices need much longer to bring the link up, for instance when the reset also restarts embedded firmware that controls the link. The Readiness Time Reporting Extended Capability (sec 7.9.17) cannot describe this: its times are capped at about 1.006 s and are only meant to shorten the spec-mandated waits. Add a link_up_timeout member to struct pci_dev that quirks can set for such devices. When waiting for the secondary bus, use the largest value of the devices on that bus, falling back to the existing 1 s, so devices without the quirk see no change. The value lives in the child's struct pci_dev, which persists across DPC recovery and bus resets, so it remains available even though the device's config space is inaccessible while the link is down. The extended timeout is only used where the link can be polled: Downstream Ports faster than 5 GT/s that report Data Link Layer Link Active. Everywhere else the existing waits apply unchanged; ports without that reporting can only sleep, and would otherwise sleep for the full extended timeout on every reset. Where it is used, the device is waited for even when firmware has zeroed every d3cold_delay on the bus (e.g. via the ACPI reset delay _DSM), which otherwise skips the wait entirely: firmware cannot account for a device erratum. A separate message reports when the extended wait expires. Signed-off-by: Brett Creeley --- drivers/pci/pci.c | 73 +++++++++++++++++++++++++++++++++++++++++++++-------- include/linux/pci.h | 1 + 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f89ad49e61e6..c387a564d997 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4614,12 +4614,14 @@ static int pci_pm_reset(struct pci_dev *dev, bool probe) * @pdev: Device whose link to wait for. * @use_lt: Use the LT bit if TRUE, or the DLLLA bit if FALSE. * @active: Waiting for active or inactive? + * @timeout_ms: How long to wait for the status change (in ms) * * Return 0 if successful, or -ETIMEDOUT if status has not changed within - * PCIE_LINK_RETRAIN_TIMEOUT_MS milliseconds. + * @timeout_ms milliseconds. */ static int pcie_wait_for_link_status(struct pci_dev *pdev, - bool use_lt, bool active) + bool use_lt, bool active, + unsigned int timeout_ms) { u16 lnksta_mask, lnksta_match; unsigned long end_jiffies; @@ -4628,7 +4630,7 @@ static int pcie_wait_for_link_status(struct pci_dev *pdev, lnksta_mask = use_lt ? PCI_EXP_LNKSTA_LT : PCI_EXP_LNKSTA_DLLLA; lnksta_match = active ? lnksta_mask : 0; - end_jiffies = jiffies + msecs_to_jiffies(PCIE_LINK_RETRAIN_TIMEOUT_MS); + end_jiffies = jiffies + msecs_to_jiffies(timeout_ms); do { pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnksta); if ((lnksta & lnksta_mask) == lnksta_match) @@ -4667,7 +4669,8 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt) * avoid LTSSM race as recommended in Implementation Note at the end * of PCIe r6.1 sec 7.5.3.7. */ - rc = pcie_wait_for_link_status(pdev, true, false); + rc = pcie_wait_for_link_status(pdev, true, false, + PCIE_LINK_RETRAIN_TIMEOUT_MS); if (rc) return rc; @@ -4681,7 +4684,8 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt) pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_RL); } - rc = pcie_wait_for_link_status(pdev, use_lt, !use_lt); + rc = pcie_wait_for_link_status(pdev, use_lt, !use_lt, + PCIE_LINK_RETRAIN_TIMEOUT_MS); /* * Clear LBMS after a manual retrain so that the bit can be used @@ -4709,11 +4713,12 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt) * @pdev: Bridge device * @active: waiting for active or inactive? * @delay: Delay to wait after link has become active (in ms) + * @timeout_ms: How long to poll for the link to change state (in ms) * * Use this to wait till link becomes active or inactive. */ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, - int delay) + int delay, unsigned int timeout_ms) { int rc; @@ -4737,7 +4742,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, */ if (active) msleep(20); - rc = pcie_wait_for_link_status(pdev, false, active); + rc = pcie_wait_for_link_status(pdev, false, active, timeout_ms); if (active) { if (rc) rc = pcie_failed_link_retrain(pdev); @@ -4763,7 +4768,8 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, */ bool pcie_wait_for_link(struct pci_dev *pdev, bool active) { - return pcie_wait_for_link_delay(pdev, active, 100); + return pcie_wait_for_link_delay(pdev, active, 100, + PCIE_LINK_RETRAIN_TIMEOUT_MS); } /* @@ -4791,6 +4797,40 @@ static int pci_bus_max_d3cold_delay(const struct pci_bus *bus) return max(min_delay, max_delay); } +/* + * Find the longest time any device on the bus needs for its link to come + * up after reset. Quirks may extend it for devices whose link takes longer + * than the spec allows to train. + * + * Context: Called with @pci_bus_sem locked for reading. + */ +static unsigned int pci_bus_max_link_up_timeout(const struct pci_bus *bus) +{ + unsigned int timeout = PCIE_LINK_RETRAIN_TIMEOUT_MS; + const struct pci_dev *pdev; + + lockdep_assert_held(&pci_bus_sem); + + list_for_each_entry(pdev, &bus->devices, bus_list) + timeout = max(timeout, pdev->link_up_timeout); + + return timeout; +} + +/* + * An extended link-up timeout is only used where the link can be polled: + * Downstream Ports faster than 5 GT/s that report Data Link Layer Link + * Active. Elsewhere the existing waits apply unchanged. + */ +static bool pcie_link_up_timeout_extended(struct pci_dev *bridge, + unsigned int timeout) +{ + return timeout > PCIE_LINK_RETRAIN_TIMEOUT_MS && + pcie_downstream_port(bridge) && + pcie_get_speed_cap(bridge) > PCIE_SPEED_5_0GT && + bridge->link_active_reporting; +} + /** * pci_bridge_wait_for_secondary_bus - Wait for secondary bus to be accessible * @dev: PCI bridge @@ -4810,6 +4850,8 @@ static int pci_bus_max_d3cold_delay(const struct pci_bus *bus) int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type) { struct pci_dev *child __free(pci_dev_put) = NULL; + unsigned int link_up_timeout; + bool extended; int delay; if (pci_dev_is_disconnected(dev)) @@ -4833,7 +4875,9 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type) /* Take d3cold_delay requirements into account */ delay = pci_bus_max_d3cold_delay(dev->subordinate); - if (!delay) { + link_up_timeout = pci_bus_max_link_up_timeout(dev->subordinate); + extended = pcie_link_up_timeout_extended(dev, link_up_timeout); + if (!delay && !extended) { up_read(&pci_bus_sem); return 0; } @@ -4897,9 +4941,16 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type) pci_dbg(dev, "waiting %d ms for downstream link, after activation\n", delay); - if (!pcie_wait_for_link_delay(dev, true, delay)) { + if (extended) + pci_dbg(dev, "allowing %u ms for downstream link to come up\n", + link_up_timeout); + if (!pcie_wait_for_link_delay(dev, true, delay, link_up_timeout)) { /* Did not train, no need to wait any further */ - pci_info(dev, "Data Link Layer Link Active not set in %d msec\n", delay); + if (extended) + pci_info(dev, "Data Link Layer Link Active not set in extended %u msec\n", + link_up_timeout); + else + pci_info(dev, "Data Link Layer Link Active not set in %d msec\n", delay); return -ENOTTY; } diff --git a/include/linux/pci.h b/include/linux/pci.h index aee6a178a535..33de05d509e4 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -434,6 +434,7 @@ struct pci_dev { unsigned int no_bw_notif:1; /* BW notifications may cause issues */ unsigned int d3hot_delay; /* D3hot->D0 transition time in ms */ unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ + unsigned int link_up_timeout; /* Link-up wait (ms), >5 GT/s ports */ u16 l1ss; /* L1SS Capability pointer */ #ifdef CONFIG_PCIEASPM -- 2.43.0