Skip to content

soc: apple: rtkit: echo OSLOG counters on every RTKit; key T6050 PMP/SIO paths on the hardware - #2412

Open
RyanTheTide wants to merge 3 commits into
integration/aurorafrom
sweep/rtkit-oslog
Open

RyanTheTide wants to merge 3 commits into
integration/aurorafrom
sweep/rtkit-oslog

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Some RTKit and T6050 protocol behaviour was chosen by a machine compatible, not by the hardware or firmware it belongs to.

  • drivers/soc/apple/rtkit.c __apple_rtkit_init(): the OSLOG counter echo was on only for apple,t8140 and apple,t8142 (d9b438c, 2df85e7).
  • apple_rtkit_oslog_rx(): with the echo off, a counter was dropped on those two machines and on apple,sync-syslog-ack nodes. On every other machine it got a checked acknowledgement (1369d18). That acknowledgement is the same message as the echo.
  • rtkit.c __apple_rtkit_init(): the PMP endpoint-7 CoreAnalytics event was acknowledged only on apple,j714s (6a9d6bf). Other T6050 boards logged "refused auxiliary buffer request" and left the firmware unanswered.
  • drivers/dma/apple-sio.c sio_t6050_board(): the T6050 SIO description was used only on apple,j714s (ed190a0).

Change

Commit 1: the OSLOG echo is on by default for every RTKit.

  • With the echo off, the counter is dropped on every SoC.
  • The echo is off on nodes with apple,sync-syslog-ack, and when a client turns it off.
  • The G17 GPU driver now turns the echo off from a field in its per-GPU Config. The field is false for T8140 and T8142, where the counters were dropped before. It is true for T6040, T6041 and T6050, where they were answered before.
  • The old acknowledgement branch could no longer be reached, so it is removed with its buffer and channel checks.

Commit 2: two T6050 gates now use the hardware instead of the J714s machine.

  • The PMP CoreAnalytics acknowledgement follows the registry-v2 PMP compatible (apple,t6050-pmp-v2). It replies only to that exact firmware word.
  • The SIO T6050 description is used when the board's available apple,t6050-sleep node has an apple,seq-commit-sio sequence. Its commit_stop needs that sequence.

Credit: Diljit Singh wrote the echo, the polled-idle handling, the CoreAnalytics acknowledgement and the T6050 SIO description. Nick extended the echo to T8142. Eryk Wieliczko and Chris Kearney wrote the counter acknowledgement.

Why the OSLOG echo needs no SoC gate

The IOP sends nothing that tells firmwares apart. The OSLOG endpoint carries a buffer request (size and IOVA), channel-zero counters and the opaque types 3-5. The management HELLO advertises protocol 11-12 on every generation.

A firmware that uses counters holds the next one until the last is echoed. While one is outstanding, it takes no AP power notice. A firmware that does not use counters never sends one, so no echo goes out.

Every non-T814x RTKit has answered counters with the same message (the exact counter on endpoint 8) since 1369d18, on M1 to M5 firmware. Before that commit, no SoC answered them. No firmware has been seen to need the counters dropped.

apple,sync-syslog-ack keeps dropping them. Only the T8122 dcpext has that property, and it has only run with its counters unanswered. A DCP driver that restarts its DCP across a sleep still turns the echo back on (dcp.c, unchanged).

Per-SoC effect of commit 1

T8140 and T8142: same bytes on the wire.

  • oslog_echo still starts true. No T8140 or T8142 node has apple,sync-syslog-ack.
  • DCP still turns the echo on.
  • The G17 Config of both still turns it off, and with it off the counter is still dropped.
  • The echo-on path is unchanged.
  • The removed branch could not be reached on these machines: both LOG branches returned before the switch.

T6040, T6041 and T6050 (G17 coprocessors, DCP, SMC, ANS, AOP, MTP, SIO, PMP, ISP, AVE):

  • These used to get the checked acknowledgement. They now get the echo, which is the same message.
  • Edge cases:
    • A counter with no negotiated or inherited buffer, or with bits 55:32 set, is now echoed. Before, it was dropped with a warning.
    • If two counters are queued before the receive work runs, only the newer one is echoed. The counter is cumulative, so that echo covers both.
    • A polled idle echoes an owed counter, as on T8140. The T6050 AOP is the only polled user outside T8140.

