1. 17 7月, 2017 1 次提交
    • J
      usb: dwc3: gadget: only unmap requests from DMA if mapped · 4a71fcb8
      Jack Pham 提交于
      A recent optimization was made so that a request put on the
      pending_list wouldn't get mapped for DMA until just before
      preparing a TRB for it. However, this poses a problem in case
      the request is dequeued or the endpoint is disabled before the
      mapping is done as that would lead to dwc3_gadget_giveback()
      unconditionally calling usb_gadget_unmap_request_for_dev() with
      an invalid request->dma handle. Depending on the platform's DMA
      implementation the unmap operation could result in a panic.
      
      Since we know a successful mapping is a prerequisite for getting
      a TRB, the unmap can be conditionally called only when req->trb
      is non-NULL.
      
      Fixes: cdb55b39 ("usb: dwc3: gadget: lazily map requests for DMA")
      Signed-off-by: NJack Pham <jackp@codeaurora.org>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      4a71fcb8
  2. 13 6月, 2017 2 次提交
  3. 02 6月, 2017 3 次提交
  4. 17 5月, 2017 2 次提交
  5. 16 5月, 2017 2 次提交
    • T
      usb: dwc3: gadget: Prevent losing events in event cache · d325a1de
      Thinh Nguyen 提交于
      The dwc3 driver can overwite its previous events if its top-half IRQ
      handler (TH) gets invoked again before processing the events in the
      cache. We see this as a hang in the file transfer and the host will
      attempt to reset the device. TH gets the event count and deasserts the
      interrupt line by writing DWC3_GEVNTSIZ_INTMASK to DWC3_GEVNTSIZ. If
      there's a new event coming between reading the event count and interrupt
      deassertion, dwc3 will lose previous pending events. More generally, we
      will see 0 event count, which should not affect anything.
      
      This shouldn't be possible in the current dwc3 implementation. However,
      through testing and reading the PCIe trace, the TH occasionally still
      gets invoked one more time after HW interrupt deassertion. (With PCIe
      legacy interrupts, TH is called repeatedly as long as the interrupt line
      is asserted). We suspect that there is a small detection delay in the
      SW.
      
      To avoid this issue, Check DWC3_EVENT_PENDING flag to determine if the
      events are processed in the bottom-half IRQ handler. If not, return
      IRQ_HANDLED and don't process new event.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      d325a1de
    • R
      usb: dwc3: gadget: Fix ISO transfer performance · f1d6826c
      Roger Quadros 提交于
      Commit 08a36b54 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()")
      caused a small change in the way ISO transfer is handled in the case
      when XferInProgress event happens on Isoc EP with an active transfer.
      This caused a performance degradation of 50%. e.g. using g_webcam on DUT
      and luvcview on host the video frame rate dropped from 16fps to 8fps
      @high-speed.
      
      Make the ISO transfer handling equivalent to that prior to that commit
      to get back the original ISO performance numbers.
      
      Fixes: 08a36b54 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()")
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      f1d6826c
  6. 11 4月, 2017 6 次提交
  7. 22 3月, 2017 1 次提交
  8. 08 3月, 2017 1 次提交
  9. 06 3月, 2017 2 次提交
    • R
      usb: dwc3: gadget: Fix system suspend/resume on TI platforms · 1551e35e
      Roger Quadros 提交于
      On TI platforms (dra7, am437x), the DWC3_DSTS_DEVCTRLHLT bit is not set
      after the device controller is stopped via DWC3_DCTL_RUN_STOP.
      
      If we don't disconnect and stop the gadget, it stops working after a
      system resume with the trace below.
      
      There is no point in preventing gadget disconnect and gadget stop during
      system suspend/resume as we're going to suspend in any case, whether
      DEVCTRLHLT timed out or not.
      
      [  141.727480] ------------[ cut here ]------------
      [  141.732349] WARNING: CPU: 1 PID: 2135 at drivers/usb/dwc3/gadget.c:2384 dwc3_stop_active_transfer.constprop.4+0xc4/0xe4 [dwc3]
      [  141.744299] Modules linked in: usb_f_ss_lb g_zero libcomposite xhci_plat_hcd xhci_hcd usbcore dwc3 evdev udc_core m25p80 usb_common spi_nor snd_soc_davinci_mcasp snd_soc_simple_card snd_soc_edma snd_soc_tlv3e
      [  141.792163] CPU: 1 PID: 2135 Comm: irq/456-dwc3 Not tainted 4.10.0-rc8 #1138
      [  141.799547] Hardware name: Generic DRA74X (Flattened Device Tree)
      [  141.805940] [<c01101b4>] (unwind_backtrace) from [<c010c31c>] (show_stack+0x10/0x14)
      [  141.814066] [<c010c31c>] (show_stack) from [<c04a0918>] (dump_stack+0xac/0xe0)
      [  141.821648] [<c04a0918>] (dump_stack) from [<c013708c>] (__warn+0xd8/0x104)
      [  141.828955] [<c013708c>] (__warn) from [<c0137164>] (warn_slowpath_null+0x20/0x28)
      [  141.836902] [<c0137164>] (warn_slowpath_null) from [<bf27784c>] (dwc3_stop_active_transfer.constprop.4+0xc4/0xe4 [dwc3])
      [  141.848329] [<bf27784c>] (dwc3_stop_active_transfer.constprop.4 [dwc3]) from [<bf27ab14>] (__dwc3_gadget_ep_disable+0x64/0x528 [dwc3])
      [  141.861034] [<bf27ab14>] (__dwc3_gadget_ep_disable [dwc3]) from [<bf27c27c>] (dwc3_gadget_ep_disable+0x3c/0xc8 [dwc3])
      [  141.872280] [<bf27c27c>] (dwc3_gadget_ep_disable [dwc3]) from [<bf23b428>] (usb_ep_disable+0x11c/0x18c [udc_core])
      [  141.883160] [<bf23b428>] (usb_ep_disable [udc_core]) from [<bf342774>] (disable_ep+0x18/0x54 [usb_f_ss_lb])
      [  141.893408] [<bf342774>] (disable_ep [usb_f_ss_lb]) from [<bf3437b0>] (disable_endpoints+0x18/0x50 [usb_f_ss_lb])
      [  141.904168] [<bf3437b0>] (disable_endpoints [usb_f_ss_lb]) from [<bf343814>] (disable_source_sink+0x2c/0x34 [usb_f_ss_lb])
      [  141.915771] [<bf343814>] (disable_source_sink [usb_f_ss_lb]) from [<bf329a9c>] (reset_config+0x48/0x7c [libcomposite])
      [  141.927012] [<bf329a9c>] (reset_config [libcomposite]) from [<bf329afc>] (composite_disconnect+0x2c/0x54 [libcomposite])
      [  141.938444] [<bf329afc>] (composite_disconnect [libcomposite]) from [<bf23d7dc>] (usb_gadget_udc_reset+0x10/0x34 [udc_core])
      [  141.950237] [<bf23d7dc>] (usb_gadget_udc_reset [udc_core]) from [<bf276d70>] (dwc3_gadget_reset_interrupt+0x64/0x698 [dwc3])
      [  141.962022] [<bf276d70>] (dwc3_gadget_reset_interrupt [dwc3]) from [<bf27952c>] (dwc3_thread_interrupt+0x618/0x1a3c [dwc3])
      [  141.973723] [<bf27952c>] (dwc3_thread_interrupt [dwc3]) from [<c01a7ce8>] (irq_thread_fn+0x1c/0x54)
      [  141.983215] [<c01a7ce8>] (irq_thread_fn) from [<c01a7fbc>] (irq_thread+0x120/0x1f0)
      [  141.991247] [<c01a7fbc>] (irq_thread) from [<c015ba14>] (kthread+0xf8/0x138)
      [  141.998641] [<c015ba14>] (kthread) from [<c01078f0>] (ret_from_fork+0x14/0x24)
      [  142.006213] ---[ end trace b4ecfe9f175b9a9c ]---
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      1551e35e
    • F
      usb: dwc3: gadget: properly increment dequeue pointer on ep_dequeue · cf3113d8
      Felipe Balbi 提交于
      If request was already started, this means we had to
      stop the transfer. With that we also need to ignore
      all TRBs used by the request, however TRBs can only
      be modified after completion of END_TRANSFER
      command. So what we have to do here is wait for
      END_TRANSFER completion and only after that jump
      over TRBs by clearing HWO and incrementing dequeue
      pointer.
      
      Note that we have 2 possible types of transfers
      here:
      
      i) Linear buffer request
      ii) SG-list based request
      
      SG-list based requests will have r->num_pending_sgs
      set to a valid number (> 0). Linear requests,
      normally use a single TRB.
      
      For each of these two cases, if r->unaligned flag is
      set, one extra TRB has been used to align transfer
      size to wMaxPacketSize.
      
      All of these cases need to be taken into
      consideration so we don't mess up our TRB ring
      pointers.
      Tested-by: NJanusz Dziedzic <januszx.dziedzic@intel.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      cf3113d8
  10. 25 1月, 2017 1 次提交
  11. 24 1月, 2017 5 次提交
  12. 03 1月, 2017 1 次提交
  13. 02 1月, 2017 2 次提交
  14. 14 12月, 2016 1 次提交
  15. 18 11月, 2016 10 次提交