Repository navigation
soc: apple: enable T6030 suspend-to-RAM on J516s - #4067
Conversation
…r blocks Allow the optional phy-shared, phy-ip, clkgen, axi2af, cio3pll, phy-common, and port/phy/intr2axi register windows on Apple PCIe host nodes so the T6030 sleep provider can map them by name from DT. Signed-off-by: Diljit Singh <hey@djdev.me>
Add the Devicetree schema for the Apple T6030 (M3 Pro) system suspend-to-RAM controller, including its 33 register windows, phandle links, wake sources, SMC sleep policy timing, and register sequence opcodes (including explicit slc-off and clear64-way opcodes). Signed-off-by: Diljit Singh <hey@djdev.me>
Add T6030 match data enabling keep_pending so masked SPMI sources owned by the T6030 firmware sleep path are not acknowledged away at probe or during unrelated IRQ handling. Bound consecutive unhandled held interrupts across all IRQ words including the notification word to prevent an interrupt storm if a masked bit ever asserts the parent line. Signed-off-by: Diljit Singh <hey@djdev.me>
…leep T6030 powers down ATC common domains during deep sleep, so set common_pd_dropped in the T6030 PHY match data so the PHY driver reinitializes its common block on wake. Signed-off-by: Diljit Singh <hey@djdev.me>
Allow sleep providers that supply apple,smc-sleep-policy in DT to drive the generic macsmc sleep sequence (pmVC, SLPA, AP idle, and wake notices) and expose until_before_slpa() so providers can pace hardware votes ahead of the SLPA deadline without duplicating SMC state. Signed-off-by: Diljit Singh <hey@djdev.me>
Export apple_dart_set_pmp_sleep() (guarded with IS_REACHABLE) so the PMP driver can mark its DART as sleep-managed. Keep TLB and PM suspend/ resume callbacks gated if the PMP DART fails to come back on wake so subsequent operations do not fault on an unpowered DART. Signed-off-by: Diljit Singh <hey@djdev.me>
Register the T6030 PMP DART with apple_dart_set_pmp_sleep() when apple_pmp_commit_available() binds the commit callback on the first apple_pmp_suspend_late() (with apple,t6030-pmp-v2 instantiated on J516s via the runtime overlay t6030-j516s-pmp.dtso), so apple-dart coordinates its suspend/resume gating across deep sleep. Also move the wake_err check in apple_pmp_resume_early() ahead of clearing pmp_commit_used and apple_sleep_coproc_set_ready() so the coprocessor stays stopped and its RX mailbox held until a real wake restores power. Signed-off-by: Diljit Singh <hey@djdev.me>
Add the generic sleep-core hooks needed by the T6030 provider: - apple_sleep_domain_kept() via soc->ops->domain_kept, checked in pmgr-pwrstate suspend so wake resync still restores genpd-OFF domains; - after_early, wfi_again, and before_enclave hooks (marking regs_staged before before_enclave so refusal cleanup always runs undo_regs); - gate_fail_closed, cpu_start_every_cluster, gp_host_apart, and failed_stop_ends_sleep profile flags; - split sleep_ps_rewake() into staged helpers for multi-stage wake ordering. Signed-off-by: Diljit Singh <hey@djdev.me>
Consult apple_sleep_domain_kept() during system sleep power-off so power domains managed directly by the SoC sleep provider are not gated early by genpd suspend while wake resync still restores genpd-OFF domains. Signed-off-by: Diljit Singh <hey@djdev.me>
Add the Apple T6030 (M3 Pro) deep suspend-to-RAM provider for apple-sleep with full SEP stop, DT-driven entry/wake register sequences (with explicit slc-off and clear64-way opcodes), PTD/CPM/SLC handshakes, GP PCIe PHY/clock park and wake recovery, PMU RTC alarm re-arming and sleep/wake stage byte updates (writing 0xfe to PMU register 0xf801 on wake, matching the 0x50 stage byte written at sleep entry), and KUnit coverage. Signed-off-by: Diljit Singh <hey@djdev.me>
Add the apple,t6030-sleep controller node with its register windows, phandle links, wake sources, SMC policy, and explicit entry/wake register sequences in t6030.dtsi, add the PCIe sleep register windows, and enable deep sleep on J516s. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: MERGE at f027342
Checked: The superseded I2C6 table is absent from all 11 commits. Seventeen changed paths match the reviewed tip of #3818 byte for byte, and the five shared paths match the clean three-way merge onto the stated main base. Both binding documents passed validation. All four PMP DT builds and the 13-slot quiesce check passed, and the quiesce negative control was caught.
Follow-ups: Please split further changes to this provider into smaller reviewable PRs.
|
Pre-qualification check for the two items flagged by @satchlj on #3818 and the #4037 T8122 deep-sleep lessons across #4067 / #3809 / #3763: 1. Pre-cycle-1 checks (
|
|
J516s (T6030, M3 Pro) deep-sleep receipts: 1. Combined qualification (
|
#3809 is in main now, and #4176 added apple_dart_clear_host_resumes() and apple_dart_host_restart() to main. Both sides add the same apple_dart_clear_host_resumes(); keep one copy, and apple_dart_is_host_resumed() from this branch, in include/linux/soc/apple/dart.h and drivers/iommu/apple-dart.c. Signed-off-by: DjDeveloperr <hey@djdev.me>
apple_sleep_undescribed() came to main while the T6030 provider was in review. It makes s2idle the default when a SoC with no regions has an ANS and no PCIe tables for it, as every deep sleep would be refused there. T6030 has no such tables and apple_sleep_refuse() asks for them only when ANS is off (gp_host_apart), so its deep sleep would go through and still not be the default. Ask for the tables with the same condition. Other SoCs don't set gp_host_apart. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merged The merge. The text conflict was only in Compared with "
Compared with The new commit. This one is not in the approved code. Checks on the result: W=1 objects of the eight touched drivers with clang and gcc, without a compiler warning; both T6030 DTBs; host tests sleep 53/53, dart 33/33, pcie 9/9, pmgr 3/3, t6030 13/14 plus DjDeveloperr pushed this, so a DjDeveloperr approval does not count for the last-push rule. RyanTheTide, erikwb or any other maintainer can approve. |
There was a problem hiding this comment.
Verdict: MERGE at 731c7e3 (code).
Checked: The ANS tunables are no longer treated as unconditionally missing at probe for the split GP-host provider. The runtime refusal still checks an inactive ANS link for those tunables. I compiled the exact predicates and checked five cases, including the live-ANS route, the missing restoration data refusal, and the unchanged legacy path. The DART implementation and header match the previously reviewed f66d67e blobs, with one host-resume clear helper. The PCIe controller matches main after #3809, and the J516s DT blob matches the preceding head. All three changed binding documents validated. The published hardware result applies to f66d67e.
|
J516s (MacBook Pro 16-inch, M3 Pro, T6030, OS firmware 27.2 / 26B123) deep-sleep row at exact head
|
sithglan
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 731c7e36276370bdbf4bb6fbf400ac9ee37a6351
Blockers: none
Checked:
- Re-reviewed the delta since Ryan's approved
f66d67e3a242:- Merge
aa90ecc72b77(main5a13ea7b4b52): clean deduplication ofapple_dart_clear_host_resumes()indrivers/iommu/apple-dart.candinclude/linux/soc/apple/dart.h, keepingapple_dart_is_host_resumed()(and its!CONFIG_IOMMU_APPLE_DARTinline stub) alongsideapple_dart_host_restart(). - New commit
731c7e362763(drivers/soc/apple/sleep.c): adding!s->soc->gp_host_aparttoapple_sleep_undescribed()matches the existinggp_host_apartbranch inapple_sleep_refuse()(which only requiresapcie_phy_tunablewhen ANS is powered off) and is strictly T6030-scoped (no other SoC setsgp_host_apart).
- Merge
- Verified exact-head J516s (T6030, fw 27.2) deep-sleep row is in and PASS (36/36), and
apple-build,dt-checks,host-tests,source,DWC3/ATC,readiness, andpr-textare green.
|
Landing check for head 731c7e3, merged locally onto main 9e6409d (merge base 5a13ea7). The merge is clean. Main has since moved to a7e09cb (#4205), which only changes DCP selftests, so nothing overlaps with this PR. The only file both this PR and main changed after 5a13ea7 is Checks run on Mini against the merge tree, limited to the code this PR touches:
Reviews at 731c7e3: aurora-silicon-review and sithglan approved. The earlier review is dismissed, and nobody has requested changes. Hardware: M3 J516s Arm B (this PR + #3653) had 35 passes, 0 failures and 1 incomplete run (an empty baseline lookup). The J516s deep-sleep row at 731c7e3 passed 36/36. The only remaining block is the last-push approval rule, so this is an admin merge at the exact head. |
Main gained the T6030 sleep profile (#4067) at the same places this branch adds T6020: keep both includes and both match-table entries in sleep.c, and both compatibles in sleep-test.c's profile list. Signed-off-by: DjDeveloperr <hey@djdev.me>
What: Enable firmware suspend-to-RAM (
deep) for the 16-inch M3 Pro (J516s) on OS firmware 27.2 (26B123). The T6030 sleep provider sequences the SMC and PMU handshakes and restores CPU, cache, power-domain, I2C6 and PCIe state. J514s keeps its sleep node disabled. On any OS firmware other than27.2the provider returns-ENODEVat probe before it maps or writes a sleep register, sos2idlestays the sleep state. This replaces #3818. #3809 is merged tomain(5a13ea7b4b52), sopcie-apple.cis no longer part of this diff. It also keepsmain's new check for missing sleep parts (apple_sleep_undescribed()) from taking the deep-sleep default away on T6030.Tested: J516s (M3 Pro, T6030, 27.2) at
f66d67e3a242: row, two separate boots of that commit. Boot A:refuse_late=1refused the first entry, then 3/3 committed deep sleeps (191 s, 11 s, 11 s) and ones2idle, same boot ID throughout. Boot B: deep sleep committed on its first entry (16 s). In the journals of both boots there is no WARNING, BUG or SError line. Display came back, Wi-Fi answered, and the PCIe links, port DARTs and Bluetooth firmware came back after each wake. Not exercised: audio playback, an SD card, a USB device, a GPU workload. The current head is that one withmain5a13ea7b4b52merged in, plus one condition insleep.c. It was built and host-tested (see Evidence) and not booted. J514s and the other Macs were not run.Risk: two-way door, a plain revert restores the old behaviour · J516s on 27.2 mainly. Shared code reached by other Macs: the SMC, SPMI, DART, PMP and PMGR hooks, and
apple-sleepitself. Most of it is gated by SoC data or a device tree property. Not gated: the reworked power-domain wake-order loop insleep.c. The late PCIe resume path came tomainwith #3809, which has its own rows: J414s, J516s and J714s. J514s gets the T6030 PCIe and ATC matches and no sleep node.Not yet:
drivers/soc/apple, 16 are the same files as in that row;sleep.chasmain's T8132/T8122 changes and the one new condition. Not booted yet: the probe linedeep sleep is the default, and one deep sleep with Wi-Fi back.1.0.0b17-g683a128b, which is not a commit in aurora-silicon/aura. aura b18 or later, and auramaindfe97a4b9783, were not tried on J516s with this PR.CLK_PERF_SOC; both boots read0x1222before and after, so the write had no visible effect.s2idlewith Wi-Fi and SD back. Also not run: a J516s on another OS firmware. There the sleep provider does not bind, but the device tree changes and the SMC transport choice (apple,smc-sleep-policy) still apply.t6030_pwrgate_init(),t6030_cpm_init()andt6030_mem_config_apply()to the first deep-sleep entry, with its own J516s row.Details
t6030_sleep_map_regs()on exact/chosen/asahi,os-fw-version == "27.2"(t6030_firmware_ok(), returning-ENODEVbefore mapping or writing any registers on other firmwares).t6030_sleep_begin()andt6030_sleep_final_check()onpcie-applebeing bound and every available GP PCIe DART being host-resumed (apple_dart_is_host_resumed()).t6030_sleep_map_regs()behind the J516s DT opt-in (&t6030_sleep { status = "okay"; }) and 27.2 firmware gate after all DT resource, sequence, and wake-source validation succeeds, using pre-mapped DT"mca-switch".no-restore-gpio-pinsskip bitmap (apple,pinctrl-skip-pins = <5 6 17>), restoring AP pin state when GPIO is powered before GP PCIe retraining, with a fallback after the early wake sequence.reset-gpiosby PCI slotreg, replacing hardcoded pinctrl offsets in the quiesce tables.apple,i2c6phandle, keeping&ps_i2c6and&ps_spi2(apple,always-on; apple,no-auto-pm;) and&spi2/&mesa(enable-gpios, CS delays,firmware-name = "apple/mesacal-j516s.bin") int6030-j516s.dts.group == 0OFF-target PMGR domains in child-before-parent order at commit and restore them parent-before-child on undo so unbound DT consumers holdingsync_state()do not block firmware sleep entry; guardapple_sleep_domain_kept()withpm_suspend_via_firmware()sos2idleis unaffected.apple,keep-pending-irqsto all three J516sapple,t6030-spmibuses (&nub_spmi,&nub_spmi_a0,&nub_spmi_a1), exclude driver-owned and RX-notify bits from the stuck-IRQ valve, match the J516s ADTsmc-pmuwake reasons (includingcodecbit 10 andtrackpadkeyboardbit 12), and usesleep-controller@3642d4000(regidx 0 ="commit", idx 5 ="ps").Details — per-call justification for probe-time boot writes (
t6030_sleep_map_regs(), answering thef0273427review):Deferring all six calls to first deep-sleep entry caused Cycle-1 Chapel watchdog resets (~73 s) on J516s (alongside the deleted
spi2/i2c6/mesaDT nodes and missingapple,keep-pending-irqson&nub_spmi_a1, all fixed in4d76e17159c5). All six run only on J516s with OS firmware27.2, after DT/mailbox/sequence/wake-source validation:t6030_boot_replay(s): runs the DWI boot pulse, zeroes the MCA audio-clock switches, and pulsesATC2_PCIEandATC1_PCIE. At first deep-sleep entry,ATC2_COMMONhas already been gated off bygenpd_power_off_unused()andATC1_PCIEis already active under CIO, causing both PCIe replay pulses to be skipped.t6030_pwrgate_init(s): enables the E- and P-cluster power-gate control registers required beforet6030_cpm_init()accesses cluster CPM state.t6030_cpm_init(): zeroes CPM counters and clears the CPM B63 gating bits for both clusters alongsidet6030_pwrgate_init().t6030_boot_auto_probe(s): setsPS_AUTO_ENABLEon active boot domains; running at first entry misses runtime-suspended domains (AUDIO_P,DPA0,UART0,UART_P).t6030_mem_config_apply(s): writes the 27.2-measured AMCC/DCS memory sleep table and sets the SoC perf upper nibble to 4 (T6030_PERF_SOC_HI_SLEEP), logging theCLK_PERF_SOCword before and after at probe.t6030_last_pmu_boot(s): reads and clears the PMU boot latches (0xf803and0xf808, leaving0xf801/0xf802untouched formacsmc-reboot) over raw SPMI at boot rather than right afterrtcwakearms the RTC alarm.Follow-up (separate issue/PR after merge): keep the DWI/ATC pulses, the AUTO pass, and the PMU latch clear at probe, and move
t6030_pwrgate_init(),t6030_cpm_init(), andt6030_mem_config_apply()to first deep-sleep entry with its own J516s cold-boot verification row to remove most of the every-boot cost ons2idle-only boots.Risk notes
ATC1_PCIE/ATC2_PCIEreplay order & kexec exception: the unconditionalATC1_PCIE/ATC2_PCIEpulse at probe would cut a USB4 PCIe tunnel if one were already up beforeapple-sleepprobes. On J516s, built-inapple-sleeprelies ondrivers/Makefilelink order (drivers/soc/links beforedrivers/pmdomain/anddrivers/spmi/, andCONFIG_USB4=m/CONFIG_USB4_APPLE_SOC=mthunderbolt_appleis a loadable module), so no power domain, ATC PHY, SPMI driver, or USB4 tunnel is up at probe — except a USB4 PCIe tunnel left active by a kexec'd kernel.s2idle-only boots on J516s 27.2: take the probe-time writes (~32 ms boot time, SoC perf upper nibble = 4, CPM/AMCC/DCS/AUTO bits, andps_spi2/ps_i2c6always-onkeepingps_spi_p/ps_sioon). Idle power comparison before/after is owed below.Evidence
scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks for the PR atf66d67e3a242, and the same for731c7e362763, the one new commit after the merge.f66d67e3a242:t6030-sleep-qblk,t6030-wiring(26/26),m3-sleep-steps(4/4),t6030-pmp-graph(27/27),t6030-pmp-supplier,apple-dart-tlb-stall --dtc,display26,j613-mtp-s2idlepass.731c7e362763(mergeaa90ecc72b77ofmain5a13ea7b4b52), W=1 with clang 23.1.3 and gcc 16.2.0:apple-dart.o,pcie-apple.o,sleep.o(with its KUnit tests),atc.o,macsmc.o,pmgr-pwrstate.o,spmi-apple-controller.oandpmp-export.obuild with no compiler warning.atc.chas 74 kernel-doc notes, the same number asmain.pmp-export.owas built with-DCONFIG_APPLE_PMP=1, as the build had no Rust. The KUnit tests were compiled, not run.t6030.dtsiandt6030-j516s.dtsare the same files as atf66d67e3a242.tools/asahi/run-host-tests.py --only) on the same tree: sleep 53/53, dart 33/33, pcie 9/9, pmgr 3/3, t8132 6/6, atc 18/18, j613 9/9, macsmc 1/1, display26 1/1, t6030 13/14. The one ist6030-pmp-dt-tests, which failed only becausefdtgetwas not installed; run by hand withfdtgetit passes for both boards, with the PR's device tree and withmain's.maincff875630c61, read 10.16 to 10.95 W on the same Stage 2. Thatmainis not an ancestor of this head and no raw log was kept, so this does not show that the probe writes lower idle power.