Skip to content

soc: apple: t6041-sleep: memory and fabric power management at boot, as macOS - #2175

Draft
AxxzyWasTaken wants to merge 40 commits into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:pr/t6041-sleep-mem-auto
Draft

AxxzyWasTaken wants to merge 40 commits into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:pr/t6041-sleep-mem-auto

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #1664. The change is in t6041-sleep.c, which #1664 adds, so this branch sits on #1664's branch: GitHub shows #1664's 38 commits first, and only the last two commits belong to this PR. I'll rebase it with #1664.

At boot, macOS's ApplePMGR::start puts every ADT pmgr device whose flag bit 2 is clear under hardware power management: target f, wait for the device to reach f, then AUTO_ENABLE (bit 28). On the M4 Max, iBoot does this for the AMCC slices but leaves the DCS channels (24 on the binned part, 32 on the full one) and 12 fabric words forced on, so under Linux they never gate when idle.

This does the same for those power-state words at arch_initcall, before the PMP driver loads: 36 words on the binned part, 44 on the full one. When I set them later, on a running system with the PMP up, the Max froze. Words that are fused off, not forced on, or already on AUTO are left alone, so the binned part skips the full part's eight extra DCS words. t6041_mem_auto=0 on the command line skips it all.

The binned part's 36 words, their order and the sequence come from macOS 26.6.2's ApplePMGR (25G83) on this J616c. I left out macOS's later DCS +0x20 write (SOCTuner); one run with it froze. The full part's eight extra DCS words (dcs_24-31) and their order come from joske's J614c test: they follow the other DCS words of their PMGR group in ADT order, as there is no macOS trace from a full part.

It runs on every T6041 boot with CONFIG_APPLE_SOC_SLEEP=y, whether or not the boot asked for suspend-to-RAM.

Testing

On a J616C (32-core M4 Max, binned: 24 channels):

  • First boot on 14 Nov: 36 words on AUTO, 0 late, no errors, and the DCS channels and fabrics no longer show as forced on. It has been in my daily kernel since then.
  • Idle at login, screen at 110: 4.43-4.52 W in total and 2.02-2.12 W SoC, against 4.55 / 2.17 W on the previous day's daily. That is at most ~0.1 W, inside the noise. No A/B in the same session, so I can't claim a power saving. It's here to match macOS.
  • With the full part's eight words: one boot of the J616c daily kernel plus the second commit gave 36 words on AUTO, 0 late; the eight words read 0x0f000300 (fused off, skipped), and there were no new warnings or errors against the daily boot.

On a J614C (full M4 Max, 32 channels), tested by joske on top of #1664:

  • 44 words on AUTO, 0 late, no new errors. All eight extra words were forced on and got switched.
  • A lid sleep and wake afterwards works, with the same wake log as without the change. Power not measured.

This branch: drivers/soc/apple/t6041-sleep.o builds with W=1 without warnings. Not booted as-is: the boots above are of my daily kernel (J616C) and of joske's kernel on #1664 (J614C) with this change.

… its own

The T6041 sleep driver runs its own commit and needs the coprocessor
stop the T8140 path does: every ready coprocessor's last stop and its
run bit off, those registered first before the rest. Export that as
apple_sleep_coprocs_stop_all(), with apple_sleep_coprocs_ans_stopped()
to tell whether ANS (and so the storage PCIe link) was stopped and
apple_sleep_coprocs_count() for the driver's own report.

Unlike apple_sleep_coprocs_stop(), a negative return of a last stop
ends the stop, as the T6041 driver expects.

apple_sleep_coproc_run_off() reads the sleep core's SoC data, which
T6041 has none of: without it, the ASC status is read before the run
bit goes off, as on every SoC but T6050.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
A system sleep driver for T6041 with the kernel at EL2 and no monitor
below, binding to an "apple,t6041-sleep" node. It runs macOS 26.6.2's
last steps before the S2R commit in macOS's order and with its values,
as traced from macOS sleeping under aura's hypervisor, commits through
aura's S2R mailbox, and on the wake restores what the sleep took:

