Skip to content

soc: apple: sleep: T6001: deep sleep (suspend-to-RAM) for MacBook Pro 16" M1 Max (J316c) (on #4239, #4304) - #4305

Open
connorchanjazzman wants to merge 82 commits into
aurora-silicon:mainfrom
connorchanjazzman:feat/t6001-j316c-deep-sleep
Open

connorchanjazzman wants to merge 82 commits into
aurora-silicon:mainfrom
connorchanjazzman:feat/t6001-j316c-deep-sleep

Conversation

@connorchanjazzman

Copy link
Copy Markdown
Contributor

Summary

Adds hardware deep sleep (suspend-to-RAM, mem_sleep=deep) support for T6001 (M1 Max) and qualifies MacBook Pro 16" M1 Max (J316c) on OS FW 27.2 (26B123) across 20/20 consecutive WARM_S2R_VERIFIED cycles with zero kernel warnings or errors.

Stack / Dependencies

  • Base: aurora-silicon/linux main (16a732e9c, which already includes #4245)
  • Depends on:
    • #4304 (T6001 27.2 bring-up: AVE 26B123, South PMGR ps_prores, South pmp_report indices & apple,no-ack)
    • #4239 (Ante042:j314s-deep-sleep, head 538b824fc, T6000 J314s deep sleep base)
  • Aura: No Aura PR required — upstream aurora-silicon/aura main already supports T6001 S2R warm resume as-is.

Commits on top of #4304 + #4239

  1. b18a44e36 — dt-bindings: soc: apple: sleep: add T6001
  2. 6059976df — drm/apple: support firmware 27.x internal display power-off in dcp_s2r_park()
  3. 4565c798e — drm/asahi: enable fw_park_for_sleep on T6001
  4. e29e90a3c — soc: apple: sleep: expose read-only boot object resumes sysfs attribute
  5. 8e5d9076a — soc: apple: sleep: add T6001 (M1 Max) deep sleep profile
  6. 6d1a710c2 — arm64: dts: apple: t6001: wire deep sleep controller and qualify J316c

Root Causes & Implementation Details

Bringing up true hardware S2R on T6001 (M1 Max) with OS FW 27.2 uncovered three T6001 / 27.x-specific blockers that initially stalled PMGR cluster quiesce until the 30 s WD2 reset, plus a South wake-path restoration issue:

  1. South DISPLAY2 (cl[7]) stuck BUSY (0x10) due to 12 un-modeled firmware-owned sub-domains:

    • On T6001, dispext2 and dispext3 on the South die own 12 PMGR sub-domains (BE, DP, GP0, GP1, PPP, DSC on each) that remain powered after firmware handoff and are not modeled as Linux genpds.
    • t6001_sleep_disp2_down() in drivers/soc/apple/sleep-t6000-display.inc raises DISPLAY2 (cl[7]) and disp2-tvm, applies the South dispext2/dispext3 fabric setups and handshakes with PMP requests 29/30 (using the corrected South pmp_report indices from #4304), powers down all 12 un-modeled South sub-domains, and drops cl[7] cleanly to 0 (restoring cl[7] on refusal or wake).
  2. North DISPLAY (cl[6]) stuck BUSY (0x10) on firmware 27.x soft-DPMS internal panels:

    • On OS FW 27.x, internal eDP uses soft DPMS so dcp_poweroff() only dims the backlight without calling set_power_state(0). Sending only A500/A550 and RTKit IDLE in dcp_s2r_park() left firmware-owned DISP0 sub-domains (DISP0_BE, DISP0_SPI, DISP0_SPMI, DISP0_DP, DISP0_BLC) powered on, holding DISP0_FE at 0x200 and DISPLAY (cl[6]) stuck BUSY (0x10) through quiesce.
    • dcp_s2r_park() now invokes iomfb_s2r_power_v27(dcp, false, true, false) and waits for D572 before A500/A550 and AP/IOP IDLE (unwinding cleanly on park failure), and dcp_s2r_unpark() restores display power via iomfb_s2r_power_v27(dcp, true, true, true) + D572. External 27.x DCPs using s2r_park are also admitted through dcp_platform_suspend().
  3. Idle PS_AUTO_ENABLE South late-domains (ps_afnc4_lw0 / ps_afnc5_lw0) polling timeout on resume:

    • T6001's South ps_afnc4_lw0 and ps_afnc5_lw0 have PS_AUTO_ENABLE set and sit at 0x1000030f (TARGET=15, ACTUAL=0) while idle. t6000_late_restore() previously polled unconditionally for PS_ACTUAL == PS_TARGET, triggering a not back at 15 warning on wake.
    • t6000_late_restore() now skips the PS_ACTUAL poll when a PS_AUTO_ENABLE domain's pre-sleep ACTUAL was 0, since hardware manages its active state automatically.
  4. T6001 sleep profile, GPU park flag, DT wiring, and warm-resume telemetry:

    • Registers apple,t6001-sleep with 8 AMCCs, 4 DCS planes, South PMGR (ps-south), 24 zero words, and T6001 late domains (ps_atc1_common, ps_afnc4_lw0, ps_afnc5_lw0), plus DT bindings in apple,t8140-sleep.yaml.
    • Wires PMP SRAM keep/reset vector, PMP/ISP DART address filters, ANS tunables, 27.2-ADT-verified apple,wake-enable, North + South display/GFX fabric tunables, SMC sleep pmVC/wake-reasons, HPM0/1/2/5 S3 SSPS, and &sleep with apple,sleep-tested on t6001-j316c.dts.
    • Enables fw_park_for_sleep: true strictly on HWCONFIG_T6001 in drivers/gpu/drm/asahi/hw/t600x.rs (leaving HWCONFIG_T6002 at false).
    • Exposes s->mbox->resumes as a read-only resumes sysfs attribute on the apple-sleep platform device so userspace and test harnesses can positively verify hardware warm resumes vs s2idle.

Qualification Results (20/20 Consecutive WARM_S2R_VERIFIED)

Tested on live MacBook Pro 16" M1 Max (MacBookPro18,2, J316c, T6001, OS FW 27.2 26B123) across 20 consecutive automated cycles (t6001-272-s2r-v15-qual01 through qual20), with default mem_sleep=[deep] via apple,sleep-tested (no apple_sleep.* kernel command-line opt-ins):

Metric Result across 20/20 cycles
Outcome 20/20 WARM_S2R_VERIFIED (0 failures, 0 cold resets)
Sleep durations 18x 8–10 s RTC wake, 2x 30 s RTC wake (cycles 10 & 20; reconnect ~40.5–40.7 s)
boot_id unchanged across suspend/resume 20/20 true
suspend_stats/success / fail 20/20 0 -> 1 / 0
Aura boot-object resumes counter (sysfs) 20/20 0 -> 1 (aura: S2R wake, resuming the OS)
16 MiB NVMe data integrity check 20/20 PASS
boot_error_count 20/20 0x00
Kernel WARNING: / BUG: / SError / Call Trace / not back at / did not acknowledge 0 across all 20 runs
Kernel noirq resume time 318.8 – 352.0 ms
Kernel early resume time 9.7 – 13.2 ms (down from ~1013 ms prior to #4304)
Kernel device resume time 313.9 – 470.8 ms (~0.81 s total kernel resume from Aura handoff)

All enabled 27.2 peripherals probe cleanly and resume without errors: internal eDP DCP, Wi-Fi/Bluetooth, NVMe/ANS2, SMC/RTC, USB-C/HPM, ave0/ave1, AVD, ISP/camera, ANE, apr1/ps_prores, and audio (macaudio/mca/admac/aop_audio/DCP HDMI-USBC audio).


Remaining Compatibility Limitations

  • GPU on OS FW 27.2: Aura intentionally leaves gpu@406400000 disabled on T6001 27.2 because g14_v27_2 / Aura gfx_fw_images does not yet carry a G13C 27.2 GPU firmware ABI/image entry (same behavior as stock Aurora 27.2). fw_park_for_sleep: true is wired strictly on HWCONFIG_T6001 for legacy 13.5 and future 27.2 GPU support, and was compile-verified (aurora.o) but not exercised live on 27.2.
  • Audio speaker-protection userspace contract: Upstream macaudio (#3212 on main) enforces a newer speakerguardd lease contract than the older userspace package installed on our test image (macaudio/mca/admac/aop_audio probe and resume cleanly, while speakerguardd-selfcheck requires matching userspace).
  • Single-suspend-per-boot harness: The automated qualification harness enforces a fresh one-shot boot per trial, so the 20/20 run validated 20 consecutive fresh-boot S2R cycles rather than 20 back-to-back suspends within a single boot.
  • Board scope: apple,sleep-tested is enabled strictly on t6001-j316c.dts (16" M1 Max MacBook Pro). Other T6001 boards (t6001-j314c.dts, t6001-j375c.dts) and T6002 (M1 Ultra) remain untested and unaffected.

Hygiene & Build Verification

  • Lab-only storage protection patches (CONFIG_APPLE_SEP_REQUIRE_RO_STORAGE) and temporary diagnostics used during development have been cleanly excluded from this PR branch.
  • Clean ARM64 LLVM=1 build verified on aurora-silicon/linux main + #4304 + #4239 (without lab-only config): all 6 T600x DTBs, drivers/soc/apple/sleep.o, drivers/gpu/drm/apple/dcp.o, drivers/pmdomain/apple/pmp-report.o, drivers/media/platform/apple/ave/ave-{drv,fw,layout}.o, and Rust drivers/gpu/drm/asahi/aurora.o compile cleanly.

A display coprocessor whose power domain is a PMP report entry keeps
its firmware running through s2idle and puts itself on the wakeup path
for it. Let the entry say so, as apple,sleep-wakeup-path says it for a
PMGR power state, so that the entry and the power states above it stay
on while the firmware runs.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
genpd keeps a domain on through system sleep for a device on the
wakeup path only if the domain is active-wakeup, and only
apple,always-on entries were. An entry without it is powered off in
the noirq phase although its consumer asked to stay powered: the
request is withdrawn and the PMGR states above it go off under a
firmware that still runs.

Make an entry with apple,sleep-wakeup-path active-wakeup too. Nothing
else changes for it: it is not seeded at the PMP start and not
requested at probe.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
With APPLE_USE_PMP (J314s, J316s) dcpext1 sits in the pmp-dispext1
report entry, which unlike disp0's and dispext0's is not always-on. Its
DCP stays on the wakeup path through s2idle, with its firmware running,
but genpd powered the entry and dispext1's power states off in the
noirq phase all the same. The firmware lost its power unseen, and the
next deep sleep could not park it: link sleep timed out, IOP IDLE
failed, and the block went down with it for the rest of the boot.

Mark the entry apple,sleep-wakeup-path. dcpext1 then goes through every
sleep as dcpext0 does.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
After a deep sleep that cut the GL9755's power, the chip reports an
empty slot for most of a second after its resume before Present State
shows the card again. The detect the core runs right after resume gets
-ENOMEDIUM from the card's re-init and drops a card that never left the
slot. The insert interrupt brings it back later as a new card, and a
filesystem mounted from it has lost its device.

The card state stable bit reads 1 throughout, so it cannot be waited on.
When a card sat in the slot before the sleep, wait in the resume hook
until the chip reports it, for 1.5 s at most. A resume without a card,
or one where the chip kept its power, does not wait.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
Outside compositor pairing order, a direct DP-alt port with no pipeline
takes the lowest free one as soon as it enters DP mode, whether or not a
display is behind it; only Desktop 26.x, T6041 and T8142 wait for HPD.
A USB-C dock without a monitor that enters DP mode before the port of a
USB-C display takes the pipeline that display needs, and the display
then waits for as long as the dock stays plugged in. Which port enters
DP mode first changes from boot to boot. At a wake the port controller
applies each port's state again, and the dock's port then takes a
pipeline an HDMI display left free.

Leave a port that owns no pipeline and has no HPD unrouted on every
machine, as those three already do. The port controller reports HPD as
a new status when a display appears, and the port is routed then. A port
that owns a pipeline behaves as before on an HPD drop, and the
compositor-ordered path is unchanged.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
When a display drops and comes back before the host has turned it off,
the DCP firmware announces a new DCPAVAudioInterface while the host
still holds the previous one open. The firmware keeps that instance, and
the display's link with it, until its client closes it: a later release
of the link (a DPTX disconnect) is never answered, and the port answers
nothing more until the firmware is restarted.

The new announcement retired the open instance on the host side as a
superseded singleton, so its Close could no longer be sent. Leave an
instance its owner still holds open to the owner (a held() callback in
the service ops). The work that opens the successor closes it first and
retires it then.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
The M1 Pro's sleep controls: the PMGR's AP wake block, its power-state
blocks on both sides, the CPU start block, the watchdog, the S2R timer
that commits a sleep, the NUB SPMI vector enables, the PMP telemetry
block, the SoC clock generator's mux block and the fabric ports of the
GPU and of the three display blocks. A sleep keeps the wake sources it
names enabled.

The node also points at the blocks the sleep reaches through their own
nodes: the PMGR's misc block (apple,pmgr-misc), SIO (apple,sio) and the
NCO (apple,nco). apple,sleep-late-domains lists the PMGR power-state
nodes written right before the S2R timer, each with the word written to
it, in the order written. apple,tunable-gfx-fabric,
apple,tunable-disp0-fabric, apple,tunable-dispext0-fabric and
apple,tunable-dispext1-fabric hold the setup each fabric port gets
before its block powers down: whole words, in the order written.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
The T6000 drivers that take part in its firmware-driven sleep need to
know whether the device tree describes that sleep. T6001 and T6002
share the T6000 block compatibles (SMC, AIC, DART, NCO) and have no
such sleep, so the check looks for an available apple,t6000-sleep
node, which only a T6000 machine's tree can carry.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
On the M1 Pro, SIO, the internal DCP and the GPU firmware are idled
before a deep sleep and carry on from their saved context once their
power comes back. Their shared buffers stay mapped through it, and the
restart is the one that was traced for them: INIT, the endpoint map
answered as at a boot, the IOP acknowledgment, every app endpoint
started again, and only then the AP state.

apple_rtkit_reinit() frees the buffers and apple_rtkit_warm_restart()
echoes the endpoint map instead, so add the pieces of that restart:
apple_rtkit_reinit_keep() and apple_rtkit_detach_keep() around the power
cut, apple_rtkit_idle_iop() and apple_rtkit_ap_power_timeout() for the
idle and the AP state with its own wait, and apple_rtkit_wake_keep_ap()
with apple_rtkit_restart_started_eps() for the way back. Nothing calls
them yet.

apple_rtkit_reinit_keep() resets the session through the helper
apple_rtkit_reinit() uses, keeping the buffers and the endpoints that
were started.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
With interrupts off, a caller can already ask for the AP's idle between
apple_rtkit_polled_begin() and apple_rtkit_polled_end(). Add the IOP's
idle to follow it, for a caller that checks its CPU's state itself
afterwards.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
A coprocessor whose power was cut loses its mailbox's control words with
it. macOS enables the inbox (bit 0 of the send control word) again
before it starts such a coprocessor, if it reads off.

Add the setter next to apple_mbox_set_recv_enabled(). It writes only if
the bit reads otherwise.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
The deep sleep of the M1 Pro cuts the power of the SIO island, and the
SoC only powers down once that island has gated. As macOS does, idle the
SIO firmware in the late suspend phase, AP state first with a 2 s wait
for its answer, then the IOP state, and stop its CPU with its buffers
and context kept. After the power cut start it again from there: the
mailbox restarted, the CPU run bit, INIT and the endpoint map, its
endpoints started again, then the AP state on.

The park needs a running firmware in the late phase, so this SIO stays
runtime-active, as one stopped at the sleep's commit does: no runtime
stop when idle, and system suspend leaves it alone. Its domain is gated
by the sleep itself and not earlier. A firmware that does not idle or
does not come back is left alone until a reboot rather than refusing the
sleep; nothing is sent to it while it is parked or lost. A firmware
parked for a sleep that is then given up stays parked until the next
deep sleep cuts the power, through any suspend-to-idle in between.
Selected by the apple,t6000-sio compatible; other SoCs keep their path.
A dry run of the sleep core, which cuts no power, leaves the firmware
running as suspend-to-idle does.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
A T6000 deep sleep resets ANS's AXI2AF block and its storage-lane block
(ADT ans reg[4] and reg[5]), and the ANS firmware crashes right after
its endpoint discovery without the settings iBoot gave them at cold
boot. Allow the two blocks as reg entries on apple,t6000-nvme-ans2,
and the ADT's tunables for them (afc-aiu-ans-dual-tunables and
storage-lane-common-tunables) as apple,tunable-axi2af and
apple,tunable-storage-lane, so the driver can put them back after such
a sleep. Other controllers have neither property.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
A T6000 deep sleep resets ANS's AXI2AF and storage-lane blocks, and the
ANS firmware crashes right after its endpoint discovery without the
settings the boot loader gave them at cold boot. Where the device tree
gives both blocks (reg-names "axi2af" and "storage-lane") with their
tunables (apple,tunable-axi2af and apple,tunable-storage-lane), map them
and put the tunables back after a firmware-driven sleep, before ANS's
run bit, together with the SART's power word as the first good start had
it. Only words whose bits differ are written. A controller without them
is left as before.

After such a sleep ANS is started with one apple_rtkit_boot(), bounded
by the handshake wait it already has.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
A deep sleep of the M1 Pro takes the PCIe complex's power. Its internal
ports, Wi-Fi and Bluetooth and the SD reader, came back in the normal
resume phase, the T8103 path, after the PCI core had already restored
the functions behind them in the noirq phase: a configuration or BAR
access to a port without a link stalls the bus.

Match apple,t6000-pcie with the T8103 layout and the sleep's noirq
bring-up of the ports that lost their link, before their functions
resume. Ports the boot loader has already set up again at the wake keep
their link and are left alone. Keep probe's 100 ms after PERST# (PCIe
r5.0, 6.6.1) before the PHY's ready bit is polled.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
…leep

After a deep sleep of the M1 Pro the internal ports that lost their link
are set up again in the noirq resume. When that set-up fails for a port
(its GPIOs, its reference clock, or its PHY never getting ready), the
functions behind the host would still resume, and Wi-Fi or the SD reader
would touch their BARs behind a dead link.

Then mark every function of the host disconnected, as after a surprise
removal, and stop the DARTs its iommu-map points at from taking commands.
A link that is set up but does not train in time is only reported, as
before.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
A sleep profile takes some blocks down itself, with interrupts off, after
their drivers have suspended: the T6000 display, whose report entry is
always on, is one. Let it set or clear one request bit whoever owns it, the
T600x AGX vote's bit 9 too, under the report's lock, and poll the
acknowledge while the PMP runs, telling the caller whether the bit was set
before so that it can put it back when the sleep is given up.

The books are left alone: what the owners asked for is what the report
hands the PMP again after the sleep.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
… stop

Before the M1 Pro's PMP is idled for a sleep, macOS's sleep action takes
every request back, not only those of the blocks the report knows, sets
the CPU and fabric DVFS entries (SOC-DEV-DVFS 0x108-0x10a and 0x10c) to
idle and the report's sleep word to 1. Do the same at the sleep's
commit, right before the idle, with interrupts off.

At the wake the requests come back from the word kept when the PMP's
suspend started, and the DVFS entries from what they read before the
idle: left at idle, the PMP keeps the fabric clocks at their idle
source. Other SoCs' reports are left as they were.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
…sleep

A PMP started again from the SRAM it kept over a sleep may set itself up
from the start: it asks for its IOVA table, sets its buffer and
registers its ioreg entries again. That was refused as a second table or
buffer, which left the firmware without an answer after the wake.

Only after such a restart, answer a repeated table request with the
table already mapped, take the new buffer, and begin a new ioreg list at
the next registration. A firmware that does not ask again sees nothing
different.

Nothing sets the restart flag yet: the T6000 PMP's power cycle, added
later in this series, does.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
A sleep that cuts the PMP's power resets the reset vector iBoot pointed at
the firmware SRAM and locked. Let the PMP node name it as an optional third
register, "iorvbar", so that the OS can put it back before the firmware
starts again.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
Where the DT names the PMP's reset vector, read what iBoot left there at
probe, and after a sleep that cut the power write it back before the
firmware starts again, unless it still reads locked. Without it the PMP
starts from the reset value instead of its SRAM.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
A deep sleep cuts the M1 Pro PMP's power. Name its reset vector (reg[1]
of the ADT's pmp node) and keep its whole firmware SRAM, 1 MiB, read
after its stop and written back before it starts again.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
The M1 Pro's DARTs have the M1's address filter: 16 entries, 0x40 apart,
the same words. A deep sleep clears it just the same. Keep what the loader
programmed and write it back after the sleep for a T6000-layout DART that
names its filter window, as for a T8020 one. No T6000 DART names one yet.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
Every access of the M1 Pro's PMP passes its DART's address filter (ADT
dart-pmp reg[1]), which a deep sleep clears. Name the window, so that the
DART driver keeps what the loader programmed and writes it back after the
sleep, before the PMP starts again.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
macOS takes the T6000 PMP's own power state and its SRAM's to 0 once the
PMP's CPU has stopped, copying the SRAM in between, and the sleep's
quiesce steps the memory clock down only once the PMP's power state
reads 0: the PMP owns the memory clock while it has power. Leaving the
power states up skipped that step on every sleep.

At the commit's stop, after the AP and IOP idle, turn the outbox off,
wait for the CPU to idle, clear RUN and lower both power states as the
PMGR does, with the SRAM copied in between. A CPU that never idles is
not powered down. The sleep driver gets no ASC for this PMP, since it
would otherwise clear RUN on an unpowered block.

At the wake, and after any sleep the stop ran in, bring the SRAM's power
up, write the SRAM back, bring the PMP's power up, put the reset vector
back and start the firmware cold: RTKit afresh, the outbox on, RUN, the
boot, INIT if the firmware does not acknowledge IOP power by itself, and
the PMP endpoint. A power state that does not come up ends the start
there, with nothing written into its domain. The firmware then sets
itself up again, which a restarted session answers. Everything it was
given before stays allocated and mapped, as it runs from the kept SRAM
and may still point there; each request after the restart gets a new
buffer, and the allocation budget counts from the restart, so each sleep
keeps one more set of the firmware's setup allocations. The PMP's DART
goes down with it, as macOS saves and restores it around the power cut:
its interrupt off and its state saved once RUN is clear, and written
back, its interrupt on, before the reset vector and RUN. A PMP that does
not start again gets its requests back, but not the DVFS entries and the
acknowledge wait.

Only a PMP whose node has the reset vector register and apple,sram-keep
takes this path, and only from a deep sleep's commit; every other PMP
keeps the warm restart.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
The enclave's sleep request is staged for the sleep core's commit with a
5 s wait for its answer, and the wait ends early once the power state
reads DEV_DISABLE. On T6000 macOS waits up to 15 s for the answer, and
only after the answer waits for the power state's actual field to read
0. An idle enclave that still runs can read the same as one that slept,
so on T6000 only the answer ends the first wait.

Add a sleep profile to the platform profiles: the answer wait and what
ends the wait for the domain. Every SoC but T6000 keeps the current
values.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
After a deep sleep that cut the SoC's power, the T6000 enclave does not
start again on a doorbell. macOS powers its domain on, at its
PMGR's wake, with the minimum state raised and
DEV_DISABLE cleared, makes the enclave's DART active again, and then
lets the SEPROM resume the sepOS still in RAM through the boot endpoint:
TZ0 (0x5), and once the ROM reports its status (0xd2), op 8 in place of
the firmware, answered by 0x6c.

Do the same on the SoCs whose sleep profile asks for it, T6000 only,
after a deep sleep whose request the sleep core's commit sent. A
control message that reports sepOS active also ends the wait. If the
resume fails, the enclave is left as asleep, its receive interrupt held
and its DART gated, and the raised minimum is dropped either way.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
The enclave's mailbox loses its control words with the power cut of a
deep sleep. When macOS starts the enclave's CPU it enables the inbox if
it reads off, then the outbox, and only then lets the SEPROM resume
sepOS. Do the same before the resume handshake.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
On the M1 Pro, macOS writes pmVC and WKTP before slpa, and a failed
write there gives the sleep up: nothing that cannot be undone has
happened yet. Main sends both with slpa, after the point of no return,
where a failure can only panic.

Add an optional SMC lane step for them and a SoC flag that runs it as a
refusal in the entry, right before the enclave's stop, which stays the
last step that may refuse: a failed key write then gives the sleep up
before the enclave is asked to sleep. The SMC driver's side, which
provides the step and leaves the keys it sent out of its notice after
the point of no return, follows separately.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
A T6000 enclave that took its sleep request power-gates its own island,
and without the SoC's power cut its domain does not come on again. A
sleep given up after the request (a device's late or noirq suspend, a
refusal in .enter, a pm_test) would leave the enclave unusable until
the next deep sleep or a reboot, so the request can only go out once
nothing else may refuse.

Stage the T6000 request at device suspend, as on the other SoCs, and
let the sleep core's commit send it after the last other refusal. The
commit path learns what the T6000 profile asks for:
 - the enclave's DART goes down with the island: it is saved and its
   commands gated at device suspend, in process context, let go again
   without a reset when the request was never sent, and reset and put
   back before the enclave resumes;
 - an answer whose result is not 0 refuses the sleep with the enclave
   awake;
 - with commit_soft_fail, an answer or a gate that does not come within
   its bound refuses the sleep instead of panicking; the enclave is then
   left unused, and every later deep sleep refused, until a reboot;
 - with wake_after_thaw, the enclave is resumed through its SEPROM once
   the tasks run again, from the PM notifier, so that a SEPROM that does
   not answer holds up only the enclave's users; a dark wake's next
   sleep first runs the wake still pending;
 - with ps_nonposted, the power-state word is mapped non-posted where
   the PMGR's bus asks for it.
The other SoCs set none of these and keep their path as it was. The
enclave step's refusal line no longer says the request was not sent,
since with a soft failure it was. The enclave's sysfs ABI text says
when a T6000 enclave sleeps, and that one that fails its request blocks
deep sleep until a reboot.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
Ante042 and others added 12 commits December 3, 2026 21:56
…sleep

A T6000 DCP parked for a deep sleep no longer holds its PHYs, so the
sleep takes the ATC power domains down, and with them the display
crossbar of a Type-C display's route. The crossbar wakes with its output
lost while the mux core still holds the selection, and nothing selects
it again: the link after the wake has no path to the PHY, the firmware
reports link faults and the display does not come back.

Take the route's crossbar output down at suspend while it still has
power, and select it again at resume before the Type-C work connects the
link, with dcp_typec_route_park() and dcp_typec_route_unpark(), as main
does for an s2r_ext DCP and for an H17P DCP in s2idle. A sleep given up
after the suspend selects it again the same way. Without a Type-C route,
or for s2idle and dry runs, which hold the PHYs, nothing changes.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
…given up

The T6000 SIO firmware is idled and its CPU stopped in the late suspend
phase, and only starts again from reset, which the deep sleep's power cut
gives. A sleep given up after that point cuts no power, so the firmware
stayed stopped until the next deep sleep, and DisplayPort and HDMI sound
with it.

On the resume of a sleep given up, pulse the SIO's engine reset, as the
runtime resume does, and start the firmware the way the wake does. If
the reset fails, the firmware stays parked as before and the log says so.

With the sleep controller bound, the engine reset took only power domains
in the PMGR block mapped as its "ps", and found none for the T6000 SIO,
whose domain is in the east block. Map such a domain through its own PMGR,
as the reset already does where no sleep controller is bound.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
Admit the M1 Pro/Max (T6000/T6001) video encoder firmware preloaded by the
macOS 27.2 (26B123) stub (shared TEXT 0x13c000, per-engine DATA 0x134000,
link cell at TEXT 0x423c, TEXT CRC 0x24812842 using ave_layout_26b123).

Also scan all 5-cell entries in iommu-addresses inside ave_fw_segment() so
dual-encoder SoCs (T6001 ave0/ave1) sharing the preloaded TEXT carveout
match their own phandle entry instead of failing with -EINVAL.

Verified live on MacBook Pro 16" M1 Max (J316c / T6001, OS FW 27.2 26B123).

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
T6001's South PMGR places ps_prores at offset 0xc000 (verified from live
J316c 27.2 ADT /arm-io/pmgr reg[3] size 0x74000, ps-reg[18] offset 0xc000).
Extend &pmgr_south's reg length from 0xc000 to 0xc004 so ps_prores and
apr1 probe cleanly on T6001.

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
…ple,no-ack

Live J316c (T6001) 27.2 ADT /arm-io/pmp/iop-pmp-nub soc-device records
index South devices three slots lower than the prior T600x DT entries
(afnc4_ioa=0x1a, afnc5_ioa=0x1b, dispext2=0x1d, dispext3=0x1e,
venc1=0x1f, msr1=0x20, prores=0x21). Previously afnc4_ioa/afnc5_ioa
occupied 0x1d/0x1e, inadvertently keeping dispext2/dispext3 requested.

Additionally, soc-device-ps-group (0x0ffff803f1fffe00) has bits 26 and 27
(afnc4_ioa/afnc5_ioa) cleared (just like IOA0..IOA3), so PMP never
acknowledges them in SOC-DEV-PS-ACK. Mark pmp_report_afnc4_ioa and
pmp_report_afnc5_ioa with apple,no-ack and read apple,no-ack in
apple_pmp_report_entry_probe() for non-start reports as well, eliminating
the 1000 ms PMP acknowledgment timeout warning on wake (reducing early
resume from ~1013 ms to ~11 ms on J316c).

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
Document apple,t6001-sleep (M1 Max) with its South PMGR (ps-south) and
South external display fabric blocks (dispext2-fabric, dispext3-fabric)
and their apple,tunable-* properties.

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
…r_park()

Extend hw.s2r_park (T6000/T6001) to support firmware 27.x (27.2 / 26B123)
alongside 13.5.

On firmware 27.x, internal eDP uses soft DPMS so dcp_poweroff() only dims
the backlight without calling set_power_state(0). Sending only A500/A550
and RTKit IDLE in dcp_s2r_park() left firmware-owned DISP0 sub-domains
(DISP0_BE, DISP0_SPI, DISP0_SPMI, DISP0_DP, DISP0_BLC) powered on, which
kept DISP0_FE at 0x200 and the DISPLAY cluster (cl[6]) stuck BUSY (0x10)
through quiesce, stalling the sleep engine until the 30 s WD2 reset.

In dcp_s2r_park() for firmware 27.x soft-DPMS internal panels (when not
already soft-off), send iomfb_s2r_power_v27(dcp, false, true, false) and
wait for D572 before A500/A550, AP IDLE, and IOP IDLE (unwinding on park
failure), and restore display power in dcp_s2r_unpark() via
iomfb_s2r_power_v27(dcp, true, true, true) + D572. Also allow external
27.x DCPs using s2r_park (or dry-run) through dcp_platform_suspend().

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
Enable fw_park_for_sleep on HWCONFIG_T6001 (M1 Max) so the legacy GPU
firmware stops cleanly at deep-sleep commit, matching T6000 while keeping
HWCONFIG_T6002 (M1 Ultra) unchanged.

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
Expose the Aura/m1n1 boot-object warm-resume counter (s->mbox->resumes)
as a read-only sysfs attribute on the apple-sleep platform device so
userspace and automated S2R qualification can positively distinguish
hardware deep-sleep warm resumes from s2idle.

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
Add the apple,t6001-sleep profile extending T6000 deep sleep for M1 Max
(T6001 / J316c):

- Match apple,t6001-sleep in apple_t6000_sleep_described() and register
  the T6001 profile (8 AMCCs, 4 DCS planes, South PMGR ps-south, 24 zero
  words, T6001 late-domain layout including ps_atc1_common and South
  ps_afnc4_lw0/ps_afnc5_lw0).
- Add t6001_sleep_disp2_down() to raise DISPLAY2 (cl[7]) and disp2-tvm,
  apply South dispext2/dispext3 fabric setups and handshakes with PMP
  requests 29/30, power down all 12 un-modeled firmware-owned South
  sub-domains (BE/DP/GP0/GP1/PPP/DSC) that otherwise kept cl[7] stuck
  BUSY (0x10), and drop cl[7] cleanly to 0 (restoring cl[7] on refusal
  or wake).
- Skip polling PS_ACTUAL == PS_TARGET in t6000_late_restore() for
  PS_AUTO_ENABLE domains whose pre-sleep ACTUAL was 0 (such as
  ps_afnc4_lw0/ps_afnc5_lw0 at 0x1000030f), which remain hardware-managed
  at ACTUAL=0 while idle.

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
Wire T6001 (M1 Max) deep sleep properties in t6001.dtsi (PMP SRAM keep
and reset vector, PMP/ISP DART address filters, ANS sleep tunables,
27.2-ADT-verified apple,wake-enable, North + South display/GFX fabric
tunables, and T6001 sleep-late-domains including ps_atc1_common and
ps_afnc4_lw0/ps_afnc5_lw0).

Enable SMC sleep pmVC/wake-reasons, HPM0/1/2/5 S3 SSPS, and &sleep with
apple,sleep-tested on MacBook Pro 16" M1 Max (t6001-j316c.dts),
qualified across 20/20 consecutive WARM_S2R_VERIFIED cycles on OS FW 27.2
(26B123).

Signed-off-by: Connor Chan <connor.chan.jazzman@gmail.com>
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:media Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Merge readiness at 6d1a710c: not ready yet

Check Detail
CI at head ok 7 checks passed
Review no needs one approving review from Core, Omarchy Mac or Aurora Maintainers (not the author)
Requested changes no requested by aurora-silicon-review
Hardware row at head no no line with the head SHA 6d1a710c, a Mac and a result in the PR body or a comment
Conflicts no merge conflicts with main: merge it in (no force push)
PR text no add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:display, area:gpu, area:media, area:platform, area:power

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 6d1a710

Failure: dcp.c:10316–10325 records the panel power-off only after D572 completes. In an exact-source replay, the firmware accepted and applied the power-off call, but D572 did not complete. The park returned -ETIMEDOUT without issuing power-on. The resume path skips unpark because the firmware never reached parked state. Restore the panel on this refusal as the acknowledged power-off path already does on an A500 failure.

Failure: dcp_s2r_dart_power() completes D572 even when the DART stream operation records -EIO. The new park path never reads that result. The exact replay reports a successful park, clears the firmware run bit and marks the display quiesced despite the DART failure. The existing deep-sleep path checks the recorded error after completion. Preserve that failure handling here and when restoring power.

Checked: Both failure cases reproduced on GCC and Clang. A normal park and the existing restoration after an A500 error passed. The sleep binding passed document validation. Four DTBs built at the head and stack base and passed focused sleep schema validation. The T6000 control is byte-identical. This review concerns the new feature commits on top of #4239 and #4304.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@connorchanjazzman This branch now conflicts with main (1da341136110) in:

  • drivers/gpu/drm/asahi/driver.rs

Could you forward-merge main into this branch (normal git merge, no rebase/force-push)? If you haven't had a chance within 24 hours, a maintainer can forward-merge main on top for you.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) changes-requested A reviewer requested changes (bot) labels Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:media Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants