Subject: Possible regression between 4.9 and 4.13

From: [email-masked] (Mathias Nyman)
Date: Mon, 28 Aug 2017 11:39:27 +0300

On 23.08.2017 17:30, Mason wrote:
> On 23/08/2017 14:41, Mason wrote:
>
>> I compiled a minimal kernel, with lots of irrelevant drivers and
>> frameworks left out, including power management. I still get the
>> "xHCI host controller not responding, assume dead" issue.
>
> The problem seems to have a timing-related aspect.
>
> I added a bunch of logs (to a slow serial console) and the HC was
> not killed. I was able to plug the Flash drive a second time.
> (I am logging config space reads and writes.)

Could you take a log with the following added debug, without
your extra delays, It should show a bit more about the state
of the controller when we read 0xffffffff

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 4bc6f42..a124c3d 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -23,6 +23,7 @@
  
  #include <linux/slab.h>
  #include <asm/unaligned.h>
+#include <linux/pci.h>
  
  #include "xhci.h"
  #include "xhci-trace.h"
@@ -1280,7 +1281,11 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                 wIndex--;
                 temp = readl(port_array[wIndex]);
                 if (temp == ~(u32)0) {
-                       xhci_hc_died(xhci);
+                       struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
+                       xhci_err(xhci, "ClearPortFeat port%d @%p=%x, hcd->state:0x%x hcd->flags:0x%x, pci_state 0x%x\n",
+                                wIndex, port_array[wIndex], temp, hcd->state, hcd->flags, pdev->current_state);
+
+                       WARN_ON(1);
                         retval = -ENODEV;
                         break;
                 }

Thanks
-Mathias