]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
PCI / PM: Fix native PME handling during system suspend/resume
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 6 Jul 2017 00:32:02 +0000 (02:32 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 12 Jul 2017 23:50:07 +0000 (01:50 +0200)
commitc7b5a4e6e8fbef8fdf2c529f953000d24c561339
treecfcfbc878ad716b3bd39cc8b0edce09d462caf1b
parent0ce3fcaff92908c370334ce3b9111aeea71159d6
PCI / PM: Fix native PME handling during system suspend/resume

Commit 76cde7e49590 (PCI / PM: Make PCIe PME interrupts wake up from
suspend-to-idle) went too far with preventing pcie_pme_work_fn() from
clearing the root port's PME Status and re-enabling the PME interrupt
which should be done for PMEs to work correctly after system resume.

The failing scenario is as follows:

 1. pcie_pme_suspend() finds that the PME IRQ should be designated
    for system wakeup, so it calls enable_irq_wake() and then sets
    data->suspend_level to PME_SUSPEND_WAKEUP.

 2. PME interrupt happens at this point.

 3. pcie_pme_irq() runs, disables the PME interrupt and queues up
    the execution of pcie_pme_work_fn().

 4. pcie_pme_work_fn() runs before pcie_pme_resume() and breaks out
    of the loop right away, because data->suspend_level is not
    PME_SUSPEND_NONE, and it doesn't re-enable the PME interrupt
    for the same reason.

 5. pcie_pme_resume() runs and simply calls disable_irq_wake()
    without re-enabling the PME interrupt (because data->suspend_level
    is not PME_SUSPEND_NONE), so the PME interrupt remains disabled
    and the PME Status remains set.

To fix this notice that there is no reason why pcie_pme_work_fn()
should behave in a special way during system resume if the PME
interrupt is not disabled by pcie_pme_suspend() and partially revert
commit 76cde7e49590 and restore the previous (and correct) behavior
of pcie_pme_work_fn().

Fixes: 76cde7e49590 (PCI / PM: Make PCIe PME interrupts wake up from suspend-to-idle)
Reported-and-tested-by: Naresh Solanki <naresh.solanki@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pcie/pme.c