Repository navigation
soc: apple: sleep: T6030 (M3 Pro) profile, draft - #2689
aronvandepol wants to merge 5 commits into
Conversation
|
Thanks for the careful write-up. An early read of the draft:
Assisted-by: LLM (Claude:Opus 5.5) |
5de1dff to
9a0959c
Compare
|
Thanks. Updated (head 9a0959c, rebased on integration/aurora a84637d):
Builds: sleep.o W=1 clean, dtbs clean, dt_binding_check and dt-validate clean, KUnit config compiles (not run, no arm64 QEMU here). |
|
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 ( |
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)
9a0959c to
17ac166
Compare
|
@aronvandepol checking open drafts today. To come out of draft, this still needs:
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. |
|
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 |
|
Correction to the above: with |
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
soc: apple: sleep: allow a profile with no display coprocessor. These are soc: apple: sleep: T6040 (M4 Pro, J616s) suspend-to-RAM #2215's twondisphunks, copied byte for byte so the two branches merge in either order. T6030 hasndisp = 0.soc: apple: sleep: offer deep sleep for early-context SoCs as for the rest.apple_sleep_early_opsusedsuspend_valid_only_mem, so an untested early-context profile would list deep withoutapple_sleep.deep=1. It now usesapple_sleep_valid(), which answers the same for every tested SoC.dt-bindings: soc: apple: add the T6030 sleep controller, with a MAINTAINERS line, in the shape of the T8140 binding.soc: apple: sleep: add T6030 profile(sleep-t6030.h), the match entry, a Kconfig help line and the KUnit changes.arm64: dts: apple: t6030: add sleep controller. The node goes int6030.dtsiwith status "disabled", andapple,wake-enablegoes int6030-j516s.dts.The profile follows T6040's structure. It runs early-context with its own register map,
commit_regsand 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.
cpu_restoreclears them on each starting core, and the wake op clears them first thing on the boot core.deep_wfi_armsaves each core's CYC_OVRD and sets it, andcpu_restoreputs it back.smc_policy, macsmc's noirq suspend already sendsapple_rtkit_ap_power(false)afterslpa, which is AP-only, so the profile has nocommit_notice.MBSE = slpahad 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..beginand 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.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_sleepint6030-j516s.dts, boot with the aurora mailbox in /chosen and passapple_sleep.deep=1.apple_sleep.untested_commit=1,echo mem > /sys/power/statefails at.beginwith -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 nosmc_policy, macsmc sendsslpaat its noirq suspend, before.entercould 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_checkkeeps a dry-run stop for anuntested_commitcleared after.begin.apple,deep-sleep = "dry-run" | "commit"in place ofdeepanduntested_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.beginrefusal would stay untilslpamoves behind the dry-run point (TODO 2), because a "dry-run" sleep would still reach.enterafter macsmc's noirqslpa.apple_sleep.untested_commit=1, the sleep is refused at.enterwith "refused: ANS or PCIe is on with no driver to stop it". The SMC has hadslpaby then, so expect the SSD to be gone until a reboot. Do not run this until the ANS item below is done.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.
apple,t6030-nvme-ans3) matches t8103's data, which has nosleep_traced, so it registers no sleep stop and every sleep is refused at the ANS check. It also needs theapple,apcietunables for ANS's PCIe block.slpahas to move behind the dry-run point, through a T6030smc_policyor a macsmc hook. Then the dry run can reachfinal_checkinstead of stopping at.begin.asahi_g15_pmp_get/put) holds its PMP vote for the whole session and has no sleep stop. It needs a first-pass stop throughapple_sleep_coproc_register_first()that withdraws the vote before pmp-export's stop idles the PMP.display_offis empty andndispis 0. The out-of-tree port lowered the display pipes from its provider.final_checkwithundo_regsto put them back.gate_coprocslist (DCP, SIO, PMP) was considered and left out. Each word would then also need aps_all.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.owithW=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.owithCONFIG_KUNIT=y CONFIG_APPLE_SOC_SLEEP_KUNIT_TEST=yandW=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 addsapple_sleep_test_t6030. The shared-path list and MCC checks now skip a profile with its owncommit_regsand no lists. soc: apple: sleep: T6040 (M4 Pro, J616s) suspend-to-RAM #2215's T6040 profile would need the same.dtbs, witht6030-j514s.dtbandt6030-j516s.dtbrebuilt and 0 warnings.Imagebuilds with 0 errors. The full build had 2 warnings, unused functions indrivers/iommu/apple-dart-dcp.h, which this branch does not touch.dt_binding_check DT_SCHEMA_FILES=soc/apple/apple,t6030-sleep.yamlpasses.dt-validatepasses on the J516S node set to okay, and it fails as expected whenapple,wake-enableis removed.Refs #2687
https://claude.ai/code/session_016eHgyJKRZBHRz41DTDHS7m