device attached to USB 3.0 hub port doesn't respond address device command after resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I found a usb 3.0 hub issue. Now I use a NEC xHCI host card and a VIA VL810 3.0
hub to test suspend/resume function. I found the device attached to a usb 3.0
hub port didn't respond the address device command in the procedure of
re-enumeration after resume. I tested linux kernel from 2.6.39 to 3.1.0+. All
of them have the issue.

[   69.270895] r8169 0000:03:00.0: PME# enabled
[   69.270903] pcieport 0000:00:1c.5: wake-up capability enabled by ACPI
[   69.286767] xhci_hcd 0000:01:00.0: PME# enabled
[   69.286775]  pci0000:00: wake-up capability enabled by ACPI
[   69.302787] ehci_hcd 0000:00:1d.7: PME# enabled
[   69.302792] ehci_hcd 0000:00:1d.7: wake-up capability enabled by ACPI
[   69.318711] uhci_hcd 0000:00:1d.2: wake-up capability enabled by ACPI
[   69.318735] uhci_hcd 0000:00:1d.1: wake-up capability enabled by ACPI
[   69.318758] uhci_hcd 0000:00:1d.0: wake-up capability enabled by ACPI
[   69.318788] ehci_hcd 0000:00:1a.7: PME# enabled
[   69.318793] ehci_hcd 0000:00:1a.7: wake-up capability enabled by ACPI
[   69.334698] uhci_hcd 0000:00:1a.2: wake-up capability enabled by ACPI
[   69.334723] uhci_hcd 0000:00:1a.1: wake-up capability enabled by ACPI
[   69.334746] uhci_hcd 0000:00:1a.0: wake-up capability enabled by ACPI
[   69.334794] PM: late suspend of devices complete after 64.100 msecs
[   69.335002] ACPI: Preparing to enter system sleep state S3
[   69.335424] PM: Saving platform NVS memory
[   69.335449] Disabling non-boot CPUs ...
[   69.438628] CPU 1 is now offline
[   69.542518] CPU 2 is now offline
[   69.542950] Broke affinity for irq 1
[   69.542981] Broke affinity for irq 19
[   69.646435] CPU 3 is now offline
[   69.646947] ACPI: Low-level resume complete
[   69.646980] PM: Restoring platform NVS memory
[   69.647261] Enabling non-boot CPUs ...
[   69.647356] Booting Node 0 Processor 1 APIC 0x4
[   69.647357] smpboot cpu 1: start_ip = 9b000
[   69.657413] Initializing CPU#1
[   69.658281] Calibrating delay loop (skipped) already calibrated this CPU
[   69.678797] CPU1 is up
[   69.678862] Booting Node 0 Processor 2 APIC 0x1
[   69.678864] smpboot cpu 2: start_ip = 9b000
[   69.689019] Initializing CPU#2
[   69.689887] Calibrating delay loop (skipped) already calibrated this CPU
[   69.710470] CPU2 is up
[   69.710541] Booting Node 0 Processor 3 APIC 0x5
[   69.710543] smpboot cpu 3: start_ip = 9b000
[   69.720701] Initializing CPU#3
[   69.721568] Calibrating delay loop (skipped) already calibrated this CPU
[   69.742421] CPU3 is up
[   69.744237] ACPI: Waking up from system sleep state S3
[   69.744431] pcieport 0000:00:01.0: restoring config space at offset
0x7 (was 0xf0, writing 0x200000f0)
[   69.758861] i915 0000:00:02.0: BAR 0: set to [mem
0xfb800000-0xfbbfffff 64bit] (PCI address [0xfb800000-0xfbbfffff])
[   69.758867] i915 0000:00:02.0: BAR 2: set to [mem
0xe0000000-0xefffffff 64bit pref] (PCI address
[0xe0000000-0xefffffff])
[   69.758871] i915 0000:00:02.0: BAR 4: set to [io  0xff00-0xff07]
(PCI address [0xff00-0xff07])
[   69.758884] i915 0000:00:02.0: restoring config space at offset 0x1
(was 0x900403, writing 0x900407)
[   69.758907] pci 0000:00:16.0: restoring config space at offset 0xf
(was 0x100, writing 0x105)
[   69.758926] pci 0000:00:16.0: restoring config space at offset 0x4
(was 0xfed10004, writing 0xfbfff004)
[   69.758934] pci 0000:00:16.0: restoring config space at offset 0x1
(was 0x180006, writing 0x100006)
[   69.758975] uhci_hcd 0000:00:1a.0: wake-up capability disabled by ACPI
[   69.759002] uhci_hcd 0000:00:1a.1: wake-up capability disabled by ACPI
[   69.759030] uhci_hcd 0000:00:1a.2: wake-up capability disabled by ACPI
[   69.759069] ehci_hcd 0000:00:1a.7: wake-up capability disabled by ACPI
[   69.759074] ehci_hcd 0000:00:1a.7: PME# disabled
[   69.759087] snd_hda_intel 0000:00:1b.0: restoring config space at
offset 0xf (was 0x100, writing 0x107)
[   69.759100] snd_hda_intel 0000:00:1b.0: restoring config space at
offset 0x4 (was 0x4, writing 0xfbff8004)
[   69.759104] snd_hda_intel 0000:00:1b.0: restoring config space at
offset 0x3 (was 0x0, writing 0x10)
[   69.759109] snd_hda_intel 0000:00:1b.0: restoring config space at
offset 0x1 (was 0x100000, writing 0x100002)
[   69.759138] pcieport 0000:00:1c.0: restoring config space at offset
0x7 (was 0x20001010, writing 0x1010)
[   69.759215] uhci_hcd 0000:00:1d.0: wake-up capability disabled by ACPI
[   69.759242] uhci_hcd 0000:00:1d.1: wake-up capability disabled by ACPI
[   69.759269] uhci_hcd 0000:00:1d.2: wake-up capability disabled by ACPI
[   69.759308] ehci_hcd 0000:00:1d.7: wake-up capability disabled by ACPI
[   69.759312] ehci_hcd 0000:00:1d.7: PME# disabled
[   69.759378] ata_piix 0000:00:1f.2: restoring config space at offset
0x8 (was 0xf001, writing 0xf401)
[   69.759427] ata_piix 0000:00:1f.5: restoring config space at offset
0x1 (was 0x2b00001, writing 0x2b00005)
[   69.759456] xhci_hcd 0000:01:00.0: restoring config space at offset
0xf (was 0x100, writing 0x105)
[   69.759470] xhci_hcd 0000:01:00.0: restoring config space at offset
0x4 (was 0x4, writing 0xfbefe004)
[   69.759475] xhci_hcd 0000:01:00.0: restoring config space at offset
0x3 (was 0x0, writing 0x10)
[   69.759480] xhci_hcd 0000:01:00.0: restoring config space at offset
0x1 (was 0x100000, writing 0x100402)
[   69.759507]  pci0000:00: wake-up capability disabled by ACPI
[   69.759511] xhci_hcd 0000:01:00.0: PME# disabled
[   69.759539] r8169 0000:03:00.0: restoring config space at offset
0xf (was 0x1ff, writing 0x10a)
[   69.759553] r8169 0000:03:00.0: restoring config space at offset
0x8 (was 0xc, writing 0xfbdf800c)
[   69.759559] r8169 0000:03:00.0: restoring config space at offset
0x6 (was 0xc, writing 0xfbdff00c)
[   69.759566] r8169 0000:03:00.0: restoring config space at offset
0x4 (was 0xfc01, writing 0xde01)
[   69.759572] r8169 0000:03:00.0: restoring config space at offset
0x3 (was 0x0, writing 0x10)
[   69.759579] r8169 0000:03:00.0: restoring config space at offset
0x1 (was 0x100000, writing 0x100407)
[   69.759712] PM: early resume of devices complete after 15.334 msecs
[   69.759773] i915 0000:00:02.0: setting latency timer to 64
[   69.759776] uhci_hcd 0000:00:1a.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[   69.759781] uhci_hcd 0000:00:1a.0: setting latency timer to 64
[   69.759801] usb usb1: root hub lost power or was reset
[   69.759811] uhci_hcd 0000:00:1a.1: PCI INT B -> GSI 21 (level, low) -> IRQ 21
[   69.759815] uhci_hcd 0000:00:1a.1: setting latency timer to 64
[   69.759833] usb usb2: root hub lost power or was reset
[   69.759842] uhci_hcd 0000:00:1a.2: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   69.759846] uhci_hcd 0000:00:1a.2: setting latency timer to 64
[   69.759864] usb usb3: root hub lost power or was reset
[   69.759870] ehci_hcd 0000:00:1a.7: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   69.759874] snd_hda_intel 0000:00:1b.0: PCI INT A -> GSI 22 (level,
low) -> IRQ 22
[   69.759877] ehci_hcd 0000:00:1a.7: setting latency timer to 64
[   69.759879] uhci_hcd 0000:00:1d.0: PCI INT A -> GSI 23 (level, low) -> IRQ 23
[   69.759881] snd_hda_intel 0000:00:1b.0: setting latency timer to 64
[   69.759884] uhci_hcd 0000:00:1d.0: setting latency timer to 64
[   69.759901] uhci_hcd 0000:00:1d.1: PCI INT B -> GSI 19 (level, low) -> IRQ 19
[   69.759909] usb usb4: root hub lost power or was reset
[   69.759911] uhci_hcd 0000:00:1d.1: setting latency timer to 64
[   69.759918] uhci_hcd 0000:00:1d.2: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   69.759924] uhci_hcd 0000:00:1d.2: setting latency timer to 64
[   69.759932] snd_hda_intel 0000:00:1b.0: irq 48 for MSI/MSI-X
[   69.759935] usb usb5: root hub lost power or was reset
[   69.759950] ehci_hcd 0000:00:1d.7: PCI INT A -> GSI 23 (level, low) -> IRQ 23
[   69.759951] usb usb6: root hub lost power or was reset
[   69.759955] ehci_hcd 0000:00:1d.7: setting latency timer to 64
[   69.759961] pci 0000:00:1e.0: setting latency timer to 64
[   69.759970] ata_piix 0000:00:1f.2: PCI INT B -> GSI 19 (level, low) -> IRQ 19
[   69.759973] ata_piix 0000:00:1f.2: setting latency timer to 64
[   69.759977] ata_piix 0000:00:1f.5: PCI INT B -> GSI 19 (level, low) -> IRQ 19
[   69.759980] ata_piix 0000:00:1f.5: setting latency timer to 64
[   69.759988] xhci_hcd 0000:01:00.0: setting latency timer to 64
[   69.759992] pcieport 0000:00:1c.5: wake-up capability disabled by ACPI
[   69.759998] r8169 0000:03:00.0: PME# disabled
[   69.760013] usb usb9: root hub lost power or was reset
[   69.760014] usb usb10: root hub lost power or was reset
[   69.762871] sd 0:0:1:0: [sda] Starting disk
[   69.864931] xhci_hcd 0000:01:00.0: irq 42 for MSI/MSI-X
[   69.864936] xhci_hcd 0000:01:00.0: irq 43 for MSI/MSI-X
[   69.864941] xhci_hcd 0000:01:00.0: irq 44 for MSI/MSI-X
[   69.864946] xhci_hcd 0000:01:00.0: irq 45 for MSI/MSI-X
[   69.864951] xhci_hcd 0000:01:00.0: irq 46 for MSI/MSI-X
[   70.089377] ata4: SATA link down (SStatus 0 SControl 300)
[   70.100065] ata3: SATA link down (SStatus 0 SControl 300)
[   70.180831] psmouse serio1: hgpk: ID: 10 00 50
[   70.202630] usb 9-1: reset high-speed USB device number 2 using xhci_hcd
[   70.219993] xhci_hcd 0000:01:00.0: xHCI xhci_drop_endpoint called
with disabled ep f1024f00
[   70.331696] usb 10-1: reset SuperSpeed USB device number 2 using xhci_hcd
[   70.409182] ata2.00: SATA link down (SStatus 0 SControl 300)
[   70.409193] ata2.01: SATA link down (SStatus 0 SControl 300)
[   70.554368] ata1.00: SATA link down (SStatus 0 SControl 300)
[   70.554378] ata1.01: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[   70.570371] ata1.01: ACPI cmd ef/03:45:00:00:00:b0 (SET FEATURES)
filtered out
[   70.570374] ata1.01: ACPI cmd ef/03:45:00:00:00:b0 (SET FEATURES)
filtered out
[   70.570376] ata1.01: ACPI cmd ef/03:0c:00:00:00:b0 (SET FEATURES)
filtered out
[   70.586717] ata1.01: configured for UDMA/133
[   70.933662] xhci_hcd 0000:01:00.0: xHCI xhci_drop_endpoint called
with disabled ep f12bbb80
[   71.314661] usb 10-1.1: Device not responding to set address.
[   71.517825] usb 10-1.1: Device not responding to set address.
[   71.721413] usb 10-1.1: device not accepting address 3, error -71
[   71.797945] usb 10-1.1: Device not responding to set address.
[   72.001483] usb 10-1.1: Device not responding to set address.
[   72.205034] usb 10-1.1: device not accepting address 3, error -71
[   72.280964] usb 10-1.1: Device not responding to set address.
[   72.485020] usb 10-1.1: Device not responding to set address.
[   72.688655] usb 10-1.1: device not accepting address 3, error -71
[   72.764018] usb 10-1.1: Device not responding to set address.
[   72.964679] usb 10-1.1: Device not responding to set address.
[   73.168368] usb 10-1.1: device not accepting address 3, error -71
[   73.168562] PM: resume of devices complete after 3411.416 msecs
[   73.168622] PM: resume devices took 3.412 seconds
[   73.168654] PM: Finishing wakeup.
[   73.168655] Restarting tasks ... done.
[   73.192601] usb 10-1.1: USB disconnect, device number 3
[   73.196214] xhci_hcd 0000:01:00.0: xHCI xhci_drop_endpoint called
with disabled ep f5935360
[   73.196218] xhci_hcd 0000:01:00.0: xHCI xhci_drop_endpoint called
with disabled ep f593538c
[   73.233539] [drm:drm_mode_getfb] *ERROR* invalid framebuffer id
[   73.239729] r8169 0000:03:00.0: eth0: link down
[   73.239734] r8169 0000:03:00.0: eth0: link down
[   73.239874] ADDRCONF(NETDEV_UP): eth0: link is not ready
[   73.277375] usb 10-1.1: Device not responding to set address.
[   73.480317] usb 10-1.1: Device not responding to set address.
[   73.683824] usb 10-1.1: device not accepting address 5, error -71
[   73.760838] usb 10-1.1: Device not responding to set address.
[   73.963992] usb 10-1.1: Device not responding to set address.
[   74.167480] usb 10-1.1: device not accepting address 6, error -71
[   74.244111] usb 10-1.1: Device not responding to set address.
[   74.447504] usb 10-1.1: Device not responding to set address.
[   74.526209] EXT4-fs (sda2): re-mounted. Opts: errors=remount-ro,commit=0
[   74.528969] EXT4-fs (sdc1): re-mounted. Opts: commit=0,commit=0
[   74.651128] usb 10-1.1: device not accepting address 7, error -71
[   74.728748] usb 10-1.1: Device not responding to set address.
[   74.931190] usb 10-1.1: Device not responding to set address.
[   75.134776] usb 10-1.1: device not accepting address 8, error -71
[   75.134795] hub 10-1:1.0: unable to enumerate USB device on port 1



