1. 08 2月, 2022 1 次提交
  2. 31 1月, 2022 1 次提交
  3. 26 1月, 2022 2 次提交
  4. 06 1月, 2022 1 次提交
  5. 03 1月, 2022 1 次提交
  6. 21 12月, 2021 1 次提交
  7. 13 12月, 2021 1 次提交
    • T
      usb: dwc3: gadget: Support Multi-Stream Transfer · 666f3de7
      Thinh Nguyen 提交于
      Synopsys introduced a new enhancement to DWC_usb32 called Multi-Stream
      Transfer (MST) to improve bulk streams performance for SuperSpeed and
      SuperSpeed Plus. This enhancement allows the controller to look ahead
      and process multiple bulk streams.
      
      Previously, to initiate a bulk stream transfer, the driver has to issue
      Start Transfer command and wait for the stream to complete before
      initiating a new stream. As a result, the controller does not process
      TRBs beyond a single stream. With the enhancement, as long as there are
      new requests, the dwc3 driver can keep preparing new TRBs and the
      controller can keep caching and processing them without waiting for the
      transfer completion.
      
      The programming flow is similar to regular bulk endpoint with a few
      additional rules:
      
      1) Chained TRBs of the same stream must have a matching stream ID
      2) The last TRB of a stream must have CHN=0
      3) All the TRBs with LST=0 must have CSP=1
      
      Depends on the application and usage, internal tests show significant
      performance improvement in UASP transfers with this enhancement.
      Signed-off-by: NThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Link: https://lore.kernel.org/r/cd9c7a8bf11f790983ac546222dd114893f16b3a.1638242424.git.Thinh.Nguyen@synopsys.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      666f3de7
  8. 10 12月, 2021 1 次提交
  9. 03 12月, 2021 3 次提交
  10. 17 11月, 2021 6 次提交
  11. 22 10月, 2021 2 次提交
    • J
      usb: dwc3: Align DWC3_EP_* flag macros · d1a46837
      Jack Pham 提交于
      Fix the DWC3_EP_* flag macros so that the definitions are all
      lined up on the same tab column for consistent style.
      
      No functional change.
      Signed-off-by: NJack Pham <jackp@codeaurora.org>
      Link: https://lore.kernel.org/r/20211021180129.27938-2-jackp@codeaurora.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1a46837
    • J
      usb: dwc3: gadget: Skip resizing EP's TX FIFO if already resized · 876a75cb
      Jack Pham 提交于
      Some functions may dynamically enable and disable their endpoints
      regularly throughout their operation, particularly when Set Interface
      is employed to switch between Alternate Settings.  For instance the
      UAC2 function has its respective endpoints for playback & capture
      associated with AltSetting 1, in which case those endpoints would not
      get enabled until the host activates the AltSetting.  And they
      conversely become disabled when the interfaces' AltSetting 0 is
      chosen.
      
      With the DWC3 FIFO resizing algorithm recently added, every
      usb_ep_enable() call results in a call to resize that EP's TXFIFO,
      but if the same endpoint is enabled again and again, this incorrectly
      leads to FIFO RAM allocation exhaustion as the mechanism did not
      account for the possibility that endpoints can be re-enabled many
      times.
      
      Example log splat:
      
      	dwc3 a600000.dwc3: Fifosize(3717) > RAM size(3462) ep3in depth:217973127
      	configfs-gadget gadget: u_audio_start_capture:521 Error!
      	dwc3 a600000.dwc3: request 000000000be13e18 was not queued to ep3in
      
      Add another bit DWC3_EP_TXFIFO_RESIZED to dep->flags to keep track of
      whether an EP had already been resized in the current configuration.
      If so, bail out of dwc3_gadget_resize_tx_fifos() to avoid the
      calculation error resulting from accumulating the EP's FIFO depth
      repeatedly.  This flag is retained across multiple ep_disable() and
      ep_enable() calls and is cleared when GTXFIFOSIZn is reset in
      dwc3_gadget_clear_tx_fifos() upon receiving the next Set Config.
      
      Fixes: 9f607a30 ("usb: dwc3: Resize TX FIFOs to meet EP bursting requirements")
      Reviewed-by: NThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Signed-off-by: NJack Pham <jackp@codeaurora.org>
      Link: https://lore.kernel.org/r/20211021180129.27938-1-jackp@codeaurora.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      876a75cb
  12. 21 10月, 2021 1 次提交
  13. 05 10月, 2021 2 次提交
  14. 21 9月, 2021 1 次提交
  15. 14 9月, 2021 2 次提交
  16. 26 8月, 2021 4 次提交
  17. 18 8月, 2021 1 次提交
  18. 13 8月, 2021 2 次提交
  19. 10 8月, 2021 1 次提交
  20. 05 8月, 2021 2 次提交
    • W
      usb: dwc3: gadget: Avoid runtime resume if disabling pullup · cb10f68a
      Wesley Cheng 提交于
      If the device is already in the runtime suspended state, any call to
      the pullup routine will issue a runtime resume on the DWC3 core
      device.  If the USB gadget is disabling the pullup, then avoid having
      to issue a runtime resume, as DWC3 gadget has already been
      halted/stopped.
      
      This fixes an issue where the following condition occurs:
      
      usb_gadget_remove_driver()
      -->usb_gadget_disconnect()
       -->dwc3_gadget_pullup(0)
        -->pm_runtime_get_sync() -> ret = 0
        -->pm_runtime_put() [async]
      -->usb_gadget_udc_stop()
       -->dwc3_gadget_stop()
        -->dwc->gadget_driver = NULL
      ...
      
      dwc3_suspend_common()
      -->dwc3_gadget_suspend()
       -->DWC3 halt/stop routine skipped, driver_data == NULL
      
      This leads to a situation where the DWC3 gadget is not properly
      stopped, as the runtime resume would have re-enabled EP0 and event
      interrupts, and since we avoided the DWC3 gadget suspend, these
      resources were never disabled.
      
      Fixes: 77adb8bd ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded")
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NFelipe Balbi <balbi@kernel.org>
      Signed-off-by: NWesley Cheng <wcheng@codeaurora.org>
      Link: https://lore.kernel.org/r/1628058245-30692-1-git-send-email-wcheng@codeaurora.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb10f68a
    • W
      usb: dwc3: gadget: Use list_replace_init() before traversing lists · d25d8506
      Wesley Cheng 提交于
      The list_for_each_entry_safe() macro saves the current item (n) and
      the item after (n+1), so that n can be safely removed without
      corrupting the list.  However, when traversing the list and removing
      items using gadget giveback, the DWC3 lock is briefly released,
      allowing other routines to execute.  There is a situation where, while
      items are being removed from the cancelled_list using
      dwc3_gadget_ep_cleanup_cancelled_requests(), the pullup disable
      routine is running in parallel (due to UDC unbind).  As the cleanup
      routine removes n, and the pullup disable removes n+1, once the
      cleanup retakes the DWC3 lock, it references a request who was already
      removed/handled.  With list debug enabled, this leads to a panic.
      Ensure all instances of the macro are replaced where gadget giveback
      is used.
      
      Example call stack:
      
      Thread#1:
      __dwc3_gadget_ep_set_halt() - CLEAR HALT
        -> dwc3_gadget_ep_cleanup_cancelled_requests()
          ->list_for_each_entry_safe()
          ->dwc3_gadget_giveback(n)
            ->dwc3_gadget_del_and_unmap_request()- n deleted[cancelled_list]
            ->spin_unlock
            ->Thread#2 executes
            ...
          ->dwc3_gadget_giveback(n+1)
            ->Already removed!
      
      Thread#2:
      dwc3_gadget_pullup()
        ->waiting for dwc3 spin_lock
        ...
        ->Thread#1 released lock
        ->dwc3_stop_active_transfers()
          ->dwc3_remove_requests()
            ->fetches n+1 item from cancelled_list (n removed by Thread#1)
            ->dwc3_gadget_giveback()
              ->dwc3_gadget_del_and_unmap_request()- n+1
      deleted[cancelled_list]
              ->spin_unlock
      
      Fix this condition by utilizing list_replace_init(), and traversing
      through a local copy of the current elements in the endpoint lists.
      This will also set the parent list as empty, so if another thread is
      also looping through the list, it will be empty on the next iteration.
      
      Fixes: d4f1afe5 ("usb: dwc3: gadget: move requests to cancelled_list")
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NFelipe Balbi <balbi@kernel.org>
      Signed-off-by: NWesley Cheng <wcheng@codeaurora.org>
      Link: https://lore.kernel.org/r/1627543994-20327-1-git-send-email-wcheng@codeaurora.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d25d8506
  21. 29 7月, 2021 1 次提交
  22. 27 7月, 2021 2 次提交
  23. 21 7月, 2021 1 次提交