Skip to content

Commit 33a176a

Browse files
maciej-w-rozyckibjorn-helgaas
authored andcommitted
PCI: Export PCIe link retrain timeout
Convert LINK_RETRAIN_TIMEOUT from jiffies to milliseconds, accordingly rename to PCIE_LINK_RETRAIN_TIMEOUT_MS, and make available via "pci.h" for the PCI core to use. Use in pcie_wait_for_link_delay(). Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maciej W. Rozycki <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 07a8d69 commit 33a176a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

drivers/pci/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4867,7 +4867,7 @@ static int pci_pm_reset(struct pci_dev *dev, bool probe)
48674867
static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active,
48684868
int delay)
48694869
{
4870-
int timeout = 1000;
4870+
int timeout = PCIE_LINK_RETRAIN_TIMEOUT_MS;
48714871
bool ret;
48724872
u16 lnk_status;
48734873

drivers/pci/pci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#define PCI_VSEC_ID_INTEL_TBT 0x1234 /* Thunderbolt */
1313

14+
#define PCIE_LINK_RETRAIN_TIMEOUT_MS 1000
15+
1416
extern const unsigned char pcie_link_speed[];
1517
extern bool pci_early_dump;
1618

drivers/pci/pcie/aspm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ static const char *policy_str[] = {
9090
[POLICY_POWER_SUPERSAVE] = "powersupersave"
9191
};
9292

93-
#define LINK_RETRAIN_TIMEOUT HZ
94-
9593
/*
9694
* The L1 PM substate capability is only implemented in function 0 in a
9795
* multi function device.
@@ -198,14 +196,14 @@ static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist)
198196
* @pdev: Device whose link to wait for.
199197
*
200198
* Return TRUE if successful, or FALSE if training has not completed
201-
* within LINK_RETRAIN_TIMEOUT jiffies.
199+
* within PCIE_LINK_RETRAIN_TIMEOUT_MS milliseconds.
202200
*/
203201
static bool pcie_wait_for_link_status(struct pci_dev *pdev)
204202
{
205203
unsigned long end_jiffies;
206204
u16 lnksta;
207205

208-
end_jiffies = jiffies + LINK_RETRAIN_TIMEOUT;
206+
end_jiffies = jiffies + msecs_to_jiffies(PCIE_LINK_RETRAIN_TIMEOUT_MS);
209207
do {
210208
pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnksta);
211209
if (!(lnksta & PCI_EXP_LNKSTA_LT))

0 commit comments

Comments
 (0)