Skip to content

J616s (M4 Pro) at EL2: hibernation and suspend-to-RAM - #1477

Closed
fbalazsy wants to merge 331 commits into
aurora-silicon:integration/aurorafrom
fbalazsy:j616s/el2-sleep
Closed

fbalazsy wants to merge 331 commits into
aurora-silicon:integration/aurorafrom
fbalazsy:j616s/el2-sleep

Conversation

@fbalazsy

@fbalazsy fbalazsy commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

J616s (MacBook Pro 16", M4 Pro, T6040) running Linux at EL2 under aura: hibernation and suspend-to-RAM with the desktop session kept. Builds on #1445, which is merged.

Update 2026-11-14, evening (head 59454c7)

331 commits on integration/aurora 7c71d6d. A rebase and one CI commit; the series itself is unchanged (git range-diff shows every commit of 22d338f as equal).

Rebase. onto 0a02a04 and then 7c71d6d: #1892 (G17P: one UAT execution context shared by a VM's queues), #1896 (dt-bindings: apple,tunable type) and #1901 (host-test runner). No conflicts. With #1892 the queues of one VM share an execution context; the cold republish after a resume resets each context's scheduler page and work-list head and each compute queue, and it runs with no command in flight, so the shared work-state claims are empty there. Not run on hardware at this base; the hardware runs of the afternoon update are on the previous base.

Commit What changed
ci: mask the pattern list of unmatched-property dt-schema messages The Device tree checks job failed on 22d338f with "new warnings: 8, removed: 8": the same eight chosen warnings of the base (t6030-j514s/j516s and six t8132 trees), whose "does not match any of the regexes" text lists every vendor prefix and so changes with the aura prefix this series adds. apple-dt-check.sh now masks that list the way it already masks phandle values. No device tree of this series has a new warning.

Local checks on this head: the host tests (shimmed 344/344), KUnit g1 (1735 tests, the same five apple-display-gate-t6041-max failures as at the base), the Rust KUnit suite (645 tests, 643 passed, 2 skipped).

The open item of the afternoon update (placements in the GPU kernel window failing with -EBUSY after a second hibernation started right after a resume) stays out of this pull request; its fix will come separately.

Update 2026-11-14, afternoon (head 22d338f)

330 commits on integration/aurora d89d8c0. Two new commits for the G17 GPU after a resume from disk, and a rebase.

Area What changed
GPU (G17), take the compute channel claim through the preparation gate Fixes the Open item of the night update below. A compute command whose channel was already bound was claimed in the scheduler's readiness check without entering the preparation gate, which every other builder and publisher enters and which stays closed from the freeze until the cold firmware is republished. A client that prepared a command in that window claimed its channel, and the cold reset of the compute queues then refused the claimed queue with -EBUSY and the device was lost. The claim now takes a preparation lease (Gate::admit_claim): a closed gate refuses it and the command waits for the reopen; a freeze that closes the gate while a claim is being taken joins it. KUnit cases added. The commit that moved the re-boot off the PM notifier now says in its message that this later commit fixes its open case.
GPU (G17), name the step that fails in a republish after hibernation A failed republish logs which step returned the error (mailbox and shared-content resets, fabric bridge, coprocessor start, kernel-window relink, opening handshake, compute, render and closed-context resets). No functional change.

Rebase. onto 1f5037a and then d89d8c0. The only conflicts were in drivers/accel/ane/ane_h16_hwx.c against #1882 (H17 programs from zin_ane_compiler 10.205), resolved by keeping both sides:

Check in the program loader Resolution
LC_NOTE The series' general rule for the provenance note is kept, with a comment naming the H17 rt.version note #1882 accepts.
Segment flags Text segments may carry SG_NORELOC (#1882); the series' exact flags for the other segments stay.
Symbol table Any N_STAB entry must have section 0 and value 0 (one rule for H16 and H17).
Section ends, base records #1882's H17 rules, with the series' error path.

The H17 KUnit cases of #1882 pass on the merged loader (two expectations take the H16 form, where the series accepts what H17 accepts).

Run on hardware (J616s, three displays, aura main 9887a6b5):

  • Two hibernations back to back in reboot mode, the second requested right after the first resume, with a Vulkan render client, a Vulkan compute loop (about 115 short video encodes) and a reader of the GPU's statistics running across both: before the fix this lost the device at the second republish ("compute queue reset failed: Error(16)"); with it, no compute queue reset failure in five such pairs.
  • On this head's tree (non-debug build): one hibernation from the desktop through systemd in reboot mode: restore of devices 331 ms, "GPU firmware republished after resume in 1365 ms", the session back, no kernel warning.

Open (new, intermittent): in two of those five pairs the second republish itself succeeded, but afterwards the driver could not place new objects in the GPU kernel window: the page-table entries of ranges its allocator considered free still held leaves (host RAM, inside the driver's own tables), so these placements failed with -EBUSY, render publications waited out their 2 s deadline, the compositor got -ETIMEDOUT and a Vulkan encode client VK_ERROR_DEVICE_LOST. A normal reboot recovers. The leaves were not mapped anywhere else in the window. A likely cause, not yet confirmed: from the freeze until the relink in the republish, the no-map table that holds the window's second level is treated as stale, and a walk then follows only the links the driver recorded itself; the levels above it, which the boot loader wrote, have no recorded link, so a walk in that window finds no leaves at all (seen at the freeze), and an unmap done in that window would return the range to the allocator with its leaves still in place. Not fixed in this head. It was seen only with the second hibernation started right after the first resume, never in a single hibernation from the desktop through systemd; the fix will come as a separate pull request, so it does not hold this one up.

Local checks on this head's tree: the host tests (shimmed 344/344; unshimmed, the same 31 failures from this host's compilers as on the previous head), KUnit g1 (1735 tests, the same five apple-display-gate-t6041-max failures as the previous head; the H17 program cases of #1882 pass), the Rust KUnit suite (645 tests, 643 passed, 2 skipped, asahi_g17_claim_gate included). The device tree is unchanged by the rebase since the last check (no new warning, the 12 changed bindings pass on 1f5037a).

Related open PRs: #1876 (aop_als: stop the reports for a system sleep and on unbind) changes the same file as iio: aop_als here; the version here has been tested on the T8140 CT817 by @niteria (see their comment), which is the case #1876 asks about, and #1876's unbind part is not in this series. #1889 (sn201202x idle sleep on T6041) touches tipd/spmi.c next to this series' restore changes; they are independent. #1870 and #1892 (G17) touch g17/runtime.rs and mmu.rs; no overlap with the two new commits' logic.

Update 2026-11-14, morning: rebase onto 5b36eff (head e87a6ed)

328 commits on integration/aurora 5b36eff. The series of a7f9a76, rebased with no other change; the tree is that head's with the base's changes merged in. Two conflicts, both resolved by keeping both sides:

File Resolution
drivers/gpu/drm/apple/dcp-internal.h struct apple_dcp_hw_data keeps the base's only_120hz_modes next to the series' s2r_pipes and nr_s2r_pipes.
tools/asahi/g17-compute-deadline-tests.py The fixture extracts the preparation gate's extend() (the series) and the AdmissionWait report (the base, #1866).

Local checks on this head: the host tests (shimmed 343/343; unshimmed, the same 31 failures from this host's compilers as on the base), KUnit g1 (1730 tests, the same five apple-display-gate-t6041-max failures as the previous head), the Apple device-tree check (no new warning, the 12 changed bindings pass).

Update 2026-11-14, morning (head a7f9a76)

328 commits on integration/aurora 2129f55. The tree is that of 4521879 apart from comments, documentation and two debugfs header lines. It conflicted with 292773f in struct apple_dcp_hw_data; see the update above.

Area What changed
Wording, whole series Comments, documentation, two debugfs headers and commit messages describe each sequence by what the hardware and its firmware need. Identifiers that a later commit renamed or removed have their neutral names from the commit that adds them, so the renaming commit in sleep-t6040.c now only renames the driver state and the seq_file. No functional change.

Local checks on this head: the host tests (shimmed 343/343; unshimmed, the same 31 failures from this host's compilers as on the base), KUnit g1 (1728 tests, the same five failures as the previous head, six on the base), the Apple device-tree check (no new warning, the 12 changed bindings pass).

Update 2026-11-14, early morning (head 4521879)

328 commits on integration/aurora 2129f55, one on top of ba5cf6e; it merged cleanly with 5d112b1 then.

Area What changed
PMC (pmdomain: apple: pmc) The voter enables and floors are written back after a resume from disk too. The early resume callback that restores them is also the restore_early callback, and it returned unless pm_resume_via_firmware() was set, which only the S2R path sets. The kernel restored from an image runs after a boot loader that started from a reset PMC, with every agent disabled on every rail, so after a hibernation no floor was honoured and the memory clock stayed at its lowest state until the next boot. The restore now has a restore_early callback of its own; the S2R path is unchanged. KUnit case added.

Run on hardware (J616s, three displays): before the fix, after one hibernation the PMC read 0 in every enable word, a CPU memory copy ran at 31 GB/s and token generation of a 4B language model on the GPU at about 36 tokens/s instead of 55, while prefill was unchanged. With the fix, cold boot and then one hibernation from the desktop in reboot mode: enables 0xb on DCS and SOC, both floors honoured, the copy at 123 GB/s, decoding at 58.6 tokens/s; restore of devices 335 ms, "GPU firmware republished after resume in 1373 ms", all displays back, no kernel warning.
Local checks on this head: the host tests (shimmed 343/343), KUnit g1 (the new PMC case passes; the same five failures as the previous head, six on the base), the Apple device-tree check (no new warning).

Update 2026-11-14, night (head ba5cf6e)

327 commits on integration/aurora 2129f55. The base gained 85 commits since a34d26c, among them T8132 (J713) sleep, the J713 radio sleep and the CIO PHY sleep, and the old head no longer applied to it, so this is a rebase with conflicts resolved by hand. It merged cleanly with the tip of that time (5314798).

Rebase. Where both sides changed the same code:

File / area Resolution
soc/apple/sleep.c The base's T8132 per-SoC data with our PS_PROT_SLICE() words and three displays; the T6040 part is selected through APPLE_SLEEP_T6040 next to the base's T8132 entries (Kconfig, sleep.c, the sleep test).
mfd/macsmc.c The base's wake reason tables kept; our PM notifier replaces the forward declarations; both the wake reasons and the WKTP handling stay.
Bluetooth hci_bcm4377.c resume A port whose sleep the radio-sleep code owns resumes through bcm4377_hci_resume() and reports back to it, before our cold-function handling. The host tests carry both sides' cases.
AIC, DART Both SoCs' AIC info (T8132, T6041); both DART bits (host off across a sleep, tunables put back).
pcie-apple.c The base's rename taken, our changes reapplied on it; the base's port prepare/restore next to ours.
rtkit.h The base's apple_rtkit_cold_restart() and our APPLE_RTKIT_IDLE_RETAINED; the base's callers treat any nonzero return as an error, which is still right.
apple,sleep.yaml One schema now for T8140, T8132 and T6040 (the base's T8132 entry added to it with its 25-26 registers, the last one ps-prot, and its external display processors); apple,t8140-sleep.yaml is gone.
apple-atc.h, USB4 router binding Our ops-based PHY selection with the base's cio_* calls (stubs when the PHY driver is not reachable). The router binding takes the base's phy-names = "cio"; the T6040 routers in t6040-usb4.dtsi name their PHY "cio" and the Thunderbolt driver asks for it by that name.

Three things the merge broke without a conflict, fixed in the commits they belong to: the T8132 NVMe table entry uses our renamed sleep flag; the G16 GPU of the T8132 registers for the first stops with our argument list; the brcmfmac suspend host test models a restored image (the restart behind the restore in the last push had no stub for it).

New since f96cb63 (7 commits: hibernation speed, and the HDMI link after a sleep):

Area What changed
GPU (G17) After a resume from disk the GPU firmware is booted again from a work item behind a lock that every GPU entry point takes, so the hibernation's resume no longer waits for it (about 2.4 s); the second cache clean of that path is gone.
PCIe The two conventional ports are brought up side by side after a resume from disk (624 -> 311 ms); a comment says why the sleep reads the root port words each time.
Wi-Fi (BCM4388) The restart behind the restore covers a resume from disk too; no 500 ms sleep per interface in the suspend (wiphy_suspend 577 -> 58 ms).
Display (HDMI) When the converter reports its sink again after a sleep, the HDMI link is started from a work item once the system is back, not inside the DRM resume; the start and the HPD interrupt's tail are serialized by one lock, and the work is cancelled before a suspend, before the external link is stopped for a hibernation, and at unbind and remove.

Run on hardware on the first six commits (J616s, 48 GB, aura main 9887a6b5, HDMI + DP in picture-by-picture, USB Ethernet, two boots): cold boot (three displays, ANE without a timeout, SEP, Wi-Fi, Bluetooth, KVM, fans taken by the SMC); suspend-to-idle; suspend-to-RAM twice (noirq resume 116-117 ms, resume of devices 3.2 s, wiphy_suspend 58 ms, three displays back); two hibernations from the desktop in reboot mode, the second started right after the first had resumed, with a Vulkan render client, a Vulkan compute loop and a reader of the GPU's statistics running across both: freeze of devices 88-96 ms, restore of devices 343 ms, both PCIe ports back; "hibernation exit" before "GPU firmware republished after resume in 2401 / 2411 ms"; the statistics read during the republish blocked for 2.4 s and returned; at the second hibernation "GPU drained for hibernation" came after the republish line; both clients ran on without an error; a suspend-to-RAM after them. No kernel warning in the journal.
On the previous head plus the 6 commits (same set-up, one boot): the same hibernation with lzo and lz4; restore of devices 1255 -> 335 ms against the old head, freeze of devices 608 -> 89 ms.
With the HDMI commit on top (same set-up, two boots): cold boot with three displays; suspend-to-RAM three times (resume of devices 3.21-3.22 s, noirq 118 ms, three displays back, no warning); a hibernation from the desktop with the HDMI display attached: "GPU firmware republished after resume in 2395 ms", HDMI, DP and the panel back and enabled, the compositor kept running. The converter had its sink ready at each wake, so the deferred start ran on its first attempt; the path where the sink comes late was not reached.

Open: a hibernation requested while the GPU firmware is still being booted again after a resume (within about 2.5 s of it) waits for that work as intended, but the boot then fails with -EBUSY and the GPU is lost for its clients. Found by writing disk to /sys/power/state twice in a row with the hook that hibernates this machine bypassed; through systemd the next hibernation starts about 15 s after a resume, so the normal path does not reach it. Not fixed in this head; the commit message says so. Fixed in 22d338f, see the afternoon update.

Not run: the GPU driver unloaded and loaded again, a USB4/Thunderbolt device, a T8132.

Update 2026-11-13, late night (head f96cb63)

320 commits on integration/aurora a34d26c, a fast-forward of 6e7d5e4 by 15 commits; it merged cleanly with the tip of that day (1d2ef21).

Area What changed
SMC mfd: macsmc: own the pmVC request for the VDD_CIO rail: the SMC driver writes the pmVC key for the sleep controller (same key, value and moment as before).
GPU Three G17 clean-ups without a change in what reaches the hardware: one kick ring reset after a cold firmware boot, the PMP handover wait next to the GPU's other PMP code, the hibernation gate and the G17 sleep notifiers moved out of the statistics shim into g17/hibernate.c (the gate is registered at module load).
ANE (H16) 11 commits for Apple-compiled whole-model HWX on H16: the provenance note, __TEXT with SG_NORELOC, the symbol table (debugging entries, size for whole models), kernel data split over __KERN_0..__KERN_n and bound with its constants, surface names longer than seven bytes, a bound by the total mapped size, the declared buffer size in an EXECUTE descriptor when the section is smaller, a selftest and the documentation of the forms.

Run on hardware on the same tree (one boot, three displays, a Type-C hub with Ethernet and a USB3 disk attached): cold boot (all displays lit, ANE, ProRes, AES, Touch ID, fans taken by the SMC); suspend-to-RAM three times with the hub attached (devices back, the disk's filesystem intact, no pmVC warning); suspend-to-idle; dry run 2; a sleep refused at the enclave; a hibernation aborted before the image (devices recovered in 0.93 s); one hibernation from the desktop in reboot mode with a Vulkan render client and a Vulkan compute client running (restored, GPU firmware back in 2.5 s, both clients kept running without an error, SEP attached again, fingerprint listed) followed by a suspend-to-RAM with both clients still running. ANE on this kernel: the add-128 selftest, an Apple-compiled add bit-exact, and a Parakeet encoder (load 0.88 s, execute 79-80 ms) bit-exact against the reference output of the same model.
Local checks: the full host test suite, KUnit g1 (ANE included) base vs head, the ANE boot and transport KUnit, the Rust KUnit, the sep-source jobs and the Apple device-tree check.
Not run: the GPU driver unloaded and loaded again with a desktop on it, a USB4/Thunderbolt device.

Update 2026-11-13, night (head 6e7d5e4)

305 commits on integration/aurora a34d26c; the PR did not conflict then. The base moved twice during the day (4277bdd, a34d26c). The rebase onto the second one dropped two commits of the series: the base now carries the T6041 ProRes encoder (media: apple: prores by RyanTheTide), so the ProRes part of media: apple: ProRes on T6041 and the ISP across sleep and media: apple: prores: drop a store that the suspend already made are gone; what is left of the first is media: apple: isp: ask the sleep controller whether the power is lost (a dry run keeps the power, so the ISP must not stop its firmware for it). Since the first update of the day (1ea066e) these were added:

Area What changed
Hibernation core The generic code no longer knows the platform: pm_hibernate_is_loading() for drivers, an arch hook for cleaning the pages of a loaded image (ARCH_HIBERNATION_CLEAN_IMAGE), an admission hook and two arm64 hooks (layout cookie, nosave pages) that aura-hibernate.c fills, and a record the loading kernel leaves so the restored kernel knows whether another boot loaded it (the SEP uses it instead of the PMP restart counter). A hibernation that ends before an image exists now recovers the devices (PMSG_RECOVER) instead of running their restore callbacks, and 13 drivers lost the check that guarded against that.
Sleep controller One schema for the T6040 and T8140 sleep controllers with the same register names (the T6040 names were renamed in the DT and the driver together), one test for the GP host's system domain.
Display The HDMI converter state flag is accessed with READ_ONCE/WRITE_ONCE, the once-per-machine power check is documented and atomic; the S2R warm restarts share their firmware return; unused includes dropped; apple_rtkit_idle() reports an idle that kept the firmware's memory apart from an error.
USB / PHY One dwc3 role decision during a sleep (a device role asked for on a host-only port during a sleep now leaves the port off after the wake, as the running path does); the PHY sleep provider is picked by its ops; one start of the Type-C controller's application firmware.
USB4 (Thunderbolt) The routers reach the Type-C PHY through phys and struct phy instead of a node pointer. DP IN 1 of a tunnel gets PCLK1 as well (as on T6030 and T8132). These commits were not run on a USB4/Thunderbolt device (none here); they are separate commits and carry that note, so they can be tested or dropped on their own.
Fixes of the first push The host test of the display fabric models the T6040 tunnel clock symbol; the layout and operations KUnit cases skip a SoC that has a part of its own; the tipd host test extracts the new start helper.

Run on the head of the previous rebase (8acba58, without its last commit, the Thunderbolt-only PCLK1 one), one boot, HDMI + DisplayPort in picture-by-picture, USB3 disk, no dock: cold boot (all three displays lit, ANE, ProRes, AES, Wi-Fi, BT, Touch ID, fans taken by the SMC); suspend-to-RAM four times (wake record MBSE 0x10650, noirq resume 113-120 ms, devices 560-580 ms); suspend-to-idle; dry run 2 ("a real commit would go on here (0 check(s) failed)"); a sleep refused at the enclave's request in the deep path (no SIO message, fans taken after); a hibernation aborted before the image (pm_test devices: devices recovered, SEP session kept, display and radios up); two hibernations from the desktop in reboot mode in one boot (restored, 14 CPUs, SEP attached again, fingerprint listed, Wi-Fi and BT up, RTC alarm kept) each followed by a suspend-to-RAM.
Local checks on the head: the full host test suite (the one failure it showed is fixed), KUnit g1 (1708 passed; the five apple-display-gate-t6041-max cases fail as they do on the base), the Apple device-tree check (no new warnings, apple,sleep.yaml and the USB4 router binding pass).
Run on this head (with an unrelated local series in drivers/accel/ane, which does not touch sleep): cold boot (three displays lit, ANE without timeouts, SEP, Touch ID, fans), the ProRes encoder through the base's driver (4 frames, no error; the frame header differs from the earlier driver in three bytes of colour metadata, the coded data is equal), suspend-to-RAM three times, suspend-to-idle, dry run 2, a sleep refused at the enclave, a hibernation aborted before the image (devices recovered, SEP session kept) and one hibernation in reboot mode (restored, SEP attached again, ANE restarted cold with no program replayed, fingerprint listed, radios up) followed by a suspend-to-RAM.
Not run: the dock, a KVM guest across sleeps, a disk behind a hub, a USB4/Thunderbolt device.

Base

  • 328 commits on integration/aurora at 5b36eff (head e87a6ed), see the first update above. The rest of this bullet describes the earlier rebase onto aa68b3c, whose first 258 commits it counted. The first 168 are the series as it stood at d24d697, rebased. The base's move of the SoC words into per-SoC data (sleep.c) met three of the clean-up commits: the shared header now carries the base's definitions, the PMU write helper takes the USID as the base's does, and what the base reads from its match data (the PMU write command, the boot stage, the response vector's enable for the sleep) stays with the T6040 part as its own values. The 89 on top are new in this push and are listed under "New in this push".
  • Every commit of mine carries its Signed-off-by; the two commits taken from others (RyanTheTide's phy: apple: t6040: tolerate a busy recovery domain, AxxzyWasTaken's spmi: apple: drop replies left by firmware at a firmware-driven resume) keep their authors and trailers.
  • The aura side, J616s at EL2: hib=1 fixed layout, T6040 S2R windows, the 26.7 display handoff and the S2R wake path aura#148, is merged; aura main has it.
  • Replaces J616s (M4 Pro): hibernation (suspend to disk) under aura's fixed boot layout #906.

What is in it

Area Change
PM core pm_hibernate_is_restored() lets restore callbacks tell a restored image from an aborted hibernation; a boot chain with a fixed layout (aura hib=1) admits hibernation.
arm64 Spin-table CPUs at EL2 are parked in a pen and released across S4 and S2R; EL2 state is restored for the hibernation resume.
soc/apple aura hibernation layout; RTKit cold restart and re-adoption of a coprocessor found running or halted after a power loss; PMP (data SRAM kept across S2R), AOP, SEP, DockChannel.
soc/apple sleep T6040 S2R as a part of the generic driver (sleep.c + sleep-t6040.c, struct apple_sleep_part in sleep-internal.h; one platform driver apple-sleep, the node enabled per board, on the J616s only). The entry takes the hardware down in a fixed order (CPU complexes, power gates, axi2af bridges, APCIe, DCS, the MasterMini S2R timer, then the commit word) and the wake brings the same blocks back, before syscore resume. The coprocessor and enclave registry stays in sleep-registry.c; the driver binds it once in probe and each SoC's part gives the two answers (T8140's rules and T6040's are the ones they had). APPLE_T6040_SLEEP stays an option, now the switch of the T6040 part under APPLE_SOC_SLEEP (with MFD_MACSMC=y). The part keeps its own suspend ops: suspend-to-idle passes through untouched and deep is offered only on a kernel booted with t6040_sleep.allow_entry=1. Four module parameters are left (allow_entry, dry_run, sleep_wd_secs, wd2_secs; 79 before); the progress marks, PMU records, probes, dumps and the experiments that were off by default are gone, the steps that were on by default are unconditional. Dry-run levels are 1 (every step that can be taken back, refused at the commit point) and 2 (also the last steps); the old level 1 never reached the commit point and is removed.
Display (drm/apple) Internal and external T6041 display processors across S4 and S2R: the stop order the firmware expects, power words, DART streams, AFK endpoints paused and resumed, backlight level sent again. External links are given back before the sleep and set up again after it. The HDMI output's link is started once per plug, from the converter's power-up: a second start through an HPD pulse left the display black on some cold boots. A display that the wake's link has just woken can list the modes of its standby first: a Type-C display that lists other modes than before the sleep is read again once, and the hybrid pipeline is not handed over on the first lists after a wake. A display that fits one pipe again no longer counts as waiting for a second one.
GPU (drm/asahi) G17 drain and restart around S4 and S2R, the GPU's PMGR word found through its PMP report entry.
USB / Type-C A T6040 Type-C port keeps its xHCI host through a deep sleep (PHY stopped and started under it), a pin D dock port included while DP is down; USB4 routers get their Type-C PHY in the DT; ACIO, CIO PHY and tipd across sleep.
PCIe, NVMe, radio DART locked tables re-imported; ANS/NVMe; brcmfmac survives a hibernation that was aborted or only thawed. After an S2R the internal host's two links are set up again in the noirq phase, with the port word, the tunables and the root-port link words the boot loader had set, so the PCI core finds the functions. The BCM4388's Bluetooth function comes back without its firmware: hci_bcm4377 sees that at resume (its configuration windows read reset values, boot stage 0), sends nothing and starts the transport's reset recovery at once instead of after command timeouts.
Camera (apple-isp) T6040's ISP is powered down between streams and its firmware started again from its data segment as loaded (the T8132 scheme), so the camera works after a sleep.
ANE H16 firmware 26.7.1, resident programs, system sleep and hibernation, on the base's hung-request recovery: its hung_stop and session quarantine are used unchanged, the hibernation events go through its notifier, and an engine quarantined at bring-up is powered off for a sleep (and left off at the resume) instead of refusing every sleep of that boot.
KVM Resuming from disk is a cold boot, so the physical counter starts again while a VM's counter offsets stay: the guest's counter went backwards and its clock stood still. The offsets of every VM are moved by the lost count at syscore resume.
SMC The sleep's commit writes WKTP = 2; after a full wake WKTP = 0 is written. Without it the SMC treats all the time awake as a power nap: it refuses manual fan control for the rest of the boot and asks for a sleep under load.
Other drivers AIC3, pmdomain, SPMI, PMU RTC, pinctrl (every AP pin and the block's global word put back after S2R), ProRes T6041 across sleep (on #1260's variant: the J616s rows are its built-in ones, the per-Mac file stays an optional override), SIO restart, DockChannel HID, AOP ALS, cs42l84 jack interrupt.
DT T6040 sleep controller, ProRes, JPEG, DP audio and USB4 PHY links on the J616s.
Clean-up (63 commits) Comments, dead code and state nobody reads, per-sleep messages at debug level (the display driver prints 96 lines per wake instead of 141), names and named constants, pm_sleep_ptr() instead of #ifdef CONFIG_HIBERNATION in PM operations, dev_* messages from the T6040 part, the sleep node's unit address, bindings for apple,t6041-display-power and aurora,s2r-mailbox. One of them fixes a build configuration: with CONFIG_HIBERNATION=n a suspend-to-RAM stopped the display firmware and could not start it again; the restart is built for every system sleep now. For the comment, rename and constant commits the objects are identical before and after; sleep.o built without the T6040 part has every symbol unchanged from f259e90.

New in this push (89 commits)

Area Change
SMC (4 commits at the end of the mfd group) A suspend that is called off no longer leaves the machine without its fans. This SMC does not take MBSE = slpw back: after slpw and then waka with no sleep between, it stopped running the fans (0 rpm with the CPU die at 100 to 113 C) and refused a fan request until the reboot; after the whole commit (WKTP, slpa, the AP idle notice) and no power loss its sensor reports stood still as well, so the thermal zones read a constant. A dry run, a device that refuses, a wake event during the entry and a refusal at the commit point all ended there, on the previous head of this series too. On T6041 the whole sequence is now sent from the sleep controller's last stop, with interrupts off and every refusal behind it (apple_rtkit_ap_idle_polled() is new for that); on the other SoCs slpw moves from .prepare to the noirq suspend, right before the commit. A suspend that ends short of the power loss sends the SMC nothing.
USB3 after a suspend-to-idle (phy-apple-t6040) The loss of USB3 until a reboot is fixed at its cause: in a suspend-to-idle genpd powered the PHY coprocessor's domains off under the running host, and the next stop of the coprocessor got AP idle not acknowledged: -62. The PHY now refuses that power-off while its firmware runs. With it: a powered-down sleep counts as the coprocessor's power cycle, a host whose USB3 is not back at a wake stays at USB2 and tries again at the next wake, and the CIO bring-up recovers the coprocessor and shuts the lanes down when it fails.
Display (drm/apple) A resume commit no longer sends a mode set to an external pipe whose sink is reported gone (the mode set failed: -5 of every suspend-to-idle with an HDMI display); the hotplug that reports the sink back sets the mode. A T6041 sleep keeps to the pipe's own power words; a firmware that was given up stays stopped across an S2R, and a dead internal processor no longer refuses every sleep; the sleep registers are mapped once at probe.
Wake time The two PCIe ports share the waits of a wake instead of taking 100 ms twice each (noirq resume 423 -> 118 ms); the dwc3 glue is asynchronous, so the USB hosts no longer start behind whatever the PM core's main thread waits for; the Type-C controllers do not wait 100 ms for a wake interrupt that has already come; a BCM4388 that lost its power is restarted from a freezable work item once the resume of every device is over (its resume callback: 619 ms -> 24 us).
Bluetooth The core is resumed after the cold function's reset, not before it (sending frame failed (-19) at the first wake of a boot).
Hibernation The jack codec, the RTC alarm, the pins, the AIC masks and the SPMI interrupt masks are put back after a resume from disk; tipd revalidates a port restored from disk itself, so the hibernation hook no longer has to write roles.
Thunderbolt / Type-C No wait for the router stop in PM_POST_*, the LSTX level at a router stop keyed on T6040, the T6040 DP IN adapters kept disabled, no watch for a router whose node is disabled. Without a USB4 device here these ran as regressions only.
NVMe, ISP, ProRes, ANE The RTKit object of a restore is configured as probe does; one predicate each for "this suspend takes the power"; timer_wakeups instead of irq_timeouts in the ANE's debugfs.
Tests macsmc_sleep_order_test expects the lid read (it failed at the base); new KUnit cases for the SMC's last stop; the host tests of the PM callbacks follow the code they extract.

Hardware results

J616s (48 GB), firmware 26.7.1, aura main (9887a6b5) at EL2, kernel built from this tree with APPLE_SOC_SLEEP and APPLE_T6040_SLEEP enabled.

This head (278b7b9) is the rebase onto aa68b3c of the head the tables below were run on (4b0be95 on fdef45b), plus one commit (dmaengine: apple-sio: stop the T6041 firmware at the sleep's commit). On the rebase (3d13866) with that commit's module: cold boots, three suspends to RAM, one suspend to idle, a level 2 dry run and two sleeps refused at the enclave's request, with the panel and both external displays, Wi-Fi and Bluetooth back each time. Hibernation and the tables below were not run again.

On 4b0be95, one boot. Set-up: a Samsung G95NC in picture-by-picture with one half on the HDMI port and the other in DP alternate mode, a USB3 disk, charger; no dock. All three displays were seen lit after the boot and after every step.

Test on 4b0be95 Result
Cold boot Panel and both external displays, Wi-Fi, Bluetooth, the USB3 disk; ANE at the first attempt; the SMC registered for the sleep controller's last stop.
Suspend-to-RAM (deep, RTC wake after 25 s) 3 of 3, one of them after the hibernation: the same compositor process, three outputs with their modes, Wi-Fi associated and answering, Bluetooth, the disk. "noirq resume" 118 ms, "resume of devices" 406 ms; no mode-set error. The SMC's sequence goes out at the last stop ("sleep warning at the last stop: 0 messages in 200 ms") and the wake record is the usual one.
Suspend-to-idle with the HDMI display No mode set failed; the HDMI half is back with the firmware's hotplug, about 5 s after the wake.
Dry run level 2 Refused at the commit point; nothing is sent to the SMC, its reports move and it takes a fan request afterwards.
Hibernation from the running desktop, reboot into the resume 1 of 1: image restored, both external displays, the disk, Wi-Fi, Bluetooth, a fan request taken; ANE exact, AES equal in both directions, ProRes frames identical.

On the previous base (6970a51) the same commits ran over five kernels as they were written, most of it with a dock (hub, Ethernet, card reader), the USB3 disk and one USB-C DP display:

Test Result
Suspend-to-RAM 34 in all, none failed; with the dock 12 USB devices on 9 SuperSpeed links after each.
The USB3 failure's recipe (cold boot, suspend-to-idle 15 s, then a dry run) genpd's power-off of the PHY domains refused once per port, no -62, 9 SuperSpeed links before and after. Before the fix: 2 of 2 lost USB3.
PHY fault injection on the dock port (drop_next_power_down_ack) Dropped acknowledge and a real S2R: 9 links. Dropped acknowledge and a dry run: the host stays, at USB2, nothing latched. A real S2R right after: USB3 back, 9 links.
Fans and SMC Before the fix (the 81 commits without the SMC ones): a dry run left both fans at 0 rpm at 100-113 C under load and a fan request refused; in the same boot the SMC had run the fans before it. After it: reports live and a fan request taken after a dry run, after a refusal before the enclave's request (apple_sep sleep_refuse_before_send), and after an RTC alarm that fired during the entry.
Hibernation Two in one boot, each restored, a suspend-to-RAM after them; an RTC alarm set before the first one fired at its time after the restore, one that passed while the machine was off was gone and a new one could be set.
USB disk across a suspend-to-RAM Mounted read-only with a reader running: the same block device and SHA-256. Mounted read-write with a writer: 120 blocks of 1 MiB written with fsync across the sleep, all 120 read back with the right SHA-256, no btrfs or I/O error.
ANE, Bluetooth A held ANE session exact across a sleep; Bluetooth powered off across a sleep and on again, two sleeps back to back: no error line.
Wake time, kernel only, from "Enabling non-boot CPUs" to "PM: suspend exit" Nothing attached: 0.285 s (noirq resume 125 ms, devices 62-88 ms), the panel's firmware back at 0.37 s. HDMI + DP + disk: 0.76 s. With the dock: 2.7 s, of which 2.2 s is the dock's hub tree coming back level by level by reset-resume.

Not run on either of these two heads: anything with the dock (it was run on the previous base only), the KVM guest across the sleeps, a USB4/Thunderbolt device (none here). T8140 was not run by me on any head, and the SMC and wake-time commits change paths it shares: the noirq slpw on every SoC, device_enable_async_suspend() on the dwc3 glue, the BCM4388 restart, the skipped 100 ms in sn201202x_resume.

Review

The comments and commit messages of the 89 new commits follow the same rule as the rest since the last review: they say what the hardware or firmware does and what was measured on the J616s.

Checks

Run on 4b0be95 against its base fdef45b (not repeated after the rebase onto aa68b3c), on an aarch64 host with its own compilers (gcc 16, clang 23, rustc 1.99), not the pinned ones of the workflows.

Check Result
tools/asahi/run-host-tests.py 324 runs, all ok with the host's compiler differences shimmed away (the base's new brcmf-recovery-tests among them). Without the shims 28 runs fail on this host's compilers; that run was not repeated at this base.
KUnit, C suites of the directories the series touches (qemu arm64) 1712 tests: 1703 pass, 4 skipped, and the five apple-display-gate-t6041-max cases that fail at the base as well (base: 1686 tests, those five and macsmc_sleep_order_test, which passes with the series).
KUnit, ANE boot.kunitconfig and transport.kunitconfig 230 of 230 each.
KUnit, drivers/soc/apple/sep.kunitconfig 605 tests, 603 passed, 2 skipped; in the workflow's form (LLVM, apple_sep*) 301 of 301.
scripts/dtc/apple-dt-check.sh (CHECK_DTBS on every Apple tree, dt_binding_check on the changed bindings) No warning the base does not have (402 lines at both, 137 DTBs); the 12 changed bindings pass.
sep-source workflow: the tools/aurora-sep tests, the three DWC3/ATC compile profiles The Python tests pass (14 lines, -O ones and the ABI step included); the three apple-dwc3-atc-compile.sh profiles compile; apple-sep.o builds.
checkpatch.pl --strict on the commits written for this push Clean but for one "prefer kzalloc_obj" note in the brcmfmac commit.

Open

  • A sleep refused at the commit point left the SIO firmware stopped until the next completed sleep: fixed by the last commit. The T6041 firmware now stops in the sleep's last step, as the T8140's does, so a refusal finds it running. After two refused sleeps and a dry run the AES engine behind it still encrypts and decrypts equal to the software implementation.
  • The SMC's last stop cannot refuse. If the SMC does not answer there, each of its three writes waits its 5 s with interrupts off before the sleep goes on. An event the SMC sends during the 240 ms of the sequence is taken from its outbox and handled after the wake.
  • After hot re-cabling (a full-width DP display on both pipes, the HDMI cable plugged while it ran, then the monitor switched to picture-by-picture) the HDMI half stayed dark once: "HDMI: no sink behind the converter yet, link started again (3/3)". A cold boot had both; the same switch of the monitor worked on the next two tries, one of them after a hibernation. Not reproduced, cause not known. A WARNING at typec_altmode_update_active() came once in the same re-cabling and was not looked at.
  • A resume from disk still logs "Unable to change power state from unknown to D0, device inaccessible" for the internal host's functions; they work afterwards.
  • The ANE's H16 firmware start with ignore_loglevel: unchanged from the previous description. Independent of sleep.
  • A mounted USB disk is not carried through a hibernation (the hook that hibernates this machine takes the Type-C controllers down first).
  • With a dock most of a wake is the USB core's reset-resume of the hub tree. usbcore.old_scheme_first=Y and the ports' fast-enumeration quirk took 0.64 s of it here with the same devices and device numbers; that is a setting, not part of this series.
  • Questions the new commits leave for you: whether the T8140 SMC also stays in its dark-wake policy until WKTP is written 0, and whether it loses its fan policy after slpw + waka as this one does (then its noirq path has the same hole after the noirq phase that the last stop closes on T6041); whether sn201202x_resume may skip the 100 ms on every SoC with that controller; whether the AIC mask resync after a resume from disk should be registered for every SoC; whether a host left at USB2 by a wake should try a normal start at once instead of at the next wake. 263989e (DART in an off domain) is not in here.

How to try

Deep sleep stays opt-in, on the kernel command line:

t6040_sleep.allow_entry=1
echo deep > /sys/power/mem_sleep; systemctl suspend

With t6040_sleep.dry_run=1 (writable at run time) the same request stops at the commit point and resumes warm.

@fbalazsy
fbalazsy force-pushed the j616s/el2-sleep branch 2 times, most recently from 3926193 to abc6ee8 Compare November 11, 2026 15:57
@fbalazsy fbalazsy changed the title J616s (M4 Pro) at EL2: hibernation, and suspend-to-RAM (WIP), on #1445 J616s (M4 Pro) at EL2: hibernation and suspend-to-RAM, on #1445 Nov 11, 2026
@fbalazsy
fbalazsy force-pushed the j616s/el2-sleep branch 3 times, most recently from c99d8b7 to 6deb620 Compare November 12, 2026 02:50
@fbalazsy fbalazsy changed the title J616s (M4 Pro) at EL2: hibernation and suspend-to-RAM, on #1445 J616s (M4 Pro) at EL2: hibernation and suspend-to-RAM Nov 12, 2026

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Before this can merge, please reword the comments that name macOS driver classes and methods, mark steps as RE or decompile-verified, or say where a value was read. That covers mainly t6040-sleep.c, plus t6040-usb2.c, dcp.c and macsmc.c. Each comment should say what the hardware or firmware does: the register, the bits, the order, and what you measured on the J616s. Values and code can stay as they are.

@fbalazsy
fbalazsy force-pushed the j616s/el2-sleep branch 3 times, most recently from 2ce0d80 to 7aefde0 Compare November 12, 2026 07:05
@fbalazsy

Copy link
Copy Markdown
Contributor Author

Done in 7aefde0, thanks for the pointer to #1625.

  • The comments that named host-driver classes or routines, marked a step as reverse-engineered, or said where a value was read (a trace, a recording, a run, a source file) now describe the hardware or firmware: register, bits, order, and what was measured on the J616s. Mainly t6040-sleep.c and dcp.c, also t6040-usb2.c, macsmc.c, nvme/host/apple.c, pmp.rs, t6040.dtsi and apple-ane.rst. The private labels of my bring-up notes went with them.
  • Values and code are as they were: with comments stripped the files are identical, apart from six strings (five parameter descriptions and one log line) that carried the same labels.
  • One real change came out of it: t6040-sleep.c still printed a list of steps that "had never run on hardware" at every suspend and needed i_know_untested to get past it, although all of them run. The list and the parameter are removed in the last commit; the commit is reached with no live blocker and t6040_sleep.allow_entry=1, and a requested dry run comes first.

Rebased onto aea2deb on the way. Tested on the J616s on this head (suspend-to-RAM, hibernation, suspend-to-RAM again; details in the description). That round was on battery without the dock, so the external displays have not run on this head yet; I will add that run.

What is left in t6040-sleep.c are the module parameters and records marked "Bring-up"; they go when the T6040 becomes match data in sleep.c.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Tested on a second J616s (M4 Pro, 24 GB, firmware of a macOS 27.0 install), Linux at EL2 under aura main 27298d21 (includes aura#148), kernel = integration + this series:

  • Deep sleep, RTC wake after 30 s: 25 of 25 sleeps resumed, each a real commit and mailbox return (wake: resumes now +1 per cycle): 10/10 on c99d8b7, then 4 + 10 on 7aefde0 with the four commits below (two boots). After every wake: Wi-Fi reassociated, gateway ping, an 8 MiB NVMe write + fsync + read, internal panel and the USB-C DP monitor, 7 input devices, CPUs 0-13. Wall time 32.3-33.5 s for a 30 s alarm.
  • One miss: on the first sleep of one boot, the dock port's USB3 side did not come back. phy-apple-t6040-usb2 392a90000.phy: RTKit: AP idle not acknowledged: -62 at the suspend, then PHY not back after the sleep (-5), dwc3-apple 392280000.usb: not resuming xHCI ... -5; the port came back USB2-only (hub on bus 3, the USB3 device gone) and stayed that way, with phymxwrap suspend failed: -11 on each later sleep. 24 of the 25 wakes had all 8 USB devices.
  • One 603 s deep sleep on battery: about 0.34 W average from the fuel gauge (rough: the battery was full and the gauge corrects itself after a wake). Awake with the panels off: 3.9-4.1 W.
  • Kernel log after each wake: the hci_bcm4377 -19 lines you list under Open, plus 1-5 apple_soc_edac 'event-log source 9' reports in the first ~10 s after the wake.

Four commits on top of 7aefde0 are on aurora-silicon/linux branch j6s2r/el2-sleep-fixups. Please pick them into this branch (or say if you want them changed):

  1. soc: apple: t6040-sleep: leave suspend-to-idle alone: the PM core calls suspend_ops->begin/end for s2idle when there are no s2idle_ops, so t6040_sleep_begin() refused every s2idle with -EOPNOTSUPP once the controller probed. .begin now returns 0 for anything but PM_SUSPEND_MEM, .end only undoes a MEM .begin, and .valid offers MEM only with t6040_sleep.allow_entry=1, so mem_sleep keeps s2idle as the default.
  2. soc: apple: share the sleep registry so one kernel builds both controllers: sleep.c and t6040-sleep.c both exported the nine apple_sleep_coproc_*/apple_sleep_enclave_* symbols, hence depends on !APPLE_SOC_SLEEP. The registry moves to sleep-registry.c; each controller binds to it in its probe. asahi.config gets CONFIG_APPLE_T6040_SLEEP=y, so one config builds the T8140 and T6040 controllers.
  3. soc: apple: t6040-sleep: depend on a built-in SMC driver: built in, it calls apple_smc_read_u32/write_u32.
  4. soc: apple: t6040-sleep: name the T8140 driver instead of its pull request: comment wording.

Checks on that branch: universal config builds (both controllers =y, and each one off), sleep KUnit 6 pass / 1 skip, checkpatch --strict clean, s2idle 3/3 with no kernel errors and the deep rows above on the J616s, s2idle 3/3 on an M1 Pro and an M2 with no new kernel errors.

AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 12, 2026
…uspend

The T6041 (M4 Max) has the AICv3 of T8122 and now a suspend-to-RAM
driver of its own. Give "apple,t6041-aic3" its own info, the T8122 one
with fw_suspend, so the AIC state the sleep loses is saved and put
back as on T8140. Nothing else in the driver looks at fw_suspend.

Also in aurora-silicon#1477 (T6040 sleep), which admits apple,t6041-aic3 the same
way; drop this one when that lands.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 12, 2026
apple_nvme_t6040_hw is only matched by "apple,t6041-nvme-ans2". Give it
the sleep fields T8140 uses: register ANS with the sleep core
(sleep_traced), flush namespace 1 only, the OS's own, and send the
full shutdown notification at suspend. The T6041 sleep driver stops
ANS through the sleep core's coprocessor stop.

On T6041 the sleep core's last check (the shutdown notification has
completed) does not run: the T6041 driver calls only the coprocessor
stop.

Also in aurora-silicon#1477, which sets the same fields with sleep_untraced on the
same struct; drop this one when that lands.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 12, 2026
The PMP's SRAM loses its contents in a real sleep. On the J616C's
26.6.2 firmware its __DATA segment is at 0x500761000, 0x7d000 bytes:
back up (0x61000, 0x7d000) of the SRAM, as T8140 does for its own.

Also in aurora-silicon#1477, whose HW_CFG_T6041 has the same range; drop this one
when that lands.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 12, 2026
On apple,t6041, write the keys macOS writes last before MBSE slpa in a
trace of its sleep: WKTP = 2 (AppleSMCEmbedded, going to sleep), then
pmVC. The value written is 0x101, as the bring-up kernel runs it; the
comment, taken over from it, says the trace has 0x100. That difference
is open.

Also in aurora-silicon#1477, which writes WKTP through a sleep_wktp parameter;
drop this one when that lands.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 12, 2026
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.

Also in aurora-silicon#1477 (0ab1a66), which this follows; drop this one when that
lands.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@fbalazsy
fbalazsy force-pushed the j616s/el2-sleep branch 2 times, most recently from 1599341 to 9bee928 Compare November 12, 2026 13:35
@fbalazsy

fbalazsy commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Picked up, thanks for the second machine and the four commits. Head is f259e90 on integration/aurora 107b361 (the brcmfmac .thaw commit dropped out, the base has it now). In order:

  1. 7aefde0 as you tested it, then your four from j6s2r/el2-sleep-fixups, unchanged.
  2. One fix for them: the registry commit moved apple_sleep_commit_stops_coprocs() and the enclave registration out of sleep.c, and tools/asahi/sep-suspend-errors-tests.py reads them from there, so it and its 21 mutation runs failed ("missing function"). The test now reads the three functions from sleep-registry.c.
  3. The follow-up I had announced as a separate pull request, 35 commits; it was finished and it removes what you would otherwise have to review twice:
    • t6040-sleep's bring-up parameters, marks, records, probes and dumps are gone: 79 module parameters down to 4 (allow_entry, dry_run, sleep_wd_secs, wd2_secs); the same in the display, GPU, PCIe, pinctrl, PHY, dwc3 and PMP parts of the series.
    • dry_run=1 never reached the commit point (the PMU RTC refuses a deep sleep that is not firmware-driven in .prepare); it is removed and the levels are 1 and 2 now.
    • The T6040 controller is a part of the generic driver: sleep.c + sleep-t6040.c, one apple-sleep platform driver. Your sleep-registry.c and struct apple_sleep_ctl stay as they are; the driver binds the registry once in probe and the SoC's part supplies the two answers, each SoC with the rules it had. APPLE_T6040_SLEEP stays a real option (the switch of the T6040 part, with your MFD_MACSMC=y), so the line in asahi.config stays valid. Your suspend-to-idle change is kept as written: the part keeps its own suspend ops, .valid offers deep only with allow_entry=1.
    • Two comments that still cited pull request numbers are reworded.

If you would rather merge 9bee928 first and take the 35 commits as a second pull request, say so and I will split it there; they sit on top and nothing below them changed.

On the J616s here, kernel from this head with APPLE_SOC_SLEEP and APPLE_T6040_SLEEP (lid closed, no dock): cold boot, suspend-to-idle, dry run 1 and 2, suspend-to-RAM x3, hibernation, suspend-to-RAM after it; KVM guest, SIO AES and ProRes checked after each. The same list passed on 9bee928 earlier today. Host tests 292 -> 306 ok, KUnit with the same six failures as the base, Rust KUnit 573 of 575, sep-source, the three DWC3/ATC profiles and the dt check pass; details in the description.

Not verified: T8140 on the merged driver (its object differs from before only in the functions that now go through the part; a sleep on a T8140 would be welcome), and external displays, the dock and the kept USB hosts on this head. The USB3 miss on your dock port ("AP idle not acknowledged: -62") is under Open; I could not try for it without a dock.

sithglan added a commit to sithglan/aurora-linux that referenced this pull request Nov 12, 2026
… K116s deep-sleep base

Base: Jens Axboe's K116s series of 2026-11-12 (40 patches on
integration/aurora 2b4523c), the tree his K116s runs at EL2.
aurora-silicon#1477 brings the generic Apple SoC sleep driver with per-SoC parts
(sleep.c, sleep-t6040.c) to start a T6050 part from.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@RyanTheTide

Copy link
Copy Markdown
Contributor

@fbalazsy thanks for picking up the fixups and folding the T6040 controller into sleep.c. To merge this we need:

  1. A rebase onto the current integration/aurora (028d762); the branch conflicts now.
  2. Signed-off-by on 9bee928, c92a639, 9794539 and f259e90.
  3. Your external-display run on the rebased head, and whether you have seen the dock port come back USB2-only after a wake (phy-apple-t6040-usb2 "AP idle not acknowledged: -62") on your machine.
  4. Please reword "follows the order of macOS's quiesce and commit" in the description to describe the hardware order itself.
    One PR is fine with us; there is no need to split off the 35 follow-up commits. Once the rebased head is up we will run the J616s sleep rows and a regression pass on our other Macs.

@fbalazsy

Copy link
Copy Markdown
Contributor Author

Closing in favour of a stack of smaller pull requests, so that each subsystem can be reviewed and merged on its own. The commits are the ones of this pull request, restricted to each part's files and kept in the same order. The tree at the top of the stack (#1916) is identical to this pull request's tree at 59454c7. The hardware results above apply to that tree.

Merge order:

  1. ci: mask the pattern list of unmatched-property dt-schema messages #1903: ci: mask the pattern list of unmatched-property dt-schema messages (needed by the next one for dt-checks)
  2. J616s (M4 Pro) sleep, 1/9: device tree bindings and T6040 device tree #1904: 1/9, device tree bindings and the T6040 device tree
  3. J616s (M4 Pro) sleep, 2/9: hibernation core under aura (PM, arm64, RTKit handoff) #1909: 2/9, hibernation core under aura (PM, arm64, RTKit handoff)
  4. J616s (M4 Pro) sleep, 3/9: T6040 sleep controller, SMC, PMU, SPMI, pinctrl, AIC #1910: 3/9, T6040 sleep controller, SMC, PMU, SPMI, pinctrl, AIC
  5. J616s (M4 Pro) sleep, 4/9: PMP, AOP, SEP, DockChannel, keyboard, light sensor, headset codec #1911: 4/9, PMP, AOP, SEP, DockChannel, keyboard, light sensor, headset codec
  6. J616s (M4 Pro) sleep, 5/9: PCIe, NVMe, DART, Wi-Fi and Bluetooth after a power loss #1912: 5/9, PCIe, NVMe, DART, Wi-Fi and Bluetooth after a power loss
  7. J616s (M4 Pro) sleep, 6/9: ATC PHY, dwc3, Type-C and USB4 across sleep #1913: 6/9, ATC PHY, dwc3, Type-C and USB4
  8. J616s (M4 Pro) sleep, 7/9: display coprocessors (DCP) across sleep #1914: 7/9, display coprocessors (DCP)
  9. J616s (M4 Pro) sleep, 8/9: G17 GPU across hibernation and S2R #1915: 8/9, G17 GPU across hibernation and S2R
  10. J616s (M4 Pro) sleep, 9/9: ANE H16 across sleep and whole-model programs #1916: 9/9, ANE H16 and whole-model programs

Each part builds on its own and has its own checks. GitHub cannot stack pull requests from a fork, so each pull request also carries the commits of the ones before it; its description says which commits are its own. The open GPU item (a second hibernation started right after a resume) is described in #1915 and will get its own pull request. The review discussion stays here for reference.

@fbalazsy fbalazsy closed this Nov 14, 2026
joshuaswarren pushed a commit to joshuaswarren/omarchy-mlx that referenced this pull request Nov 15, 2026
## Changed contracts

M4 Pro (G16S) on the Borealis driver: the standing battery passes, with
the backend fixes it found and its receipt. The one route change is on
G16S only: the fused f16 decode SDPA arm no longer waits for the
cooperative matrix there. The G16S decode defaults are not part of this
PR.

| Commit | Contract |
|---|---|
| elementwise: keep the f16 rsqrt source from being a bare widening on
G16S | The f16 elementwise pipelines (sqrt, exp, rsqrt, normal, erfinv)
compile on G16S. The AGX packer refused `rsqrt` of a bare f16 widening;
the f16 variant ORs the operand bits with `params.dims >> 16` (always
0), so the value is bit-identical. Fixed 15 failing cases. |
| quantized gemv group: form the token-multi route for rows > 1 |
`dispatch_quantized_gemv_group` compared `node.size()` with `n`, so the
multi-row route never formed. It now compares with `rows * n`, and the
fused_chain test requires the route to form instead of comparing the
composed route bit for bit (a 1-ulp flake). |
| sdpa prefill: close the flash submission every 4e9 MACs, route
oversized score bindings to flash; sdpa prefill flash: no submission
split while a tape records | A 16384x8 flash prefill (~550 GMAC at ~50
GMAC/s) ran as one ~11 s submission past the per-job GPU timeout
(`Error(110)`). The tile loop now commits every 4e9 MACs, except while a
compiled tape records (`encoder.in_tape_recording`, as in
`dispatch_qmm_tile`); a new case checks 3 commits eager vs 1 recorded,
identical bits. Shapes whose score matrix exceeds
`maxStorageBufferRange` take the flash kernel; under a capability
simulation that branch refuses by name when the hardware lacks the
kernel's workgroup and shared memory. |
| sdpa decode f16 arm: no longer gated on the cooperative matrix; sdpa
decode f16 arm: keep the cooperative-matrix gate outside G16S | The
shader never used the cooperative matrix. On G16S only
(`sdpa_decode_f16_without_coopmat_part` in `device.h`) the gate drops
that clause; every other part keeps it. Decode SDPA f16 on G16S, us per
call, composed -> fused: 1100 keys 586 -> 177, 4096 keys 1872 -> 308,
263 keys 254 -> 141, 37 keys 153 -> 124. bf16 unchanged. The
capability-simulation backing check covers only the f16 arm, so
`m1-stock-no-coopmat` on lavapipe is 10/10 again. |
| tests: distributed ops load MPI at run time, gdn_bf16_state compiles,
no latched statics | The distributed test detects an MPI loaded with
dlopen; `test_gdn_bf16_state` compiles with GCC 16; `MLX_OMARCHY_GDN_PF`
and `MLX_OMARCHY_GDN_STATE_F32` are read live. |
| tests: stream-independence floor for Aurora Borealis | Two-stream
overlap floor 0.80 when the driver id is Aurora Borealis (measured
0.83-0.93 over 8 runs, every copy byte-for-byte correct); every other
driver keeps 0.95. The correctness checks are unchanged. |
| tests: require the token-multi group to form on G16S only | The
token-multi case requires a formed group on G16S, where its per-row bit
identity is measured; other subgroup-32 parts report the count. |
| shaders: round to f16 with an integer RNE conversion instead of
packHalf2x16 | GLSL leaves the rounding of `packHalf2x16`
implementation-defined, and a development Mesa build lowers it to
round-toward-zero. `shaders/omarchy_half.h` adds `omarchy_f16_bits_rne`
(integer RNE, 0 mismatches against the hardware conversion over all 2^32
float32 patterns); fused_chain, swiglu, fast_trio, qmm_vec, qmm_fma,
sdpa_decode_native_p1 and cast_int use it. On G16S with the system Mesa
the outputs are bit-identical to the `packHalf2x16` shaders and the time
per call is the same within run-to-run spread (`rne-ab.txt`); M1/M2 not
measured here. |
| receipts: repo-relative test path in the token-multi stock Mesa log |
`fused-chain-token-stock-mesa.txt` names
`tests/omarchy/test_fused_chain.cpp`. |
| qmm gemv group: epilogue sizes follow the rows * n node | The Add
epilogue checks compare with `node.size()` (rows * n) and take the
addend as the full (rows, n) residual or the (n) bias. Single-row groups
check the same sizes as before; the token route builds no epilogue. |
| shaders: include omarchy_half.h after the #extension directives | The
header follows the last `#extension` in each of the seven shaders (in
swiglu inside the f16 branch, its only user). |
| tests: pin omarchy_f16_bits_rne and the f16 rsqrt operand |
`omarchy_f16_rne_tests`: the header compiled as C++ against fixed IEEE
half bits and CPU `astype(float16)` at 65504, 65519, 65520, 2^-14,
2^-24, 2^-25, normal and subnormal ties, quiet NaNs and -0, plus a
strided sweep of the float32 bit space; on the GPU the same inputs
through a strided float32 -> float16 astype (cast_int.comp) and the f16
rsqrt route. The GPU cases skip without a Vulkan device. |
| receipts | `receipts/2026-11-13-m4-pro-g16s-gpu/`: battery, model
runs, the dual-Mesa battery, the RNE A/B and the stock-Borealis pipeline
sweep. |

## What ran

The standing battery at 532bbb48 (this tree plus the f16 qmm
cooperative-matrix shader change now in #437, which no suite reaches on
stock Borealis, where the cooperative matrix is not exposed; a later
battery of a tree containing this one ran 63 units with no failure) on
stock Borealis `05ddb00f5c`, one process per suite plus the 8
capability-simulation profiles: 78 units, 1090 test cases, all pass. On
`main` the same battery fails `primitive`, `fast_ops`, `fused_chain`,
`compiled_tape` and `sdpa_decode_fused` on the f16 `rsqrt` packer
refusal, `distributed` on the MPI check, the 16384x8 flash prefill on
the GPU timeout, two capability-simulation profiles on the f16 decode
gate, and `test_gdn_bf16_state` does not compile with GCC 16; the
commits above fix each of these.
`omarchy_ane_runtime_tests` links the libane runtime sources and is not
built here, as on `main`.

On a356ccd with the same Mesa: `omarchy_f16_rne_tests` 4/4 (12408
assertions), `fused_chain` 42/42, `fast_ops` 52/52, `matmul_family`
46/46, `primitive` 107/107, `sdpa_decode_fused` 7/7, `copy_offset`
29/29, `qmv_batch` 4/4, `fast_regression` 2/2, `runtime` 60/60,
`eq_math` 7/7, `sdpa_prefill_flash` 16/16.

## Hardware

| | |
|---|---|
| Machine | MacBook Pro 16-inch, M4 Pro (J616s, T6040), 14 CPU cores, 48
GB |
| GPU | `Apple M4 Pro (G16S B1)`, subgroup 32, 32 KiB shared memory,
`maxStorageBufferRange` 2 GiB - 1, no `VK_KHR_cooperative_matrix` |
| Driver | Mesa 26.3.0-devel `git-05ddb00f5c`, Borealis, Vulkan 1.4.363
|
| Kernel | Linux 7.3.0, aurora-silicon/linux `integration/aurora` with
the J616s series of aurora-silicon/linux#1477 |
| Toolchain | GCC 16.1, glslc 2026.4, Python 3.14.9 |

## Mesa and the opt-in routes

Stock Borealis `05ddb00f5c` builds and runs the opt-in routes the suites
reach, the multi-token GEMV included (the token-multi case dispatches
`qmm_vec_q4_multi_token4_subgroup_bf16` and `..._token8_subgroup_bf16`;
raw log in `fused-chain-token-stock-mesa.txt`).
`shaders-refused-stock-borealis.txt` comes from a standalone pipeline
sweep with other device features and a fixed layout; it is not a list of
backend refusals. No Mesa change is needed for anything measured here.

## Related

- The f16 qmm cooperative-matrix fix of #425 (7d7bdb0) is not in this
PR: it is #437, on top of #429 (@RyanTheTide) as asked in the #429
review.
- aurora-silicon/mesa#319 (the cooperative matrix default on the M4 Pro
and fixes for the two compile refusals the battery found with #275) and
aurora-silicon/mesa#299 (@RyanTheTide, the same default across the AGX3B
ISA) are the Mesa side. The backend default in 4a9a827 only sets
`ASAHI_AGX3B_COOPERATIVE_MATRIX=1` when the variable is unset, so it
changes nothing once either lands.
- #411 (@RyanTheTide, register-blocked f32 tile without a cooperative
matrix) merges cleanly with this branch.
- Replaces the backend fixes of #425, which is closed. The ANE lane 3 is
#438. The G16S decode defaults and split-K rows of #425's follow-up work
come in a separate PR after their measurements.
m0d16l14n1 added a commit to m0d16l14n1/linux that referenced this pull request Nov 15, 2026
…merges

aurora-silicon#1941 brought a second copy of struct dcp_s2r_layout (this tree had it from
the J815 sleep work); aurora-silicon#1808 names nvme's sleep_traced, which this tree calls
sleep_coproc (with sleep_untested, from the aurora-silicon#1477 rework).

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <nekreshen@yandex.ru>
fbalazsy added a commit to fbalazsy/omarchy-mlx that referenced this pull request Nov 15, 2026
…shuaswarren#439)

## Changed contracts

M4 Pro (G16S) on the Borealis driver: the standing battery passes, with
the backend fixes it found and its receipt. The one route change is on
G16S only: the fused f16 decode SDPA arm no longer waits for the
cooperative matrix there. The G16S decode defaults are not part of this
PR.

| Commit | Contract |
|---|---|
| elementwise: keep the f16 rsqrt source from being a bare widening on
G16S | The f16 elementwise pipelines (sqrt, exp, rsqrt, normal, erfinv)
compile on G16S. The AGX packer refused `rsqrt` of a bare f16 widening;
the f16 variant ORs the operand bits with `params.dims >> 16` (always
0), so the value is bit-identical. Fixed 15 failing cases. |
| quantized gemv group: form the token-multi route for rows > 1 |
`dispatch_quantized_gemv_group` compared `node.size()` with `n`, so the
multi-row route never formed. It now compares with `rows * n`, and the
fused_chain test requires the route to form instead of comparing the
composed route bit for bit (a 1-ulp flake). |
| sdpa prefill: close the flash submission every 4e9 MACs, route
oversized score bindings to flash; sdpa prefill flash: no submission
split while a tape records | A 16384x8 flash prefill (~550 GMAC at ~50
GMAC/s) ran as one ~11 s submission past the per-job GPU timeout
(`Error(110)`). The tile loop now commits every 4e9 MACs, except while a
compiled tape records (`encoder.in_tape_recording`, as in
`dispatch_qmm_tile`); a new case checks 3 commits eager vs 1 recorded,
identical bits. Shapes whose score matrix exceeds
`maxStorageBufferRange` take the flash kernel; under a capability
simulation that branch refuses by name when the hardware lacks the
kernel's workgroup and shared memory. |
| sdpa decode f16 arm: no longer gated on the cooperative matrix; sdpa
decode f16 arm: keep the cooperative-matrix gate outside G16S | The
shader never used the cooperative matrix. On G16S only
(`sdpa_decode_f16_without_coopmat_part` in `device.h`) the gate drops
that clause; every other part keeps it. Decode SDPA f16 on G16S, us per
call, composed -> fused: 1100 keys 586 -> 177, 4096 keys 1872 -> 308,
263 keys 254 -> 141, 37 keys 153 -> 124. bf16 unchanged. The
capability-simulation backing check covers only the f16 arm, so
`m1-stock-no-coopmat` on lavapipe is 10/10 again. |
| tests: distributed ops load MPI at run time, gdn_bf16_state compiles,
no latched statics | The distributed test detects an MPI loaded with
dlopen; `test_gdn_bf16_state` compiles with GCC 16; `MLX_OMARCHY_GDN_PF`
and `MLX_OMARCHY_GDN_STATE_F32` are read live. |
| tests: stream-independence floor for Aurora Borealis | Two-stream
overlap floor 0.80 when the driver id is Aurora Borealis (measured
0.83-0.93 over 8 runs, every copy byte-for-byte correct); every other
driver keeps 0.95. The correctness checks are unchanged. |
| tests: require the token-multi group to form on G16S only | The
token-multi case requires a formed group on G16S, where its per-row bit
identity is measured; other subgroup-32 parts report the count. |
| shaders: round to f16 with an integer RNE conversion instead of
packHalf2x16 | GLSL leaves the rounding of `packHalf2x16`
implementation-defined, and a development Mesa build lowers it to
round-toward-zero. `shaders/omarchy_half.h` adds `omarchy_f16_bits_rne`
(integer RNE, 0 mismatches against the hardware conversion over all 2^32
float32 patterns); fused_chain, swiglu, fast_trio, qmm_vec, qmm_fma,
sdpa_decode_native_p1 and cast_int use it. On G16S with the system Mesa
the outputs are bit-identical to the `packHalf2x16` shaders and the time
per call is the same within run-to-run spread (`rne-ab.txt`); M1/M2 not
measured here. |
| receipts: repo-relative test path in the token-multi stock Mesa log |
`fused-chain-token-stock-mesa.txt` names
`tests/omarchy/test_fused_chain.cpp`. |
| qmm gemv group: epilogue sizes follow the rows * n node | The Add
epilogue checks compare with `node.size()` (rows * n) and take the
addend as the full (rows, n) residual or the (n) bias. Single-row groups
check the same sizes as before; the token route builds no epilogue. |
| shaders: include omarchy_half.h after the #extension directives | The
header follows the last `#extension` in each of the seven shaders (in
swiglu inside the f16 branch, its only user). |
| tests: pin omarchy_f16_bits_rne and the f16 rsqrt operand |
`omarchy_f16_rne_tests`: the header compiled as C++ against fixed IEEE
half bits and CPU `astype(float16)` at 65504, 65519, 65520, 2^-14,
2^-24, 2^-25, normal and subnormal ties, quiet NaNs and -0, plus a
strided sweep of the float32 bit space; on the GPU the same inputs
through a strided float32 -> float16 astype (cast_int.comp) and the f16
rsqrt route. The GPU cases skip without a Vulkan device. |
| receipts | `receipts/2026-11-13-m4-pro-g16s-gpu/`: battery, model
runs, the dual-Mesa battery, the RNE A/B and the stock-Borealis pipeline
sweep. |

## What ran

The standing battery at 532bbb48 (this tree plus the f16 qmm
cooperative-matrix shader change now in joshuaswarren#437, which no suite reaches on
stock Borealis, where the cooperative matrix is not exposed; a later
battery of a tree containing this one ran 63 units with no failure) on
stock Borealis `05ddb00f5c`, one process per suite plus the 8
capability-simulation profiles: 78 units, 1090 test cases, all pass. On
`main` the same battery fails `primitive`, `fast_ops`, `fused_chain`,
`compiled_tape` and `sdpa_decode_fused` on the f16 `rsqrt` packer
refusal, `distributed` on the MPI check, the 16384x8 flash prefill on
the GPU timeout, two capability-simulation profiles on the f16 decode
gate, and `test_gdn_bf16_state` does not compile with GCC 16; the
commits above fix each of these.
`omarchy_ane_runtime_tests` links the libane runtime sources and is not
built here, as on `main`.

On a356ccd with the same Mesa: `omarchy_f16_rne_tests` 4/4 (12408
assertions), `fused_chain` 42/42, `fast_ops` 52/52, `matmul_family`
46/46, `primitive` 107/107, `sdpa_decode_fused` 7/7, `copy_offset`
29/29, `qmv_batch` 4/4, `fast_regression` 2/2, `runtime` 60/60,
`eq_math` 7/7, `sdpa_prefill_flash` 16/16.

## Hardware

| | |
|---|---|
| Machine | MacBook Pro 16-inch, M4 Pro (J616s, T6040), 14 CPU cores, 48
GB |
| GPU | `Apple M4 Pro (G16S B1)`, subgroup 32, 32 KiB shared memory,
`maxStorageBufferRange` 2 GiB - 1, no `VK_KHR_cooperative_matrix` |
| Driver | Mesa 26.3.0-devel `git-05ddb00f5c`, Borealis, Vulkan 1.4.363
|
| Kernel | Linux 7.3.0, aurora-silicon/linux `integration/aurora` with
the J616s series of aurora-silicon/linux#1477 |
| Toolchain | GCC 16.1, glslc 2026.4, Python 3.14.9 |

## Mesa and the opt-in routes

Stock Borealis `05ddb00f5c` builds and runs the opt-in routes the suites
reach, the multi-token GEMV included (the token-multi case dispatches
`qmm_vec_q4_multi_token4_subgroup_bf16` and `..._token8_subgroup_bf16`;
raw log in `fused-chain-token-stock-mesa.txt`).
`shaders-refused-stock-borealis.txt` comes from a standalone pipeline
sweep with other device features and a fixed layout; it is not a list of
backend refusals. No Mesa change is needed for anything measured here.

## Related

- The f16 qmm cooperative-matrix fix of joshuaswarren#425 (7d7bdb0) is not in this
PR: it is joshuaswarren#437, on top of joshuaswarren#429 (@RyanTheTide) as asked in the joshuaswarren#429
review.
- aurora-silicon/mesa#319 (the cooperative matrix default on the M4 Pro
and fixes for the two compile refusals the battery found with joshuaswarren#275) and
aurora-silicon/mesa#299 (@RyanTheTide, the same default across the AGX3B
ISA) are the Mesa side. The backend default in 4a9a827 only sets
`ASAHI_AGX3B_COOPERATIVE_MATRIX=1` when the variable is unset, so it
changes nothing once either lands.
- joshuaswarren#411 (@RyanTheTide, register-blocked f32 tile without a cooperative
matrix) merges cleanly with this branch.
- Replaces the backend fixes of joshuaswarren#425, which is closed. The ANE lane 3 is
joshuaswarren#438. The G16S decode defaults and split-K rows of joshuaswarren#425's follow-up work
come in a separate PR after their measurements.
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
…uspend

The T6041 (M4 Max) has the AICv3 of T8122 and now a suspend-to-RAM
driver of its own. Give "apple,t6041-aic3" its own info, the T8122 one
with fw_suspend, so the AIC state the sleep loses is saved and put
back as on T8140. Nothing else in the driver looks at fw_suspend.

Also in aurora-silicon#1477 (T6040 sleep), which admits apple,t6041-aic3 the same
way; drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
apple_nvme_t6040_hw is only matched by "apple,t6041-nvme-ans2". Give it
the sleep fields T8140 uses: register ANS with the sleep core
(sleep_traced), flush namespace 1 only, the OS's own, and send the
full shutdown notification at suspend. The T6041 sleep driver stops
ANS through the sleep core's coprocessor stop.

On T6041 the sleep core's last check (the shutdown notification has
completed) does not run: the T6041 driver calls only the coprocessor
stop.