T8103, T8112, T600x, T602x, T603x, T8122 (except its dcpext): same as above. The legacy GPU, M3 and M5 live-boot RTKit paths never called set_oslog_echo.

T8122 dcpext (apple,sync-syslog-ack): unchanged. Counters are still dropped.

Per-board effect of commit 2

PMP CoreAnalytics acknowledgement:

  • J714s: unchanged.
  • Other T6050 boards: the PMP's all-zero CoreAnalytics event now gets the zero acknowledgement. Before, it got no answer.
  • No other SoC has apple,t6050-pmp-v2.

SIO T6050 description:

  • J714s has apple,seq-commit-sio (t6050-j714s-sleep-soc.dtsi): unchanged.
  • J716c also has the sequence (t6050-j716c-sleep-full.dtsi). Its sleep stops the SIO at commit, and apple,sleep-darts includes the SIO DART. Its SIO node is disabled in the kernel DT, as it is on the J714s, where the loader enables it. Where the loader enables it on the J716c, the J716c now gets the T6050 description. That matches its sleep sequence. It has no apple,channel-threshold/apple,channel-limit, so the channel words are the generic ones. If its SIO firmware is not protocol 10, the probe refuses it cleanly (-ENODEV). Note that commit 2's message says the J716c does not change. That holds only while its SIO stays disabled.
  • J714c, J716s, K114c/s, K116c/s, J775c/d and J873s have no sleep node: they keep the generic description.
  • A board whose DT gains the SIO commit sequence (the K116s deep-sleep series) gets the description with no driver change.

Testing

  • Build, against the release config at 0abc2f3: drivers/soc/apple/rtkit.o and drivers/dma/apple-sio.o with W=1, drivers/gpu/drm/apple/ and the Rust drivers/gpu/drm/asahi/ all build. There are no new warnings: the Rust dead-code warnings in the asahi build are already in the base and are not in the lines changed here.

  • Host tests: tools/asahi/rtkit-oslog-tests.py passes (1710 controls), and each of its five mutants (owed, policy, counter, reset, buffer) is killed. The OSLOG case of the apple-dcp selftest (boot.oslog) passes.

  • DT check: no DT file is changed. The final DTs of every T6050, T8140, T8142 and T8122 board were compiled with cpp and dtc and checked for the properties that now decide:

    • apple,t6050-sleep with apple,seq-commit-sio: J714s and J716c only.
    • apple,t6050-pmp-v2 okay: J714s, J714c and K116s.
    • apple,sync-syslog-ack: T8122 J613/J615 only. No T8140 or T8142 board has it.
  • Merged integration/aurora (44b7574) after soc: apple: sleep, mfd: macsmc: T6050: a port's wake with the lid closed is a dark wake #2445: its saved-lane echo (apple_rtkit_log_word()) now asks apple_rtkit_oslog_owed_msg(), i.e. rtk->oslog_echo, and the machine-keyed apple_rtkit_oslog_unanswered()/apple_rtkit_oslog_echoed() it added are gone. drivers/soc/apple/rtkit.o builds with W=1 and no warnings; host tests 437/437, including rtkit-oslog-tests and its five mutants.

  • Hardware (one-shot test kernel 7.3.0-aurora-swl1 = integration 0abc2f3 + this and the other open sweep PRs, 2026-11-20):

    • T8112 J413 and T6000 J316s: boot + 20 s idle + 3 s2idle cycles (rtcwake, ~20 s each, rc=0): 0 kernel errors, 0 SError, 0 failed units, 0 AVC; no RTKit crash/timeout lines; only the DCP firmware's own syslog lines, the same as on the current kernel.
    • T6040 J616s: same, RTKit errors 0.

Still to run

Run all rows on one combined test kernel. "dmesg clean" means dmesg | grep -i -e rtkit -e oslog -e crash shows no new errors.

  • Neo (T8140 J700): boot, dmesg clean, s2idle x2, deep x1. Expected: the same as the base kernel (no wire change).
  • J616s (T6040): boot, dmesg clean, s2idle x2, GPU idle and resume working.
  • M1 Pro (T6000 J316s): boot, dmesg clean, s2idle x2.
  • M2 (T8112 J413): boot, dmesg clean, s2idle x2.
  • Neo (T8140 J700) GPU OSLOG echo soak, then drop the per-GPU oslog_echo field: the follow-up commit is ready on sweepfix/2412-gpu-oslog-echo (89b0218, removes Config::oslog_echo, its five initialisers and the set_oslog_echo(false) call, so the T8140/T8142 GPU coprocessors echo like every other RTKit). Row: boot, gpubench rows, GPU idle -> runtime suspend -> resume x20, s2idle x3 + deep x1, 30 min idle soak with a GPU client every 5 min; pass = no GPU coprocessor crash, "Invalid AP power" or RTKit timeout, and the GPU counters echoed. If it passes, the commit lands here; if the Neo breaks, the echo stays off keyed on the firmware build, with the failure cited. Hardware row: pending.
  • T6050 boards (J714s/K116s): not in our lab. A tester should check that "refused auxiliary buffer request" is gone and that the SIO probes as before.

Assisted-by: LLM (Claude:Opus 5.5)

The OSLOG counter echo was chosen by machine: rtk->oslog_echo was set
only when the machine is apple,t8140 or apple,t8142, and with the echo
off a counter was dropped on those two machines (and on a node with
apple,sync-syslog-ack) but acknowledged after a buffer/channel check on
every other one.

The echo is RTKit protocol behaviour, not a SoC property. The IOP sends
nothing at OSLOG setup that tells the two apart: its endpoint carries a
buffer request (size and IOVA), channel-zero counters and the opaque
types 3-5, and the management HELLO advertises protocol 11-12 on every
generation. A firmware that uses the counter protocol sends counters and
holds the next one until the last is echoed; one that does not sends
none, so the echo never goes out. The acknowledgement that every
non-T814x RTKit has sent since 1369d18 is the same message (the
exact counter on endpoint 8), so M1- to M5-era firmware already gets it.

So echo every channel-zero counter by default, on every RTKit. The off
state keeps its meaning everywhere: the counter is dropped. It is off
on a node with apple,sync-syslog-ack (the T8122 dcpext, which has only
run with its counters unanswered; a DCP driver that restarts its DCP
across a sleep turns it back on as before) and where a client turns it
off. The G17 GPU driver turns it off only where its firmware has only
run with the counters unanswered (A18 Pro, M5), now from a field of its
per-GPU Config, and leaves it on for M4 Pro/Max and M5 Pro/Max/Ultra,
whose GPU firmware has had its counters answered since 1369d18.

The admitted-buffer and channel checks of the old acknowledgement path
go with it: the echo path, which T8140 and T8142 have run since their
sleep work, echoes the exact counter as macOS does. The one behaviour
change on other SoCs is in edge cases: a counter that failed those
checks is now echoed instead of dropped with a warning, a polled idle
(T6050 AOP) echoes an owed counter as on T8140, and when two counters
are queued before the receive work runs only the newer one is echoed,
which acknowledges the older one too since the counter is cumulative.

T8140 and T8142 keep the same messages on the wire: oslog_echo starts
true there as before (no node of theirs has apple,sync-syslog-ack), the
DCP still turns it on, the G17 Config of both turns it off as before,
and with it off the counter is dropped as before. The removed
acknowledgement branch was unreachable on both machines.

The host OSLOG control test and the DCP selftest now check the echo
policy instead of the machine list.

The echo and its polled-idle handling are Diljit Singh's (T8140) and
Nick's (T8142); the counter acknowledgement is Eryk Wieliczko's and
Chris Kearney's.

Fixes: d9b438c ("arm64: apple: support coordinated suspend-to-RAM on T8140")
Fixes: 1369d18 ("soc: apple: acknowledge OSLog progress in negotiated and inherited sessions")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
… the hardware

Two T6050 paths were chosen by the machine apple,j714s, the board they
were first run on.

