1. 04 Jan, 2024 3 commits
    • Uttkarsh Aggarwal's avatar
      usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart · e9d40b21
      Uttkarsh Aggarwal authored
      Current implementation blocks the running operations when Plug-out and
      Plug-In is performed continuously, process gets stuck in
      dwc3_thread_interrupt().
      
      Code Flow:
      
      	CPU1
      
      	->Gadget_start
      	->dwc3_interrupt
      	->dwc3_thread_interrupt
      	->dwc3_process_event_buf
      	->dwc3_process_event_entry
      	->dwc3_endpoint_interrupt
      	->dwc3_ep0_interrupt
      	->dwc3_ep0_inspect_setup
      	->dwc3_ep0_stall_and_restart
      
      By this time if pending_list is not empty, it will get the next request
      on the given list and calls dwc3_gadget_giveback which will unmap request
      and call its complete() callback to notify upper layers that it has
      completed. Currently dwc3_gadget_giveback status is set to -ECONNRESET,
      whereas it should be -ESHUTDOWN based on condition if not dwc->connected
      is true.
      
      Cc:  <stable@vger.kernel.org>
      Fixes: d742220b ("usb: dwc3: ep0: giveback requests on stall_and_restart")
      Signed-off-by: default avatarUttkarsh Aggarwal <quic_uaggarwa@quicinc.com>
      Link: https://lore.kernel.org/r/20231222094704.20276-1-quic_uaggarwa@quicinc.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9d40b21
    • Kevin Hao's avatar
      usb: ueagle-atm: Use wait_event_freezable_timeout() in uea_wait() · 738ec5ab
      Kevin Hao authored
      A freezable kernel thread can enter frozen state during freezing by
      either calling try_to_freeze() or using wait_event_freezable() and its
      variants. So for the following snippet of code in a kernel thread loop:
        wait_event_interruptible_timeout();
        try_to_freeze();
      
      We can change it to a simple wait_event_freezable_timeout() and
      then eliminate a function call.
      Signed-off-by: default avatarKevin Hao <haokexin@gmail.com>
      Link: https://lore.kernel.org/r/20231218074730.1898699-1-haokexin@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      738ec5ab
    • Wesley Cheng's avatar
      usb: dwc3: gadget: Handle EP0 request dequeuing properly · 730e12fb
      Wesley Cheng authored
      Current EP0 dequeue path will share the same as other EPs.  However, there
      are some special considerations that need to be made for EP0 transfers:
      
        - EP0 transfers never transition into the started_list
        - EP0 only has one active request at a time
      
      In case there is a vendor specific control message for a function over USB
      FFS, then there is no guarantee on the timeline which the DATA/STATUS stage
      is responded to.  While this occurs, any attempt to end transfers on
      non-control EPs will end up having the DWC3_EP_DELAY_STOP flag set, and
      defer issuing of the end transfer command.  If the USB FFS application
      decides to timeout the control transfer, or if USB FFS AIO path exits, the
      USB FFS driver will issue a call to usb_ep_dequeue() for the ep0 request.
      
      In case of the AIO exit path, the AIO FS blocks until all pending USB
      requests utilizing the AIO path is completed.  However, since the dequeue
      of ep0 req does not happen properly, all non-control EPs with the
      DWC3_EP_DELAY_STOP flag set will not be handled, and the AIO exit path will
      be stuck waiting for the USB FFS data endpoints to receive a completion
      callback.
      
      Fix is to utilize dwc3_ep0_reset_state() in the dequeue API to ensure EP0
      is brought back to the SETUP state, and ensures that any deferred end
      transfer commands are handled.  This also will end any active transfers
      on EP0, compared to the previous implementation which directly called
      giveback only.
      
      Fixes: fcd2def6 ("usb: dwc3: gadget: Refactor dwc3_gadget_ep_dequeue")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarWesley Cheng <quic_wcheng@quicinc.com>
      Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Link: https://lore.kernel.org/r/20231206201814.32664-1-quic_wcheng@quicinc.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      730e12fb
  2. 02 Jan, 2024 11 commits
  3. 23 Dec, 2023 1 commit
  4. 22 Dec, 2023 2 commits
  5. 20 Dec, 2023 1 commit
  6. 15 Dec, 2023 22 commits