Also in aurora-silicon#1477, which sets the same fields with sleep_untraced on the
same struct; drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
The PMP's SRAM loses its contents in a real sleep. On the J616C's
26.6.2 firmware its __DATA segment is at 0x500761000, 0x7d000 bytes:
back up (0x61000, 0x7d000) of the SRAM, as T8140 does for its own.

Also in aurora-silicon#1477, whose HW_CFG_T6041 has the same range; drop this one
when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
On apple,t6041, write the keys macOS writes last before MBSE slpa in a
trace of its sleep: WKTP = 2 (AppleSMCEmbedded, going to sleep), then
pmVC. The value written is 0x101, as the bring-up kernel runs it; the
comment, taken over from it, says the trace has 0x100. That difference
is open.

Also in aurora-silicon#1477, which writes WKTP through a sleep_wktp parameter;
drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
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.

Also in aurora-silicon#1477 (0ab1a66), which this follows; drop this one when that
lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
…uspend

The T6041 (M4 Max) has the AICv3 of T8122 and now a suspend-to-RAM
driver of its own. Give "apple,t6041-aic3" its own info, the T8122 one
with fw_suspend, so the AIC state the sleep loses is saved and put
back as on T8140. Nothing else in the driver looks at fw_suspend.

Also in aurora-silicon#1477 (T6040 sleep), which admits apple,t6041-aic3 the same
way; drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
apple_nvme_t6040_hw is only matched by "apple,t6041-nvme-ans2". Give it
the sleep fields T8140 uses: register ANS with the sleep core
(sleep_traced), flush namespace 1 only, the OS's own, and send the
full shutdown notification at suspend. The T6041 sleep driver stops
ANS through the sleep core's coprocessor stop.

On T6041 the sleep core's last check (the shutdown notification has
completed) does not run: the T6041 driver calls only the coprocessor
stop.

Also in aurora-silicon#1477, which sets the same fields with sleep_untraced on the
same struct; drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
The PMP's SRAM loses its contents in a real sleep. On the J616C's
26.6.2 firmware its __DATA segment is at 0x500761000, 0x7d000 bytes:
back up (0x61000, 0x7d000) of the SRAM, as T8140 does for its own.

Also in aurora-silicon#1477, whose HW_CFG_T6041 has the same range; drop this one
when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
On apple,t6041, write the keys macOS writes last before MBSE slpa in a
trace of its sleep: WKTP = 2 (AppleSMCEmbedded, going to sleep), then
pmVC. The value written is 0x101, as the bring-up kernel runs it; the
comment, taken over from it, says the trace has 0x100. That difference
is open.

Also in aurora-silicon#1477, which writes WKTP through a sleep_wktp parameter;
drop this one when that lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 17, 2026
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.

Also in aurora-silicon#1477 (0ab1a66), which this follows; drop this one when that
lands.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
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.

4 participants