Skip to content

Commit b9c370b

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 af9a530 commit b9c370b

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
@@ -1302,6 +1302,9 @@ static int pci_set_full_power_state(struct pci_dev *dev)
13021302
pci_restore_bars(dev);
13031303
}
13041304

1305+
if (dev->bus->self)
1306+
pcie_aspm_pm_state_change(dev->bus->self);
1307+
13051308
return 0;
13061309
}
13071310

@@ -1396,6 +1399,9 @@ static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state)
13961399
pci_power_name(dev->current_state),
13971400
pci_power_name(state));
13981401

1402+
if (dev->bus->self)
1403+
pcie_aspm_pm_state_change(dev->bus->self);
1404+
13991405
return 0;
14001406
}
14011407

drivers/pci/pci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,12 @@ bool pcie_wait_for_link(struct pci_dev *pdev, bool active);
561561
#ifdef CONFIG_PCIEASPM
562562
void pcie_aspm_init_link_state(struct pci_dev *pdev);
563563
void pcie_aspm_exit_link_state(struct pci_dev *pdev);
564+
void pcie_aspm_pm_state_change(struct pci_dev *pdev);
564565
void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
565566
#else
566567
static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { }
567568
static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) { }
569+
static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) { }
568570
static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { }
569571
#endif
570572

drivers/pci/pcie/aspm.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,25 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
10551055
up_read(&pci_bus_sem);
10561056
}
10571057

1058+
/* @pdev: the root port or switch downstream port */
1059+
void pcie_aspm_pm_state_change(struct pci_dev *pdev)
1060+
{
1061+
struct pcie_link_state *link = pdev->link_state;
1062+
1063+
if (aspm_disabled || !link)
1064+
return;
1065+
/*
1066+
* Devices changed PM state, we should recheck if latency
1067+
* meets all functions' requirement
1068+
*/
1069+
down_read(&pci_bus_sem);
1070+
mutex_lock(&aspm_lock);
1071+
pcie_update_aspm_capable(link->root);
1072+
pcie_config_aspm_path(link);
1073+
mutex_unlock(&aspm_lock);
1074+
up_read(&pci_bus_sem);
1075+
}
1076+
10581077
void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
10591078
{
10601079
struct pcie_link_state *link = pdev->link_state;

0 commit comments

Comments
 (0)