PCI/LINK: Disable bandwidth notification interrupt during suspend
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 15 Apr 2019 08:41:42 +0000 (11:41 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 18 Apr 2019 23:23:28 +0000 (18:23 -0500)
If the bandwidth notification interrupt is left unmasked when entering
suspend to idle, it triggers immediately bringing the system back to
working state.

To keep that from happening, disable the interrupt when entering system
sleep and enable it again during resume.

Reported-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pcie/bw_notification.c

index d2eae3b7cc0f74d5c8fdec80fa6ffffd68dd8501..971eb7e90fb099abde02ac063d745f569825da03 100644 (file)
@@ -96,11 +96,25 @@ static void pcie_bandwidth_notification_remove(struct pcie_device *srv)
        free_irq(srv->irq, srv);
 }
 
+static int pcie_bandwidth_notification_suspend(struct pcie_device *srv)
+{
+       pcie_disable_link_bandwidth_notification(srv->port);
+       return 0;
+}
+
+static int pcie_bandwidth_notification_resume(struct pcie_device *srv)
+{
+       pcie_enable_link_bandwidth_notification(srv->port);
+       return 0;
+}
+
 static struct pcie_port_service_driver pcie_bandwidth_notification_driver = {
        .name           = "pcie_bw_notification",
        .port_type      = PCIE_ANY_PORT,
        .service        = PCIE_PORT_SERVICE_BWNOTIF,
        .probe          = pcie_bandwidth_notification_probe,
+       .suspend        = pcie_bandwidth_notification_suspend,
+       .resume         = pcie_bandwidth_notification_resume,
        .remove         = pcie_bandwidth_notification_remove,
 };