From 35725347a42bbf7282206e9318e59ce1c4bd6505 Mon Sep 17 00:00:00 2001 From: Sriharsha Allenki Date: Fri, 29 Mar 2019 15:18:57 +0530 Subject: [PATCH] xhci: Fix possible interrupt storm with suspend failure In the case where the xhci_suspend failed because the controller is not halted within the delay, we see that the xhc interrupts are not acked and is leading to a storm of unwanted dwc3_interrupt calls. Fix this by setting the HCD_FLAG_HW_ACCESSIBLE so that the interrupts are acked by the xhci_irq. Once the suspend failure happens, the device does not respond to any new device connect/disconnect. So, fix this by restarting the host stack by notifying the hc_died to the dwc3 glue driver. Change-Id: Ie383d5eacca428b123c1a071a304df54e087c42e Signed-off-by: Sriharsha Allenki --- drivers/usb/host/xhci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 44242f4f4546..8d6e7a0ce194 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -985,6 +985,12 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) if (xhci_handshake(&xhci->op_regs->status, STS_HALT, STS_HALT, delay)) { xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n"); + /* Set the HW_ACCESSIBLE so that any pending interrupts are + * served. + */ + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); + xhci_hc_died(xhci); spin_unlock_irq(&xhci->lock); return -ETIMEDOUT; }