- power-state words compared with and restored toward macOS's values at
  its commit, parents before children (t6041-ps-order.h, generated
  from t6040-pmgr's power-domains);
- ATC, AXI2AF, MCC/AMCC and AVE power-down steps;
- the ANS storage-PCIe tunables reapplied on the wake
  (t6041-apcie-tunables.h, from the J616C ADT /arm-io/apcie0);
- the coprocessors stopped through the sleep core's
  apple_sleep_coprocs_stop_all().

t6041-macos-regs.h holds the register values macOS has at its S2R
commit (generated from a trace of macOS 26.6.2). The driver needs the
kernel at EL2 (CTXR window) and the "aurora,rvbar-spin-table" CPU
enable method, so the other cores can leave the kernel.

The driver still carries its bring-up diagnostics (dry and diag
parameters, PMU scratch notes, register compare snapshots); the hooks
that feed it from the PM core and the SError handler are separate
commits at the end of this series.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
…uspend

The T6041 (M4 Max) has the AICv3 of T8122 and now a suspend-to-RAM
driver of its own. Give "apple,t6041-aic3" its own info, the T8122 one
with fw_suspend, so the AIC state the sleep loses is saved and put
back as on T8140. Nothing else in the driver looks at fw_suspend.

Also in aurora-silicon#1477 (T6040 sleep), which admits apple,t6041-aic3 the same
way; drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
apple_nvme_t6040_hw is only matched by "apple,t6041-nvme-ans2". Give it
the sleep fields T8140 uses: register ANS with the sleep core
(sleep_traced), flush namespace 1 only, the OS's own, and send the
full shutdown notification at suspend. The T6041 sleep driver stops
ANS through the sleep core's coprocessor stop.

On T6041 the sleep core's last check (the shutdown notification has
completed) does not run: the T6041 driver calls only the coprocessor
stop.

Also in aurora-silicon#1477, which sets the same fields with sleep_untraced on the
same struct; drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The PMP's SRAM loses its contents in a real sleep. On the J616C's
26.6.2 firmware its __DATA segment is at 0x500761000, 0x7d000 bytes:
back up (0x61000, 0x7d000) of the SRAM, as T8140 does for its own.

Also in aurora-silicon#1477, whose HW_CFG_T6041 has the same range; drop this one
when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
On apple,t6041, write the keys macOS writes last before MBSE slpa in a
trace of its sleep: WKTP = 2 (AppleSMCEmbedded, going to sleep), then
pmVC. The value written is 0x101, as the bring-up kernel runs it; the
comment, taken over from it, says the trace has 0x100. That difference
is open.

Also in aurora-silicon#1477, which writes WKTP through a sleep_wktp parameter;
drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Give T6041 a configuration of its own, T6040's with:

- the AFK sleep and wake order macOS 26.6.2 uses on the J616C (trace,
  8 Nov 2026): sleep to 0x2b, 0x2a, 0x24, 0x20, 0x27, 0x26, 0x28, 0x25,
  0x21, 0x29, 0x23, 0x22, then the AP idle notice, and wake in the
  reverse order;
- the ED0p boot argument at ec0p + 0x20000, where the 27.2 firmware
  adds a segment, and that segment accepted at its translated IOVA by
  the memory-region check.

Other SoCs keep their configuration; ED0p stays the firmware's own
value there.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
A conventional host (internal ports with the radio and the SD reader)
loses its power in a real sleep: the endpoints sit unpowered or in
reset behind a link that is down. On a firmware suspend, save what
only the port registers hold; on the noirq resume, note which ports
lost their link and keep a copy of their functions saved state before
the PCI core spends it on the down link; in the normal resume phase
(after the SMC, which owns the PWREN GPIOs) bring each such port up
again as probe does, then restore its functions.

