Bug 85141 - XHCI host dies when LPM is enabled and webcam gadget is connected
Summary: XHCI host dies when LPM is enabled and webcam gadget is connected
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: Intel Linux
: P1 blocking
Assignee: XHCI bugs virtual user
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-25 10:48 UTC by Amit Virdi
Modified: 2016-02-15 14:57 UTC (History)
3 users (show)

See Also:
Kernel Version: v3.16, the status is same on v3.17-rc6
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Enabled DEBUG flag in files drivers/usb/core/hcd.c, drivers/usb/core/hub.c, drivers/usb/core/message.c, drivers/usb/host/xhci.c, xhci-ring.c, xhci-dbg.c, xhci-hub.c, xhci-mem.c, xhci-pci.c, xhci-plat. (69.79 KB, text/plain)
2014-09-25 10:48 UTC, Amit Virdi
Details

Description Amit Virdi 2014-09-25 10:48:05 UTC
Created attachment 151881 [details]
Enabled DEBUG flag in files drivers/usb/core/hcd.c, drivers/usb/core/hub.c, drivers/usb/core/message.c, drivers/usb/host/xhci.c, xhci-ring.c, xhci-dbg.c, xhci-hub.c, xhci-mem.c, xhci-pci.c, xhci-plat.

Host PC details:
USB3.0 Hardware: TI's TUSB7340EVM xHCI host
Software changes: Added Quirk to enable LPM for this card, some additional debug logs added

Device Side:
USB3.0 Hardware: Synopsys DWC3 controller, Camera sensor mounted on the platform

Problem description:
I have enabled LPM support for this xHCI card. My device also supports LPM. 
 - When I insert webcam gadget module, the host controller stops responding. It dies after few seconds I have to restart the system in order to make it work again. 
 - The webcam gadget has one configuration, 2 interfaces. Interface 0 has one Interrupt IN EP (wMaxPacketSize 16, bInterval 8). Interface 1 has one BULK IN EP (wMaxPacketSize 1024)
 - In USB protocol logs, I see SET_FEATURE U1_Enable and U2_Enable being sent by the host along with the values of exit latencies.
 - After that, I see CLEAR_FEATURE transaction for U1_Enable and U2_Enable.
 - Enabling/disabling autosuspend on host side has no additional impact on the behavior when the webcam is connected and LPM is enabled
 - When LPM is disabled, the webcam gadget works fine.
 - If I use gadget zero, then the xHCI host works well. The gadget zero has one interface having two EPs (BULK IN, BULK OUT) with wMaxPacketSize 1024.

Please see the attached logs, I have enabled DEBUG flag in drivers/usb/core/hcd.c, drivers/usb/core/hub.c, drivers/usb/core/message.c, drivers/usb/host/xhci.c, xhci-ring.c, xhci-dbg.c, xhci-hub.c, xhci-mem.c, xhci-pci.c, xhci-plat.c

Also, I have added some additional logs that might be helpful. Please let me know if anything further is required.
Comment 1 Greg Kroah-Hartman 2014-09-25 11:11:29 UTC
On Thu, Sep 25, 2014 at 10:48:05AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=85141
> 
>             Bug ID: 85141
>            Summary: XHCI host dies when LPM is enabled and webcam gadget
>                     is connected

Please send to the linux-usb@vger.kernel.org mailing list.
Comment 2 Amit Virdi 2014-09-25 11:28:05 UTC
Sent. Thanks!
Comment 3 Amit Virdi 2014-09-26 09:24:21 UTC
(In reply to Amit Virdi from comment #0)
> Created attachment 151881 [details]
> Enabled DEBUG flag in files drivers/usb/core/hcd.c, drivers/usb/core/hub.c,
> drivers/usb/core/message.c, drivers/usb/host/xhci.c, xhci-ring.c,
> xhci-dbg.c, xhci-hub.c, xhci-mem.c, xhci-pci.c, xhci-plat.
> 
> Host PC details:
> USB3.0 Hardware: TI's TUSB7340EVM xHCI host
> Software changes: Added Quirk to enable LPM for this card, some additional
> debug logs added
> 
> Device Side:
> USB3.0 Hardware: Synopsys DWC3 controller, Camera sensor mounted on the
> platform
> 
> Problem description:
> I have enabled LPM support for this xHCI card. My device also supports LPM. 
>  - When I insert webcam gadget module, the host controller stops responding.
> It dies after few seconds I have to restart the system in order to make it
> work again. 
>  - The webcam gadget has one configuration, 2 interfaces. Interface 0 has
> one Interrupt IN EP (wMaxPacketSize 16, bInterval 8). Interface 1 has one
> BULK IN EP (wMaxPacketSize 1024)
>  - In USB protocol logs, I see SET_FEATURE U1_Enable and U2_Enable being
> sent by the host along with the values of exit latencies.
>  - After that, I see CLEAR_FEATURE transaction for U1_Enable and U2_Enable.
>  - Enabling/disabling autosuspend on host side has no additional impact on
> the behavior when the webcam is connected and LPM is enabled
>  - When LPM is disabled, the webcam gadget works fine.
>  - If I use gadget zero, then the xHCI host works well. The gadget zero has
> one interface having two EPs (BULK IN, BULK OUT) with wMaxPacketSize 1024.
> 
> Please see the attached logs, I have enabled DEBUG flag in
> drivers/usb/core/hcd.c, drivers/usb/core/hub.c, drivers/usb/core/message.c,
> drivers/usb/host/xhci.c, xhci-ring.c, xhci-dbg.c, xhci-hub.c, xhci-mem.c,
> xhci-pci.c, xhci-plat.c
> 
> Also, I have added some additional logs that might be helpful. Please let me
> know if anything further is required.

Debugging further, I see that once the host reads all the descriptors of the webcam gadget, it initiates SET_CONFIGURATION transfer. It then sends SET_SEL request for Ux SEL/PEL latencies and then enable the U1 and U2 features.

Towards the end of usb_set_configuration, it tries to add interface (see the log "adding ... config #1, interface 0". At this point host tries to add/bind the driver. So, it issues command to configure the endpoint. This configure endpoint command times out and then stopping the command ring also fails.

Note You need to log in before you can comment on or make changes to this bug.