audit 0.21.0: Microchip SAMD/SAMx7x follow-ups (SAMD ISO OUT bank overrun)

Aperta
#4,537 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c
Ambito
embedded-iot

Direzione di ricerca

This is a batch of three hardware-dependent defects, not one edit: start with item 3, the ISO OUT CRC overrun, reading samd/dcd_samd.c:210 and :257 against the 196-byte buffer traced through src/class/audio/audio_device.c:120 and :1213. Items 1 and 2 live in samx7x/dcd_samx7x.c:465, :567, :573 with src/common/tusb_mcu.h:817. Done means bank-boundary canary tests plus ISO OUT runs on metro_m4_express, a SAMD21 board and same70_xplained; the adjudication notes list the datasheet lookups still pending.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

follow-up Prio 📌

Deferred defects found in the repository audit of 0.21.0..ad7c83db8 (batch port-microchip). Each was validated against the source at ad7c83db8 and judged real but too large, or too hardware-dependent, for the audit PR's contained fixes.

1. FIFO submission bypasses the deferred-ZLP path. A concrete candidate is DMA-backed IN completion followed by FIFO-backed ZLP on the same endpoint while its bank remains occupied.
  • Where: samx7x/dcd_samx7x.c:567, :573
  • Verdict: valid uncovered code path; hardware consequence still pending; introduced: Older; range fixes only buffer API; severity: medium
  • Hardware/spec dependence: Yes; USBHS sequencing partially checked, full busy-bank claim pending
  • Overlap: #3512 concerns OUT ZLP reception, not full coverage
  • Remaining work and verification: Share the verified ZLP-start sequence after reproducing DMA→FIFO submission on same70_xplained. The cited audio trigger is blocked by C-F6; ordinary FIFO-only completion does not establish a busy-bank trigger.
2. ISO_ALLOC is selected, but both SAMX7X ISO hooks return false. Audio allocation therefore fails; video/vendor ISO also encounter these hooks.
  • Where: samx7x/dcd_samx7x.c:465; src/common/tusb_mcu.h:817
  • Verdict: valid; introduced: Older; confirmed at 0.21.0; severity: medium
  • Hardware/spec dependence: Failure established entirely from code; implementing support needs hardware documentation
  • Overlap: No full coverage; #3512 contains related lifecycle discussion only
  • Remaining work and verification: Implement allocation/activation and transfer retirement as a separate port task. Build and exercise ISO audio/video plus alternate-setting transitions on same70_xplained; no SAMX7X board appears in the checked farm roster.
3. ISO OUT now accepts a 196-byte audio buffer while selecting a 256-byte bank; successful 196-byte reception stores two CRC bytes past the object.
  • Where: samd/dcd_samd.c:210, :257; src/class/audio/audio_device.c:120, :1213
  • Verdict: valid; introduced: Yes, newly reachable through ISO hooks; underlying direct-buffer behavior older; severity: high
  • Hardware/spec dependence: Yes; CRC behavior verified by lookups below. Complete remedy not verified
  • Overlap: No matching open issue/PR found
  • Remaining work and verification: Provide controller-safe receive storage, covering all ISO callers rather than only this example. Test lengths around bank boundaries with canaries, then ISO OUT on metro_m4_express and a SAMD21 board. Build-only cannot verify DMA bounds.
Adjudication notes: port-microchip

Claims still needing read-doc:

  • S-F01/S-F02: For each supported host-capable SAMD/SAML variant, confirm PCKSIZE encoding, supported packet limits, and PCFG.PTYPE mapping against datasheet and errata. Arithmetic is established; complete variant coverage is pending.
  • C-F2/C-F3/C-F10 and any S-F03 extraction: What sequence safely retires a bank already being accessed, suppresses pending TRCPT, and disables an endpoint while preserving EP0 SETUP handling? Check SAMD11, D21/DA1, L21, L22, D51/E5x. For C-F10 also check configuration-change requirements; do not infer them from repeated same-configuration behavior.
  • S-F07/C-F1: Confirm DMA completion versus bank availability, the effect of FIFOCONC on an occupied bank, and the required TXINI acknowledgement/forcing sequence for single and multiple banks. Book 6165 §38.6.2.12 supports clear-TXINI-before-FIFOCON ordering; it does not complete this claim.
  • X-P1 remedy: Confirm safe MULTI_PACKET_SIZE, storage capacity, and completion handling for the proposed staging/padding solution. Datasheets additionally require MULTI_PACKET_SIZE to be a multiple of the bank size; merely adding two bytes must not be assumed sufficient.
  • Dropped alternatives, only if revived: S-F08’s direct ZLP submission, S-F10’s batched NVIC writes/barriers, and C-F5’s behavior under hardware STALL still lack verified claim records.

Document evidence obtained during this adjudication:

  • CRC claim verified: D21/DA1 DS40001882L, book 6173, §32.6.2.7 p734, lookup f90b5ecc7fd8; D5x/E5x DS60001507K, book 1951, §38.6.2.7 p1013, be2695561c24; D11 Atmel-42363H, book 6143, §30.6.2.7 PDF p723, 71d1e8938641; L21 DS60001477E, book 6102, §39.6.2.7 p849, 8ca7fea253d5; L22 DS60001465D, book 6109, §38.6.2.7 p850, 34daae28761f. Each states that both CRC bytes enter the receive buffer when payload is at least two bytes below the bank size.
  • Checked corresponding errata through books 6087, 6096, 6098, 6095, 6101; no USB CRC-write exception surfaced. Relevant lookup IDs: 9f82d2baa2cc, d0a7f0d14378, 3980c530a451, c8959e52db42, ad0bddf7f074, 0dc8a094f7f9.
  • USBHS sequencing partially verified: SAME70/S70/V70/V71 DS60001527J, book 6165, §38.6.2.12 pp760–761, 7d39858d8a1d; errata DS80000767M, book 6073, §2.20 pp20–21, 4eb1f496c589. Full busy-bank and proposed-fix verification remains pending.

No additional independently established defect was found in the batch’s changed code. No builds, unit tests, compiler buffer-size check, or hardware runs were performed here; the CRC buffer size was independently traced through the macros and calculated as 196 bytes. Hardware-dependent fixes are not cleared for application.

Lingua principale
C
Stelle
7.3k
Fork
1.6k
Merge medio
1g 19h
PR unite (30g)
67

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hathach/tinyusb

Tutte le issue di hathach/tinyusb

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.