Repository navigation
T8132: enable deep sleep at the SoC for every board; s2idle stays the default where the DT lacks a part - #3629
Conversation
…part On a qualified SoC deep sleep becomes the default mem_sleep state as soon as the sleep controller binds. Some of what every deep sleep needs is known from the device tree at probe, and a board whose tree leaves it out has every deep sleep refused: at .enter for the display coprocessor and ANS's PCIe block, at the PCIe host's .prepare for the managed radio. The devices resume and the suspend fails, so with deep as the default such a machine has no working sleep at all, s2idle included. At probe, name each such missing part and leave s2idle the default when any is missing. Deep sleep is still offered in /sys/power/mem_sleep, and mem_sleep_default=deep still makes it the default. The parts: - the first display coprocessor disabled, while apple_sleep_refuse() wants its driver bound; - on T8132, its node without apple,display-power: the DCP's firmware-27 stop takes its power words from there, and without them the firmware keeps running; - no PCIe tunables for ANS (the windows or the loader's tables) on a SoC that restores ANS's PCIe block itself; - a PCIe host with the managed radio contract whose radio port (pci@0,0) has no reset-gpios or clkreq-gpios: pcie-apple-radio.c can't recover the radio, and the host refuses every deep sleep. Each check is by what the device tree describes, so a board gets deep sleep by default once its tree has the parts. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The native radio sleep recovery was registered only on a machine compatible with apple,j713. Every other condition it checks is the hardware the device tree describes: a T8132 host with the managed radio contract (SIDs 1 and 2), a single port at index 0 with its PHY, the radio's PERST# and CLKREQ# on the AP pins 163 and 160, the loader's tables and the two BCM4388 functions. A host with the contract and no recovery refuses every deep sleep in its .prepare. The J715 is the J713's board with the same radio port (its ADT has the same function-perst and function-clkreq), so it needs the recovery for deep sleep too. Drop the machine check: a board without the port's CLKREQ# in its tree, or with another radio, still fails the bind with a warning, as before, and the sleep controller keeps s2idle its default. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…h the J715 The J715 is the J713's board with a bigger panel, six amps and its own radio island and ATC PHY trims. The deep sleep's wiring sat in the J713 tree only: the internal DCP's display power words and PMC interface, the DCP and display DARTs' clock protection slices, the external DCPs' switched power domains, the USB4 and dock DARTs' slices, the radio port's CLKREQ# and the ACIO hosts' PHY links. The J715's ADT (macOS 27.0) has the same clock-protection-slice-index for every one of those DARTs as the J713's (dcp 42, disp0 8, dcpext0 5, dispext0 4, dcpext1 30, dispext1 29, acio0 15, acio1 19, apciec0 14, apciec1 18), and the same function-clkreq and function-perst on the radio port (pci-bridge0, AP GPIOs 160 and 163). Move the blocks unchanged into t8132-j713-j715.dtsi, keeping only the panel in the J713 tree. The J713's &pcie0 and &dart_apcie0 status overrides are left out: t8132-jxxx.dtsi enables both on every T8132 board already. The J713's DTB is unchanged in content. On the J715 this turns on the DCP's display power gating while blanked and the external DCPs' switched domains, which no one has run on a J715 yet. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…board
Deep sleep, both CPU clusters' power gates and the enclave with its
power domains were enabled in the J713 tree only. None of it is the
board's: the sleep controller, the cluster power gates, the SEP, its
DART and its power state are SoC blocks at the same addresses on every
T8132, and the ADT ap-wake-sources the sleep node's wake list comes from
are the same on the J713, J715 and J773g.
Enable them in t8132.dtsi. The SEP's domains move into its node, and
ps_sep becomes firmware-owned in t8132-pmgr.dtsi, as the J713 had it:
the enclave gates it itself and Linux only reads it. The J713/J715 PMGR
policy no longer disables ps_sep. The J713 tree keeps no sleep override
of its own; its DTB is unchanged apart from five status = "okay"
properties that are now the default.
Every other board now has the sleep controller bound. Where its tree
leaves out a part every deep sleep needs, the controller keeps s2idle the
default and names the part ("soc: apple: sleep: keep s2idle the default
when the DT lacks a sleep part"): on main that holds for the
J604 (no apple,display-power on its DCP, no ANS PCIe windows, no radio
CLKREQ#), the J623 and J624 (DCP disabled, no ANS PCIe windows, no radio
CLKREQ#) and the J773g (DCP disabled, no ANS PCIe windows). The J715,
with the J713's wiring, gets deep sleep as its default.
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
Verdict: HOLD at 747e5567 — the 4-commit diff (+243/-180 across sleep.c, pcie-apple-radio.c, and T8132 DTS/PMGR files) is clean and code-ready; awaiting queued hosted CI and the required T8132 hardware verification rows.
Blockers:
- Wait for queued hosted CI (
apple-build,dt-checks,host-tests,kunit,source,rust-build,DWC3/ATC,pr-text,readiness, KUnit suites) to pass at747e5567. - Post the exact-head
747e5567hardware verification rows listed in the PR merge conditions: J713 (undocked + docked deep sleep unchanged), J715 (boot, Touch ID, deep sleep with/without dock, display blank/unblank), J773g (with#2762/#2763), and J604/J623/J624 (boot confirmings2idlestays default with the expecteddeep sleep:lines and clean SEP bind).
Checked:
drivers/soc/apple/sleep.c(6418ae82): verifiedapple_sleep_undescribed()cleanly mirrors the runtime refusal conditions (disableddisplay[0], missingapple,display-powerwhendisplay_power_dtis set on T8132,!s->soc->regions && s->soc->ps.ans && !s->apcie_phy_tunablematching L3642, and managed-SIDspci@0,0missingreset-gpios/clkreq-gpios), balancesof_node_put(radio)andof_node_put(host)on every path, and keepsmem_sleep_current = PM_SUSPEND_TO_IDLEunlessmem_sleep_default=deepwas explicitly requested.drivers/pci/controller/pcie-apple-radio.c(7eb30d04): verified droppingof_machine_is_compatible("apple,j713")leavesapple_radio_bind()failing cleanly with a warning (leavingpcie->radio = NULLwithout aborting PCIe probe) on T8132 boards lackingclkreq-gpios(J604/J623/J624).- T8132 DTS/PMGR (
57b96ad4,747e5567): verified all J713 deep-sleep wiring (dcp_power,dcp_dart/disp0_dart/usb4_*_dart/dcpext*_dart/dispext*_dartclock protection slices,ps_dispext*consumer-switched domains,&port00clkreq-gpios,&usb4_{0,1}_aciocioPHYs) moves cleanly intot8132-j713-j715.dtsi, andcluster_pwrgate,sleep,sep_dart,sep, andps_sep(apple,firmware-owned) move cleanly tot8132.dtsi/t8132-pmgr.dtsiwithstatus = "disabled"removed fromt8132-j713-pmgr.dtsi(DCOSigned-off-by:present on all 4 commits).
Evidence
drivers/soc/apple/sleep.cL7963–8015, L8540–8545:for_each_available_child_of_node(host, port)breaks withradio = portand releases withof_node_put(radio)+of_node_put(host).drivers/pci/controller/pcie-apple-radio.cL709–737:apple_radio_register()retainsapple,t8132-pcie,managed_sids == (BIT(1) | BIT(2)),!piodma_supplier, singular port 0,nvecs == 32,port_msiaddr_hi, andport_msimapchecks; missingclkreq-gpioslogsdev_warnand returns cleanly.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
The platform data for the original J713 loader tree, which the J715
shares, kept the SEP power domain for the J713 alone
("apple,policy-machine"). The policy then turns ps_sep off on a J715
before anything probes, even though the SoC tree now enables the
enclave on every T8132 board, and apple_sep fails its probe with
-ETIMEDOUT ("could not keep the power domains on"). Deep sleep needs
the enclave bound, so the J715 could never sleep.
Drop the machine restriction from ps_sep. The ACIO power states stay
the J713's.
Reported in linux#3465 (J715, deep sleep working once ps_sep was
allowed there).
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
J713 row (lab), 2026-11-30, at 747e556, plus a new commit The kernel was main 498d53f + this PR at 747e556, with the J713's fleet85 config. One-shot BLS entry; the saved fleet85 entry and DTB were not changed. The J713's DT content is the same as before (it comes from Stage 2), so this row tests the driver side.
So on the J713 this PR behaves exactly like main. The deep reset is already on main without it: this is #3555. #2673's body: "without this handoff, a deep sleep in the first ~22 s after boot resets the J713 (both dcpext probes still in their RTKit handshakes)". Here both dcpext probes give up with -110. A J713 deep row that means something therefore needs #2673's stack under this PR. That's my next J713 slot. New commit 98552c2 (fast-forward): Evidence: |
There was a problem hiding this comment.
Verdict: HOLD at 98552c21d3e8
Blockers:
- Hosted CI at
98552c21d3e8is still running (9passed,0failed,28queued/in-progress); also notepr-textpreviously flagged addingone-wayortwo-wayto the PR body'sRisk:line. - Exact-head hardware verification at
98552c21d3e8: awaiting the J713 deep-sleep row (over the#2673stack, as noted in your comment) and the J715 / other T8132 board verification rows.
Checked:
- Verified the incremental commit
98552c21d3e8(drivers/soc/apple/t8132-platform-data.dts,+4/-2, DCO): removesapple,policy-machine = "apple,j713";from&ps_sepwhile keepingapple,firmware-owned;andstatus = "okay";, aligning the legacy loader platform-data overlay witht8132.dtsi/t8132-pmgr.dtsiso J715 (and other T8132 boards booting through that tree) no longer power-gateps_sepbeforeapple_sepprobes, while leaving the J713 ACIO power-state overrides scoped toapple,j713. - Confirmed the four prior commits (
6418ae82..747e5567) remain unchanged and code-clean, and reviewed the J713 control-vs-patcheds2idlerow at747e5567confirmingapple_sleep_undescribed()reports no missing parts on J713.
Evidence
drivers/soc/apple/t8132-platform-data.dtsL40-48:&ps_sepretainsapple,firmware-owned;andstatus = "okay";withoutapple,policy-machine, matchingt8132-pmgr.dtsi.- Live check status at review time:
9passed,0failed,28queued/in-progress.
|
J713 row 2 (lab): PASS with #2673 under this PR Kernel: this PR at 98552c2 merged with #2673 at 525da01 (local merge 9a16a506). The one conflict was in
So on the J713 this PR is no-regression, and deep works once #2673 is in, which is what #3555 says. Merge order: #2673 before (or with) this PR. Lab Mac restored to fleet85 (saved entry, no next entry, test entry removed, 0 failed units, Enforcing). Remaining merge conditions: Dj's J773g row (with #2762/#2763), and a J715 owner row (asked on #3465). There is no iMac / J604 owner yet; those boards stay on s2idle by default under the new probe check until their DT describes the missing parts. |
|
Desktop follow-up for the J773g (and the iMacs), ready on branch #2763 changes the sleep's refusal: when the DT disables the internal DCP (J773g), it waits for every available external DCP instead. This PR's probe check still counts a disabled internal DCP as a missing part, so with #2763 in, a J773g would keep s2idle as the default for no reason. The commit makes the probe follow #2763's rule: the internal DCP counts only when it is available (it then needs its driver and Ordering, so the probe and the refusal never disagree: the commit lands with whichever of #3629 / #2763 merges second. Before #2763, the refusal still waits for the internal DCP and this PR's check matches it. On a J773g with #2762 + #2763 + this commit, the remaining probe item ("no PCIe tunables for ANS") is gone too (#2762 keeps the shared APCIe windows), so deep becomes the default there. That is the stack the J773g row should use. |
|
J715 row, 2026-11-30: at 98552c2 plus two local test changes, s2idle x1 and deep x3 passed on the J715 (MacBook Air 15-inch M4, Mac16,13). One more J713-only check. At this head, if (!of_machine_is_compatible("apple,j713") || !cfg || !cfg->stream_maps[0].dart ||
cfg->stream_maps[1].dart)
return -ENODEV;
That is what this J715 did on 11-28, before I let both checks through. I didn't boot the head without the change this time, so the refusal at this head is from reading the code, not from a run. With The two local changes:
Setup.
Boot:
Sleeps. One s2idle, then three deep sleeps, each woken by the RTC 20 s later. There are two RTCs:
I set the alarm on
Each deep sleep, deep 2 here:
Not tested:
|
|
@kazuhidet: thank you. That closes the J715 condition: exact head ffb43c7, no DART edit, |
|
J773g (M4 Mac mini) row: pass, 3/3 deep sleeps with this PR at its head What ran:
One conflict, in Test: one boot on the default command line with the GPU driver loaded. Three deep sleeps, each woken by the PMU RTC (
At probe, as the PR describes for the J773g:
Stock for comparison ( |
There was a problem hiding this comment.
Verdict: MERGE at ffb43c7db186
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: Removing the machine check allows the J715 radio to reach DART sleep binding. The single-stream, ready managed DART, APCIe resource, and protection syscon checks still constrain it to the supported block. The J715 run with local changes supports the fix and exercised s2idle and deep resume. Please keep the tested kernel and its boot-only DT delta explicit, and retain current-head J713, docked J715 and the other T8132 coverage already listed in the PR.
Follow-ups (not blocking): hosted CI; J713, docked J715 and listed T8132 rows; keep tested kernel/DT delta explicit
DjDeveloperr
left a comment
There was a problem hiding this comment.
The series is right, and the J713, J715 (exact head) and J773g rows cover it. The three machine checks are replaced by hardware checks, and a board missing a sleep part keeps s2idle instead of failing every deep sleep. One blocker, which comes from your own 11-29 23:28 comment and is real now that #2763 is in main.
Blocker: on the J773g this makes s2idle the default again. #2763 (merged) lets a desktop whose DT disables the internal DCP sleep by waiting for its external DCPs. This PR's probe check still counts a disabled display[0] as a missing part (sleep.c, the new "deep sleep: ..." check). So on the J773g, mem_sleep falls back to s2idle at boot, while main defaults to deep. The J773g row passed because it forced deep sleep. Fix: fold e64ec7ce ("soc: apple: sleep: follow the desktop display rule at probe", on sleep/t8132-desktop-follow) into this PR when you merge main. It conflicts with main now anyway. The internal DCP should count only when it's available.
After that, the J773g check is quick: boot shows deep sleep is the default with no missing parts, plus one deep cycle. I'll re-review at the merged head.
Signed-off-by: DjDeveloperr <hey@djdev.me>
With "admit M4 Mac mini (J773g) ... desktop apple-sleep gates", the sleep's refusal no longer waits for an internal display coprocessor the device tree disables: it waits for every available external one, and each of those has its own driver. The probe check still counted the disabled internal DCP as a missing part, so a J773g kept s2idle as the default even though nothing in its tree is missing. Count the internal DCP only when it is available: it then needs its driver bound and, on T8132, apple,display-power. This goes in after the desktop gates; before them the refusal still waits for the internal DCP and the old check matches it. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org> (cherry picked from commit e64ec7c) Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Pushed two commits, no rebase or force-push:
Local checks against a warm arm64 config: |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Approve at 2c2788a9e76e. This replaces my 12-02 changes-requested review: the blocker is fixed.
The added commit is Ryan's e64ec7ce byte for byte, with authorship kept, so a disabled internal DCP no longer counts as a missing part. The main merge 908ed8aa1375 differs from a clean git merge-tree of its parents only in t8132-j713.dts and sleep.c, and both are resolved right:
t8132-j713.dts: main's DCPEXT GAPF regs stay a J713-only override, and the moved sleep wiring lives int8132-j713-j715.dtsi.sleep.c: main splituntestedintountestedandderived, and the fallback now runs for!derived. That keeps it off T8142 and T8122, which this PR's base excluded throughuntested, so the scope the PR was tested with is unchanged. Main'sdisp_prot_slice42 is kept.
Checked on pc:
sleep.o,apple-dart.o(which includesapple-dart-sleep.c) andpcie-apple.o(which includespcie-apple-radio.c):W=1, 0 warnings.- All 141 Apple DTBs at this head against its main parent
87c01c2c901d. J713 only loses five redundantstatus = "okay"lines. J715 gains the J713's sleep wiring. J604, J623 and J624 gain the sleep controller, cluster power gate, SEP and firmware-ownedps_sep. J773g is unchanged. dtcW=1adds only the two knownunique_unit_address_if_enabledwarnings on each newly enabled board, as the PR says. Hosted dt-checks passed. checkpatch --stricton the cherry-pick: clean. Merges cleanly with current main.
One correction to the J773g row I asked for (not a code problem): on main as it is now, it can't show "deep sleep is the default". The J773g's ANS PCIe node only has config, rc, port0, phy0, port2 and phy2: t8132-apcie-port2.dtsi replaces reg-names and drops the five shared windows, and #2762, which kept them, was closed. So apple_sleep_map_apcie() finds no ANS tunables, and the new probe check keeps s2idle the default with "deep sleep: no PCIe tunables for ANS". That is the right result. NVMe registers ANS as a pcie_ans coprocessor on T8132, and apple_sleep_refuse() refuses every deep sleep with ANS idled and no tunables, so a deep default there would fail every suspend. The J773g row should check instead that the only deep sleep: line is the ANS one (no DCP line, which is what e64ec7ce removes), that s2idle is the default, and that one s2idle cycle works. Deep as the J773g default needs those windows back in a separate change.
Before merge: hosted CI and that J773g row. The commits were pushed from this account, so it needs another approver or an admin merge.
|
J773g (Apple M4 Mac mini, T8132, firmware 27.2) receipt at exact head
|
|
Merged at
Not run: the full host-test list, the KUnit suites, dt-schema checks and a full kernel build on the merge (hosted CI was green at the head). No Mac booted the merge. J604, J623 and J624 still have no row, and J715's is at |
Deep sleep on T8132 (M4) was enabled in the J713 tree only. This moves the SoC parts to
t8132.dtsiso every T8132 board has the sleep controller bound, and makes the driver keep s2idle the default on any board whose tree is missing a part that every deep sleep needs.Commits:
soc: apple: sleep: keep s2idle the default when the DT lacks a sleep part. T8132 is a qualified SoC, so deep becomes the default as soon as the node binds. A board that is missing a required part then has every deep sleep refused after the devices have suspended, and the system has no working sleep at all. At probe the driver now checks the device tree, names each missing part with adeep sleep: ...warning, and leaves s2idle the default. Deep stays in/sys/power/mem_sleep, andmem_sleep_default=deepis honoured. The checks:display[0]disabled;apple,display-power;apple,managed-sidshost whosepci@0,0lacksreset-gpiosorclkreq-gpios.PCI: apple: drop the J713 machine check from the radio's sleep recovery. Every other condition inapple_radio_register()and the bind already checks the hardware. A host under the managed contract that has no recovery refuses every deep sleep in.prepare. The J715's radio port is the J713's.arm64: dts: apple: t8132-j713-j715: share the J713's sleep wiring with the J715. This moves the following fromt8132-j713.dtsto the shared dtsi unchanged:pmc-interfaceand the gapf reg;clkreq-gpios;The J715 ADT (27.0) has the same
clock-protection-slice-indexfor each of those DARTs and the same radiofunction-clkreq/function-perst(AP 160/163) as the J713's. The J713's&pcie0/&dart_apcie0okay overrides are dropped becauset8132-jxxx.dtsialready enables both on every board. This is the J715 part of the closed arm64: dts: apple: t8132-j713-j715: give the J715 the J713's sleep, enclave and display power wiring #2245.arm64: dts: apple: t8132: enable deep sleep and the enclave on every board. This enables the sleep controller, the cluster power gates,sep_dartandsep(withpower-domains = <&ps_sep>, <&ps_gpio>) int8132.dtsi.ps_sepbecomes firmware-owned int8132-pmgr.dtsi, and the J713/J715 PMGR policy no longer disables it. The J713 keeps no sleep overrides of its own.What each board gets on main with this PR (from the built DTBs):
apple,display-power; no ANS PCIe tunables (t8132-apcie-port2.dtsidrops the windows, fixed by #2762); radio port has noclkreq-gpios.clkreq-gpios.#2763 changes the prepare-time rule to accept a disabled
display[0]when the external DCPs are bound. Its probe-time counterpart is the first check inapple_sleep_undescribed(), and it should follow #2763's rule once that lands. Until then deep is offered on the J773g but is not the default.History: #2245 (the J715 part) was closed because it "turns on deep sleep, the enclave and display power gating on a J715 that nobody has booted with them; it can come back with a J715 row". The lane's direction since then is to enable at the SoC with no board gating. This PR therefore includes the J715 (deep by default, plus DCP power gating while blanked and the switched DISPEXT domains), and a J715 row is a merge condition below.
Tested:
make ARCH=arm64 LLVM=1 W=1 apple/t8132-{j604,j623,j624,j713,j715,j773g}.dtb: all build. The J713 keeps its 14 dtc warnings. Every other board gains only the twounique_unit_address_if_enabledwarnings for the now-enabledsleep-controller@380700000, which the J713 already has.dtc -sbefore/after: identical, phandles included, except fivestatus = "okay"lines (sep_dart,cluster_pwrgate,ps_sep,sep,sleep) that are now the default. At commit 3 alone, the J713 is identical to main.sleep,cluster_pwrgate,sep,sep_dartenabled,seppower-domains andps_sepfirmware-owned.drivers/soc/apple/t8132-platform-data.dts(legacy-loader adapter, includest8132-j713-pmgr.dtsi): preprocessed and sorted output is identical before/after.drivers/soc/apple/sleep.oanddrivers/pci/controller/pcie-apple.o:LLVM=1 W=1, no warnings. The same holds merged with soc: apple: admit M4 Mac mini (J773g) in T8132 SEP profile and desktop apple-sleep gates #2763 and arm64: dts: apple: t8132-apcie-port2: keep shared APCIe register windows #2762 (both merge cleanly with this branch). arm64: dts & PCI: apple: enable J773g port 2 Ethernet and T8132 multi-port deep sleep #2770 has the same two conflicts against this branch as against main.apple-sleep-soc-data(arm64 16K pages, qemu): 14/14 passed.checkpatch.pl --stricton each commit: 0 errors, 0 warnings, 0 checks.Risk: two-way · M4 (T8132: J713, J715, J773g, J604, J623, J624); a plain revert undoes it.
ps_gpioheld through its device link,ps_sepfirmware-owned) now bind at boot. Deep is not the default there, but these blocks are new on those boards.ps_sepis no longer J713-only int8132-platform-data.dts(98552c2); the ACIO states still are.pcie-apple.cstill checksapple,j713, so a J715 tunnel takes the older path. This PR does not change that.Merge conditions:
deep sleep: ...lines name the parts listed above, and check that the SEP binds.Dependencies: none to build or merge. For the J773g, #2762 (ANS windows) and #2763 (display rule) are needed before deep can work there. #2770 is independent.
Rows so far: J713 (lab) PASS with #2673 under this PR, s2idle 1/1 + deep 3/3 (comments below). Merge after/with #2673 (#3555).