Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TESTING: V6.12 dwc hcd fixes #6496

Draft
wants to merge 4 commits into
base: rpi-6.12.y
Choose a base branch
from

Commits on Nov 26, 2024

  1. usb: hub: Enforce power cycle on port connect fail

    This helps to reproduce issue faster ...
    
    Signed-off-by: Stefan Wahren <[email protected]>
    lategoodbye authored and popcornmix committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    c14d11d View commit details
    Browse the repository at this point in the history
  2. usb: dwc2: Fix HCD resume

    The Raspberry Pi can suffer on interrupt storms on HCD resume. The dwc2
    driver sometimes misses to enable HCD_FLAG_HW_ACCESSIBLE before re-enabling
    the interrupts. This causes a situation where both handler ignore a incoming
    port interrupt and force the upper layers to disable the dwc2 interrupt
    line. This leaves the USB interface in a unusable state:
    
    irq 66: nobody cared (try booting with the "irqpoll" option)
    CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W          6.10.0-rc3
    Hardware name: BCM2835
    Call trace:
    unwind_backtrace from show_stack+0x10/0x14
    show_stack from dump_stack_lvl+0x50/0x64
    dump_stack_lvl from __report_bad_irq+0x38/0xc0
    __report_bad_irq from note_interrupt+0x2ac/0x2f4
    note_interrupt from handle_irq_event+0x88/0x8c
    handle_irq_event from handle_level_irq+0xb4/0x1ac
    handle_level_irq from generic_handle_domain_irq+0x24/0x34
    generic_handle_domain_irq from bcm2836_chained_handle_irq+0x24/0x28
    bcm2836_chained_handle_irq from generic_handle_domain_irq+0x24/0x34
    generic_handle_domain_irq from generic_handle_arch_irq+0x34/0x44
    generic_handle_arch_irq from __irq_svc+0x88/0xb0
    Exception stack(0xc1b01f20 to 0xc1b01f68)
    1f20: 0005c0d4 00000001 00000000 00000000 c1b09780 c1d6b32c c1b04e54 c1a5eae8
    1f40: c1b04e90 00000000 00000000 00000000 c1d6a8a0 c1b01f70 c11d2da8 c11d4160
    1f60: 60000013 ffffffff
    __irq_svc from default_idle_call+0x1c/0xb0
    default_idle_call from do_idle+0x21c/0x284
    do_idle from cpu_startup_entry+0x28/0x2c
    cpu_startup_entry from kernel_init+0x0/0x12c
    handlers:
    [<f539e0f4>] dwc2_handle_common_intr
    [<75cd278b>] usb_hcd_irq
    Disabling IRQ raspberrypi#66
    
    So enable the HCD_FLAG_HW_ACCESSIBLE flag in case there is a port
    connection.
    
    Fixes: c74c26f ("usb: dwc2: Fix partial power down exiting by system resume")
    Link: https://lore.kernel.org/linux-usb/[email protected]/T/
    Link: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Stefan Wahren <[email protected]>
    lategoodbye authored and popcornmix committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    4a51c5d View commit details
    Browse the repository at this point in the history
  3. usb: dwc2: hcd: Fix GetPortStatus & SetPortFeature

    On Rasperry Pis without onboard USB hub the power cycle during
    power connect init only disable the port but never enabled it again:
    
      usb usb1-port1: attempt power cycle
    
    The port relevant part in dwc2_hcd_hub_control() is skipped in case
    port_connect_status = 0 under the assumption the core is or will be soon
    in device mode. But this assumption is wrong, because after ClearPortFeature
    USB_PORT_FEAT_POWER the port_connect_status will also be 0 and
    SetPortFeature (incl. USB_PORT_FEAT_POWER) will be a no-op.
    
    Fix the behavior of dwc2_hcd_hub_control() by replacing the
    port_connect_status check with dwc2_is_device_mode().
    
    Link: raspberrypi#6247
    Fixes: 7359d48 ("staging: HCD files for the DWC2 driver")
    Signed-off-by: Stefan Wahren <[email protected]>
    lategoodbye authored and popcornmix committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    5be8cbc View commit details
    Browse the repository at this point in the history
  4. usb: dwc2: Fix HCD port connection race

    On Raspberry Pis without onboard USB hub frequent device reconnects
    can trigger a interrupt storm after DWC2 entered host clock gating.
    This is caused by a race between _dwc2_hcd_suspend() and the port
    interrupt, which sets port_connect_status. The issue occurs if
    port_connect_status is still 1, but there is no connection anymore:
    
    usb 1-1: USB disconnect, device number 25
    dwc2 3f980000.usb: _dwc2_hcd_suspend: port_connect_status: 1
    dwc2 3f980000.usb: Entering host clock gating.
    Disabling IRQ raspberrypi#66
    irq 66: nobody cared (try booting with the "irqpoll" option)
    CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.12.0-gc1bb81b13202-dirty raspberrypi#322
    Hardware name: BCM2835
    Call trace:
     unwind_backtrace from show_stack+0x10/0x14
     show_stack from dump_stack_lvl+0x50/0x64
     dump_stack_lvl from __report_bad_irq+0x38/0xc0
     __report_bad_irq from note_interrupt+0x2ac/0x2f4
     note_interrupt from handle_irq_event+0x88/0x8c
     handle_irq_event from handle_level_irq+0xb4/0x1ac
     handle_level_irq from generic_handle_domain_irq+0x24/0x34
     generic_handle_domain_irq from bcm2836_chained_handle_irq+0x24/0x28
     bcm2836_chained_handle_irq from generic_handle_domain_irq+0x24/0x34
     generic_handle_domain_irq from generic_handle_arch_irq+0x34/0x44
     generic_handle_arch_irq from __irq_svc+0x88/0xb0
     Exception stack(0xc1d01f20 to 0xc1d01f68)
     1f20: 0004ef3c 00000001 00000000 00000000 c1d09780 c1f6bb5c c1d04e54 c1c60ca8
     1f40: c1d04e94 00000000 00000000 c1d092a8 c1f6af20 c1d01f70 c1211b98 c1212f40
     1f60: 60000013 ffffffff
     __irq_svc from default_idle_call+0x1c/0xb0
     default_idle_call from do_idle+0x21c/0x284
     do_idle from cpu_startup_entry+0x28/0x2c
     cpu_startup_entry from kernel_init+0x0/0x12c
    handlers:
     [<e3a25c00>] dwc2_handle_common_intr
     [<58bf98a3>] usb_hcd_irq
    Disabling IRQ raspberrypi#66
    
    So avoid this by reading the connection status directly.
    
    Fixes: 113f86d ("usb: dwc2: Update partial power down entering by system suspend")
    Signed-off-by: Stefan Wahren <[email protected]>
    lategoodbye authored and popcornmix committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    8daa905 View commit details
    Browse the repository at this point in the history