Re: [PATCH v2 0/3] usb: dwc2: gadget: descriptor DMA fixes for BNA, found on Sophgo SG2002

From: Chen-Yu Yeh

Date: Thu Nov 26 2026 - 05:23:21 EST


Hi Vadim,

I tested v2 on a Milk-V Duo 256M (SG2002), on top of 65e4fd942f72
(v7.4-rc3-406), with "p->g_dma = false;" removed from
dwc2_set_cv1800_params() and dr_mode set to "peripheral" in the board
DTS. The params file in debugfs shows g_dma 1 and g_dma_desc 1. The
gadget is a configfs composite of ECM, mass storage (a 16 MiB file) and
UAC1 with req_number 8, on an x86 host with xHCI, high speed.

Three kernels: A without the series, B with patches 1 and 2, C with all
three. On each:

- iperf3 over ECM, 60 s in each direction
- dd of the whole LUN with O_DIRECT, one write and 20 reads
- sg_turs -n 200000 on the LUN, while the board copies a 32 MiB file
in tmpfs to /dev/null in a loop
- speaker-test playing a 440 Hz sine into UAC1 for 5 minutes. After
30 s the board writes a 120-character KERN_ERR line to /dev/kmsg
every 2 s, so each line goes out on the 115200 baud serial console,
about 10 ms like the hold in your test.

A B C
iperf3 in/out Mbit/s 138/94.9 149/97.9 142/95.9
dd write/read MB/s 6.6/18.8 5.8/23.6 8.9/23.5
sg_turs per second 3432 3279 3359
UAC1 runs wedged 3 of 4 0 of 2 0 of 1

iperf3 is host to board / board to host. No retransmits, no sg_turs
errors and no dd errors on any kernel.

On A, two runs wedged within about 45 s of playback with the console
lines: speaker-test failed with -EBADFD and the host reset the port.
The third went through the 5 minutes and wedged when playback stopped.
The SET_INTERFACE to alt 0 timed out on the host (-110), and at the
port reset the board logged

dwc2_hsotg_ep_stop_xfr: timeout GINTSTS.GOUTNAKEFF
dwc2_hsotg_ep_stop_xfr: timeout DOEPCTL.EPDisable

after which the host could not enumerate the device again. Rebinding the
UDC on the board failed; only a reboot recovered it. This looks like
what you describe for patch 1, EP0 not answering after the stall, but I
cannot show the BNA itself: on A it is dev_dbg and my config has no
CONFIG_DYNAMIC_DEBUG, so the link to BNA is from the symptoms only.

On B and C no run wedged. After the console lines, arecord on the board
captured the sine, and after playback stopped the gadget was still
configured with no port reset.

On C I also ran everything together for 30 minutes: the sine, the
console lines, the copy loop, iperf3 -R for 1800 s and sg_turs
9 x 200000. iperf3 moved 11.0 GB at 52.3 Mbit/s on average with no
retransmits, sg_turs had no errors, and
the host logged no reset. Afterwards arecord on the board still
captured the sine.

The "BNA, DxEPINT" warning from patch 2 did not appear on B or C, and A
showed no bulk errors either. My copy loop is much lighter than your
H.264 encode, so patches 2 and 3 ran here without being exercised; for
those this shows only that nothing regressed. The UAC1 counts are also
small, 4, 2 and 1 runs plus the 30 minutes.

Tested-by: Chen-Yu Yeh <chenyou910331@xxxxxxxxx> # Milk-V Duo 256M

Thanks,
Chen-Yu