linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix allowing of ep queuing while stopping transfers
@ 2021-03-19  9:31 Wesley Cheng
  2021-03-19  9:31 ` [PATCH 1/2] usb: dwc3: gadget: Avoid continuing preparing TRBs during teardown Wesley Cheng
  2021-03-19  9:31 ` [PATCH 2/2] usb: dwc3: gadget: Ignore EP queue requests during bus reset Wesley Cheng
  0 siblings, 2 replies; 9+ messages in thread
From: Wesley Cheng @ 2021-03-19  9:31 UTC (permalink / raw)
  To: balbi, gregkh; +Cc: linux-kernel, linux-usb, Wesley Cheng

commit f09ddcfcb8c5 ("usb: dwc3: gadget: Prevent EP queuing while stopping
transfers") addressed an issue where the DWC3 gadget was still allowing EP
queuing to occur while the pullup disable routine was executing.  This led to
a situation where the controller prepares a TRB, which will be unmapped by the
stop active transfer call.

In addition to the above, there are a few other places in the DWC3 gadget where
we need to block preparing of TRBs:

 1. While the DWC3 gadget cleans up completed TRBs (during
    dwc3_gadget_endpoint_trbs_complete()), DWC3 gadget giveback is utilized and
    will release the dwc->lock.  If a pullup disable call occurs while the
    cleanup is happening, then there is a chance dwc3_gadget_ep_should_continue
    will prepare a TRB, which will later on be unmapped by the stop active
    transfer in the pullup disable path.

 2. If we are in the CONFIGURED state and the host issues a bus RESET.  In this
    situation, the connected flag is still set to true while we stop active
    transfers, which can lead to the same initial problem.  Ideally, function
    drivers would stop any pending usb requests through dwc3_reset_gadget()
    using the EP disable call, but for some function drivers, this does not
    occur synchronously in their disable() callback.  These functions would rely
    on the stop active transfers in the reset handler to issue the endxfer cmd.

Wesley Cheng (2):
  usb: dwc3: gadget: Avoid continuing preparing TRBs during teardown
  usb: dwc3: gadget: Ignore EP queue requests during bus reset

 drivers/usb/dwc3/gadget.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-23 23:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19  9:31 [PATCH 0/2] Fix allowing of ep queuing while stopping transfers Wesley Cheng
2021-03-19  9:31 ` [PATCH 1/2] usb: dwc3: gadget: Avoid continuing preparing TRBs during teardown Wesley Cheng
2021-03-19  9:31 ` [PATCH 2/2] usb: dwc3: gadget: Ignore EP queue requests during bus reset Wesley Cheng
2021-03-20  0:40   ` Thinh Nguyen
2021-03-20  1:07     ` Wesley Cheng
2021-03-20  2:01       ` Thinh Nguyen
2021-03-20  2:14         ` Thinh Nguyen
2021-03-20  5:30         ` Wesley Cheng
2021-03-23 23:47           ` Thinh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).