linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6] usb: ohci: disable start-of-frame interrupt in ohci_rh_suspend
@ 2021-10-13  3:32 Yinbo Zhu
  2021-10-13 14:06 ` Alan Stern
  0 siblings, 1 reply; 2+ messages in thread
From: Yinbo Zhu @ 2021-10-13  3:32 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel,
	Greg Kroah-Hartman, Patchwork Bot
  Cc: zhuyinbo

While going into S3 or S4 suspend, an OHCI host controller can
generate interrupt requests if the INTR_SF enable flag is set.  The
interrupt handler routine isn't prepared for this and it doesn't turn
off the flag, causing an interrupt storm.

To fix this problem, make ohci_rh_suspend() always disable INTR_SF
interrupts after processing the done list and the ED unlinks but
before the controller goes into the suspended (non-UsbOperational)
state.  There's no reason to leave the flag enabled, since a
suspended controller doesn't generate Start-of-Frame packets.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
Change in v6:
		1. Rework the commit log information.
		2. Move the key change code after ohci_work in 
		   ohci_rh_suspend.


 drivers/usb/host/ohci-hub.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index f474f2f..90cee19 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -91,6 +91,9 @@ static int ohci_rh_suspend (struct ohci_hcd *ohci, int autostop)
 	update_done_list(ohci);
 	ohci_work(ohci);
 
+	/* All ED unlinks should be finished, no need for SOF interrupts */
+	ohci_writel(ohci, OHCI_INTR_SF, &ohci->regs->intrdisable);
+
 	/*
 	 * Some controllers don't handle "global" suspend properly if
 	 * there are unsuspended ports.  For these controllers, put all
-- 
1.8.3.1


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

* Re: [PATCH v6] usb: ohci: disable start-of-frame interrupt in ohci_rh_suspend
  2021-10-13  3:32 [PATCH v6] usb: ohci: disable start-of-frame interrupt in ohci_rh_suspend Yinbo Zhu
@ 2021-10-13 14:06 ` Alan Stern
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2021-10-13 14:06 UTC (permalink / raw)
  To: Yinbo Zhu
  Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, Greg Kroah-Hartman,
	Patchwork Bot

On Wed, Oct 13, 2021 at 11:32:08AM +0800, Yinbo Zhu wrote:
> While going into S3 or S4 suspend, an OHCI host controller can
> generate interrupt requests if the INTR_SF enable flag is set.  The
> interrupt handler routine isn't prepared for this and it doesn't turn
> off the flag, causing an interrupt storm.
> 
> To fix this problem, make ohci_rh_suspend() always disable INTR_SF
> interrupts after processing the done list and the ED unlinks but
> before the controller goes into the suspended (non-UsbOperational)
> state.  There's no reason to leave the flag enabled, since a
> suspended controller doesn't generate Start-of-Frame packets.
> 
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> ---

Acked-by: Alan Stern <stern@rowland.harvard.edu>

> Change in v6:
> 		1. Rework the commit log information.
> 		2. Move the key change code after ohci_work in 
> 		   ohci_rh_suspend.
> 
> 
>  drivers/usb/host/ohci-hub.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
> index f474f2f..90cee19 100644
> --- a/drivers/usb/host/ohci-hub.c
> +++ b/drivers/usb/host/ohci-hub.c
> @@ -91,6 +91,9 @@ static int ohci_rh_suspend (struct ohci_hcd *ohci, int autostop)
>  	update_done_list(ohci);
>  	ohci_work(ohci);
>  
> +	/* All ED unlinks should be finished, no need for SOF interrupts */
> +	ohci_writel(ohci, OHCI_INTR_SF, &ohci->regs->intrdisable);
> +
>  	/*
>  	 * Some controllers don't handle "global" suspend properly if
>  	 * there are unsuspended ports.  For these controllers, put all
> -- 
> 1.8.3.1
> 

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

end of thread, other threads:[~2021-10-13 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13  3:32 [PATCH v6] usb: ohci: disable start-of-frame interrupt in ohci_rh_suspend Yinbo Zhu
2021-10-13 14:06 ` Alan Stern

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).