Skip to content

soc: apple: sleep: T6030 (M3 Pro) profile, draft - #2689

Closed
aronvandepol wants to merge 5 commits into
aurora-silicon:mainfrom
aronvandepol:t6030-sleep-profile
Closed

aronvandepol wants to merge 5 commits into
aurora-silicon:mainfrom
aronvandepol:t6030-sleep-profile

Conversation

@aronvandepol

@aronvandepol aronvandepol commented Nov 21, 2026 •

Copy link
Copy Markdown

Draft, for review against the T6040 (#2215) and T6050 profiles. The branch is on integration/aurora at a84637d. Compile-tested only. It has never been booted on integration/aurora. Context and the earlier runs are in #2687.

What is here

  1. soc: apple: sleep: allow a profile with no display coprocessor. These are soc: apple: sleep: T6040 (M4 Pro, J616s) suspend-to-RAM #2215's two ndisp hunks, copied byte for byte so the two branches merge in either order. T6030 has ndisp = 0.
  2. soc: apple: sleep: offer deep sleep for early-context SoCs as for the rest. apple_sleep_early_ops used suspend_valid_only_mem, so an untested early-context profile would list deep without apple_sleep.deep=1. It now uses apple_sleep_valid(), which answers the same for every tested SoC.
  3. dt-bindings: soc: apple: add the T6030 sleep controller, with a MAINTAINERS line, in the shape of the T8140 binding.
  4. soc: apple: sleep: add T6030 profile (sleep-t6030.h), the match entry, a Kconfig help line and the KUnit changes.
  5. arm64: dts: apple: t6030: add sleep controller. The node goes in t6030.dtsi with status "disabled", and apple,wake-enable goes in t6030-j516s.dts.

The profile follows T6040's structure. It runs early-context with its own register map, commit_regs and wake. The commit releases the secondaries first and polls their power words off, turns WD0 off, writes the AON AP deadline 0, sets nub-spmi0's notify enable and clears the complex words' low nibbles. The steps are fixed. There is no module parameter to switch them, and no new one anywhere in the branch. Every address is from the J516S ADT.

No provider driver is carried. The out-of-tree port had one for the device side (display off, SMC keys, PMP idle, SEP, memory cache). Each of its steps here either uses a mechanism the core already has or is listed under TODO.

Measured on J516S with the out-of-tree 7.2.11 port

These come from the earlier runs (#2687), not from this branch. The profile keeps each one as data or a comment.

  • The CPU-start stride is 6.
  • A core's wake needs CPM_PWRDN_CTL (S3_5_C15_C6_2) bits 0 and 63 cleared again. cpu_restore clears them on each starting core, and the wake op clears them first thing on the boot core.
  • The last WFI needs CYC_OVRD WFI mode 3 with retention off, or a core keeps cpuidle's mode 2 and never power-gates. deep_wfi_arm saves each core's CYC_OVRD and sets it, and cpu_restore puts it back.
  • Reading EDPRCR hangs the SoC. Unlike T6040, the profile never touches the external debug block.
  • The SMC's AP idle notice must be AP-only SET_AP_PWR_STATE 0x201. An IOP 0x201 word made the SMC power-cycle the SoC 5-9 s later. With no smc_policy, macsmc's noirq suspend already sends apple_rtkit_ap_power(false) after slpa, which is AP-only, so the profile has no commit_notice.
  • A sleep that came back after MBSE = slpa had lost the SSD (EIO, btrfs read-only) until a reboot. The log reads it as the SMC cutting ANS's NAND link. That was the port's SMC and NVMe code. Integration's macsmc and NVMe resume path were never run on T6030, so here the loss is expected, not measured.
  • A dry run under the port returned and then hung about a minute later. The cause was not found.
  • The GPU's AGX vote must be withdrawn before the PMP goes idle, or the PMP firmware crashes.
  • WD2 does not arm. The core still arms it at .begin and the wake re-arms it as T8140 does, but there is no watchdog net. A hang after the commit word ends only with a long power-button press.
  • The same register sequence, with the provider's device side before it, wrote the commit word with every secondary off and then hung. It never woke, and no reset came. Lowering SIO's power word as well (after the T6050 finding in T6050 K116s (27.2): deep sleep entry completes, the SoC does not sleep; DCP secure mailbox and DCPEXT handoff needed #2075 that iBoot left VENC0_SYS on) gave the same hang.

This branch: what it does if enabled

The DT node is disabled. An available sleep-controller node also changes pmp-export's suspend path, because pmp-export registers its commit stop whenever it finds one. To try it, set status = "okay" on &t6030_sleep in t6030-j516s.dts, boot with the aurora mailbox in /chosen and pass apple_sleep.deep=1.

  • Without apple_sleep.untested_commit=1, echo mem > /sys/power/state fails at .begin with -EBUSY and "dry run refused at .begin: the SMC's slpa cost the SSD on the out-of-tree port". No device suspends and the SMC hears nothing. With no smc_policy, macsmc sends slpa at its noirq suspend, before .enter could refuse, so a dry run that got further would be expected to cost the SSD for nothing. This differs from the usual untested-profile dry run, which reaches .enter. That alternative was rejected for this reason. final_check keeps a dry-run stop for an untested_commit cleared after .begin.
  • The intended gate is the DT opt-in that soc: apple: sleep: T6050: drop the AUSS, display DART and core-start switches #2657 announced, apple,deep-sleep = "dry-run" | "commit" in place of deep and untested_commit. It is not in integration/aurora yet, so this branch does not depend on it. Once it lands, the J516S node would start as "dry-run". The .begin refusal would stay until slpa moves behind the dry-run point (TODO 2), because a "dry-run" sleep would still reach .enter after macsmc's noirq slpa.
  • With apple_sleep.untested_commit=1, the sleep is refused at .enter with "refused: ANS or PCIe is on with no driver to stop it". The SMC has had slpa by then, so expect the SSD to be gone until a reboot. Do not run this until the ANS item below is done.
  • Past that point a commit is expected to hang as the out-of-tree port did, with no watchdog to end it.

nub-spmi0 stays out of apple_sleep.spmi. That keeps the core's untested-SoC PMU notes from writing PMU 0x8308.., which is not known to be free scratch on T6030's PMU. The out-of-tree port kept its stage record at PMU 0xf810.

Boot risk of the DT change

On the port, a boot.bin whose DTB carried the sleep node stopped in m1n1 at "Running proxy" and never reached the payload. The suspect was the gzip payload landing at an offset that is not 4-aligned once the DTB grew by 477 bytes. That was never confirmed, and later runs added the node through an overlay instead. status = "disabled" keeps the node in the DTB, so every J514S and J516S boot from a boot.bin built with this tree carries the same risk until it is understood.

TODO

In the order a commit needs them.

  1. ANS. The T6030 NVMe (apple,t6030-nvme-ans3) matches t8103's data, which has no sleep_traced, so it registers no sleep stop and every sleep is refused at the ANS check. It also needs the apple,apcie tunables for ANS's PCIe block.
  2. The SMC's slpa has to move behind the dry-run point, through a T6030 smc_policy or a macsmc hook. Then the dry run can reach final_check instead of stopping at .begin.
  3. GPU. G15 (asahi_g15_pmp_get/put) holds its PMP vote for the whole session and has no sleep stop. It needs a first-pass stop through apple_sleep_coproc_register_first() that withdraws the vote before pmp-export's stop idles the PMP.
  4. Display. display_off is empty and ndisp is 0. The out-of-tree port lowered the display pipes from its provider.
  5. SEP. No sleep request was ever sent on T6030, and the out-of-tree port left it running. Whether the SEP's enclave stop registers on T6030 was not checked.
  6. Memory. The AMCC cache off and the DCS/AMCC error enables, staged in final_check with undo_regs to put them back.
  7. Power words. Lower SIO's (0x1b8), the PMP's (0x4c8) and PMS SRAM's (0x4d0) once their coprocessors have stopped. On the port, lowering SIO's did not change the hang. A diff of the power words against macOS at its commit, as T6050 K116s (27.2): deep sleep entry completes, the SoC does not sleep; DCP secure mailbox and DCPEXT handoff needed #2075 did for T6050, is the open lead.
  8. A watchdog net, since WD2 does not arm.
  9. A gate_coprocs list (DCP, SIO, PMP) was considered and left out. Each word would then also need a ps_all.
  10. Not carried, needed only if a macOS commit trace on T6030 shows them: T6040's PMU boot stage 0x50 (PMU 0xf801) and nub-spmi-a0 notify enable, and T8140's SoC perf state (0x35005c000 = 2), clock-mux parking (0x350040000, six muxes) and CLLT clear (0x350768000 +0x24 bits 16-17). The port's runs had all five off. Their blocks are out of the binding and the DT node too.

Also not ported: the provider's SIQ park/unpark hooks, its CPU-start stop-bit switch (the core always writes the stop bit), its stage markers, RTC alarm and wake fix-ups other than the CPM and CYC_OVRD ones above.

Checks run

On an x86 host with clang 18.1.8 (ARCH=arm64 LLVM=1, Rust on), config from the earlier T6030 build plus olddefconfig, CONFIG_APPLE_SOC_SLEEP=y.

  • drivers/soc/apple/sleep.o with W=1, 0 warnings and 0 errors.
  • drivers/soc/apple/, 0 errors and 9 warnings, all in Rust code this branch does not touch. The same 9 come from untouched integration/aurora.
  • sleep.o with CONFIG_KUNIT=y CONFIG_APPLE_SOC_SLEEP_KUNIT_TEST=y and W=1, 0 warnings. The KUnit suite was not run, since there is no arm64 QEMU on the build host. The suite lists the T6030 compatible and adds apple_sleep_test_t6030. The shared-path list and MCC checks now skip a profile with its own commit_regs and no lists. soc: apple: sleep: T6040 (M4 Pro, J616s) suspend-to-RAM #2215's T6040 profile would need the same.
  • dtbs, with t6030-j514s.dtb and t6030-j516s.dtb rebuilt and 0 warnings.
  • Image builds with 0 errors. The full build had 2 warnings, unused functions in drivers/iommu/apple-dart-dcp.h, which this branch does not touch.
  • dt_binding_check DT_SCHEMA_FILES=soc/apple/apple,t6030-sleep.yaml passes. dt-validate passes on the J516S node set to okay, and it fails as expected when apple,wake-enable is removed.

Refs #2687

https://claude.ai/code/session_016eHgyJKRZBHRz41DTDHS7m

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the careful write-up. An early read of the draft:

  • Commit 2 (apple_sleep_early_ops → apple_sleep_valid) is a real fix and safe for the existing early-context SoC. T6050 is qualified, so it still offers deep sleep, and an untested early-context profile no longer lists deep without the opt-in.
  • t6030_steps (module parameter, 0644) is a runtime switch. The rule here is that merged code picks its behaviour itself. For a profile that has never been booted on this tree, the "untested" gate already keeps it from committing by default. soc: apple: sleep: T6050: drop the AUSS, display DART and core-start switches #2657 is moving that gate to a DT property (apple,deep-sleep = "dry-run" | "commit"), so a T6030 board could start as "dry-run" there. If the steps are needed only while bringing it up, keeping them out of the merged version (or in debugfs) would fit better.
  • The measured facts (stride 6, CPM_PWRDN_CTL bits, CYC_OVRD WFI mode 3, never touching EDPRCR, AP-only 0x201) are exactly what the profile should carry. Keeping each one as a named field or a comment pointing at T6030 J516S (16" M3 Pro): deep sleep commit word is written, the SoC does not sleep #2687's runs, as you've done, makes them reviewable.

Assisted-by: LLM (Claude:Opus 5.5)

@aronvandepol

Copy link
Copy Markdown
Author

Thanks. Updated (head 9a0959c, rebased on integration/aurora a84637d):

  • t6030_steps is gone. The steps its default had on are now fixed in the profile, with no module parameter and no debugfs. The five that were off by default (PMU boot stage, nub-spmi-a0 notify, SoC perf, clock-mux parking, CLLT) are dropped and listed in the TODO as "needed only if a macOS commit trace on T6030 shows them". The binding loses their four reg entries (13 -> 9).
  • soc: apple: sleep: T6050: drop the AUSS, display DART and core-start switches #2657 is in the base, but apple,deep-sleep is not in integration yet, so the branch does not depend on it. The PR body names it as the intended gate. One note for that work: on T6030 a "dry-run" that reaches .enter would still have sent slpa from macsmc's noirq suspend (no smc_policy), which cost the SSD on our port. So the profile keeps its refusal at .begin until slpa can move behind the dry-run point.
  • The measured facts stay as named fields and comments pointing at T6030 J516S (16" M3 Pro): deep sleep commit word is written, the SoC does not sleep #2687.

Builds: sleep.o W=1 clean, dtbs clean, dt_binding_check and dt-validate clean, KUnit config compiles (not run, no arm64 QEMU here).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Nothing for T6030 is in the sleep core on integration/aurora (4a17f73), and this draft still merges onto that tip without conflicts after the J604 sleep changes that landed since (#1966, #1968). Commit 2 (apple_sleep_early_ops using apple_sleep_valid()) is a standalone fix; the tip still has suspend_valid_only_mem there, so it could go in on its own ahead of the profile. @aronvandepol two small things when you next push: drop the Claude-Session: trailers from the five commits (the disclosure belongs in the PR description), and keep an eye on #2215, which carries the same two ndisp hunks and is still open. The profile itself stays draft until the items in your TODO (ANS stop, slpa ordering, GPU vote, watchdog) have a first boot on this tree.

Aron van de Pol added 5 commits November 23, 2026 10:10
A SoC whose own display_off op takes its display pipes down needs no
entry in apple,display-coprocessors, and the core then never marks
display[0] bound. Accept ndisp == 0 in the profile check, and only refuse
for an unbound display coprocessor when the profile names one.

These are the same two hunks as in the T6040 profile (aurora-silicon#2215), so the two
branches merge without a conflict in either order. The T6030 profile
that follows has ndisp == 0.

Signed-off-by: Aron van de Pol <hello@aronvandepol.com>
Assisted-by: LLM (Claude:Opus 5.5)
… rest

apple_sleep_early_ops took suspend_valid_only_mem, so an untested
early-context profile would list deep in /sys/power/mem_sleep without
apple_sleep.deep=1. No such profile existed until now. Use
apple_sleep_valid(), which answers the same for every tested SoC and
keeps deep hidden for an untested one unless it is asked for.

Signed-off-by: Aron van de Pol <hello@aronvandepol.com>
Assisted-by: LLM (Claude:Opus 5.5)
The M3 Pro's sleep registers: the commit word, the PMGR power states,
power gates, CPU-start block and complex words, the AON watchdog, the AP
wake-enable words and nub-spmi0. The AON AP watchdog deadline is
optional, and the profile leaves it alone when it is missing.

Signed-off-by: Aron van de Pol <hello@aronvandepol.com>
Assisted-by: LLM (Claude:Opus 5.5)
An untested profile for the M3 Pro (J516S), in T6040's shape: early
context, its own register map, commit_regs and wake, the secondaries
released at the start of the commit and their power words polled off,
WD0 off, the AON AP deadline 0, nub-spmi0's notify enable and the
complex words' low nibbles to 0. The steps are fixed, with no module
parameter to switch them. T6040's PMU boot stage and nub-spmi-a0 steps
and T8140's SoC perf, clock-mux and CLLT steps are not carried: the
out-of-tree port's runs had them off.

The register sequence comes from an out-of-tree 7.2.11 port, where it
wrote the commit word with every secondary off and then hung. That port
had a separate driver for the device side. None of it is carried here:
each step either uses a mechanism the core already has or is a TODO in
the header.

Measured on J516S (aurora-silicon#2687) and kept in the profile:
 - the CPU-start stride is 6;
 - a core's wake needs CPM_PWRDN_CTL bits 0 and 63 cleared, done in
   cpu_restore on each starting core and first thing in the wake;
 - the last WFI needs CYC_OVRD WFI mode 3 with retention off, saved and
   put back per core;
 - reading EDPRCR hangs the SoC, so unlike T6040 nothing touches the
   external debug block;
 - the SMC's idle notice must be AP-only 0x201, which macsmc's
   no-policy path already sends, so there is no commit_notice;
 - WD2 does not arm.

A dry run is refused at .begin, before any device suspends. With no
smc_policy, macsmc sends slpa at its noirq suspend, before .enter could
refuse. On the out-of-tree port a sleep that came back after slpa had
lost the SSD until a reboot, and the same is expected here. final_check
keeps the dry-run stop for an untested_commit cleared after .begin.
The refusal stays even once a DT opt-in (apple,deep-sleep = "dry-run",
proposed after aurora-silicon#2657) replaces untested_commit: a dry run there still
reaches .enter after macsmc's noirq slpa, unless slpa moves too.

nub-spmi0 stays out of apple_sleep.spmi so that the core's PMU notes do
not write PMU 0x8308.. on a PMU where that is not known scratch.

KUnit: the T6030 compatible is listed, and the shared-path list and MCC
checks skip a profile with its own commit_regs and no lists. Compiled,
not run.

Signed-off-by: Aron van de Pol <hello@aronvandepol.com>
Assisted-by: LLM (Claude:Opus 5.5)
The T6030 sleep registers from the J516S ADT, as T6040 and T6050 have
theirs: a sleep-controller node with reg, reg-names and, on the board,
apple,wake-enable (the ADT's pmgr ap-wake-sources).

The node stays disabled. The profile is untested, and an available
sleep-controller node also changes the PMP's suspend path, since
pmp-export registers its commit stop when it finds one. A test boot
sets status = "okay" on &t6030_sleep.

Signed-off-by: Aron van de Pol <hello@aronvandepol.com>
Assisted-by: LLM (Claude:Opus 5.5)
@aronvandepol

Copy link
Copy Markdown
Author

Done: the five commits are pushed again without the Claude-Session: trailers (head 17ac166, same tree as 9a0959c), and the disclosure stays in the PR description. Commit 2 is on its own in #2960, on top of integration/aurora a4b51cd. I'll keep #2215 in view for the ndisp hunks.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@aronvandepol checking open drafts today. To come out of draft, this still needs:

  • It conflicts with main. Merge main in or rebase (no force push needed: a merge commit is fine).
  • Then a test run at the final head on a Mac with the hardware it touches, and mark it ready for review.

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.

@aronvandepol

Copy link
Copy Markdown
Author

Not needed as a draft for now, please close it. The profile can't pass a test at head yet: with the node disabled it proves only that the J516S boots, and with it enabled the sleep is refused at .begin or hangs. The open lead is the macOS-at-commit power-state diff from aura#508, which will likely change the profile. The branch t6030-sleep-profile stays, and I'll open a fresh PR against main once that diff exists. The ndisp = 0 hunk is still needed then (main still rejects it), unless #2215 lands first. Work continues in #2687.

@aronvandepol

Copy link
Copy Markdown
Author

Correction to the above: with untested_commit=1 this branch is refused at .enter on the ANS check, after macsmc has sent slpa, so the SSD is expected to drop. It does not reach the port's hang. A fresh PR needs more than the macOS diff. It waits on the items from 22 Nov (ANS stop, slpa ordering, GPU vote, watchdog) having a first boot on main. Commit 2 is already on main as b43e2b08. Closing this myself. The branch stays.

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