Only for hosts that are not tunneled, have no managed SIDs, no PIO DMA
supplier and more than a root bus; s2r_conventional turns it off. The
suspend-to-idle paths (domain hold, adopted links) are unchanged.

Also in aurora-silicon#1477 (0ab1a66), which this follows; drop this one when that
lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Let the T6041 25G83 profile (the J616C) restart the GPU after a real
sleep, as T8140 does: sleep_restart is set for it only.

Find the GPU's power-state word through a PMP report entry too: where
the GPU's first power domain is an "apple,t6000-pmp-v2-report-entry"
node, as in the J616C device tree the bring-up runs, the word is that
entry's own power domain. With a first power domain that is the word
itself, as this tree's t6041.dtsi has (ps_gfx), nothing changes.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
A display DART is locked, so the driver neither saves nor restores its
TCR/TTBR. After a real sleep the panel stayed black with everything
else up. apple_dart_display_keep() saves the TCR/TTBR of the given
streams and the whole register block before the sleep; after it, it
logs which register words differ and writes back the TCR/TTBR values
that changed.

Bring-up, test code, not for upstream as is.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Add dcp_t6041_s2r_all(), called from the platform suspend (firmware
sleep only) and resume, to stop every DCP before a real sleep and
restart and recommit it after, with tunable settle/stop/down waits as
module parameters, step marks kept in nvmem, the display DART state
kept via apple_dart_display_keep(), and a panic kmsg dumper.

After the restart, dcp_backlight_s2r_restore() clears a request left
in flight by the stop and sends the user's level again, since the
backlight class device may resume before or after the restart.

For the 26.6 desktop firmware, add A500 and callbacks 583 and 597
(purpose unknown, answered with zero).

The DART streams switched and kept are T8140's, taken from its
dcp_s2r_t8140 layout, as DCP_S2R_DISP_STREAMS and DCP_S2R_DCP_STREAMS.

Bring-up, not for upstream as is.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Three changes to the T6041 display stop and restart:

- At the first stop of an external pipe, mark its display DART dark
  for good while its block is still on. The stop forces the external
  display domains off and nothing raises them again, so a later
  framebuffer unmap flushed a DART behind a dead block and the CPU
  doing it never returned (login or sddm restart after a wake).
- At restart, set bit 0 of bridge 4's two words only with the new
  s2r_bridge_arm parameter (default off). Boot leaves the bit clear,
  and with it set the driver's display power-off after a wake froze
  the machine. Print the bridge words at restart.
- Keep the internal pipe's GAPF word as boot left it, and write it
  back after the restart only with the new s2r_gapf_restore parameter
  (default off): writing it back after a wake froze the machine.

Bring-up, not for upstream as is.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Lower the default settle/words/stop/down waits of the T6041 display
stop and restart from 1000/500/2000/1000 ms to 200/100/300/100 ms,
the values used in the 11 Nov wake runs. They stay module
parameters.

Bring-up, not for upstream as is.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
When the resume comes via firmware and no DMA window is set, the
function lost its power and its firmware is gone; every resume command
would only time out before the rebind anyway. Skip them and queue the
rebind directly, so probe boots the firmware from scratch.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
After a real sleep, setting the PCIe ports up again takes about
0.75 s, and the NVMe resume waits 0.2 to 0.9 s on its coprocessor.
Enable async suspend/resume on both platform devices so they do not
hold up the other devices.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
On T6041 a level interrupt fired again at once every time it was
unmasked although its line was inactive: the J616c speaker amps on
pin 55 (mode 3, data 1) raised about 140 interrupts a second from boot
until the core disabled the line as unhandled. Switching the pin's
mode back from "off" leaves its status bit set. Clear it once more in
the unmask of a level interrupt; a level that really is active sets it
again.

Untested bring-up: not yet run on hardware.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Refuse a firmware suspend in sleep_enter() with one line, -EBUSY, when
the enclave's mailbox stays full for 100 ms: it isn't reading, and the
commit's own check would only find out after its send wait with
interrupts off. A Lost enclave (one that did not come back from a sleep
earlier this boot) is refused with -EBUSY and a log line too, instead
of a silent -EIO. Mailbox gains send_ready().

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
…it sends SLEEP

The sleep core stages the enclave's SLEEP for its commit, which sends
it with interrupts off; only the T8140 commit does that. T6041 has a
sleep driver of its own and no such commit, so the staged request was
refused there, and a commit-time send the T6041 driver ran itself made
the J616C reset in its first test.

Where apple_sleep_commit_stops_coprocs() is false on a firmware
suspend, put the enclave to sleep as the T6041 bring-up kernel does,
an order that has passed many sleeps on the J616C: at device suspend,
seconds before the commit, save its DART, send SLEEP (mode byte 0x02,
as op_sleep() has it), wait for the answer, hold its receive side,
and let suspend_noirq wait up to 5 s for it to gate its domain. On a
refused sleep, an enclave that gated stays asleep until the next real
sleep, and one that didn't is asked whether it still answers.

A deep sleep is refused at once, -EBUSY with one line, over an enclave
that did not answer a sleep request or a wake earlier this boot, that
did not finish coming up, or whose mailbox stays full: a commit over a
running enclave resets the SoC.

T8140 keeps the commit-time SLEEP unchanged.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The probe line and the header comment still said "test, entry only"
and "no resume yet". The driver resumes: the commit writes cpu_resume
into aura's S2R mailbox, and the wake comes back through it. No code
change.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The spin table only stops a parked CPU that answered a hold first:
smp_rvbar_spin_table_cpu_die() leaves the park for the stop only while
spin_table_hold_parked() has asked for it. The T6041 commit called
spin_table_stop_parked() without the hold, so every other core stayed
awake in the park, with its power state still on. The sleep engine then
waited for the cores, and the watchdog reset the SoC about 5 s after
the commit.

Ask for the hold in .enter while the suspend can still be refused, as
the sleep core does for T8140, and refuse the sleep if a parked CPU
does not answer.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The driver writes the PMU over the SPMI controller by itself and gave
each command's reply a fixed 50 us before draining the FIFO. A reply
that arrived later stayed there. The controller keeps its power
through the sleep, so after the wake the SPMI driver's next command,
the RTC's acknowledge of the alarm that woke the machine, read that
reply ("unexpected SPMI response 0x8b30"), the RTC marked its I/O as
failed and refused every later suspend.

Poll for the reply for up to 1 ms, then drain the FIFO.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
While Linux is away the queue keeps being used: aura's wake path and
the platform's sleep code write the PMU through it. Every command the
driver sent was answered before the suspend, so a reply still waiting
at the resume is someone else's, and the next command takes it as its
own. On the M4 Max that was the RTC's acknowledge of the alarm that
woke the machine ("unexpected SPMI response 0x8b30"), after which the
RTC refused every later suspend.

Read such replies out at resume_noirq after a firmware-driven suspend.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
aura writes the PMU on the same queue at the wake. Waiting for the
first reply after a write could take one of its replies for ours and
leave ours behind. Empty the FIFO before the write as well.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
… lists

On T6041 the enclave is told to sleep at device suspend. Its DART is
saved first with apple_dart_sleep_prepare(), which only saves a DART
whose node has apple,sleep-restore, and only such a DART is then left
alone by its own callbacks. Without the property nothing was saved, the
enclave slept, its power domain went off, and the DART's noirq suspend
read its registers: the suspend hung there. This was seen on a J614C
booted with the in-tree device tree, which has no lists for that DART.

Refuse the sleep at suspend instead when the DART has no list.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Without the mailbox the driver set its suspend ops anyway and refused
every sleep in .enter. Deep sleep is then the default, so a kernel
booted at EL2 by another loader could not suspend at all. Don't bind
instead.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The T6041 sleep driver binds to an "apple,t6041-sleep" node, which the
J614c and J616c device trees get at their root. The node has no
registers and no properties: the driver maps the blocks it writes
itself, and finds its way back from a sleep through the boot loader's
S2R mailbox in /chosen. The other Apple sleep bindings (apple,t8140-sleep
and apple,t6050-sleep) require the registers and the display
coprocessors, so this node gets a binding of its own.

Without it, CHECK_DTBS reports /t6041-sleep in t6041-j614c.dtb and
t6041-j616c.dtb as matching no schema.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Give the SEP's DART the writes around a sleep that T8140's has, as the
J616C's bring-up device tree does: the SEP driver saves the DART with
them before the enclave sleeps at suspend, and refuses that sleep
without them.

Add the apple,t6041-sleep node to the J614C and J616C, so the in-tree
device tree is enough to test suspend-to-RAM there. The driver stays out
unless aura passes its S2R mailbox.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The 40-core J614C on 25G83 firmware runs CONFIG_25G83, which had no
sleep_restart, so its GPU refused every deep sleep. Set it as the
32-core profile has.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Remove what was only there to find the sleep's problems on hardware:
the dry, diag and serror_go parameters, the progress marks and notes in
PMU scratch and SRAM, the register snapshot against the macOS table at
the commit, the before and after windows with their S2RDIFF and S2RAMCC
lines, the console, die and panic notes, and code nothing called any
more (the MCC stop, the AXI2AF teardown, the core snapshot).

The writes, delays and polls of the commit and of the wake are the same
as before. The AMCC cache words and the display's PMC votes, which the
wake puts back, are saved on their own now instead of through the
comparison windows. The clkgen write-back that worked from those windows
only ran with diag set, and goes with them. What the wake could not
bring back is reported at .end.

apple_sleep_coprocs_count() had no other user and goes too.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
apple_dart_display_keep() read the whole register block of a display
DART before a sleep and printed what differed after the wake, with each
stream's TCR and TTBR. That was only there to look for what the wake
took. Keep the TCR and TTBR save and write-back, and declare the helper
in <linux/soc/apple/dart.h> instead of in its caller.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The display stop and restart for T6041's deep sleep ran as test steps
first: an s2r_stop parameter took them one at a time, and each step
wrote progress marks to PMU scratch, logged S2RSTOP, S2RSTART and
S2RTIME lines and kept result words. A kmsg dumper put a panic's call
trace into PMU scratch, and s2r_bl showed the backlight state.

Remove all of that, and the parameters with it. The waits are constants
with the values that ran (settle 200 ms, words 100 ms, stop 300 ms,
down 100 ms), and each switch keeps the behaviour it had by default: the
display power-off without the sleep transition (s2r_hard = 2), bridge 4
left as boot has it, the GAPF word not written back, the backlight and
the boot power words restored, the steps run from the display's own
suspend and resume. What fails is still reported. The power word step
now unmaps what it maps.

dcp_sleep() has no caller again and gets its __maybe_unused back.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
…ISPEXT

The M4 Max gate enables each external display chain as the in-tree
trees describe it: no DISPEXT power domain, the domains are on as iBoot
left them. The J616c's bring-up EL2 tree does describe them: the chains'
DARTs, mailbox and DCP point at dispextN_fe, which is disabled like the
PMP report entries above it. Enabled as they were, those devices waited
for power domain providers that never came and failed at the deferred
probe timeout (the mailboxes with -110), and the display subsystem never
bound: the internal panel stayed on simpledrm.

Drop the power-domains property of a chain node whose domain stays
disabled, so such a tree ends up as the in-tree ones do. Nothing changes
with the in-tree trees.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The power word step forces both external display chains down, and the
display subsystem maps every framebuffer through their display DARTs.
Only the DART of an external DCP the stop visited was marked dark, but
a DCP whose probe failed (the display subsystem skips it as unusable)
is not bound to the DCP driver, and the stop never saw it. After the
wake, an sddm restart or a logout unmapped a framebuffer, flushed that
DART behind its dead block, and the machine stopped: on the J616c the
HDMI chain's display DART at 0x3a2300000.

