Repository navigation
soc: apple: suspend-to-RAM on the M4 Max (T6041, J616c) - #1664
AxxzyWasTaken wants to merge 45 commits into
Conversation
|
Tried this on a J614c (MacBook Pro 14" M4 Max, 40-core GPU), os-fw 26.6.2, EL2 through aura main d5e180ba. The kernel was GPU: the 40-core part runs Then it hangs:
PMU notes (
The count drops by 10, the two removed devices' callbacks, so the hang comes at the same point in the sequence. The noted device looks like whatever is next, not the cause. My guess: something is already stuck by then, possibly around the SEP going to sleep at device suspend. One more J614c data point, from #1477's hibernation dry runs on this machine: at every |
84f27ca to
fe530fa
Compare
|
Thanks for trying it on the J614c, this helps a lot. I think the hang is the SEP's DART. On my J616c the bring-up device tree gives I've pushed four commits for it:
To try it on your current build, this in your DTS should be enough:
|
fe530fa to
3862ef2
Compare
|
Thanks, the SEP DART lists were it: the hang at Same J614c (MacBook Pro 14" M4 Max, 40-core GPU), os-fw 26.6.2, aura 1.0.0b12 + aura#166 + a local dcpext3 entry. Kernels:
Real sleep, PMU scratch after the 35.6 reset (
So the commit looks clean from here: nothing busy, the SEP asleep, the USB-C domains down. The failure is after it: the RTC wake doesn't come, or the wake path resets before it reaches Linux. One more thing: with Wi-Fi WoWLAN enabled ( I'm happy to run more: a different wake source, a debug build, or other PMU offsets. |
|
Thanks, that's a big step: the commit really is clean now. Your 35.6 record matches the commit record of my J616c when it wakes fine almost byte for byte: 3 non-PS and 52 PS rows differing from macOS, the same 0x8342-0x834c, the same PS bytes, nothing busy, the SEP asleep, the USB-C domains down. Only the first differing PS row differs: My best guess for the reset: your kernel has #1667, #1684 and a local dcpext3 entry, so it runs more external DCPs than mine. The display stop before the sleep kept one "already stopped" slot per external DCP by name: dcp@3a2e00000 got one, and every other external DCP shared the second. So with three or four external DCPs, the second one stopped took that slot and the rest were skipped, their firmware still running at the commit. Only the first two chains' DARTs were made dark, too. I've pushed Two things that would tell us more:
The pm_test=platform black panel is a real gap: the display stop assumes a real sleep follows. Under pm_test the firmware is stopped but never power-cycled, and the restart path expects a power cycle. So pm_test=platform with the display isn't supported yet. I'll put that in the PR text, along with your WoWLAN note (brcmfmac refuses |
|
Thanks! The raw PMU scratch 0x8300-0x83ff from that 35.6 run ( Correction to my last comment: 0x8359/5a fall inside the bitmap, which is written after them, so the fac697f: still resets. Built as fac697f with fe530fa's (the other lines are as above.) Next I'll try your other suggestion, only dcpext0/1 enabled, by booting an aura without the dcpext2/3 fill so the gate leaves those chains off. |
|
Only dcpext0/1: still resets. Same 35.8 kernel (fac697f + fe530fa's sleep files for the marks), with an aura from main just before #166, so The record is the same again: mark 0x06, nothing busy, the same 0x8308-0x834c, and fab3_soc 0xff. The 53rd PS row is now dcs_10 (macOS 0x4f, here 0xff) instead of nub_spmi4, so that row seems to vary between runs. So with the same external DCPs as your J616c it still resets, and across the three runs fab3_soc at 0xff is the only difference from your record that stays. Is there anything on fab3 that the J614c has and the J616c doesn't, or that I could take out to test? |
|
Your exact branch: still resets. Built fac697f as it is (base integration/aurora 9219565), with only fe530fa's The record is byte for byte the one from my first 35.6 run: mark 0x06, nothing busy, 3 non-PS and 52 PS rows differing from macOS with the same bitmap and bytes, fab3_soc 0xff. So on the J614c it resets in every configuration I tried (4 or 2 external DCPs, my tree or yours) with the same clean commit record, and fab3_soc is the one row that differs from your J616c every time. Happy to try a patch that does something to fab3 before the commit, or to read anything else after the reset. |
|
Thanks for running all of those. Same record in every configuration, with fab3_soc on, rules out the external DCPs. One difference between our setups I can name: your kernel boots the in-tree device tree, mine boots my bring-up one, and they describe fab3_soc's children differently (in-tree: So, to see which domain it is, a small patch on top of fe530fa's diff --git a/drivers/soc/apple/t6041-sleep.c b/drivers/soc/apple/t6041-sleep.c
index 15130a0..bd61e84 100644
--- a/drivers/soc/apple/t6041-sleep.c
+++ b/drivers/soc/apple/t6041-sleep.c
@@ -404,6 +404,32 @@ static int t6041_ps_match_all(void)
* 0x837e..0x83a1 the first 6 non-PS diffs as u16 index + u32 value;
* 0x83a2..0x83ff each differing PS row's [7:0] (actual, target), in row order, 94 of them.
*/
+/*
+ * DIAG: every PS word that reads on (ACTUAL != 0) at the commit, as bitmaps in PMU SRAM, bit n
+ * of byte n / 8 = the word at +8 n: 0xa300 the main PMGR (0x502800000, +0x000..+0x4f8, 20
+ * bytes), 0xa314 East (0x502280000, +0x000..+0x3f8, 16 bytes), 0xa324 AON (0x508300000,
+ * +0x000..+0x178, 6 bytes); 0xa32a = 0x50 when done.
+ */
+static void t6041_ps_on_map(struct t6041_sleep *s)
+{
+ static const struct { u16 at, words; } blk[3] = { { 0xa300, 160 }, { 0xa314, 128 }, { 0xa324, 48 } };
+ void __iomem *base[3] = { s->ps, s->east, s->ps_aon };
+ unsigned int b, i;
+
+ for (b = 0; b < 3; b++) {
+ for (i = 0; i < blk[b].words; i += 8) {
+ u8 byte = 0;
+ unsigned int j;
+
+ for (j = 0; j < 8; j++)
+ if (FIELD_GET(PS_ACTUAL, readl(base[b] + 8 * (i + j))))
+ byte |= BIT(j);
+ t6041_pmu_write(s, blk[b].at + i / 8, byte);
+ }
+ }
+ t6041_pmu_write(s, 0xa32a, 0x50);
+}
+
static void t6041_reg_diff(struct t6041_sleep *s)
{
unsigned int i, n[2] = { 0, 0 };
@@ -1210,6 +1236,7 @@ static int t6041_sleep_commit(unsigned long unused)
busy_n < ARRAY_SIZE(busy_rows))
busy_rows[busy_n++] = i;
MARK(s, 6);
+ t6041_ps_on_map(s);
t6041_commit_t = read_sysreg(cntpct_el0);
for (i = 0; i < ARRAY_SIZE(t6041_macos_regs); i++)
t6041_reg_now[i] = readl(t6041_reg_map[i]);After the reset: |
|
For comparison, the same map from my J616c: one RTC deep sleep (20 s) at the greeter on a kernel with fe530fa's sleep files plus the patch above. It woke normally (0x8308 = 0x67). Bit n of byte n/8 is the word at +8n. fab3_soc is East +0x118 (byte 4, bit 3): off here, as the 0x0f in the PS rows says. Any bit that is set in your map and clear in mine is a domain still on at your commit, and the likely holder of fab3. This run's 0x8350/1 read 03 35 (53 PS rows), so the 53rd row varies on mine too. |
|
The map from the J614c, same build as my exact-branch run (fac697f + fe530fa's sleep files) plus your patch, Nothing is on in yours that's off in mine. On here and off on your J616c, named from the J614c ADT's pmgr
So at the commit this machine has all 32 memory controllers on (AMCC0-31), and yours has 24 (AMCC0-23). This one is the full M4 Max (16 CPU cores, 64 GB, 512-bit). Going by the 24, I guess yours is the binned one (14 cores, 36 GB, 384-bit)? AMCC28-31 and DCS_28-31 sit in the East block with FAB3_SOC, so fab3 looks like the fabric for that last quarter of DRAM. If that's right, it isn't a leaked domain but the extra channels, and whatever the sleep path does per memory channel (or the macOS table it's checked against) only covers 24 of them. If you have a macOS table or sequence from a 512-bit M4 Max, or want me to try something per channel for AMCC24-31, I can run it. One aside: this boot came from the J614c's aura build with the dcpext3 entry rather than stock main (update-m1n1 didn't switch it), but the gate still only enabled dcpext0/1, as in the exact-branch run, and the commit record is the same as before (mark 0x06, nothing busy, 3 non-PS and 52 PS diffs, fab3_soc 0xff). 🤖 Generated with Claude Code |
|
That's it, thanks. Yes, mine is the binned one: 14 cores, 36 GB, 384-bit. On it, the words you list read target and actual 0 live (amcc24 +0x248 = 0x0f000300, amcc28 East +0x2c0 = 0x0f000300), so those channels are fused off. The sleep path is written for 24 channels throughout, not only the macOS table:
So on yours, the last eight channels are never flushed, and their PS words stay forced on. That holds fab3_soc at I've pushed
One check before you run it: the AMCC and DCS addresses for groups 6 and 7 are extrapolated from the first six: AMCC block If it still resets, the same map with the new commit would show whether fab3_soc came down. |
|
f3fcc17: still resets. The addresses match the J614c ADT first:
So it's fresh, and it's bit for bit the map from before the change: AMCC24-27, DCS_24-26 (main +0x248..+0x280), AMCC28-31 and DCS_28-31 (East +0x2c0..+0x2d8, +0x340..+0x358), and FAB3_SOC (East +0x118) still read on at that point. Note that on your J616c map AMCC0-23 read on at the commit too, so on AMCC/DCS words seem expected there. What's still different is fab3_soc, which stays on here alongside the extra channels even with them on AUTO. If it helps, I can dump the raw words (target, AUTO, flags, actual) of those 15 plus fab3_soc at the same point, or try whatever you'd like done to fab3 or the extra channels before the commit. 🤖 Generated with Claude Code |
|
Thanks for checking the addresses and for the run. Agreed: AMCC/DCS reading on at that point is expected, because their AUTO state only drops them once the commit has gone quiet. fab3_soc is the one real difference. Yes, the raw words would help most. Could you dump these 16 at two points: where the map runs now, and right after
Writing them as 32-bit words from 0xa340 (16 x 4 bytes, then the second set from 0xa380) keeps them clear of the map. Those words would tell us three things:
If fab3_soc is at AUTO 4 with the extra channels on AUTO, then the next suspect is the fab3 child the J614c has and mine doesn't. In your bring-up DTB, fab3's children are sio, ans, apcie_sys_st1 and apcie_sys_gp. |
|
The raw words, f3fcc17 + your map + a dump of the 16 words at both points (u32 LE, in your order: amcc24-27, dcs_24-26, amcc28-31, dcs_28-31, fab3_soc). 0xa300..0xa3bf was zeroed first; after the reset the done marks 0xa32a/b/c read 50 51 52, so all three sets are from this run. It reset as before.
Raw dump of 0xa340..0xa3bf for reference: 🤖 Generated with Claude Code |
|
One more thought on those words, and a question.
The children both machines have (sio, ans, sep) read the same in both maps. The only difference is the eight extra channels, and AMCC28-31/DCS_28-31 sit in the East block with fab3. On your binned part they're fused off and fab3 goes to 0. So I suspect fab3 is the fabric for that last quarter of DRAM, and with those channels at auto state 4 (which macOS allows for the DCS words too), fab3 has to stay up on a full part. If so, fab3 at f is expected here, and the reset comes from something a binned-J616c reference can't show. So, how did you capture the macOS commit state on your J616c? If it's something I can run on this J614c under macOS (26.6.2), a full-part table would show what macOS really does with fab3_soc and AMCC24-31 at the commit, and what else differs. I'd rather get that than guess at memory fabric power before the commit. If you'd like the theory confirmed first, I can do one more run that rewrites fab3_soc to auto state 4 and the extra AMCCs to 0 at the map point, waits, and dumps the words again. 🤖 Generated with Claude Code |
5499579 to
7288144
Compare
|
Same result on the new head (7288144, with the integration/aurora merge) plus the same two diag commits: 32 memory channels, 🤖 Generated with Claude Code |
|
I tried one more idea on the J614c, from the M5 Max sleep in #2119. There the commit dropped all the CPU clusters together, the P cluster's power-down queued behind the boot cluster's and never finished, and the engine's watchdog reset the chip 5 s after the commit. The fix was to take the secondary clusters down first and poll until they're done. Our symptom is the same, so I checked whether it applies here. Diag on 7288144: the cluster block (0x502820000, +0x00..+0x38) dumped to PMU SRAM at three points in
E and P1 change at once and read 0 by the last point, the same as the AVE complexes. Only the boot cluster is still at 0x10. That is the order #2119 needed, so I don't think this is our reset. T6041 has no T6050-style sequencer status words at +0x18/+0x1c (everything past the AVE words reads 0), so this is based on the cluster words only. Same reset as before. So I'm back to the AMCC words. Your comment in 🤖 Generated with Claude Code |
|
Found it: on the full T6041 the reset is dcs_27, and with one line added the J614c sleeps and wakes. A diag kernel on 7288144 dumped the PS words of all 32 AMCC slices and all 32 DCS channels right after The fix, with the value your table has for the other DCS words: { 0, 0x280, 0x1000030f }, /* amcc27 */
+ { 0, 0x530, 0x1400034f }, /* dcs_27 */
{ 1, 0x2c0, 0x1000030f }, /* amcc28 */(and On 7288144 plus that line, J614c (16/40, 32 channels, os-fw 26.6.2), one boot:
Still open on the J614c:
🤖 Generated with Claude Code |
|
Two more things from the J614c, one bad and one good. Merged with a newer integration/aurora, the wake hangs. I merged 7288144 (plus the dcs_27 line) into integration/aurora c0a2a75 (15 Nov) for my daily kernel. Five conflicts, all resolved by keeping both sides: The same set of extra commits cherry-picked onto your branch instead (7288144 + dcs_27) wakes every time. So it's something in integration between your base (fc05050) and c0a2a75. That range is 19 PRs, and the one that touches the sleep path is #1963 (T6050 S2R: The SD reader after a wake. I found the cause of the @@ static int apple_pcie_resume(struct device *dev)
if (!port || !port->hib_cold)
continue;
+ /*
+ * The PCI core's noirq power-up ran with the link down and left the function
+ * marked D3: the reset brought it up in D0, so record that before the
+ * restore, or its driver's resume can't enable MSI again (-EINVAL).
+ */
+ pci_set_power_state(fn->pdev, PCI_D0);
if (pci_load_saved_state(fn->pdev, fn->state))With it, on 7288144 + dcs_27: two Still open here: 🤖 Generated with Claude Code |
7288144 to
8f34100
Compare
|
Rebuilt the series without the merge commit: the 37 commits now sit directly on fc05050, the merge's It still conflicts with current Disclosure: prepared with an AI tool (the commits carry Assisted-by: LLM); tested on my M4 Max as described. |
|
An overnight result from the J614c (16/40), on 7288144 + dcs_27 + the SD fix and a few unrelated cherry-picks, now my daily kernel. Battery: one lid-closed deep sleep of 9 h 30 min, unplugged. After that wake: panel, Wi-Fi (I'm typing this over it), speakers, Bluetooth and the camera all work. The camera also worked after earlier wakes, so the description's note that the ISP doesn't come back is out of date, at least for T6041. No EDAC Brightness after a lid wake: two parts.
I can push the brightness change somewhere if it's useful, but it's a workaround for the level, not the whole fix. 🤖 Generated with Claude Code |
On T6041 the SMC firmware expects the wake type key (WKTP) set to its sleep value and the CIO rail word (pmVC) written at the sleep commit, and WKTP cleared after a full wake; left at the sleep value it treats the time awake as a power nap. T6040 shares the SMC node and its compatible through t604x.dtsi, so a compatible can't select it. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Set apple,sleep-host-stop on the internal DCP and apple,sleep-wake-type on the SMC, in t6041.dtsi only, so the J614c, J616c and J575c get them and the T6040 boards don't. The drivers follow them in the next two commits. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
dcp_t6041_s2r_all() ran on of_machine_is_compatible("apple,t6041"). It now
runs when a DCP node with apple,sleep-host-stop has probed. The DTBs built
from this tree have the property on the T6041 boards only, so nothing
changes on any machine.
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
apple_smc_sleep_commit() wrote WKTP and pmVC on
of_machine_is_compatible("apple,t6041"). It now follows the SMC node's
apple,sleep-wake-type, read at probe. Nothing changes on any machine.
The comment named pmVC = 0x100 while the code writes 0x101. 0x101 is right:
macOS's 0x100 was traced while the hypervisor held ATC0 up, and 0x101 is what
the sleep that works here has written since 9 Nov. The comment says so now.
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Three fixed sleeps in the DCP stop path wait on something they can watch: - msleep(100) after the power-off, before the display DART's streams went off. Its reason is the firmware's D572(0), its sign that it is done with the display: streams turned off while the pipe still scanned out crashed the firmware (axi_rd_err). The 26.6 desktop firmware's D572 now goes through dcp_s2r_dart_power(), as on the other firmwares, and the stop sets s2r_active and waits for it (DCP_S2R_D572_TIMEOUT_MS), so the streams go off when the firmware says so, as on macOS. Without a D572 it warns and turns them off as before. - msleep(20) after the CPU stop: nothing after it in the stop depends on it, and the power word step after the stop waits DCP_S2R_STOP_MS anyway. - msleep(50) before the SYS poll: SYS reports its state once the domains under it are down, which macOS polls for up to 50 ms. The poll now runs for every pipe (it ran for the internal one only, with fab6_soc held), with a 100 ms timeout, and the external ones are checked too. Other machines' D572 paths are unchanged; on the 26.6 desktop firmware D572 does nothing unless a sleep path set s2r_active, and no other path that sets it runs that firmware. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
|
Thanks. Both points are addressed in six commits on top of dabfe7f. The machine checks. The DCP and SMC nodes come from
Both are set in The three fixed sleeps in the DCP stop path:
The named waits in Tested: |
|
J616C row with the six review commits. Kernel 7.3.0-j616c-s2rT is my daily base (ia33) plus the six commits as pushed here, and #1889 as merged (5ff7084). Its DTB is built from the same tree.
Not covered: lid-close wakes and a sleep with an external display connected. The four named DCP waits are unchanged, as said above. Moving this out of draft. |
|
Re-review of b4b8db1: Blockers: 4. From the last comment:
New, in the sleep path:
Two smaller ones:
HW row: J616c and J614c, this head on the default command line with the in-tree DTB. 3 or more Assisted-by: LLM (Claude:Opus 5.5) |
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. Assisted-by: LLM Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com> [fbalazsy: carried from aurora-silicon#1664 for the J616s; a later commit moves the ports' set-up to the noirq resume] Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com>
|
This still merges cleanly onto the current integration/aurora tip 110861f, and nothing equivalent has landed: the tip has no T6041 sleep driver. The machine-compatible checks were replaced with DT properties as asked. The four blockers from the 11-21 re-review of b4b8db1 are still open: the internal DCP is picked by its unit address, the sleep code uses fixed physical addresses and a per-chip register table instead of reg/phandles, several waits have no state check behind them, and the storage link tunables are compiled in from one machine's ADT instead of being read from apple,tunable in the DT. The s2r_conventional module parameter and the early s2r_dart_done completion also need changing. @AxxzyWasTaken once those are in, the J616c and J614c rows listed in the re-review are what's left. Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): |
|
An update from the J614c, on a kernel with integration/aurora 5441428 + this PR at dabfe7f (before the six review commits) + #2175 at 565c3d2, plus the J614c speaker and dcpext3 PRs and my local test patches. Dim panel after a wake: gone. With my extra display off and on switched off, the panel came back at full brightness after both wakes I tried, a short lid sleep and a 68 min one. In my test on 19 Nov the same setting ("none" in the table) came back dim. Sleep: on that kernel, 4 of 4 deep sleeps on battery woke clean. None of them logged A cancelled suspend leaves Touch ID dead: when a suspend is aborted after the enclave was put to sleep, the SEP logs Assisted-by: LLM (Claude:Opus 5.5) |
|
A correction to my last comment: the kernel without the review commits has now hung too, on the fifth sleep. It was a lid close on the charger, with WoWLAN off. The journal again ends at Assisted-by: LLM (Claude:Opus 5.5) |
|
Test report: J616c with the 40-core GPU (MacBook Pro 16" M4 Max), in-tree DTB.
Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at b4b8db1b17360b1752192b9591c475307946d2a8 (CI: 8/8 checks green — dt-checks, host-tests, kunit, source, rust-build, DWC3/ATC ×3; MERGEABLE / CLEAN, non-draft).
Confirmed clean
- §4 Commit attribution & §6 Naming: All 45 commits carry human author/committer and human
Signed-off-by:only, zero AI trailers in commit messages, PR body disclosesAssisted-by:, and naming is clean. - Prior machine-check fix: The
of_machine_is_compatible("apple,t6041")checks indcp.candmacsmc.cwere replaced with DT properties (apple,sleep-host-stop,apple,sleep-commit).
Blockers before approval
- Build failure (
-Werror,-Wmissing-prototypes):drivers/gpu/drm/apple/dcp_backlight.c:424definesdcp_backlight_s2r_restore()without a header prototype (the declaration sits privately indrivers/gpu/drm/apple/dcp.c:10226), breaking full arm64apple_drmbuilds (also confirmed by@RyanTheTideand@jcrowthe). Move the prototype intodcp_backlight.h(included viadcp-internal.h). - §1 Hardcoded unit addresses, physical addresses, and per-chip register tables:
drivers/gpu/drm/apple/dcp.c:9935,10235selects the internal DCP by hardcoded unit address (strstarts(dev_name(dev), "402e")) instead of DT/match data.drivers/gpu/drm/apple/dcp.c(dcp_t6041_s2r_step()andioremap()calls) anddrivers/soc/apple/t6041-sleep.c(ioremap()of hardcoded T6041 addresses;Documentation/devicetree/bindings/soc/apple/apple,t6041-sleep.yamlhas noregor phandles) embed chip-specific addresses and static register/PMGR tables (drivers/soc/apple/t6041-macos-regs.h,drivers/soc/apple/t6041-ps-order.h) rather than taking addresses and power domains from DTreg, phandles, and PMGR nodes.
- §1 / §3 / §4 Hardcoded machine-specific ADT tunables in source:
drivers/soc/apple/t6041-apcie-tunables.hcompiles J616C ADT tunables into the kernel tree and applies them to every T6041 board (including J614C). Storage-link tunables must come from the machine via DTapple,tunableproperties (include/linux/soc/apple/tunable.h), skipping link re-init or refusing sleep when absent. - §2 Production-ready — module parameter, unbacked fixed sleeps/spins, and early wake completion:
- Drop
module_param(s2r_conventional, ...)indrivers/pci/controller/pcie-apple.c:103-105(no new module parameter for a feature to work; keep behavior unconditional whereapple_pcie_s2r_conventional()allows it). - Replace unbacked sleeps/spins with hardware state polls + timeouts and error paths:
dcp.c(usleep_range(5000, 6000)redundant with theiomfb_channels_idlepoll,usleep_range(4000, 5000)beforeapple_rtkit_idle(), andDCP_S2R_SETTLE_MS/DCP_S2R_WORDS_MS/DCP_S2R_STOP_MS/DCP_S2R_DOWN_MS),t6041-sleep.c(udelay(2000)/udelay(5000)andt6041_spin_s(30/20/3)), and derive or document the hardware basis of the hardcoded commit constant indrivers/mfd/macsmc.c. - In
drivers/gpu/drm/apple/dcp.c(dcp_s2r_dart_power()), completes2r_dart_doneonly on0on the 26.6 desktop stop path so a "wants it back" callback cannot release the stop wait early.
- Drop
- §5 Hardware stability & regression evidence on exact head
b4b8db1b1736:@jcrowthe(2026-11-23, 40-core J616C atb4b8db1b+ prototype fix) hit an immediate hard reset on the firstrtcwake -m mem -s 20(macsmc-reboot: PMU logged 1 boot error(s)).@joske(2026-11-23, 40-core J614C) hit hard hangs requiring forced power-off on 2 of 5 deep sleeps with the review commits (b288ee75..b4b8db1b, and 1 of 5 without), plus cancelled suspends leave SEP/Touch ID dead (EAGAIN) until reboot or a real sleep.- Exact head
b4b8db1blacks passing multi-cycle (>=3rtcwake -m mem+ lid close/open) and full regression rows (0failed units,0SELinux AVC denials,0new kernel errors, panel lit, nono D572/sys still/didn't go idlewarnings) on default cmdline + in-tree DTB across J616C (32- and 40-core) and J614C. (Also note the PR body still opens with "Draft:" while marked ready for review.)
Assisted-by: LLM (Gemini 4 Neon)
|
One more data point from the J614c, on the kernel without the review commits (integration/aurora 5441428 + this PR at dabfe7f + #2175 at 565c3d2): another hang, so that kernel is now at 2 hangs in 6 deep sleeps (the review checklist above has 1 of 5). It was a lid close on battery, with WoWLAN off. As before, the journal ends at Assisted-by: LLM (Claude:Opus 5.5) |
Real suspend-to-RAM on the MacBook Pro 16" M4 Max (T6041, J616c) under Linux at EL2: entry, wake and a full resume of the running system, from the lid or
systemctl suspend. It uses the sleep core from #1445; the T6041 side has its own platform driver (t6041-sleep.c), because the M4 Max commits through aura's S2R mailbox rather than the T8140 path.Draft: the sleep works on my machine and the bring-up diagnostics are gone; see "Not working" for what is left.
Tested on
One machine: J616c, 26.6.2 firmware, booted at EL2 through aura.
This series, on #1445 as it was on 11 Nov (
b8f5b1e7f750), 12 Nov:integration/aurora(9219565939723cd5) for this PR; it rebased without conflicts, and two new AOP configs (T8152, T8142) needed the newed0pfield. With the J614C fixes and the cleanup below, 12 Nov evening: 3 deep sleeps in a row (RTC alarm, 20 s each), each one back on its own: Wi-Fi with the SSH session up, NVMe, Bluetooth,suspend_stats3 ok and 0 failed. With the display gate fix below as well: the internal panel on appledrm from boot, then a lid close and open, deep sleep, and the picture back after the wake.The same T6041 code on my older bring-up tree (7.3 daily kernel, 10 to 12 Nov):
Found while porting onto #1445
spin_table_hold_parked()first. The T6041 commit calledspin_table_stop_parked()without the hold, so the other cores stayed on and the watchdog reset the SoC 5 s after the commit. The T6041 enter now asks for the hold while it can still refuse.spmi-apple-controllernow drops replies left over at a firmware-driven resume, and the T6041 driver drains the FIFO around its own PMU writes. The SPMI change applies to any firmware-driven suspend, so T8140 too; it would be good to check it there.Found on a J614C (joske's test, 12 Nov)
apple,sleep-restore; the J616C's bring-up tree has the lists, the in-tree one didn't. Without them the DART's noirq suspend read its registers after the SEP's domain went off.t6041.dtsinow has the lists (the same writes as T8140's), and the SEP refuses that sleep with a message instead of hanging when they're missing.CONFIG_25G83inhw/t6041.rshad nosleep_restart, so the GPU refused every sleep there; it has it now.apple,t6041-sleepnode, and the driver doesn't bind without aura's S2R mailbox (before, it set its suspend ops and refused every sleep).Found on a J614C (joske, 17 Nov)
soc: apple: t6041-sleep: dcs_27 to AUTO at the commit on the full partputs it on AUTO with the others. With that line, the rebased head (cd59f6bf5donintegration/aurora59b02d5) wakes on the J614c fromrtcwake -m mem -s 20and from a lid close: panel, Wi-Fi, speakers and the SD reader are back. An earlier head with the same line slept 9 h 30 min unplugged for -18 mAh. The commit itself is build-tested only.apple_soc_edac event-log-handler: hardware error: event-log source 9a few times around each wake on the J614c. Nothing visibly breaks.Found on the J616C with integration/aurora
power-domains = <&dispextN_fe>, disabled like the PMP report entries above it; the in-tree trees describe no DISPEXT domain. The M4 Max gate enabled the chain nodes only, so they waited for domain providers that never came, failed at the deferred probe timeout (the mailboxes with-110), and the display subsystem never bound: the panel stayed on simpledrm.soc: apple: display-gate: M4 Max: chains from a tree that describes DISPEXTdrops the property where the domain stays disabled; nothing changes with the in-tree trees.iommu@3a2300000, the HDMI chain's display DART. That chain's DCP fails its probe here, so it is not bound to the DCP driver and the sleep's stop never marked its DART dark, while the power word step powers the chain off.drm/apple: T6041 S2R: the external chains' DARTs dark by nodemarks both external chains' display and DCP DARTs dark by node before their power words go down. After it: 2 deep sleeps, each followed by an sddm restart, in one boot, with the machine and the panel fine. Then on my daily build of this series (latestintegration/aurora+ this PR + clpc/g17: busy-share GPU memory floor from the DT #1369), a lid close and open followed by a desktop logout: fine.dcp_platform_suspend()warns twice (workqueue.c:4409,flush_workandcancel_delayed_work_syncon work that was never set up), apparently for the external DCP that is skipped as unusable. Harmless. That code isn't from this series, the gate fix only makes it reachable here; I left it alone.Not working / not tested
External displays: I have no external monitor to test with. The current code shuts the external display controllers down at the first sleep and they stay down until a reboot (as J616s (M4 Pro) at EL2: hibernation and suspend-to-RAM #1477 does).
@astaff, you are the other person doing M4 Max work: if you have a display and want to try or fix this part, that would be very welcome.
Touch ID after a wake, bring-up tree: works (a lid close and open, then a fingerprint unlock at the lock screen). A deep sleep is refused, cleanly, while the enclave is not confirmed asleep (
soc: apple: sep: refuse a deep sleep at once over a stuck enclave).Speakers after a wake: the amplifiers keep their configuration and report no fault; playback not checked by ear.
Camera: works after a wake on the J614c, including after a 9.5 h sleep (joske). Not checked on the J616c.
Panel dim after a wake (J614c): the brightness level is right, but the picture is at about half brightness until a DPMS off and on from the compositor; the same cycle inside the resume doesn't fix it (joske, 17 Nov). Cause not found yet.
Touch ID after a wake on this tree: works (a lid close and open, then an unlock at the lock screen). One earlier try failed 5 times and locked Touch ID; the integration driver keeps that lockout across restarts until
SEP_BIO_REARMgets the password, which nothing on my install calls yet.pm_test=platformand the display: the display stop assumes a real sleep follows. Underpm_testthe firmware is stopped but never power-cycled, the restart expects a power cycle, and the internal panel stays dark (joske, J614c). Not supported yet.Wi-Fi WoWLAN: with WoWLAN enabled, brcmfmac refuses
deepwith -95 (brcmf_pcie_pm_enter_D3) and the suspend is aborted; WoWLAN is s2idle only. Withdeepas the default, that is worth knowing (joske).More than two external DCPs: the display stop used to handle only the first two external DCPs;
drm/apple: T6041 S2R: every external DCP, not only the first twohandles every enabledapple,t6041-dcpext. Build-tested only.Notes for review
apple,t6041-sleepnode and the SEP DART lists; I have only slept with the bring-up EL2 DTB on the J616C so far.sep_pm_platform_commit()picks the path.spmi: apple: drop replies left by firmware at a firmware-driven resume(above),pinctrl: apple: ack a level interrupt again after unmasking it(all Apple SoCs; it stopped an interrupt storm from the speaker amps after a wake here),PCI: apple, nvme-apple: resume asynchronously, and the coprocessor stop helpers insleep.c.t6041-sleep.c(thedry,diagandserror_goparameters, PMU scratch marks and notes, register snapshots), the DCP driver (thes2r_*parameters, the step-by-step test hook, S2RSTOP/S2RSTART prints, the panic dumper) andapple_dart_display_keep()(its register dump). The commit and wake do the same hardware writes, delays and polls as before; the defaults the parameters had are now fixed. They are separate commits so the change is easy to review, and can be folded into the commits they clean up. The 4 BRING-UP ONLY commits are dropped.Assisted-by: LLM (Anthropic:Claude Opus 5.5)