linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/LINK: Disable bandwidth notification interrupt during suspend
@ 2019-04-15  8:41 Mika Westerberg
  2019-04-18 23:24 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Mika Westerberg @ 2019-04-15  8:41 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alexandru Gagniuc, Lukas Wunner, Imre Deak, Rafael J. Wysocki,
	Mika Westerberg, linux-pci

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>
---
 drivers/pci/pcie/bw_notification.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/pci/pcie/bw_notification.c b/drivers/pci/pcie/bw_notification.c
index 4fa9e3523ee1..77e685771487 100644
--- a/drivers/pci/pcie/bw_notification.c
+++ b/drivers/pci/pcie/bw_notification.c
@@ -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,
 };
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI/LINK: Disable bandwidth notification interrupt during suspend
  2019-04-15  8:41 [PATCH] PCI/LINK: Disable bandwidth notification interrupt during suspend Mika Westerberg
@ 2019-04-18 23:24 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2019-04-18 23:24 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Alexandru Gagniuc, Lukas Wunner, Imre Deak, Rafael J. Wysocki, linux-pci

On Mon, Apr 15, 2019 at 11:41:42AM +0300, Mika Westerberg wrote:
> 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>

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

> ---
>  drivers/pci/pcie/bw_notification.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/pci/pcie/bw_notification.c b/drivers/pci/pcie/bw_notification.c
> index 4fa9e3523ee1..77e685771487 100644
> --- a/drivers/pci/pcie/bw_notification.c
> +++ b/drivers/pci/pcie/bw_notification.c
> @@ -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,
>  };
>  
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-18 23:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-15  8:41 [PATCH] PCI/LINK: Disable bandwidth notification interrupt during suspend Mika Westerberg
2019-04-18 23:24 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).