Repository navigation
HID: spi-hid-apple: validate replies and retry transient GET failures - #842
Merged
Merged
Conversation
An invalid GET write status still looks successful after fcc1700 ("HID: spi-hid-apple: stop status mismatches on boot and suspend"). Return -EPROTO immediately instead of waiting for an unacknowledged GET. Keep the existing best-effort SET/OUTPUT behavior without replaying it. Serialize synchronous GETs, arm their reply state before transmission, and accept only the requested interface, report and sequence ID. Bound copies and the returned length to the caller's destination buffer. Keep at most three attempts only when an acknowledged GET's reply wait times out: receive CRC validation still discards consumed replies, a path untouched by fcc1700. Do not retry bad status or SPI errors. Drop the previous speculative framing reset and settling delays. Adapt the six fake-controller KUnit cases to the new power state and exercise invalid status, CRC-discarded replies, stale/wrong-interface replies, timeout exhaustion, copy bounds and non-replayed SETs. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The M1 Pro can return status 9c 17 e5 f8 for a valid dimensions GET several seconds after probe. magicmouse_open() enables multitouch and then reads report 0xd9 on the first input open. Probe does not read those dimensions, and a successful open already caches them. Removing the query would leave the input axes unconfigured. The write and status transfers form one SPI message, writes hold tx_lock, and synchronous GETs hold get_report_lock. The available trace does not establish an interleaved host transfer or the firmware meaning of this status. The same report works on the other boots, so recover a transient rejection without assuming that it means busy. Retry a bad-status GET within the existing three-attempt budget shared with reply timeouts. Retire the pending reply on every failure and use a fresh ID on retry. Report status mismatches as warnings and keep the final error on exhaustion. Distinguish bad status from spi_sync() errors explicitly, including an SPI -EPROTO, rather than replaying on an errno alone. SET and OUTPUT remain single attempts. Keep the existing KUnit cases and add a successful earlier GET followed by the MT SET, a dimensions GET rejected at ID 11, and a successful retry that discards stale replies. Cover mixed-failure exhaustion and non-replayed SPI errors as well. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Picks up the tools/aurora-sep source-check fix (c60537c) and the current release branch, so CI runs against today's base. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
RyanTheTide
added a commit
that referenced
this pull request
Nov 7, 2026
…ck-20261107 Merge train 11-08. Test kernel 7.3.0-aurora-mtrl1 (integration 43c790f + this check + #842/#1088/#1091) one-shot on the Neo: AV1 1080p 747 fps and 4K 189 fps decode bit-exact against software (fleet23 base 747/189), VP9/H.264 bit-exact, GStreamer v4l2slav1dec 1080p/4K clean, 0 tile refusals on valid streams, 0 AVD errors, 0 AVC, CTXR boot verify PASS. Build warnings = fleet22, W=1 avd 0, run-host-tests --only avd 12/12, CI green. M4 Max evidence: AxxzyWasTaken's J616C (Chromium 8-tile/1-entry case).
RyanTheTide
marked this pull request as ready for review
November 10, 2026 17:23
This was referenced Nov 11, 2026
Merged
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.
Supersedes #782. This branch starts at
aurora-wipcommite1524e6135e9, includesfcc170020a1c, and preserves the original #782 branch. The update is a fast-forward fromf3f555427e9a.A valid trackpad dimensions GET can receive status
9c 17 e5 f8after probe. In the supplied M1 Pro run, 19/20 boots were clean with baseline-identical axes; one boot failed at 4.849 seconds with report0xd9, interface 2, sequence ID 11, followed byget report d9 failed: -71and magicmouseunable to request dimensions (-71). Returning immediately on every bad status makes that transient condition fatal to the input open.The call path explains the timing:
magicmouse_input_configured()calls the SPI input setup, which setsquery_dimensions = true. The 1.6-second messages report input registration and haptic setup, not a successful dimensions GET.magicmouse_open()callshid_hw_open(), sends the multitouch SET{ 0x02, 0x01 }, then reads feature report0xd9whilequery_dimensionsis set. This is the first input-open geometry query, consistent with the userspace device discovery occurring around the failure. The log does not identify the opening process or establish an earlier successful0xd9GET.query_dimensions. Subsequent opens reuse them. A failed query leaves the flag set for another open, but that does not prevent the original error. The resume callbacks restore multitouch mode but do not re-arm the dimensions query. Dropping this read would leave the initial input geometry at its placeholder values.Writes already hold
tx_lock; the write and its status read are in one SPI message, serialized by the SPI core against the IRQ read message. Synchronous GETs also holdget_report_lock, and replies match interface, report and sequence underreply_lock. The supplied log does not establish a host transfer interleaving. Firmware work after the preceding MT SET, or its own input traffic, could still affect acceptance, but that is not proven by this trace.The firmware meaning of
9c 17 e5 f8is not documented by this code. It also occurs for an unsupported actuator request fixed byfcc170020a1c, so it cannot safely be called a busy-only or unsupported-only answer. Here it accompanies a report that succeeds on other boots. Use bounded GET recovery without inventing a firmware status definition.The final change:
-EPROTOif all bad-status attempts fail. Keep each status mismatch visible as a warning with interface, command, report and sequence.spi_sync()error, including SPI-EPROTO. SPI errors and interrupted waits are not retried. SET/OUTPUT remain single attempts with their existing best-effort status behavior.min(len, reply_len)copy bound from the original PR commit. Preserve the power, LED and resume fixes fromfcc170020a1c.Validation at
c48d1d05ae0f3d638cfdb3cc14390601ffae3375:W=1 -j8 drivers/hid/spi-hid/ drivers/hid/hid-magicmouse.o: passed, zero warning/error diagnostics. The core, OF transport and magicmouse objects were compiled, including the SPI HID KUnit code..kunitconfig,W=1: all nine cases passed, zero failures/skips. The cold UML build emits warnings in unchanged code outside this driver.status message mismatch: 9c 17 e5 f8 (device 2 request 32 report d9 id 11)and-71. The fixed decision passes the same case.The build command returned
rc=0. Separate artifact retrieval was refused by the controller's local free-space guard, so configuration files, objects and raw TAP were not retrieved. The complete 19,402-byte streamed build/test log is preserved, SHA-256d30cc05f1578f77893554d39e19b06a2d111274db8c883009080d924ee0660d2. This artifact collection failure is recorded separately from the successful compilation and tests.M1 Pro retest plan, for lane 4:
a7a8a258) candidate with the exact updated HID: spi-hid-apple: validate replies and retry transient GET failures #842 commits. Record both the PR head and resulting candidate commit/kernel identifier. Keep the known-good kernel and bootguard fallback for every one-shot boot.ABS_X,ABS_Y,ABS_MT_POSITION_XandABS_MT_POSITION_Yafter first open. Require valid ranges identical to this M1 Pro's fleet14m baseline on all 30 boots.This task runs synthetic tests and builds only. Hardware retesting is pending, and this PR stays a draft.