Then I found the root cause by USB CATC. USB core sends a set hub
depth request to
usb 3.0 hub in hub_configure() in superspeed hub initialization. And
If we do a s3/s4,
after resume usb core should reset the device and send the set hub
depth request
again. But before re-enumeration the usb core doesn't do it. So I
added a set hub depth
request after setting configuration in usb_reset_and_verify_device().
Now it seems like
the issue is gone.

Signed-off-by: Elric Fu <elricfu1@xxxxxxxxx>
---
 drivers/usb/core/hub.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 96f05b2..707f27e 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -87,6 +87,11 @@ static inline int hub_is_superspeed(struct usb_device *hdev)
        return (hdev->descriptor.bDeviceProtocol == 3);
 }

+static inline int is_usb_hub(struct usb_device *hdev)
+{
+        return (hdev->descriptor.bDeviceClass == 9);
+}
+
 /* Protect struct usb_device->state and ->children members
  * Note: Both are also protected by ->dev.sem, except that ->state can
  * change to USB_STATE_NOTATTACHED even when the semaphore isn't held. */
@@ -3930,6 +3935,18 @@ static int usb_reset_and_verify_device(struct
usb_device *udev)
        mutex_unlock(hcd->bandwidth_mutex);
        usb_set_device_state(udev, USB_STATE_CONFIGURED);

+        if (is_usb_hub(udev) && hub_is_superspeed(udev)) {
+                ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+                                HUB_SET_DEPTH, USB_RT_HUB,
+                                udev->level - 1, 0, NULL, 0,
+                                USB_CTRL_SET_TIMEOUT);
+                if (ret < 0) {
+                        dev_err(&udev->dev,
+                                "set hub depth failed\n");
+                        goto re_enumerate;
+                }
+        }
+
        /* Put interfaces back into the same altsettings as before.
         * Don't bother to send the Set-Interface request for interfaces
         * that were already in altsetting 0; besides being unnecessary,


Best Regards,
Elric Fu
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux