Skip to content

soc: apple: J613 (T8122) suspend-to-RAM on the shared T8142 sleep framework (draft: wake unshown) - #2572

Draft
satchlj wants to merge 9 commits into
integration/aurorafrom
soc-apple/j613-sleep-port
Draft

satchlj wants to merge 9 commits into
integration/aurorafrom
soc-apple/j613-sleep-port

Conversation

@satchlj

@satchlj satchlj commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf. Draft: J613 (M3 Air, T8122) has not woken from this deep sleep yet. It is opened so the work stacked on it has a base and can be reviewed, not to be merged.

What it is

J613's suspend-to-RAM support on the shared T8142 sleep framework:

  • drivers/soc/apple/sleep-t8122.h: T8122's sleep data and ops (power words, commit, coprocessor stops).
  • Gates in sleep.c, sleep.h and Kconfig that keep J613's untested path off unless asked for, with a dry run that reads registers and a hold before the commit.
  • The DCP, G17 GPU sleep and macsmc hooks the sleep needs.
  • The T8122 sleep-controller DT nodes.

The commits are the base of the J613 deep-sleep trial series. The first was written by Codex; the others are review fixes and the hardware selection above.

Status

  • Wake: unshown. In every trial so far the SoC keeps its power after Linux's sleep commit: the boot stage's watchdog witness fires and the machine cold-boots. The trial series on top of this has been comparing Linux's state at the commit with macOS's (PMGR words, the display coprocessor's shutdown, every coprocessor's ASC state).
  • Disk safety in testing: the trials run from a RAM initrd. It mounts nothing on NVMe and sets the disk read-only.
  • Building: built alone (these four commits on 8fd2d5e8, no trial commits; rebased onto acfcd08b since, range-diff =) on alba's arm64 build VM with the J613 trial kernel config: clean, Image sha256 73e577d0…. Not booted alone.
  • Selection: a fourth commit replaces the port's board matches with hardware selection.
    • DCP: the 26.6 firmware interface on an internal panel, with the sleep driver owning the coprocessor stops.
    • G17 GPU-sleep map: non-posted where the bus's nonposted-mmio marks the resource (IORESOURCE_MEM_NONPOSTED), not on the T8122 machine compatible.
    • macsmc: the opt-in WKTP=2 write without a board check.
    • The T8122 sleep data keeps .machine = "apple,j613". That is the framework's board and CPU inventory check (boot core, core count), used the same way by T6050's J714s and J716c data.

Stacked work

  • The T8122 NVMe late idle (nvme-apple/t8122-sleep-idle) needs this sleep driver to call its last stop.
  • A read-only census of every ASC's control and status at the commit (trial diagnostic).

0687f996 merges integration/aurora into this branch to clear the conflict without a force-push. Review the four commits below it; the merge's only resolved hunk is in apple_sleep_end(), which keeps integration's PMU wake hook and this branch's no-WD2 condition on the WD2 clear.

Selection after 934b438c: the T8122 sleep data no longer carries .machine, so the controller's compatible selects it on every board with the apple,t8122-sleep node in t8122.dtsi: J433, J434, J504, J613 and J615. Tested on J613 only. The commit path itself stays behind the data's untested flag (apple_sleep.deep=1 and apple_sleep.untested_commit=1), so on the default command line nothing changes on any of those boards.

Still open: the DCP firmware-version gate (fw_compat == DCP_FIRMWARE_V_26_6 in dcp_sleep_owned()). On J613 the internal DCP (28ec00000) advertises RTKit endpoint map parts 0x11f and 0x821fff (IOMFB 0x37 among them); a map from a firmware with a DCP sleep path is needed before an advertised endpoint can replace the version check.

Draft, and stays draft until two gates are gone: the commit path still needs apple_sleep.untested_commit=1 (with apple_sleep.deep=1) and the DCP cold stop still selects on the firmware version. The bar is no gates on the default command line. Also not yet shown: that the SoC powers down after the commit on J613 at all (trial rows return only through the watchdog).

