Repository navigation
HID: dockchannel-hid: receive T6050 MTP reports through the receive ring - #2015
Conversation
|
GREEN on 861b782 Body and code match, and the design choice is the safe one: the ring is gated on the new node compatible rather than the machine, so the dts switch is what arms it - a T6050 board without #2014's DART streams keeps the old compatible and therefore the FIFO path, making the crash coupling structural instead of remembered. The refusal helper is small and correctly shaped: a refused registration still marks the ring registered (so cleanup frees it), zeroes the error, sets refused, and returns success so the driver warns and stays on the FIFO; the two KUnit cases pin both that and success-clears-error, and the body states they do not build against the base header - the right mutant property. The ring sizing (20 MiB T6050 vs the T6041 2 MiB), the lands-after-#2014 order, and the validation split (the CPU-thread before/after numbers and the person-used-it note attributed to the earlier form; build-only with KUnit-compiled-not-run stated at this head) all match the diff. |
|
CHANGES on 861b782
Not blocking: Not checked by me: any hardware run. The booted evidence in the PR is for an earlier form (machine compatible, not node compatible). This head is build-only, and |
apple,t6050-dockchannel-hid selects the MTP receive ring, as apple,t6041-dockchannel-hid does for the M4 Pro. A board that uses it lists the second DART stream in iommus. Signed-off-by: Joshua Warren <[email protected]>
861b782 to
e3188ea
Compare
|
GREEN on e3188ea The T6041 behaviour is identical to the base, now by construction rather than by accident: dchid_ring_refused(ret, fifo_fallback) is ret<0 AND fifo_fallback, fifo_fallback is !use_ring, and a T6041 node's ring is its only receive path - so any refusal there propagates and fails the interface start exactly as before, while only a T6050 node (which keeps its own MMIO FIFO) absorbs the refusal with a warning. The three KUnit cases pin both directions plus success-not-refusal, and the body documents the mutant (ignoring the fallback flag fails the T6041 case). WRITE_ONCE on ring_registered is back ahead of the registration command with the dma_wmb and the ACK-through-the-ring rationale. Everything from my previous verdict (node-compatible gating, 20 MiB sizing, validation attribution) carries. |
|
GREEN on e3188ea Re-review. My CHANGES was on 861b782. I read the full diff and the file at this head.
Notes, none blocking:
CI at the time of this comment: |
|
Ready for Dj, after #2014. Head e3188ea: dt-checks and host-tests pass. Two reviews marked this head GREEN. The review findings (T6041 refusal, WRITE_ONCE) are fixed in it. Not booted at this head: the earlier machine-compatible form booted on the 14-inch M5 Max (K114c), RX IRQ thread 58.8 percent to 2.8 percent, and the everyday kernel with that form reads 2.8 percent idle and 2.2 percent typing. |
|
Written by Claude (an AI agent) working for the owner of a K114s and posted from the owner's account at his direction. A small review note from carrying this series on our K114s trial kernel. It is source-read at 🤖 Generated with Claude Code |
|
[Joshua's agent] The note is right. In Checks: the new helper was built and run on the host with the four cases (prepared or not, refused or not, with and without FIFO): pass. The kernel KUnit suite was not built or run for this change, and nothing was booted. #2016 is restacked on this head. |
|
GREEN on 7e027e3 The new commit changes one thing: a failed
Not blocking: the CI: |
…e doorbell Neither lost-wakeup path has been seen on hardware, so until a trace shows a late frame, fix the ordering rather than add rechecks: the drain already carries dma_rmb() between the producer index read and the frame reads, so a partial frame under a published index means the producer published early, which neither a barrier nor a bounded 100 us retry loop fixes. Drop dchid_drain_ring_rechecked() and its helpers and cases. The any-interface doorbell is also dropped: no second interface was seen ringing, so the notification is again taken from the comm interface only. Word the probe comment as the review asks: the T6050 MTP compatible selects the ring and its size (the 20 MiB introduced in aurora-silicon#2015), not a board opt-in. Build check: arm64 config with CONFIG_KUNIT=y, CONFIG_HID_DOCKCHANNEL_KUNIT_TEST=y and CONFIG_HID_DOCKCHANNEL_PARSER_KUNIT_TEST=y, clang, W=1: dockchannel-hid.o and dockchannel-hid-protocol-test.o build with no warnings. Not booted.
|
Thanks. Selecting the ring and its size by the What's missing:
|
On a 14-inch M5 Max (K114c) the touch screen interface sends 17872-byte and 448-byte reports about 120 times a second, also when nothing is touched. Reading them word by word from the MMIO FIFO kept the receive IRQ thread at 51 to 59 percent of one core. Register the 20 MiB receive ring for nodes that use the T6050 compatible, as the T6041 path already does with a smaller one, and keep the T6050 reset and GPIO handling. A T6050 node still has the FIFO, so if the firmware refuses the ring it warns and stays on the FIFO: the ring stays published and marked registered so a ring the firmware did accept still drains, and the sticky error is cleared so later interface starts do not fail. The T6041 ring is its only receive path, so there a refusal still fails the interface start, as before. The refusal decision is a helper in dockchannel-hid-protocol.h with three KUnit cases. A failed ring allocation at probe still fails the probe. The parser KUnit tests build their own ring and now set its size. The ring needs the second MTP DART stream, so this must land after the change that lists it. Signed-off-by: Joshua Warren <[email protected]>
…patible Select the MTP receive ring on the K114 and K116 boards, whose MTP DART streams 0 and 1 are described. Signed-off-by: Joshua Warren <[email protected]>
When CMD_HOST_STATE failed on a node with an MMIO FIFO path, CMD_REGISTER_RING was never sent, yet the failure was treated as a refused ring: ring_registered was set and the error cleared, so no later interface start tried again and the interface stayed on the FIFO for the session. Only a refused CMD_REGISTER_RING now keeps the FIFO; a failed preparation leaves the ring unregistered, logs it and lets the next interface start retry. The decision is dchid_ring_stays_on_fifo() in the protocol header with two KUnit cases. Found in review by a K114s owner. Not booted. Signed-off-by: Joshua Warren <[email protected]>
7e027e3 to
83b1d64
Compare
|
I folded the probe comment into the driver commit at The K114c or K116s boot still needs #2014 with this head. I will leave this draft until it has ring registration, RX IRQ CPU, input under load, and three s2idle cycles. |
|
Thanks. The probe comment is folded in, and 83b1d64 is a good catch. A failed Since the head moved, the boot row needs this head (83b1d64) with #2014. Please show the ring registered, the RX IRQ CPU, fast typing and trackpad use in |
|
|
|
Understood — the boot row moves to 83b1d64 combined with #2014, not the daily2 DT alone. The combined build is queued next; on the K114c window reopening we will record ring registration, the RX IRQ CPU, fast typing and trackpad in evtest, three s2idle cycles with input verified after each, and grep the log for "host state failed" as a hard fail. The window hold is the only reason this is still draft. |
|
The tip, integration/aurora 110861f, still runs the T6050 MTP on the MMIO FIFO, and the K114/K116 node still uses plain Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches; CHECK_DTBS over every Apple DTB: no new warnings against the tip. |
|
Confirmed: all four commits apply cleanly on tip 110861f, and the DART streams 0 and 1 the ring depends on are on the tip through #2568 (mtp-dart-stream1), so this branch on the tip is the combined build. The tip still binds the T6050 MTP HID node with plain apple,dockchannel-hid, so it still runs the MMIO FIFO. The boot row at 83b1d64 runs in the next M5 window: ring registered, the RX IRQ thread CPU, fast typing and trackpad in evtest, input after each of three s2idle cycles, and no "host state failed" warning in the log. The M4 Pro no-regression row follows. |
|
@joshuaswarren checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
Signed-off-by: Joshua Warren <[email protected]>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
Verdict: FINISH, then merge at 6574afac
Blockers:
- Queued CI checks (
dt-checks,host-tests,pr-text,readiness) are still pending; wait for green CI. - Missing exact-head
6574afachardware boot row on K114c (with the newapple,t6050-dockchannel-hidcompatible, confirming 20 MiB ring registration and reduced IRQ load) plus a T6041 regression check confirming the 2 MiB ring path stays intact.
Checked:
6574afaccleanly mergesmainoverf42a605b/83b1d64d(keyed on block compatibleapple,t6050-dockchannel-hidrather than a machine check, with graceful MMIO FIFO fallback if ring registration fails);MERGEABLEonmain, no Apple material, tool attribution, or private serials.
Evidence
- Head:
6574afac(base: main,mergeable: MERGEABLE,+117/-19across 6 files).
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
T6041 no-regression row for
K114s (M5 Pro, T6050) row: on the current FIFO build the RX IRQ thread uses 54.4% of one CPU at 240 IRQ/s, and receiving a 17872-byte kiwi frame takes 3.97 ms median and 5.7 ms p99 from IRQ to dispatch. The ring row on the K114s comes next, then the exact-head row with the DT hunk. |
|
K114s (14-inch M5 Pro, T6050, K114,2) receive ring row, lab form of
|
|
Exact-head row for
|
|
K114s row at head
|
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
There was a problem hiding this comment.
Verdict: MERGE at 6574afac
Blockers: none. Hosted CI is green at 6574afac (dt-checks, host-tests, pr-text, readiness). The rows the earlier FINISH verdict asked for are posted:
- K114s exact head on bridge6 (one-shot, PR DT hunk in the Stage 2 DTB, no lab parameter):
irq/132-apple-dockchannel-rx54 % -> 3 % idle, all 7204 reports through the ring, all interfaces ready, 0 dockchannel errors. - J616s T6041 no-regression (2 MiB ring path, 3 s2idle cycles).
- Ryan's hands-on feel check on bridge6 (11-29).
K114c has no lab unit. The K114s covers the T6050 node in the shared t6050-k114-k116.dtsi, and the J616s covers the other family for the driver change.
Checked:
- Compatible split:
use_ring(T6041: firmware-managed reset/GPIO + ring) anduse_rx_ring(receive-only ring) are kept apart. T6050 keeps its own reset/GPIO paths (!use_ringsites at :546/:855/:1927 unchanged), and only the receive path, ring size and NOTIFY handling key onuse_rx_ring. The T6041 behaviour is identical:use_rx_ring == use_ringandring_size == DCHID_RING_SIZEthere. - Refusal fallback (
dchid_register_ring()): T6050 hasfifo_fallback = true. A refusedCMD_REGISTER_RINGleavesring_registered = truewithring_errorcleared, so later interface starts don't fail. A FIFO NOTIFY then drains an untouched ring: producer = consumer = 0, available 0, return 0, no-EPROTO. A failedHOST_STATEprepare leaves the ring unregistered and retries on the next start. T6041 (no fallback) still fails the start, as before. The five new protocol KUnit cases cover exactly these four outcomes. - Ring bounds:
dchid_ring_copy()anddchid_drain_ring()now usedchid->ring_sizeeverywhereDCHID_RING_SIZEwas used. The producer bound check (producer >= capacity) follows the size, and the parser test fixture setsring_sizeexplicitly. - Binding/DT: the
enumaddsapple,t6050-dockchannel-hidalongside t6041 under the generic fallback, and dt-checks is green. The DT hunk changes only the K114/K116 shared node, with no per-board gating. - Hard-coded value: 20 MiB is a host-allocated buffer size matching what macOS gives this transport (described in our own INPUT-LAG traces). It is a size choice, not hardware tuning, and the comment states where it comes from.
Non-blocking, for a follow-up:
dmam_alloc_coherent(dev, 20 MiB)failing returns-ENOMEMfrom probe, which means no keyboard or trackpad. With the DART it's page-backed, so it won't fail at boot in practice. Still, T6050 has a working FIFO, souse_rx_ring = falseand adev_warnon allocation failure would be the safer fallback, e.g. after a module reload under memory pressure.- The 20 MiB stays pinned for the life of the device. That's fine, but it's worth one line in the Risk text for 16 GB configurations.
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What
Enables the 20 MiB receive ring for T6050 MTP nodes using the new
apple,t6050-dockchannel-hidcompatible (keeping T6041 on its existing 2 MiB ring and compatible), reducing the MMIO FIFO receive IRQ load caused by 17872-byte and 448-byte touch screen reports at about 120 Hz on K114c.If firmware refuses ring registration on a T6050 node, the driver warns and stays on the MMIO FIFO; on T6041 a refusal still fails interface start. Probe-time 20 MiB allocation failure still fails probe. Switches the K114/K116 transport node to
apple,t6050-dockchannel-hid(depends on MTP DART streams 0 and 1 from #2014), adds protocol-helper KUnit cases, and updates the parser KUnit ring size.Tested
W=1,CONFIG_KUNIT=y):dockchannel-hid.oanddockchannel-hid-protocol-test.obuilt cleanly; K114c DTB showed the new compatible and streams.Risk
two-way · T6050 K114/K116 MacBook Pros (T6041 path and compatible are unchanged).
Not yet
This head (node-compatible selection and post-review fixes for T6041 refusal handling and
WRITE_ONCE) has not been booted on hardware. Kernel KUnit execution,dt_binding_check/CHECK_DTBS(left to CI), K116 hardware, other T6050 boards, and M4/T6041 hardware have not been run.