[PATCH AUTOSEL 5.6 046/606] dwc3: Remove check for HWO flag in dwc3_gadget_ep_reclaim_trb_sg()

From: Sasha Levin
Date: Mon Jun 08 2020 - 20:40:27 EST


From: John Stultz <john.stultz@xxxxxxxxxx>

commit 00e21763f2c8cab21b7befa52996d1b18bde5c42 upstream.

The check for the HWO flag in dwc3_gadget_ep_reclaim_trb_sg()
causes us to break out of the loop before we call
dwc3_gadget_ep_reclaim_completed_trb(), which is what likely
should be clearing the HWO flag.

This can cause odd behavior where we never reclaim all the trbs
in the sg list, so we never call giveback on a usb req, and that
will causes transfer stalls.

This effectively resovles the adb stalls seen on HiKey960
after userland changes started only using AIO in adbd.

Cc: YongQin Liu <yongqin.liu@xxxxxxxxxx>
Cc: Anurag Kumar Vulisha <anurag.kumar.vulisha@xxxxxxxxxx>
Cc: Yang Fei <fei.yang@xxxxxxxxx>
Cc: Thinh Nguyen <thinhn@xxxxxxxxxxxx>
Cc: Tejas Joglekar <tejas.joglekar@xxxxxxxxxxxx>
Cc: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxxxx>
Cc: Jack Pham <jackp@xxxxxxxxxxxxxx>
Cc: Josh Gao <jmgao@xxxxxxxxxx>
Cc: Todd Kjos <tkjos@xxxxxxxxxx>
Cc: Felipe Balbi <balbi@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: linux-usb@xxxxxxxxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx #4.20+
Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
Signed-off-by: Felipe Balbi <balbi@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/usb/dwc3/gadget.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index bc1cf6d0412a..7e9643d25b14 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2483,9 +2483,6 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep,
for_each_sg(sg, s, pending, i) {
trb = &dep->trb_pool[dep->trb_dequeue];

- if (trb->ctrl & DWC3_TRB_CTRL_HWO)
- break;
-
req->sg = sg_next(s);
req->num_pending_sgs--;

--
2.25.1