Assisted-by: LLM (OpenAI:Codex, Anthropic:Claude Fable 5.2, Anthropic:Claude Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

This series adds thirteen "J613 trial" module parameters in drivers/soc/apple/sleep-t8122.h (t8122_wdt_secs, t8122_match, t8122_atc_off, t8122_disp_off, t8122_wake_mask, t8122_quiet, t8122_console and others), j613_wktp2 in macsmc.c and untested_hold in sleep.c, all of which change what the sleep entry does or hold the machine for an external reset. A suspend path has to have one fixed sequence that works with no parameters: settle which watchdog, display, ATC and wake-mask steps are needed, apply them from the DT description, and remove the knobs. Diagnostic register dumps belong in debugfs, and the debug-cable witness and hold modes should not be in the driver. Until then this should stay a draft.

@satchlj

satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf. This answers the J615 questions and Ryan's review. Everything below comes from our own J613 Linux trials and Aura (hypervisor) captures of macOS. Run and kernel numbers are the ones in our trial log.

(a) Where J613 stands

The SoC still keeps its power after Linux's commit. Every WD1 witness bites. Five things are now established:

  1. The witness is valid. In capture 76, Aura armed WD1 for 15 s at macOS's own commit writes, the way the Linux witness does. macOS slept and woke on its RTC alarm at 29 s with no bite. WD1 pauses while the SoC is really asleep and bites about 10 s after the wake. So a bite before the alarm means the SoC never powered down.
  2. These match macOS and don't fix it:
    • Every coprocessor's ASC control/status at the commit (n47–n49).
    • The CPU side of the commit (n50, n51): each core's final-WFI state, the final WFI taken at EL1, the commit tail in macOS's order, and the boot core's wait.
    • After the commit, the engine's words don't move at 5 ms, 50 ms, 500 ms or 3 s.
  3. The whole-range diff. We compared 28,916 words across the sleep node's register ranges at the commit point (macOS capture 77 against Linux n52): 90 differ. Writing macOS's values for 45 of them at the commit (n53) didn't help either; 20 held and 25 bounced back.
  4. The lead: six PMGR power gates.
    • The ADT pwrgate-regs lists three gate banks at PMGR +0x24000 (mask 0xff000000), +0x25000 (0xffffffff) and +0x26000 (0xbfff), each gate a 0x80-byte block. Bit 30 of each block's +0x10 word reads "active".
    • The ADT power-domains names the gates in bank order.
    • On macOS, DCS6, DCS7, SMX1, LMX0, LMX1 and LMX2 (bank +0x25000, gates 1, 2, 4, 5, 6, 7) come up active. Five do so within 10 s of guest entry, and LMX2 (gate 7) by about 220 s. All six stay active through the commit.
    • On Linux they are never active, from 1 s after boot through the hold (n54, n56).
    • XNU never writes those blocks: capture 79 had the page trapped from before guest entry. They come on during XNU's PMP traffic, so the PMP firmware turns them on.
  5. What we've ruled out on the PMP, and what's next:
    • Linux receives the same 350 tunable requests in the same order and answers them with the same sizes (n55, n57).
    • Its SET_IOREG replies do differ from XNU's (n57), but answering the way XNU does didn't turn the gates on (n59).
    • The PMP boot arguments match field for field, apart from per-boot keys and one field: PMCM is 0x000f4240 on macOS, 0 on Linux (capture 84 against n60).
    • Next: n62, a pre-commit hold that patches PMCM, to see whether the six gates come on. Only then a WD1 witness, against a same-kernel control.

A J615 row that would help: boot the branch below with apple_sleep.t8122_wide_dump=0x7ff and report the controller blocks active at probe … line and the samples after it. That shows whether J615's Linux leaves the same six gates off. If your J615 has an Aura macOS capture set up, the same mask at macOS's commit would confirm the gate story on a second board.

(b) Trial branch

trial/t8122-sleep-20261121 on aurora-silicon/linux, head 02609de. It is 63 commits on integration/aurora 024cec8c, all signed off, without tonight's PMP message logging. The last commit drops the board gate: the T8122 sleep data, its trial switches and the macsmc checks now follow an available apple,t8122-sleep node instead of of_machine_is_compatible("apple,j613"). The probe still checks the boot core (MPIDR 0x10100) and the eight CPUs, so a J615 DT with that node gets the same code unchanged. The trial command line we use is in our runner (run-lin.sh, X=); I can post it here if useful.

Ryan's review

Agreed: a suspend path needs one fixed sequence and no parameters. The parameters stay only while we find which steps the hardware needs. Once a J613 sleep wakes, the needed steps become fixed and follow the DT. The rest goes: the diagnostic dumps move to debugfs, and the witness and hold modes leave the driver. Until then this stays a draft.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615 (MacBook Air 15-inch, M3, T8122; DCP and the rest on the 27.2 images) rows on trial/t8122-sleep-20261121 02609de, as asked.

The six gates are off on J615 too. With apple_sleep.t8122_wide_dump=0x7ff:

controller blocks active at probe 0001fd9ffffc8e01
... (sample 0)  0007fdbefffc8c09
... (sample 9)  0007fdbfffff8f09   (61 s)
... at suspend begin 0007fd9fffff8f09

Bits 1, 2, 4, 5, 6 and 7 are never set, the same as your J613 Linux. One difference worth knowing: this J615 never starts the PMP at all (the pmp@2d0500000 node is disabled in its tree; the display gate keeps PMP and PMS SRAM on), so "Linux answers the PMP's requests" and "nobody talks to the PMP" end in the same gate state.

Entry and commit.

  • Dry run: every check passed (warnings only: pmp and gpu unbound, both with their domains off).
  • First commit: refused late with a bound display coprocessor is still running, and the machine came back cleanly in 0.8 s. The internal DCP's cold stop was J613-only and 26.6-only.
  • With the cold stop also taking the T8122 27.2 image: the sleep commits, and the J615 resets about 90 s after PM: suspend entry (deep) (t8122_wdt_secs=90, t8122_wake_mask=1, RTC alarm at +30 s). That is the WD1 witness biting with the SoC still powered, the same result as J613.

Two fixes the J615 needed, on branch j615s2r/t8122-trial-fixes (a18079a = your 02609de + #2580 for the 27.2 panel + these two). Take them into the trial series if they suit you:

  • 3122f40 iommu: apple-dart: keep a live MTP through a firmware-driven sleep. With a live MTP handoff (apple,bypass-handoff-streams) the DART refused every sleep except s2idle with -EBUSY in dpm_suspend, so the deep sleep never reached the sleep driver. The rtkit helper already keeps the MTP running through a firmware sleep, so the DART is now kept the same way as through s2idle, and its resume still checks that stream 1 is in bypass. J613 hits this too wherever the MTP is handed over live.
  • a18079a drm/apple: T8122 sleep: stop the internal DCP cold on the 26.6 and 27.2 images, by hardware. Selects the T8122 internal DCP by compatible instead of apple,j613.

The J615 is free for your next hypothesis (n62, PMCM) as a second board. Post the trial commit and its command line, and the probe timeline will show whether the six gates come on before any commit.

Rows and setup
  • Kernel 7.3.0-aurora-j615s2r2: trial 02609de + drm/apple, soc: apple: drive the M3 Air (T8122) internal display on macOS 27.2 #2580 + the two commits above. Config: our J615 lab config + APPLE_SOC_SLEEP_T8122=y.
  • Stage 2: aura main (our J615 default) with its DTB carrying the trial's sleep node (incl. the 5 MCC ranges), apple,display-coprocessors = <&dcp>, &sep { power-domains = <&ps_sep>; } and the SIO ASC size change. /chosen/aurora,s2r-mailbox is present; deep sleep available, not the default: boot object resumes 0.
  • Inventory: Booting Linux on physical CPU 0x0000010100, 8 CPUs, apple,j615 apple,t8122.
  • Dry-run witness 0: dcp ASC control 0x10 status 0x3000ac; pmp control 0 status 0x2a; gpu/ans/sep read dead0ff0 (domains off); gates 80000000/80000000; clusters f/f; CLLT 00031c17; debug switch 0x1000030f (no debug port named, no cut).
  • s2idle control on the same boot: 1/1.
  • Disk: freeze_filesystems=1 + sync before the commit; 0 btrfs errors after the reset.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Follow-up from the J615: Linux can start the J615's halted PMP. A lab module asks for it the way a consumer would; on 27.2 the GPU, its consumer, is unbound, so nothing else starts it. The start went through (PMP started, PMP ready: PTD status 0x1 request 0x20800 ack 0x208f0). The dry run then passes with the PMP bound. The six gates still read off at suspend begin, about 45 s after the start (0007fd9fffff8f09, blocks 1, 2, 4, 5, 6, 7 clear). So the J615 now matches your J613 with a running PMP and the boot loader's requests (display + storage), and is ready for the PMCM test (n62).

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615, PMCM (n62 on a second board): I added PMCM to the PMP driver's optional boot arguments (read from an apple,pmcm property, lab only) and set it to your macOS value on the J615's PMP node. Then I started the PMP from Linux as before (PMP ready ... ack 0x208f0). The six gates still read off at suspend begin 45 s and 240 s after the start (0007fd9fffff8f09). One caveat: the boot-argument patcher rewrites only keys already in the firmware's block and logs nothing, so this row doesn't prove the word changed. If your n62 shows the gates coming on, I'll repeat it with a read-back of the block.

A J615-side note for anyone trying deep sleep here: with wifi0 as a wakeup source (#2581) and WoWLAN armed, brcmfmac refuses a firmware sleep (brcmf_pcie_pm_enter_D3 returns -EOPNOTSUPP; it allows WoWLAN only in s2idle). WoWLAN has to be off for a deep-sleep row.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615, PMCM again, with a read-back this time: the PMP driver reads the boot-argument block back from SRAM after its patch and before the firmware runs, and logs PMCM reads 0xf4240. So the write took. The PMP starts (ack 0x208f0), and the six gates still read off at suspend begin 45 s and 240 s later (0007fd9fffff8f09). A commit on the same boot (PMP running, PMCM set, t8122_wdt_secs=90, t8122_wake_mask=1) ends in the WD1 reset about 90 s after PM: suspend entry (deep), as before. On the J615, at least, PMCM alone is not what brings DCS6/7, SMX1 and LMX0-2 up.

@RyanTheTide

Copy link
Copy Markdown
Contributor

More J615 rows on the six-gate lead. These are register reads on the production kernel through /dev/mem, plus two one-shot boots of the trial kernel. Data: traces/power/20261121-j615-pmgr-gates and traces/power/20261121-j615-s2r2 on our store; I can attach anything you want to see.

1. Linux can't write the gate banks at all, so "bit 30 doesn't stick" is the whole bank. I wrote +0x0, +0x4, +0x8, +0x10 (bit 30), +0x14, +0x18 and +0x28 of an inactive block at 0x2d0725600. Each read back unchanged after 10 ms and after 1 s. As a control, the same mapping writes PMGR PS fine: DEV_DISABLE on the powered-off DISPEXT_CPU set, then cleared. So arming these gates from the AP at the commit is not an option. Only whoever owns the bank can arm them.

2. Bit 30 follows a domain's live power-gated state. I sampled once a second with nothing else touching the PMGR:

  • bank +0x26000 gate 5 is set exactly while ans (PS 0x3f8) idles to 0x1000230f and clears when ANS comes back to 0x1f0023ff. That's 5 of 5 transitions.
  • bank +0x26000 gate 0 flips with avd_sys (PS 0x1f0) when the AVD node is opened.

Active blocks also always read +0x28 = 0x0c000000, inactive ones 0. That word is a read-only state field.

3. That puts the gate names in doubt. AVD_SYS isn't in the ADT power-domains list at all, and ANS sits at bank +0x25000 gate 30 in that order, not where the hardware shows it. So at least bank +0x26000 is not in list order. I can't prove bank +0x25000 is wrong either way. One thing argues against the memory names, though: the blocks the list would call DCS5 and SMX0 stay "active" through 20 s of a 6-thread 512 MB copy. If active means gated, those aren't DRAM-channel or fabric gates the CPU is using. I'd treat DCS6/DCS7/SMX1/LMX0-2 as positions (gates 1, 2, 4-7) until a domain is seen to drive them.

4. PMP start requests don't arm them (R6b). I added PMP report entries for the DCS, AMCC, IOA0 and IOA1 soc-device records, always-on and no-ack, so the PMP started with request 0x2080f ack 0x208f0. The six stayed off at +10, +60 and +240 s (bank mask ffff8f09 before and after). This was on top of R3/R4b (PMP started, PMCM verified).

5. Request bits on T8122 are record indices, and the storage request sits on the wrong one. The unrequested ack bits 4-7 are the SOC_AON, SOC_REST, EACC0 and PACC0 records, which only makes sense if bits are records. The storage entry (report@11) is not marked apple,soc-device-record, so it uses bit 17. Bit 17 is the record of report@d (scodec). ANS's own record is bit 19. My first try (R6) tripped over exactly this: no unique request bit for report@11. It also means your "macOS keeps bit 19 (IOA1) set through sleep" finding is probably macOS keeping ANS requested. IOA1 is record 3 on this table. Worth a look in the display gate too (it sets the storage entry up).

6. Gate masks move between Linux boots without the PMP. The fleet kernel boot reads 8070000a / fffe8e09 / 0007fd9f (banks +0x24000/+0x25000/+0x26000). The trial-kernel boots read 9870000a / ffff8f09: bank +0x24000 blocks 27 and 28 and bank +0x25000 gates 8 and 16 come on. So some of these blocks follow what the AP side has powered, not only PMP commands.

What I'd try next, and what I can run on the J615
  • Name the six by behaviour rather than by list order. On macOS under Aura, log bit 30 of bank +0x25000 gates 1-7 next to the PS words in the first 10 s after guest entry, and see which PS (or ps-aon) words change in the same sample. On J615 Linux the same sampler is ready (corr.py, read-only).
  • The two PS words that differ in state at the commit, SIO_CPU 0x210 and APCIE_PHY_SW 0x4a0, are powered on J615 Linux too, along with ATC0/1_COMMON, IOA1 and the ps-aon ATC words. Both J615 USB-C ports have a partner here (charger plus our tether). A commit row with both cables out needs a person. I'll ask for one if you think the ports matter.
  • The J615 is free for your next hypothesis: post the commit and the command line, and we run it within the hour.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Follow-up to point 5: the storage-request fix is #2682 (draft). On T8122 the display gate now marks report@11 apple,soc-device-record too, so ANS is requested on its record bit, 19, and no longer on bit 17, which is the device ID 14 record. J615 row on the default command line: requests 0x80800, PMP ack 0x8f0, NVMe and panel fine, s2idle x2. A J613 row from your side would complete it, since your PMP runs with the GPU there.

@RyanTheTide

Copy link
Copy Markdown
Contributor

One more J615 row, and it settles the naming question from point 3.

Bank +0x25000 gate 8 is the external DP PHY's gate. On a trial-kernel boot I toggled dptx_ext_phy (PS 0x430) on and off twice. The gate's bit 30 cleared with the PHY on and set with it off, 4 of 4, within 0.5 s. The ADT power-domains order calls gate 8 "LMX3". So list order doesn't name bank +0x25000 either, and gates 1, 2 and 4-7 are not known to be DCS6/DCS7/SMX1/LMX0-2. DCS0-7 also have their own PS words (0x330-0x370), and those are on both at macOS's commit and on Linux.

What fits better: the six are ordinary per-domain gates, set when their domain is power-gated, for six domains that macOS has gated at its commit and Linux still has powered. Your trial's own lists name exactly six such domains:

  • main PMGR: SIO_CPU (0x210) and APCIE_PHY_SW (0x4a0), idled to 4 under macOS. On Linux they're on, and the auto-idle write doesn't stick;
  • ps-aon: 0x80 nub_spi0, 0x88 nub_ocla, 0xb8 atc1_usb_aon, 0xc8 atc1_usb (t8122_macos_aon_off).

That count may be a coincidence; a ps-aon domain may not even have a gate in the main bank. But it's testable: watch bank +0x25000 bit 30 while you lower each of them at the hold. Lowering is what you already do with t8122_macos_state; the new part is reading which gate follows. Getting SIO_CPU and APCIE_PHY_SW to actually idle on Linux (why the write bounces) then looks like the real lever.

(Side note for our fleet kernel: it keeps dptx_ext_phy powered with nothing attached; the trial kernel leaves it off.)

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615: APCIE_PHY_SW is one of the two PS words you found differing at the commit, and its idle comes from the PCIe link, not from a write.

  • On J615 Linux the internal port and the BCM4388 run ASPM L1 with the L1 substates off (L1SubCtl1: ASPM_L1.2- ASPM_L1.1-, policy default), although both ends advertise L1.1 and L1.2.
  • With pcie_aspm policy powersupersave (L1.1 + L1.2 on), APCIE_PHY_SW goes from 0x1f0000ff to 0x1400024f, macOS's commit value, within 0.5 s. APCIE_GP and APCIE_ST auto-gate as well, and Wi-Fi keeps working. Revert, and it's back to 0x1f0000ff. That is also why the auto-idle write doesn't stick: the PHY idles only when the link sits in L1.2.
  • At the hold (dry-run witness 0) it now reads ps 004a0 1400024f. In every earlier J615 dry run it read 1f0000ff.
  • A commit with it in macOS's state still ends in the WD1 reset (commit4: suspend entry (deep) 08:20:04Z, new boot 126 s after arming, the same as commit3). So on J615 APCIE_PHY_SW alone is not what keeps the SoC up.

That leaves SIO_CPU from your diff. On J615 Linux there is no SIO device at all: the domain sits powered with AUTO_ENABLE and no firmware ever runs on it, so it can't idle the way macOS's (0x1400024f) does. The auto-idle field is ignored when written from the AP here too. Lowering it fully at the hold (your t8122_sio_off) is the next J615 row I can run if you haven't covered it on J613. Say so and I'll queue it.

Separately: enabling L1 substates on the Apple internal PCIe port by capability looks like a plain power win for s2idle and runtime too. I'll hand that to our power lane with numbers rather than push it here.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Correction to my last paragraph: no t8122_sio_off row is needed on J615. The dry-run witness at the hold already reads ps 00210 0f000200 (R5 and R9), so SIO_CPU is fully off there, which is lower than macOS's idled 0x1400024f.

So on J615, at the hold, both PS words from your commit diff are at or below macOS's state: APCIE_PHY_SW with L1 substates on, and SIO_CPU off. The commit still ends in the WD1 reset. Whatever keeps the SoC up on J615 is not a main-PMGR PS state.

Signed-off-by: Satya Benson <satya@benson.earth>
The J613 port named the shared untested/untested_commit gates but its
early-context entry reached neither of them, and it did not compile.

- The early-context ops offered deep sleep whatever apple_sleep.deep said:
  they now use apple_sleep_valid, as the common ops do.
- The early-context entry never stopped before the commit. It now stops
  right after the refusals, as the common entry does, having run the
  coprocessors' last checks and the SoC's final check: no core held, no
  power word written, nothing stopped. The switch is latched at .begin.
- A dry run stopped J613's display coprocessor cold, with no restart.
  apple_sleep_dry_run() tells its driver, which then takes its ordinary
  suspend; the sleep driver doesn't count the running coprocessor in a
  dry run (display_no_restart).
- Step notes went to PMU scratch at J815's offset, unmeasured on J613's
  PMU: no_pmu_notes.
- A SoC that requires a wake source also requires its wake block.
- The trial's reset watchdog is not armed over a dry run, and the empty
  commit_begin left from the panic stage is gone.
- The shared match had a stray (*failed)++ on an int, and the header
  called three match helpers that don't exist: restored and made local.
- The probe's dump of the common layout's words is skipped for a SoC with
  its own register map, whose offsets for them are all zero.

The SMC's order is recorded as an open difference from macOS's and not
changed: the only shared hook that defers the final notice behind the
peer stops uses a transport never run on this SMC.

Not built, not run.

Signed-off-by: Satya Benson <satya@benson.earth>
… hold before commit

The per-core FIQ quiet T8142 runs before its last WFI becomes a shared helper,
which J613's trial can ask for (t8122_quiet). A J613 dry run can print the boot
core's timer, PMU and deep-sleep registers (t8122_dry_regs, reads only). An
untested SoC can run its whole entry and hold at the last step before the
commit word (apple_sleep.untested_hold), for trials booted from RAM. The note
on the SMC's order names the shared policy path that matches macOS's order and
why it is not taken yet.

Signed-off-by: Satya Benson <satya@benson.earth>
- dcp: the 26.6 firmware interface on an internal panel, with the sleep
  driver owning the coprocessor stops, selects the cold stop; drop the
  J613 board match.
- asahi g17 sleep: map non-posted where the bus says so
  (IORESOURCE_MEM_NONPOSTED, from the DT's nonposted-mmio), not on the
  T8122 machine compatible.
- macsmc: the opt-in WKTP=2 write needs no board match.

The T8122 sleep data keeps .machine, the framework's board/CPU inventory
check that T6050's J714s and J716c data use the same way.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj
satchlj force-pushed the soc-apple/j613-sleep-port branch from 4820c62 to 7f160c1 Compare November 21, 2026 17:58
Conflict in apple_sleep_end(): keep integration's PMU wake hook and this
branch's no-WD2 condition on the WD2 clear.

Signed-off-by: Satya Benson <satya@benson.earth>
It was off by default behind a module parameter and never qualified on
hardware; the default sleep path does not use it.

Signed-off-by: Satya Benson <satya@benson.earth>
Drop .machine from the T8122 data so the controller's compatible alone
selects it; the board/CPU inventory check no longer runs for it.

Signed-off-by: Satya Benson <satya@benson.earth>
j613_sleep_down and dcp_j613_sleep_owned() describe a firmware-sleep cold
stop, not a board: rename them sleep_cold_stopped and dcp_sleep_owned().

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf. Split: the gate-free part (T8122 data, DT node, Kconfig, KUnit, macsmc and asahi hooks, no module parameters, no board or firmware selection) is now #2746. This PR keeps the DCP 26.6 cold stop and the commit enablement as a draft until a real resume works on J613.

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

J613 DT finding, the same one #2746 had: in this PR's t8122-j613.dtb the sleep node is status = "disabled", and it has neither apple,display-coprocessors nor apple,debug-port, so the driver can't probe on J613 as written (-ENODEV: no display coprocessor 0 on #2746's equivalent). The current J613 row on this stack (with #2583) uses a trial DTB that enables the node and adds both properties. I'll add the properties here before undraft, as on #2746 (a4905c2). Whether the node itself should be enabled by default is the same question as there.

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

J613 commit row on this stack (with #2583 and the current tip). Trial-only conditions: SEP disabled with its gate skipped by a local trial commit, an older trial DTB, RAM boot, disk read-only. So this is not evidence for this PR's real path.

  • At entry: "this sleep commits: wake sources not armed, left as they are; no wake is qualified". The RTC alarm the trial armed (15 s) isn't qualified as a wake source on J613, so the sleep had no armed wake.
  • The commit went ahead ("going ahead with 1 problems": GPU unbound). WD1 bit about 60 s later and Stage 1 booted the installed system, so the SoC kept its power and nothing woke it.
  • On a RAM boot the J613 DTB from this PR can't bind DCP (no apple,firmware-compat, normally added by the bootloader) or PMP (no apple,pmp-report), so the framework refuses there independently of the SEP.
    Next: qualify the RTC alarm as a J613 wake source from the DT/hardware description.

macOS's commit on J613 shows the wake block's seven mask words at +0x08
and its status words from +0x24: every wake (RTC or keyboard) latches
source 155 at +0x34, bit 27, which is status word 4 from +0x24. The
match data had the status at +0x28, taken from T8140's layout, so a wake
was read one word off. Use +0x24; the mask offset was already right.

Signed-off-by: Satya Benson <satya@benson.earth>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-checked at eaf1225.

  • Dropping the WKTP=2 opt-in (b15f23c) and selecting by the sleep controller instead of .machine (934b438) both look right.
  • eaf1225: the new comment says the seven mask words cover ids up to 223, but .wake_last_word = GENMASK(16, 0) still stops the seventh word at id 208 (sleep-t8122.h, t8122_sleep_soc). If the measured mask block really goes to 223, the last word should be the full 32 bits. Otherwise the comment should say 208, as it did before.
  • Every J613 row so far ran on a trial DTB, because this PR's t8122-j613.dtb leaves the sleep node disabled and has no apple,display-coprocessors or apple,debug-port. The 07:37 row also had no wake armed, so it doesn't test wake or power-down. That fits the draft status. For the undraft row, please run this PR's own DTB on the default command line with a qualified wake source armed.
  • Still open from before: the 12 t8122_* module parameters, untested_hold, and the DCP_FIRMWARE_V_26_6 check in dcp_sleep_owned().

Assisted-by: LLM (Claude:Opus 5.5)

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

SEP sleep on J613 works through this PR's enclave stop. On a trial dry run (SEP bound, link still up, a trial-only hook calling apple_sleep_enclave_stop() after "every check passed"), the stop returned 0 and the SEP's power word (0x2d0700c00) went from 0x1f0022ff to 0x1000270f within 50 ms. That is macOS's value at its commit (actual 0), so the SEP reaches macOS's disabled state.

One thing to handle: after that stop, the dry run's refusal returned into resume with the SEP asleep, and the kernel took an Asynchronous SError Interrupt (el1_abort, PID 1) about 30 ms later, presumably an access to the powered-off SEP domain during resume. In this PR the enclave stop only runs past the last refusal, so it can't happen as written. But any path that refuses or returns after apple_sleep_enclave_stop() would need to bring the SEP domain back before resume touches it, or panic deliberately instead.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615, five deep commits on this stack (#2583 f386099e + integration 8b360dc8, plus our DART live-MTP and DCP 27.2 cold-stop fixes and #2682). This time each one leaves a record that survives the reset.

Step notes through the reset. On J615 the PMU scratch (ADT pmu-main info-scrpad = 0x8000 + 0x2800, usid 0xe) is byte-identical across a warm reboot. A test pattern at 0x8308 survived one unchanged, so the framework's notes there can be read after a WD1 bite. Branch j615s2r2/t8122-sleep-notes (one commit on f386099e) does three things. A sleep-notes nvmem cell of the PMU's layout on the sleep node turns the notes on for T8122. The next boot prints the last sleep's notes and clears them. The T8122 last mile notes steps 0x70-0x77 plus a digest of each witness snapshot: words with bit 11 (BUSY/PARENT_MISSING), words asked off but still on, words on where your macOS commit table has them off, the SEP and DISP_CPU words, and a 0x5a marker right before writel(1, s->commit).

row change on top of the previous row result notes at 0x8308
A defaults, t8122_wake_mask=1, PMU RTC +20 s, WD1 witness 90 s WD1, new boot at 121 s a5 77 00 02 17 00 ff 00 ff 04 34 62 6a 0f 00 5a
B ACIO (thunderbolt-apple-acio) unbound, so the atc0/1 cio, cio_pcie and cio_usb domains go off WD1, 128 s .. 01 34 ff ff 0f 00 5a
C qspi (0x2c8) lowered (a trial-kernel artifact: this tree has no QSPI driver, so sync_state kept it on) WD1, 130 s .. 00 ff ff ff 0f 00 5a
D SEP DART apple,sleep-prepare/-restore/-restore-late (T8140's prepare, restore values from the J615 ADT dart-sep tunables) WD1, 124 s same as C
E t8122_disp_off=3 (GFX, DISPEXT CPU/FE/SYS, I2C3, SPI2) WD1, 130 s same as C

What that says, for every row:

  • The last step is 0x77 with the marker, so the commit word is written. Nothing between the last refusal and the commit hangs.
  • No PS word has bit 11 latched at the last snapshot, so there is no PARENT_OFF latch to clear here. Disarming AXI2AF bridges (as on T6041/T6040) has nothing to act on on T8122, at least among the 128 words your table names.
  • The SEP word's low byte is 0x0f, the same as macOS's 0x1000270f.
  • From row C, all 128 named PS words are at or below macOS's commit state (0 on where macOS is off). The SEP DART sleep lists (D) and the DP/DPEXT children (E) change nothing.

So on J615 what keeps the SoC up is after the commit word or outside the main PMGR words. The parked-CPU hold (spin_table_hold_parked()) is already on this path. Next on J615 is a post-commit probe like T8142's: the boot core notes the engine's state some ms after the commit (clusters, power gates, the commit word read back, a pending wake), then takes its WFI. If you have a J613 reading of what the engine waits on after the commit, I'll run that first.

Row tools, raw notes and both boots' logs: kept on our side. The decoder maps the index bytes back to your t8122_ps_all.

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