Skip to content

Commit 8cc22ba

Browse files
bjorn-helgaasgregkh
authored andcommitted
Revert "PCI/ASPM: Remove pcie_aspm_pm_state_change()"
commit f93e71a upstream. This reverts commit 08d0cc5. Michael reported that when attempting to resume from suspend to RAM on ASUS mini PC PN51-BB757MDE1 (DMI model: MINIPC PN51-E1), 08d0cc5 ("PCI/ASPM: Remove pcie_aspm_pm_state_change()") caused a 12-second delay with no output, followed by a reboot. Workarounds include: - Reverting 08d0cc5 ("PCI/ASPM: Remove pcie_aspm_pm_state_change()") - Booting with "pcie_aspm=off" - Booting with "pcie_aspm.policy=performance" - "echo 0 | sudo tee /sys/bus/pci/devices/0000:03:00.0/link/l1_aspm" before suspending - Connecting a USB flash drive Link: https://lore.kernel.org/r/[email protected] Fixes: 08d0cc5 ("PCI/ASPM: Remove pcie_aspm_pm_state_change()") Reported-by: Michael Schaller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Helgaas <[email protected]> Cc: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c25546c commit 8cc22ba

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

drivers/pci/pci.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,9 @@ static int pci_set_full_power_state(struct pci_dev *dev)
13351335
pci_restore_bars(dev);
13361336
}
13371337

1338+
if (dev->bus->self)
1339+
pcie_aspm_pm_state_change(dev->bus->self);
1340+
13381341
return 0;
13391342
}
13401343

@@ -1429,6 +1432,9 @@ static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state)
14291432
pci_power_name(dev->current_state),
14301433
pci_power_name(state));
14311434

1435+
if (dev->bus->self)
1436+
pcie_aspm_pm_state_change(dev->bus->self);
1437+
14321438
return 0;
14331439
}
14341440

drivers/pci/pci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,12 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt);
566566
#ifdef CONFIG_PCIEASPM
567567
void pcie_aspm_init_link_state(struct pci_dev *pdev);
568568
void pcie_aspm_exit_link_state(struct pci_dev *pdev);
569+
void pcie_aspm_pm_state_change(struct pci_dev *pdev);
569570
void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
570571
#else
571572
static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { }
572573
static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) { }
574+
static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) { }
573575
static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { }
574576
#endif
575577

drivers/pci/pcie/aspm.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,25 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
10011001
up_read(&pci_bus_sem);
10021002
}
10031003

1004+
/* @pdev: the root port or switch downstream port */
1005+
void pcie_aspm_pm_state_change(struct pci_dev *pdev)
1006+
{
1007+
struct pcie_link_state *link = pdev->link_state;
1008+
1009+
if (aspm_disabled || !link)
1010+
return;
1011+
/*
1012+
* Devices changed PM state, we should recheck if latency
1013+
* meets all functions' requirement
1014+
*/
1015+
down_read(&pci_bus_sem);
1016+
mutex_lock(&aspm_lock);
1017+
pcie_update_aspm_capable(link->root);
1018+
pcie_config_aspm_path(link);
1019+
mutex_unlock(&aspm_lock);
1020+
up_read(&pci_bus_sem);
1021+
}
1022+
10041023
void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
10051024
{
10061025
struct pcie_link_state *link = pdev->link_state;

0 commit comments

Comments
 (0)