Repository navigation
spmi: apple: recover every generation 4 controller from a failed exchange - #2309
Conversation
…ange After a failed exchange a generation 4 controller (apple,t8142-spmi: T8142 and T6050) has no known FIFO flush, so the driver reads the late or stray reply words out before the next command. That recovery ran only on a board list (J714s, J716c, J813, J815); every other generation 4 board refused all later commands on the bus for the rest of the boot, the PMU's RTC among them. The reply FIFO and its read-out are the controller's, the same on every board with it, and the recovery is bounded: it waits one command timeout, reads at most SPMI_GEN4_REPLY_DRAIN_MAX words, and keeps the failure if the FIFO does not empty. Run it for every generation 4 controller. The earlier generations keep their FIFO flush; the generation is the match data (!legacy_irqs), as before. The recovery was written by Diljit Singh and extended by Nick and Erik Bourget. Fixes: e6b75c3 ("spmi: apple: J714s: recover from a failed exchange on a generation 4 controller") Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
No blockers. Checked at 53f5d6c: apple_spmi_gen4_recover() (drivers/spmi/spmi-apple-controller.c:241) only runs from __spmi_raw_cmd() with
HW row: nice to have, not needed to merge: a generation 4 Mac that was not on the old list (J704, J714c or K114c) booted on the head, with 0 new spmi errors and a working RTC after 3x s2idle. Lab Macs do not reach this code. Assisted-by: LLM (Claude:Opus 5.5) |
|
Adversarial pass at 53f5d6c: no blockers. One small point:
Assisted-by: LLM (Claude:Opus 5.5) |
There was a problem hiding this comment.
Formal §1–§6 pre-PR review at verified live head 53f5d6c4e625c4dcf0ae6f5d909721ffb05b4140 against live integration/aurora (70a00e583b03, not superseded; MERGEABLE/CLEAN; live CI host-tests: PASS).
Verified Clean (§1–§4, §6)
- Hardware selection & locking (§1–§3): Dropping
apple_spmi_gen4_recovers()so reply-FIFO drain recovery runs for every!spmi->hw->legacy_irqs(apple,t8142-spmi) controller is the right §1 direction. Confirmed on liveintegration/aurorathat__spmi_raw_cmd()is only called fromspmi_raw_cmd()while holdingspmi->fifo_lock(mutex, sleeping context safe forusleep_range()), and the drain is bounded bySPMI_GEN4_REPLY_DRAIN_MAX(64 reads). - Attribution (§4): Commit
53f5d6c4e625carries human Author/Committer and full-name humanSigned-off-by: Ryan Murray <ryan@aurorasilicon.org>only (zero AI commit trailers); PR body discloses assistance and credits prior authors. - Live CI (§6): Applicable live CI (
host-tests) is green on53f5d6c4e625.
Blockers Before APPROVE
- §5 Missing hardware verification & regression triad (zero boots on any Mac):
- No hardware boot has been posted on any newly reached generation 4 board (
T8142J704 orT6050J714c/J716s/K114s/K114c/K116s/K116c/J873s/J775c/J775d), nor even a regression smoke boot on an existing gen4 or lab Mac, and no §5 regression triad (0 SELinux denials, 0 failed units, 0 new kernel errors) is recorded. - Please post an exact-head default-cmdline boot + §5 regression triad on an affected gen4 Mac (ideally one of the newly reached boards confirming working SPMI/PMU RTC across s2idle and 0 unexpected SPMI errors).
- No hardware boot has been posted on any newly reached generation 4 board (
- Duplicate hunk with open PR #2440:
Non-Blocking Note
- On a genuinely wedged gen4 bus whose RX FIFO reads empty, every subsequent command will now sleep 50–100 ms (
REG_POLL_TIMEOUT_US), print an unratelimiteddev_warn("recovered from a failed exchange...")(spmi-apple-controller.c:258), clearprev_fail, and immediately fail again inapple_spmi_wait_rx_not_empty(). Switching line 258 todev_warn_ratelimited()(matching line 264) and noting the retry wait in the commit message would prevent log spam on periodic RTC/hwmon polling.
|
K116s row (T6050, generation 4 controllers), from the machine's current boot. Kernel:
Deep sleep, not s2idle: the PMU RTC cannot wake this SoC from s2idle. |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 53f5d6c4e625
Blockers: none.
Checked: no Apple material. This removes a gate: every generation 4 controller now recovers from a failed exchange, not just the list in apple_spmi_gen4_recovers(). axboe's K116s row (T6050, generation 4) carries this commit unchanged in its daily kernel: the PMU RTC registers over SPMI, two deep sleeps (one woken by the PMU RTC alarm), 0 recovery lines, 0 SPMI errors, 0 failed units. That counts as a row at the head. CI green. This replaces my earlier review. #2440 removes the same function with different comment text. Whichever merges second just takes the other's hunk, so it isn't a blocker here.
Evidence
Read 53f5d6c4 (drivers/spmi/spmi-apple-controller.c) and axboe's 11-24 row. On the lab Macs with older controllers (T8103/T6000 match data), a boot with no new SPMI messages is a check after the merge.
Superseded by the review at 53f5d6c
Merge aurora/main (c6d73b1) to pick up aurora-silicon#1798, aurora-silicon#2309, aurora-silicon#2691 and aurora-silicon#3089. Conflict in arch/arm64/boot/dts/apple/t8152-j873g.dts: keep both the t8152-j873-thermal.dtsi include from aurora-silicon#1798 and t8152-j873-usb4.dtsi. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Problem
drivers/spmi/spmi-apple-controller.c:241-247(0abc2f3) ran the generation 4 recovery after a failed exchange only on a list of boards: J714s, J716c, J813 and J815. The recovery reads out late reply words. The list came from e6b75c3 and was extended in 446bb99 and 81c725d. On any other generation 4 board, one failed exchange made the driver refuse every later command on that bus until the next boot, and the PMU's RTC went with it.Change
The board list is removed. The recovery belongs to the controller's reply FIFO, so it now runs on every generation 4 controller. Generation 4 is the match data (
apple,t8142-spmi,!legacy_irqs), as before. Earlier generations keep their FIFO flush.The recovery is bounded. It waits one command timeout, then reads at most
SPMI_GEN4_REPLY_DRAIN_MAXwords. If the FIFO still does not empty, the failure stays. On a board where nothing goes wrong, it never runs.The recovery was written by Diljit Singh and extended by Nick and Erik Bourget.
Testing
make W=1 drivers/spmi/spmi-apple-controller.o. No new warnings.Still to run
None of our lab Macs has a generation 4 controller. Neo T8140, J616s T6040, M1 Pro T6000 and M2 T8112 all bind the
apple,t8103-spmiorapple,t6000-spmimatch data. On them, a boot withdmesg | grep -i spmishowing no new messages is enough.Reach and safety
New reach: T8142 J704 and the T6050 boards that were not on the list (J714c, J716s, K114s, K114c, K116s, K116c, J873s, J775c, J775d). They all use the same
apple,t6050-spmi/apple,t8142-spmicontroller as the J714s and J813. The code runs only after a failed exchange, and the alternative is a bus that stays dead for the rest of the boot.