fix(dwc2): defer EP0 buffer advance until DMA completion#3772
Open
tore-espressif wants to merge 1 commit into
Open
fix(dwc2): defer EP0 buffer advance until DMA completion#3772tore-espressif wants to merge 1 commit into
tore-espressif wants to merge 1 commit into
Conversation
edpt_schedule_packets() advanced xfer->buffer when scheduling EP0 IN DMA, and EP0 OUT completion invalidated cache at that already-advanced pointer. Short control OUT transfers (e.g. 7 bytes) then skipped the start of the buffer and broke class drivers. Track scheduled EP0 packet size in ep0_xact_bytes[]. Invalidate and advance the buffer only on transfer complete, then schedule the next EP0 chunk. EP0 IN advances by ep0_xact_bytes before rescheduling. Bug introduced in hathach#3295
Owner
|
Yeah I fixed this exact bug while doing usbtest, which I have been trying to get it merge for the last few days. |
Hardware-in-the-loop (HIL) Test Reporthfp.json✅ 39 passed · ❌ 13 failed · ⚪ 0 skipped · blank not run
tinyusb.json✅ 333 passed · ❌ 6 failed · ⚪ 11 skipped · blank not run
|
|
| target | .text | .rodata | .data | .bss | total | % diff |
|---|---|---|---|---|---|---|
| raspberrypi_zero/dynamic_configuration | 61,420 → 61,448 (+28) | 939 → 5,007 (+4,068) | — | — | 62,359 → 66,455 (+4,096) | +6.6% |
| xmc4500_relax/hid_composite | — | — | — | 740 → 748 (+8) | 796 → 804 (+8) | +1.0% |
| xmc4500_relax/hid_generic_inout | — | — | — | 876 → 884 (+8) | 932 → 940 (+8) | +0.9% |
| xmc4500_relax/webusb_serial | — | — | — | 1,044 → 1,052 (+8) | 1,100 → 1,108 (+8) | +0.7% |
| xmc4500_relax/dfu_runtime | 12,048 → 12,112 (+64) | — | — | — | 24,148 → 24,276 (+128) | +0.5% |
| xmc4500_relax/audio_test_multi_rate | 15,296 → 15,360 (+64) | — | — | 2,608 → 2,616 (+8) | 33,348 → 33,484 (+136) | +0.4% |
| xmc4500_relax/video_capture_2ch | 16,924 → 16,988 (+64) | — | — | — | 38,040 → 38,168 (+128) | +0.3% |
| xmc4500_relax/msc_dual_lun | 14,916 → 14,980 (+64) | — | — | — | 46,268 → 46,396 (+128) | +0.3% |
| xmc4500_relax/midi2_device | — | — | — | 1,240 → 1,248 (+8) | 3,036 → 3,044 (+8) | +0.3% |
| xmc4500_relax/cdc_msc | 17,420 → 17,484 (+64) | — | — | 1,448 → 1,456 (+8) | 52,788 → 52,924 (+136) | +0.3% |
Owner
|
it is detected when doing usbtest suite 59f02a1 |
Owner
|
this should be fixed with #3758, please check if current master work for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
edpt_schedule_packets() advanced
xfer->bufferwhen scheduling EP0 IN DMA, and EP0 OUT completion invalidated cache at that already-advanced pointer. Short control OUT transfers (e.g. 7 bytes) then skipped the start of the buffer and broke class drivers.Track scheduled EP0 packet size in
ep0_xact_bytes[]. Invalidate and advance the buffer only on transfer complete, then schedule the next EP0 chunk. EP0 IN advances byep0_xact_bytesbefore rescheduling.Fixes #3295