Mark the external chains' display and DCP DARTs dark by device tree
node right before their power words go down, while they can still be
read, whether or not their DCP bound.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The display stop for a T6041 sleep kept one "stopped already" slot per
external DCP by name: dcp@3a2e00000 got one, every other external DCP
shared the second. With more than two external chains enabled (dcpext2,
dcpext3) the second external DCP to be stopped marked that slot, and
any after it was skipped: its firmware still ran at the commit. The
DARTs made dark before the power word step were also only those of the
first two chains.

Keep the mark in each DCP, and make the display and DCP DARTs of every
enabled apple,t6041-dcpext node dark, found through the device tree.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The full T6041 has eight AMCCs and 32 memory channels, the binned one
six and 24. The sleep path only handled 24: the AMCC quiesce, the cache
flush and way restore, and DCS dynamic power gating stopped at the sixth
AMCC, and the macOS commit table (from a binned J616c) has no words for
amcc24-31 or dcs_24-31. On a full J614c those words stayed forced on at
the commit, holding fab3_soc on, and the chip reset instead of sleeping.

Count the channels at probe from amcc24's and amcc28's PS words, which
read target and actual 0 on the binned part. On the full part, run the
quiesce, flush and restore on all eight AMCCs. Put the 15 extra words on
AUTO as macOS has the same kind of word, save them first, and put them
back on the wake before the cache restore.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
The sleep commit writes WKTP = 2 on T6041, but nothing wrote it back.
With the key left at 2 the SMC treats all the time awake after the first
sleep as a power nap: it keeps its own fan policy against a fan request
(on the J616c every fan target write timed out after about 10 s and the
fans stayed at 0 rpm under load), and under thermal load it requests a
sleep once a second ("SMC Thermal pressure requested Sleep during power
nap" in its syslog), slowing the machine down. Only a reboot cleared it.

Write WKTP = 0 after a full wake, and when the sleep ends in a refusal
(apple_smc_complete), as the M4 Pro sleep series in aurora-silicon#1910 does. A dark
wake keeps the key: it sleeps again, and the next commit writes it anyway.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
… EIO again

integration/aurora now requires request-path messages in apple_sep to
be rate-limited (tools/aurora-sep/tests/test_log_ratelimit.py). Use the
rate-limited macros for the T6041 suspend-time sleep path and the
mailbox check.

On platforms with a sleep core commit, sleep_enter() refused a Lost gate
with EBUSY and a message; integration/aurora refuses it with EIO, which
sep-suspend-errors-tests checks. Take that back: T6041 never reaches
it, it sleeps through the suspend-time path.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
…ests

The bcm4377 resume and SEP suspend tests compile extracted driver
functions against fixtures. The T6041 S2R code those functions now call
is not in the fixtures, so neither test built.

bcm4377: dma_window_base, pm_resume_via_firmware() and
bcm4377_queue_rebind(). The controls model resumes after s2idle, so
pm_resume_via_firmware() is false and the rebind is never reached.

SEP: sleep_at_suspend, sleep_enter_at_suspend(), sleep_exit_at_suspend(),
mailbox_drains() and pm::platform_commit(). Every platform the test
models has a sleep core commit, so platform_commit() is true, the
suspend-time path is never taken and the mailbox always drains.

All controls and mutations pass, as does the whole run-host-tests.py
suite (321/321).

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
…as macOS

At boot, macOS's ApplePMGR::start puts every ADT pmgr device whose flag
bit 2 is clear under hardware power management: target f, wait for the
device to reach f, then AUTO_ENABLE (bit 28). On the M4 Max, iBoot does
this for the AMCC slices but leaves the 24 DCS channels and the fabrics
forced on, so under Linux they never gate when idle.

Do the same for those 36 power-state words, in macOS's order, at
arch_initcall, before the PMP driver loads: set later, on a running
system with the PMP up, it froze the machine. Words that are fused off,
not forced on, or already on AUTO are left alone. t6041_mem_auto=0 on
the command line skips it.

The words, their order and the sequence are those of macOS 26.6.2's
ApplePMGR (25G83) on the J616c.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from a0ab1c8 to 42443cc Compare November 17, 2026 22:02
@joske

joske commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Tested on the J614c (16-core CPU / 40-core GPU M4 Max, the full T6041 with 32 memory channels), on top of #1664.

The full part has eight DCS channels that the J616c list doesn't cover: dcs_24-27 and dcs_28-31. On the J614c, iBoot leaves them forced on like the other 24, so with only the 36 words from the PR they stay on. I added them after the others in each block:

	0x502800210, 0x502800220, 0x502800230, 0x502800240,	/* dcs_16-19 */
	0x502800250, 0x502800260, 0x502800270, 0x502800530,	/* dcs_24-27 (full part) */
	...
	0x502280320, 0x502280328, 0x502280330, 0x502280338,	/* dcs_20-23 */
	0x502280340, 0x502280348, 0x502280350, 0x502280358,	/* dcs_28-31 (full part) */

dcs_27 isn't next to dcs_26: it's at main +0x530, and +0x280 is amcc27. It's the same word as the dcs_27 line I suggested on #1664. I don't know macOS's order for these eight. I used the ADT order, since I have no J614c ApplePMGR trace.

Result:

  • The boot says memory and fabric power management: 44 words on AUTO, 0 late, with no new errors. All eight were forced on and got switched.
  • A lid sleep and wake afterwards works, with the same wake log as without the change.
  • I didn't measure power.

On the J616c the eight extra words should be fused off, so your check skips them and the count stays at 36. I can't test that here. Could you confirm it on yours, if you add them?

🤖 Generated with Claude Code

… too

The full T6041 has 32 memory channels, the binned one 24. The words put
on AUTO at boot come from a binned J616c, so on a full part iBoot's
forced-on dcs_24-31 stayed forced on.

Add their eight power-state words after the other DCS words of each
PMGR group: dcs_24-27 in the main group, where dcs_27 is at +0x530, as
+0x280 is amcc27, and dcs_28-31 in the East group. They go in ADT
order, as there is no macOS trace from a full part. On the binned part
they are fused off, so the existing check skips them: the binned part
puts 36 words on AUTO, the full part 44.

The full part's eight DCS words and their order come from joske's J614c
test on aurora-silicon#2175.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Thanks for testing it on the full part, and for the words.

I've added them as a new commit on top, "soc: apple: t6041-sleep: the full part's DCS channels on AUTO at boot too", as you wrote them: dcs_24-27 after dcs_16-19, with dcs_27 at main +0x530, and dcs_28-31 after dcs_20-23, in ADT order. The comment above the list now says that the full part's words are in ADT order and that the binned part skips them. The commit message credits your J614c test.

On this J616c (binned: 24 channels, 6 AMCCs), one boot of my daily kernel with only this commit added:

  • The boot line: t6041-sleep: memory and fabric power management: 36 words on AUTO, 0 late.
  • All eight words read 0x0f000300 after that boot (target 0, actual 0, auto 0): fused off on the binned part, so the check skips them. That includes dcs_27 at +0x530, which hadn't been read on the J616c before.
  • No warnings or errors in the first 120 s that the daily boot doesn't have (the only differing line is which out-of-tree module printed the taint notice first).

Seven of the eight (dcs_24-26 and dcs_28-31) already read 0x0f000300 here when I looked at them for #1664 on 13 Nov. dcs_27 at +0x530 wasn't among the words I read then.

So the count stays at 36 here, and it's 44 on your J614c.

Disclosure: prepared with an AI tool (the commits carry Assisted-by: LLM); tested as described.

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.

2 participants