Repository navigation
usb: typec: tipd: J575c: renegotiate every inherited connection - #2875
Conversation
|
Review at 17fa095. Thanks, the analysis of where the 0x04 came from is convincing, and dropping a heuristic on an undocumented status bit is the right direction. The change itself looks correct: J716c never set
Rows: the J575c rows cover the drive, HDMI, the DP monitor on typec1 and the hub. For no-regression it would help to have one J575c boot with a powered dock (with devices behind it) on a renegotiated port, and one with the boot or root disk on USB-C if that is a supported setup. Nothing else is affected: only the J575c and J716c DTs set the property, and the J716c path does not change. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist (§1–§6) review at 17fa0955233cdb014e76e31e82888bbc3f62b2ac (Host tests: success).
Verdict: REQUEST CHANGES — the root-cause analysis of register 0x7e byte 7 (0x08 at probe start vs 0x04 induced by the pre-5b5032b33af3 LDCM command) is convincing and removing the bogus heuristic leaves J716c untouched, but key §2/§3 probe-safety questions and §5 evidence items remain unanswered.
Blockers
- §3 Safety — live USB-C storage and runtime driver reprobe (
drivers/usb/typec/tipd/core.c:3623-3701):- With
check_attach_stateremoved, every connected host-role port carryingapple,reset-inherited-usb2-connectionnow unconditionally receivesDISCwith a 5 s VBUS/CC drop insidetps6598x_probe(). - Because
tipdis a loadable module (=m), please confirm and document in the commit message:- What happens at boot if an external root,
/boot, or fstab-mounted drive is on a renegotiated USB-C port whentipdprobes (is DWC3/xHCI guaranteed not to have mounted it yet via supplier ordering, or is a live disconnect possible?). - What happens on a runtime unbind/bind or
rmmod/modprobeoftps6598x? With no0x7egate and no boot-once guard, a runtime reprobe will now force a 5 s VBUS drop on every connected host-role port (including already-mounted drives and active DP monitors).
- What happens at boot if an external root,
- With
- §2 Production-ready — synchronous boot-time probe latency (
drivers/usb/typec/tipd/core.c:3651-3664):tps6598xdoes not setPROBE_PREFER_ASYNCHRONOUS, so probing 3 connected ports on J575c runsmsleep(5100)plus polling/command waits sequentially (~15–18 s+ added to probe/boot). Please provide the dmesg timestamps from the J575c boot log showing the exact boot-time impact.
- §5 Evidence — exact-head build & regression completeness:
- The J575c tests were run on
f5fae3cbb+ patch rather than a build at exact head17fa0955(acknowledged thatdrivers/usb/typec/tipd/is identical betweenf5fae3cbband110861f43), and the PR body omits the SELinux/AppArmor denial count and new-kernel-error count (0 failed unitsis noted, plus one-71descriptor retry on the USB2 hub). - Please add the dmesg probe timestamps, full regression counts (0 SELinux/AppArmor denials, 0 failed units, 0 new kernel errors), and a J575c no-regression check with a powered dock (plus external USB-C boot/root disk behavior if supported) at
17fa0955.
- The J575c tests were run on
Non-blocking §1 Note (Follow-up)
drivers/usb/typec/tipd/core.c:3608-3621: this PR improves §1 by removing the per-boardcheck_attach_stateflag, butcd321x_inherited_boards[]still gates onof_machine_is_compatible("apple,j716c")/"apple,j575c"solely for.keyand.best_effort. Sinceapple,debug-lock-keyalready exists inDocumentation/devicetree/bindings/usb/apple,sn201202x.yamlandtipd_replug_key()(core.c:3734), please track a follow-up to carryapple,debug-lock-keyin the J575c/J716c DTs and retirecd321x_inherited_boards[](respecting the §1 chicken-and-egg transition) rather than adding new rows.
§1–§6 Checklist Summary
- §1 No model gating: Pass on diff (removes a per-board flag; pre-existing
cd321x_inherited_boards[]noted for DT follow-up). - §2 Production-ready: Blocked — synchronous
msleep(5100)× N connected ports probe-time impact unquantified (dmesg timestamps owed). - §3 Safety: Blocked — live-mounted USB-C disk safety (
tipd=m) and runtime reprobe VBUS-drop hazard unaddressed. - §4 Clean-room & attribution: Pass — commit
17fa0955233ccarries human author/committer and humanSigned-off-by:only. - §5 Evidence: Blocked —
Host testsgreen, but dmesg timestamps, full regression counts (denials / kernel errors), and dock/live-disk coverage at17fa0955are owed. - §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
Since commit 1a774ee ("usb: typec: tipd: renegotiate inherited J575c connections"), a J575c connection inherited from the boot chain has been renegotiated only when byte 7 of register 0x7e lacked bit 3. That bit was taken to mean "the controller has completed an attach with the OS running", and bit 2 to mean the inherited state. It does not mean that. Read at the very start of the probe, before any command, byte 7 is 0x08 on every connected port, including a boot-attached USB 3 drive whose SuperSpeed side is stuck in RxDetect. The 0x04 that the gate saw came from the probe itself: it used to send each port an LDCM command before the gate. That command starts a new liquid measurement, and afterwards the controller reports 0x04. Since commit 5b5032b ("usb: typec: tipd: sn201202x: Send no LDCM command to a dry port") a dry port gets no LDCM command. The gate now sees 0x08 and skips the renegotiation. A USB 3 device attached at boot then comes up at 480 Mb/s (usb-storage instead of uas) until it is replugged. The controller reports nothing else that tells an inherited connection whose SuperSpeed side is stuck from one that trains. Drop the gate and renegotiate every inherited J575c connection. That is what the probe did before the LDCM change: in every J575c boot log we have from before it, the gate let every connected port through. The renegotiation drops VBUS and CC for about 5 s, but it cannot take away a USB device that is in use. dwc3-apple does not start the port's xHCI before the port controller reports the first connection, and the probe reports it only after the renegotiation. A drive on a renegotiated port is first enumerated after it, at boot as well as for a disk that fstab or the initramfs waits for. Unbinding the port controller disconnects the partner first (the host role goes to none), so a later bind renegotiates a port whose devices are already gone. The ports probe asynchronously (sn201202x sets PROBE_PREFER_ASYNCHRONOUS), so the renegotiations run at the same time. With three connected ports the boot takes 5 to 6 s longer, as with the stock linux-aurora kernel, which renegotiates the same ports: systemd reports the boot finished at 13.5 s with the gate skipping them and at 18.6 to 19.9 s with this change (stock: 18.1 to 18.3 s). Tested on a J575c (Mac Studio, M4 Max) with a USB 3 drive (10 Gb/s) attached through each reboot on the same port, kernel built from integration/aurora f5fae3c, whose tipd sources match this base: tipd sources byte 7 at the gate drive at boot f5fae3c 0x08, skipped 480M usb-storage same, LDCM change reverted 0x04, renegotiated Gen 2x1 uas f5fae3c + this change no gate, renegotiated Gen 2x1 uas With the tipd sources from before the LDCM change on the same kernel, byte 7 is 0x08 at the start of the probe and 0x04 at the gate. A kernel built from this change on integration/aurora 48470aa gives the same: the three connected ports renegotiated by 18.4 s, the drive at Gen 2x1 uas, and a read-only fstab mount of it at 19.9 s. Unbinding the drive's port controller with the drive mounted removed the drive and shut its filesystem down at once; the bind renegotiated the port in 5.2 s and the drive came back at Gen 2x1. Fixes: 1a774ee ("usb: typec: tipd: renegotiate inherited J575c connections") Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
17fa095 to
0d30880
Compare
|
Thanks to you both. The branch is rebased on integration 48470aa (no conflict, Board table (Ryan 1, DjDeveloperr §1 note). Agreed. This PR adds no row. I'll send the follow-up after this one: A drive in use on a renegotiated port (Ryan 2, DjDeveloperr blocker 1). It cannot be in use when the Runtime unbind/bind: Boot time (Ryan 3, DjDeveloperr blocker 2). The J575c ports are
So the boot takes 5 to 6 s longer than with the gate skipping, about the same as on the stock kernel, which Evidence (DjDeveloperr blocker 3). Exact head (-109) and the five -106 boots: 0 failed units, 0 AppArmor denials Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal Pre-PR Checklist Re-Review (§1–§6) — APPROVE
Re-reviewed at verified live head 0d3088096987e69d05fc0fd99b23af0e993da4ee (7robertodantas:j575c-reinit-no-attach-gate → aurora-silicon/linux:integration/aurora). Live CI: Host tests (45164294080) = success; merge state CLEAN.
Verification of Prior Blockers
- §3 Safety — live USB-C storage & runtime unbind/bind: Resolved. Confirmed against source (
drivers/usb/dwc3/dwc3-apple.choldsDWC3_APPLE_PROBE_PENDINGuntiltipdreports the first connection aftercd321x_reset_inherited_connection();sn201202x_remove()→tipd_remove()→tps6598x_disconnect()disconnects the partner and tears down xHCI before unbind finishes), documented in the commit message, and verified live on J575c at exact head0d308809with an fstab-mounted USB 3 drive (renegotiated 18.405 s, Gen 2x1uasat 19.55 s, mounted 19.85 s; live unbind of1-06removes xHCI/drive and shuts ext4 down cleanly within 20 ms before any renegotiation; bind renegotiates in 5.16 s and brings the drive back at Gen 2x1uas). - §2 Production-ready — boot-time latency: Resolved. Verified
sn201202x_driversets.probe_type = PROBE_PREFER_ASYNCHRONOUS(drivers/usb/typec/tipd/spmi.c:1434), and exact-head J575c dmesg timestamps confirm all three connected ports renegotiate in parallel (1-0618.405 s,1-0a18.407 s,1-0818.411 s), giving a total boot time of 18.6–19.9 s matching stock-40(18.1–18.3 s). - §5 Evidence — exact-head build & regression counts: Resolved. Exact head
0d308809(rebased on48470aad, kernel7.3.0-1-109) built and booted on J575c with the USB 3 drive, fstab mount, DP monitor (1-0a), HDMI, and USB2 hub: restores Gen 2x1uas(vs 480Musb-storageregression), preserves idle sleep (typec0/2/3suspended,typec1DP active), and reports0 failed units,0 AppArmor denials, and no new kernel errors beyond the hub keyboard's pre-existing-71retry (also logged on stock-40). J716c is byte-for-byte unchanged.
Pre-PR Checklist Summary (§1–§6)
- §1 No model gating: PASS on diff — removes the per-board
check_attach_stateflag (follow-up noted to movecd321x_inherited_boards[]to DTapple,debug-lock-key). - §2 Production-ready, no hacks: PASS — drops the broken
0x7ebit-3 heuristic on default cmdline with verified parallel async probe. - §3 Safety: PASS — probe ordering and unbind/bind disconnect behavior verified in code and on hardware with a mounted drive.
- §4 Clean-room & attribution: PASS — single commit
0d3088096987has human author/committer (Roberto Dantas), humanSigned-off-by:andFixes: 1a774eeee49a, zero AI trailers in commit. - §5 Evidence: PASS — exact-head hardware A/B, live unbind/bind, fstab mount, idle sleep, and regression tuple complete;
Host testsgreen. - §6 Naming: PASS.
Assisted-by: LLM (Gemini 4 Neon)
3915250
into
aurora-silicon:integration/aurora
On current integration, a USB 3 device that is attached when a J575c (Mac Studio, M4 Max) boots comes up at USB2 (480M,
usb-storage) instead of 10 Gb/s (uas), until it is replugged. Stock linux-aurora -40 (9125b31) does not have the
problem.
Cause: the 0x7e gate that #1671 added (1a774ee) never really detected an inherited connection. The controller
reports byte 7 = 0x08 for any completed attach, including the one inherited from the boot chain. The 0x04 the gate
relied on was produced by the LDCM command the probe used to send before the gate. 5b5032b (no LDCM to a dry port,
as macOS) removed that command, so the gate now sees 0x08 and skips the renegotiation. 5b5032b itself is fine.
This PR drops the gate, so the J575c renegotiates every inherited connection, as it did before 5b5032b.
Change:
drivers/usb/typec/tipd/core.conly (-30/+4): removecheck_attach_state, theCD321X_ATTACH_STATE_*definesand
cd321x_attach_state_done(); update the board table comment. No DT or binding change. The J716c row is unchanged.Tests (J575c, USB 3 drive on typec3 attached through every reboot)
Kernel
7.3.0-1-106= integration/aurora f5fae3c (tipd sources identical to the current base, 48470aa), package config.With this PR: HDMI and the typec1 DP monitor connected, USB-A keyboard and the USB2 hub on typec OK (the hub's
keyboard needed one descriptor retry, -71, after the renegotiation; same with 5b5032b reverted), no failed units.
With the integration DT (
apple,event-irq-in-sleep), the port controllers still sleep while idle after therenegotiation: typec0, typec2 and typec3 (with the drive) suspended, typec1 (DP monitor) active, as without this PR.
Exact head (0d30880, rebased on integration 48470aa; tipd code unchanged)
Kernel
7.3.0-1-109built from the head, package config, installed DT, same partners (drive on 1-06, USB2 hub,DP monitor on 1-0a, HDMI) plus a read-only
nofailfstab entry for the drive.PROBE_PREFER_ASYNCHRONOUS)-71descriptor retry (stock -40 logs it too)Not tested: a J716c (its row has no gate and is unchanged), a powered dock, a root or
/bootdisk on USB-C.Assisted-by: LLM (Claude:Opus 5.5)