Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1420080rwl; Wed, 5 Apr 2023 17:22:48 -0700 (PDT) X-Google-Smtp-Source: AKy350b+oeInE1SbyZULPLySaPAYnXu6Ttu9ma2lpmbvI6ogyNdVQ0FfSFN9p6Iore5279q54TlR X-Received: by 2002:a17:907:9607:b0:930:3916:df19 with SMTP id gb7-20020a170907960700b009303916df19mr6215315ejc.5.1680740567984; Wed, 05 Apr 2023 17:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680740567; cv=none; d=google.com; s=arc-20160816; b=vZ5PyHRKDWMmuoViJxfwbb3Vr/bOLIfMc/MtH4AiEsXjuWoMZnkDsZNdeH8GavAY2s e30gMNshuw6QS8FRPu1c3wv8Gzc9Ek4jCATOXuFgDQPf8GU0WiMIKuqi9gSz2ub4zbYZ oN7kYmHQ+wG4V0CDJN/KDmquPrA49FgRZjTJbeqZRIpXwJtFoKtWwqPTvY0o8CdRF47k Qyzwo2OCCHLCCsSyX1BiQCpD/5LFKTGcF5or0hB73PfeboLlXnyapfqHpZW3uTfxzFvR vDH8M/yijisDHGmOkYszLacYuINqCGI1WJB41Cee4XTh80EhY9tJ56Sluryi3q7I/DDz 2LzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=bPu5WJY16mvADnCufBdY9OhEa9zBQwAoR2iBxgtqTnA=; b=gTKbZLrMZ/ncQOpKELswzJLLiRUxjLWn/mZpVo6xVwQVmmQkySh5cJkSmq/qRRXE/m xDWWkOshzdjujqZKMZC9rYUem3WESDAwDNuKyqedfzCbRuNd9Aq93dk4KEzvCk4+jJq4 Aw8dIMHCevtNeWHd6oQkOvFW74iDNR3l0NvjEmfD79XmMpFRki5Dq/xX31rbfXZY4W/C /pQQJdmFjz11DZwWfqcpBtDt2tmJDjYhqz5AEWf4I/wydRKxwepPM17nnj8UpWq5LupQ YUd1SSBGZRTtJyxDGbGT3pbTy6k5JsG0D3xVlqUl8pFZVRlsVL6IqLJ4Gf7D9n3CMdMc xeiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc41-20020a17090716a900b00944bbbb1798si85849ejc.678.2023.04.05.17.22.22; Wed, 05 Apr 2023 17:22:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233950AbjDFAVU (ORCPT + 99 others); Wed, 5 Apr 2023 20:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234368AbjDFAVM (ORCPT ); Wed, 5 Apr 2023 20:21:12 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A80EB6E82; Wed, 5 Apr 2023 17:21:10 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id DB94092009E; Thu, 6 Apr 2023 02:21:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id D459B92009B; Thu, 6 Apr 2023 01:21:09 +0100 (BST) Date: Thu, 6 Apr 2023 01:21:09 +0100 (BST) From: "Maciej W. Rozycki" To: Bjorn Helgaas , Mahesh J Salgaonkar , Oliver O'Halloran , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni cc: Alex Williamson , Lukas Wunner , Mika Westerberg , Stefan Roese , Jim Wilson , David Abdurachmanov , =?UTF-8?Q?Pali_Roh=C3=A1r?= , linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 2/7] PCI: Export PCI link retrain timeout In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rename LINK_RETRAIN_TIMEOUT to PCIE_LINK_RETRAIN_TIMEOUT and make it available via "pci.h" for PCI drivers to use. Signed-off-by: Maciej W. Rozycki --- Changes from v7: - Reorder from 1/7. No change from v6. No change from v5. New change in v5. --- drivers/pci/pci.h | 2 ++ drivers/pci/pcie/aspm.c | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) linux-pcie-link-retrain-timeout.diff Index: linux-macro/drivers/pci/pci.h =================================================================== --- linux-macro.orig/drivers/pci/pci.h +++ linux-macro/drivers/pci/pci.h @@ -11,6 +11,8 @@ #define PCI_VSEC_ID_INTEL_TBT 0x1234 /* Thunderbolt */ +#define PCIE_LINK_RETRAIN_TIMEOUT HZ + extern const unsigned char pcie_link_speed[]; extern bool pci_early_dump; Index: linux-macro/drivers/pci/pcie/aspm.c =================================================================== --- linux-macro.orig/drivers/pci/pcie/aspm.c +++ linux-macro/drivers/pci/pcie/aspm.c @@ -90,8 +90,6 @@ static const char *policy_str[] = { [POLICY_POWER_SUPERSAVE] = "powersupersave" }; -#define LINK_RETRAIN_TIMEOUT HZ - /* * The L1 PM substate capability is only implemented in function 0 in a * multi function device. @@ -213,7 +211,7 @@ static bool pcie_retrain_link(struct pci } /* Wait for link training end. Break out after waiting for timeout */ - end_jiffies = jiffies + LINK_RETRAIN_TIMEOUT; + end_jiffies = jiffies + PCIE_LINK_RETRAIN_TIMEOUT; do { pcie_capability_read_word(parent, PCI_EXP_LNKSTA, ®16); if (!(reg16 & PCI_EXP_LNKSTA_LT))