The PMP's endpoint-7 CoreAnalytics event acknowledgement was on only
for registry-v2 PMP firmware (apple,t6050-pmp-v2) on the J714s. The
event, a CoreAnalytics word with every field zero, is part of that
firmware's endpoint protocol: the J714s's PMP sends it some minutes
after its start. On another T6050 board the same firmware got "refused
auxiliary buffer request" and no answer. The reply only ever answers
that exact word from the firmware, so key it on the registry-v2
compatible alone and drop pmp_ca_event_ack.

The SIO's T6050 description (protocol 10, the T6041 tables and arrays,
and commit_stop, which keeps the SIO running until the sleep's commit
stops it) was in force only on the J714s; other T6050 boards took the
generic description. The board-dependent part is commit_stop: it needs
the board's sleep controller to stop the SIO at its commit. That is
described in the DT, by an apple,seq-commit-sio sequence in the
available apple,t6050-sleep node. Key the description on that.

Boards: J714s has the sequence (t6050-j714s-sleep-soc.dtsi), as before.
J716c has it too (t6050-j716c-sleep-full.dtsi), but its SIO node is
disabled (t6050-j716c-sleep.dtsi), so nothing changes there. J714c,
J716s, K114c/s, K116c/s, J775c/d and J873s have no sleep node and keep
the generic description. A board that gains the sleep's SIO stop in its
DT, as the K116s deep-sleep series does, gets the description with no
driver change.

The CoreAnalytics acknowledgement and the T6050 SIO description are
Diljit Singh's.

Fixes: 6a9d6bf ("soc: apple: rtkit: J714s: acknowledge the PMP's CoreAnalytics event")
Fixes: ed190a0 ("dma: apple-sio, soc: apple: T6050 SIO, AOP and AOP2 for the sleep")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
integration/aurora now carries apple_rtkit_oslog_echoed() and its saved-lane
user apple_rtkit_log_word(), which decided the echo from the t8140/t8142
machine compatibles, the inherited buffer and the reserved channel bits.
This branch decides the echo from rtk->oslog_echo alone and drops those
inputs, so apple_rtkit_oslog_unanswered()/apple_rtkit_oslog_echoed() go and
the saved lane asks apple_rtkit_oslog_owed_msg(), the same test the
receive path and the polled idle use. The SMC log words the saved lane
echoes on T6050 are echoed as before: oslog_echo is on there.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Looks good; approve once the Neo row is in.

I checked the OSLOG paths in drivers/soc/apple/rtkit.c:

  • The default is !sync_syslog_ack (2264).
  • With the echo off, a counter is now always dropped (1378).
  • The saved-lane check uses the same oslog_echo test as the receive path (1574).
  • The removed acknowledgement branch sent the same endpoint-8 message as the echo.
  • T8140/T8142 keep their wire behaviour: the echo is on by default and the G17 Config turns it off as before.

The PMP CoreAnalytics reply now keys on apple,t6050-pmp-v2 alone. The SIO description keys on an available apple,t6050-sleep node with apple,seq-commit-sio (apple-sio.c:705-719). The J714s sleep node has no status (so it is available) and carries the sequence, so the J714s is unchanged.

  1. drivers/gpu/drm/asahi/g17/mod.rs:247 and hw/t8140.rs, hw/t8142.rs: Config::oslog_echo is still a per-SoC switch. The commit says why: those GPU firmwares have only run with the counters unanswered. The ready follow-up that removes it is the right end state. Fold it into this PR once the Neo soak passes, rather than landing the table and removing it later.

HW row: Neo (J700) on this kernel plus the follow-up, default command line. Boot, GPU idle -> runtime suspend -> resume x20, s2idle x3 + deep x1, 30 min idle soak with a GPU client every 5 min. Pass: no GPU coprocessor crash, no "Invalid AP power", no RTKit timeout, 0 failed units, 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Still needed: the Neo (J700) row on this head (GPU idle to runtime suspend and back 20 times, 3 s2idle plus 1 deep sleep, a 30-minute idle soak with a GPU client) and the follow-up that drops the per-SoC Config::oslog_echo (g17/mod.rs:247) folded in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant