Skip to contentSkip to conversation

PCI/LINK: Disable bandwidth notification interrupt during suspend

PATCH Applied Mika Westerberg 2 participants 2 messages Apr 15, 2019 – Apr 18, 2019 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/LINK: Disable bandwidth notification interrupt during suspend

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.

---
 drivers/pci/pcie/bw_notification.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/pci/pcie/bw_notification.c +14 -0
index 4fa9e3523ee1..77e685771487 100644
@@ -107,11 +107,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,
 };
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 9 lines · Mika Westerberg

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.

Applied to pci/portdrv for v5.2, thanks, Mika.

Quoted 37 lines
---
 drivers/pci/pcie/bw_notification.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/pci/pcie/bw_notification.c +14 -0
index 4fa9e3523ee1..77e685771487 100644
@@ -107,11 +107,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,
 };
 
Signature · 1 line
2.20.1