@@ -2714,7 +2714,7 @@ int pci_prepare_to_sleep(struct pci_dev *dev)
* lower-power idle state as a whole.
*/
if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
- pci_disable_ptm(dev);
+ pci_suspend_ptm(dev);
pci_enable_wake(dev, target_state, wakeup);
@@ -2772,7 +2772,7 @@ int pci_finish_runtime_suspend(struct pci_dev *dev)
* lower-power idle state as a whole.
*/
if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
- pci_disable_ptm(dev);
+ pci_suspend_ptm(dev);
__pci_enable_wake(dev, target_state, pci_dev_run_wake(dev));
@@ -507,9 +507,13 @@ static inline int pci_iov_bus_range(struct pci_bus *bus)
#ifdef CONFIG_PCIE_PTM
void pci_save_ptm_state(struct pci_dev *dev);
void pci_restore_ptm_state(struct pci_dev *dev);
+void pci_suspend_ptm(struct pci_dev *dev);
+void pci_resume_ptm(struct pci_dev *dev);
#else
static inline void pci_save_ptm_state(struct pci_dev *dev) { }
static inline void pci_restore_ptm_state(struct pci_dev *dev) { }
+static inline void pci_suspend_ptm(struct pci_dev *dev) { }
+static inline void pci_resume_ptm(struct pci_dev *dev) { }
#endif
unsigned long pci_cardbus_resource_alignment(struct resource *);
@@ -198,6 +198,21 @@ int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
}
EXPORT_SYMBOL(pci_enable_ptm);
+/*
+ * Disable PTM, but leave dev->ptm_enabled so we silently re-enable it on
+ * resume.
+ */
+void pci_suspend_ptm(struct pci_dev *dev)
+{
+ __pci_disable_ptm(dev);
+}
+
+void pci_resume_ptm(struct pci_dev *dev)
+{
+ if (dev->ptm_enabled)
+ __pci_enable_ptm(dev);
+}
+
bool pcie_ptm_enabled(struct pci_dev *dev)
{
if (!dev)
From: Bjorn Helgaas <bhelgaas@google.com> --- drivers/pci/pci.c | 4 ++-- drivers/pci/pci.h | 4 ++++ drivers/pci/pcie/ptm.c | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-)