Repository navigation
usb: schedule the T8140 proxy carrier with a delay it accepts - #460
Conversation
usb_init() on the T8140 schedules the deferred CDC carrier transition for a stage that is about to run the proxy, with a delay of 0. usb_cdc_state_schedule() takes 1 to 15 s and refuses anything else, so the schedule always failed: the proxy got no CDC carrier, and usb_cdc_schedule() never armed the CDC watchdog that resets a proxy no host opens. A stage with no watchdog of its own (any Stage 2, or a Stage 1 without the boot watchdog) then stays in the proxy until someone holds the power button. Schedule it with the shortest delay the state machine accepts, as the Stage 1 window already does. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 1239eda. The diagnosis holds:
|
There was a problem hiding this comment.
Pre-PR checklist (§1–§6) review at 1239eda6f677:
Replacement of #438 & Technical Verification
- Clean replacement of closed
#438: Drops the unsignedgithub-actions[bot]gfyacommit (c9f0977d) and its revert (7e430174). This PR has a single clean, human-signed commit (1239eda6f677) on currentmain, and its diff onsrc/usb.candtests/python/test_t8140_proxy_transport.pyis byte-identical to#438's code change. (#438is already closed.) - Diagnosis holds:
usb_cdc_state_schedule()(src/usb_cdc_state.c:9) rejectsdelay_ms < 1000, sousb_cdc_schedule(0, 0, BIT(1) | BIT(2))always returned-1, skippingusb_cdc_arm_watchdog()(src/usb_cdc.c:81). Switching to1000matchesuartproxy_wait_stage1()(src/uartproxy.c:98).
Blockers before merge
- §5 Evidence — J700 hardware row still owed (also flagged in @RyanTheTide's review point 4): CI is 15/15 green with 836 host tests passing, but no J700 hardware run results have been posted yet. Because this changes T8140 proxy carrier, HPM cold-reset, and watchdog behavior on every proxy stop, please post the J700 run before merge:
- Host-less Stage 2 proxy-fallback run: no
usb: unable to schedule proxy transport, printsCDC Gen1 ready; awaiting host, and resets via the CDC watchdog after ~170 s back to the configured boot. - CDC host-attached run (if available): prints
CDC primary open; watchdog disabledand completes a proxy round-trip.
- Host-less Stage 2 proxy-fallback run: no
- Open review point from @RyanTheTide (point 1 — persistent failure loop): For an
aura-trytrial,src/main.c:276-281already reboots after 10 s beforeusb_init(). For a permanently failing configured Stage 2/Stage 1 proxy stop, however, the 170 s CDC watchdog resets into Stage 1 (which opens the recovery window viastage1_read_boot_record()and then retries the configured Stage 2), looping every ~171 s with an HPM cold reset each pass if no host attaches — matching Stage 1's existing boot watchdog retry behavior. Please confirm/document explicitly in response to Ryan's point 1 that this retry loop is the intended end state for a persistent configured-boot failure.
Checklist summary
- §1 (No model gating): Pass.
if (chip_id == T8140)is pre-existing and not added by this PR; agree with Ryan's follow-up suggestion to move the deferred-carrier gates onto an ADT PHY/port property. - §2 (Production-ready, no hacks): Pass.
1000is the state machine's minimum accepted delay rather than a race sleep; once#416lands, switch1000(and the test) toUSB_CDC_SCHEDULE_MIN_MS. - §3 (Safety): Pass (subject to confirming the persistent-failure loop behavior above).
- §4 (Clean-room & attribution): Pass. Commit
1239eda6has human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:only, with zero AI trailers; PR body includesAssisted-by:. - §5 (Evidence): Blocked — CI 15/15 green, J700 hardware row still owed.
- §6 (Naming): Pass.
Verdict: Request changes — code and commit hygiene are clean (fully fixing #438's §4 blocker), but merge is blocked on the J700 §5 hardware row and confirming Ryan's point 1.
|
On point 1 (persistent failure loop): yes, the loop is the intended end state. From the code at 1239eda:
The J700 row is still owed: the kit is staged (lab image = main + this diff + a lab-only "skip the 10 s trial reboot" switch that never ships). It needs a person within reach of the Neo's power button, since the Neo has no tether or remote reset. It runs in the daytime. |
|
Executed check at 1239eda, merged onto main dc2f7e9: the CI host-test set passes (869 passed, 25 skipped; main 866), and ESP Stage 2 builds and links with no new warnings. The built aura.elf calls usb_cdc_schedule from usb_init with w0=0x3e8 (1000), w1=0, w2=6. The new test file fails 1 of 3 on main's usb.c.
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 1239eda6f677: the code is ready; it needs only a row at this head.
Blockers: none in the code. Missing row: one J700 run at this head: a Stage 2 that reaches the proxy with no host prints CDC Gen1 ready; awaiting host, with no unable to schedule proxy transport, and the CDC watchdog resets back to the configured boot after about 170 s. If a host is at hand, also one attached run (CDC primary open; watchdog disabled and a proxy round-trip). The Neo lead will run it.
Checked: no Apple material. The chip_id == T8140 check was already there; this PR doesn't add it. The diagnosis holds: usb_cdc_state_schedule() refuses delay_ms < 1000 (usb_cdc_state.c:9), so the old usb_cdc_schedule(0, …) always failed and the watchdog was never armed. 1000 ms is the state machine's minimum and matches uartproxy_wait_stage1(). The built aura.elf passes 1000, and the retry loop on a permanently failing configured boot is the intended end state (your 11-22 note). One signed commit, no bot commits; CI 15/15 green. This replaces my earlier review.
Evidence
Read 1239eda6 (src/usb.c, the new test) and your two 11-22 checks. Follow-up: key the deferred-carrier selection on an ADT PHY or port property instead of the chip id.
Superseded by the review at 1239eda
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 1239eda6f677
Blockers: none
Checked: no Apple material, no new model/board gating, no hacks, no AI attribution, host test suite and build matrix green
Evidence
- Audited
src/usb.candtests/python/test_t8140_proxy_transport.py:usb_init()previously passed delay0tousb_cdc_schedule(), whichusb_cdc_state_schedule()rejects (valid range 1 to 15 s), leaving a host-less proxy with neither a CDC carrier nor the 170 s CDC watchdog (usb_cdc_arm_watchdog()only arms on a0return).- Switching the delay to
1000ms matches the shortest delay accepted byusb_cdc_state_schedule()and mirrors the Stage 1 window path; no new SoC gate is introduced (the existingT8140branch is unchanged). - The new host test exercises the real compiled
usb_cdc_state_schedule()/usb_cdc_state_due()C state machine against the arguments extracted fromsrc/usb.c, verifies the0control is rejected, and checks theusb_cdc_arm_watchdog()guard insrc/usb_cdc.c.
- All 15/15 CI checks are green on
1239eda6f677(build,gcc,clang-macos,fedora,alarm,nix, and all four Pytest platforms).
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
|
Supersedes #438: the same commit (0838346, unchanged), on current main, without the unsigned
gfyabot commit and its revert that #438 carried. Host suite 836 passed,format-checkclean, Stage 2 builds on this base.Problem
On the T8140, a stage that reaches the proxy with no host gets neither a USB carrier nor a watchdog.
usb_init()schedules the deferred CDC carrier transition with a delay of 0, butusb_cdc_state_schedule()only takes 1 to 15 s, so the call always fails and printsusb: unable to schedule proxy transport.usb_cdc_schedule()arms the CDC watchdog (170 s, cleared when a host opens the primary port) only after a schedule succeeds, so that watchdog never arms either.A Stage 2 arms no watchdog of its own, and neither does a Stage 1 built before the boot watchdog. Either one stays in that proxy until someone holds the power button. Our A18 Pro MacBook was left showing aura's proxy text for about 6 hours on 11-21, after a trial Stage 2 failed. This path fits what we saw: the boot after the failed trial reached the proxy and never reset. It is not proven, since no log of that boot survived.
Change
Schedule the transition with 1000 ms, the shortest delay the state machine accepts. That is the same call the Stage 1 window makes on this SoC. A host-less proxy then gets its CDC carrier, and is reset by the CDC watchdog if no host opens it within 170 s.
Testing
tests/python/test_t8140_proxy_transport.pyruns the realusb_cdc_state_schedule()on the arguments it reads out ofusb_init():usb_cdc_schedule()still arms the watchdog only after an accepted schedule.format-checkpasses with clang-format 20.1.8. Stage 2 (RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1) builds.Still to run
CDC Gen1 ready; awaiting host, then a reset about 170 s later, back to the configured boot. Our J700 has no remote reset, so this needs someone at the Mac, or a J700 with a CDC host attached, where the primary opening should instead clear the watchdog (CDC primary open; watchdog disabled).Details for reviewers
src/usb.cis built into Stage 1 too. In Stage 1 this only matters for its final proxy, and only once a Stage 1 with it is enrolled. A Stage 2 with it works under any enrolled Stage 1.BIT(1) | BIT(2), unchanged), as the Stage 1 window does. This only happens on the way into a proxy stop, never on a boot that hands off to an OS.wdt_arm()restarts the counter, so the CDC watchdog replaces a running boot watchdog with a fresh 170 s one.USB_CDC_SCHEDULE_MIN_MS/_MAX_MStousb_cdc_state.hand moves the Stage 1 window's call to it, but doesn't touch this call. Whichever of the two lands second switches this1000to the constant. The test then asserts against the constant instead of the literal.