Repository navigation
soc: apple: enable T6030 suspend-to-RAM on J516s - #4067
DjDeveloperr wants to merge 17 commits into
Conversation
Link each T6030 port to its DART supplier before starting the port. Restore clocks, RID routing, and translations before training the link during firmware resume. Preserve the ASPM policy on retrained links while reopening late bridges before restoring downstream functions. Signed-off-by: Diljit Singh <hey@djdev.me>
…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 (
|
|
Verdict: FINISH at f027342 Failure: The first committed deep-sleep cycle on standalone J516s did not return to userspace and required a reset. Isolation with Linux #3809 completed both cycles. Merge #3809 first. The earlier three-PR result also covers #3763, the separate Bluetooth restoration change. Standalone and composite report Isolation result Failure: Hosted dt-checks failed on the new J516s diagnostic. This head enables the Mesa fingerprint node, which lacks the required firmware-name property under the existing apple,mesa-fingerprint binding. Both changed binding documents passed their schema checks. Fix the enabled node's binding error before landing this head. Hosted DT comparison Failure: The exact-head hosted host-tests job also failed. The existing j613-mtp-s2idle and apple-dart-tlb-stall fixtures do not compile after the DART changes. The compiler reports missing PMP fields in their stand-in DART structs. The job also reports failures in display26 and pmgr-inherited. The latter lacks apple_sleep_domain_kept in its extracted build. Hosted host-test log |
3. Prerequisite isolation (
|
RyanTheTide
left a comment
There was a problem hiding this comment.
Review at f027342. Not an approval yet. The shared changes in sleep.c, apple-dart, macsmc, atc and pmp-export are gated to T6030 as far as I can see (one tiny common change: a power domain listed twice is now restored once, and no profile lists one twice). The I2C6 table from #3818 is gone: it now saves and restores live values.
Merge order: #3809 first, then this. Dj's J516s rows match the code: this PR alone hung in cycle 1, while this PR plus #3809 passed 2/2 committed deep sleeps, and #3763 isn't needed to wake. Without #3809, the T6030 PCIe node binds t602x_hw (no noirq S2R path, no host_resumes_dart). So after a wake, apple_dart_resume_noirq() writes the Wi-Fi and SD port DARTs before their port clocks are back. t6030_apcie_wake() re-powers the GP APCIE words and leaves the port clocks, RID2SID and DARTs to the host driver. Please:
- rebase onto #3809 so the series bisects;
- ideally, have T6030 refuse deep sleep unless every
apple,pcie-dartsDART has been taken over by the host, as T6050 does for its radio DART (t6050_n1_host_bound()+apple_dart_set_host_resumes()). A missing dependency then refuses instead of hanging. Kconfig and DT can't express this, so it has to be a runtime check.
Where the PCIe PHY values come from. sleep-t6030-pcie-wake.h (447 steps) and t6030_gp_clocks_wake() write fixed PHY/PLL/clock values, repeated per lane. sleep.c already takes exactly these blocks from loader-published apple,tunable-phy, -phy-ip-pll, -phy-ip-auspma, -axi2af, -cio3pll and -clkgen, and refuses deep sleep without them. Please use that path for pcie0, or say in the commit where these values come from. Our own traces of power sequencing and timing are fine. PHY tuning values are what the tunable path exists for. The same question goes for t6030_mem_config (268 entries), the CPM table and t6030_wake_gpu. I know main already has a trace replay for the T8142 MCC start, so a sentence on the source of each table is enough there.
The probe isn't read-only, although the comment at sleep-t6030.h:1713 says it is. On every J516s boot, t6030_sleep_map_regs() runs t6030_boot_replay() (including an ATC2/ATC1 PCIe power word on/off pulse), the CPM init, the boot AUTO pass and the memory config, including a permanent SOC perf field of 4. A USB4 PCIe tunnel that is already up when the sleep driver probes can lose its power word, and these values change on every boot even if the machine never suspends. Please move them to the first deep entry, or justify each one and fix the comment.
Smaller:
- Hardcoded
0x350040000(the MCA switch), the path/soc/i2c@289028000, and the PERST pin offset in the quiesce table: please take them from DT (reg-name / phandle), like the wake path already does withreset-gpios. - The sleep driver writes PERST# pinctrl directly, while pcie-apple owns those GPIOs.
- The SPMI stuck-interrupt valve can ack a masked source that a driver has requested, and it also applies to J514s, which has no sleep node.
domain_keptin pmgr-pwrstate also keeps those domains on in s2idle, not only in firmware sleep.- The J516s DT commit also enables Touch ID and makes SPI2/I2C6 always-on: please split that out. The J516s DTB gains one W=1 unit-address warning (sleep controller vs pmgr at 0x350700000).
- Deep is the default and commits on J516s after two committed cycles. Consider the untested profile until there are more rows.
sleep-test.cdrops the nmcc check for T6040/T8103/T6050 as well.
Checked: the changed C files build clean with W=1 LLVM=1 (pmp-export read only, it needs Rust), the new host test passes and its mutation fails, the reg windows match the 27.2 J516s ADT, and all 11 commits have Signed-off-by with no extra trailers.
The sensor's binding requires firmware-name: the per-device calibration blob apple_sep loads, and the file the Touch ID setup helper writes. J516s has J514s's SoC, sensor part and enclave profile, which need the calibration alone and no signed root key. Signed-off-by: DjDeveloperr <hey@djdev.me>
The DART's PMP wake gate, the PMGR's kept domains and the PMP bridge's DART call are new to four harnesses that compile those functions. Give the stand-in DARTs the new fields and check them, run the real apple_sleep_domain_kept() with a negative control, and compile the bridge against the real DART header. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Pushed
Checked with The J516s deep-sleep receipts carry: no kernel object changes, and only The "only on j516s" lines are annotations; the sleep ones follow from J514s keeping the provider disabled. |
There was a problem hiding this comment.
Verdict: MERGE at b023a0e
Checked: I rebuilt the J516s DTB for both PMP modes from this head. The fingerprint schema reports the required-property error on both previous DTBs and zero diagnostics on the two rebuilt DTBs. The exact J613 MTP, DART TLB, display26 bridge and PMGR inherited host tests pass. The DART suite rejects its every-DART negative control. The runtime delta consists of the J516s fingerprint firmware-name property; the other changes repair the existing host tests.
Merge #3809 first. The J516s isolation run completed two deep-sleep cycles with that DART restore change, and the earlier standalone build hung on its first cycle. The isolation result used the preceding head. #4067 (comment)
…eep-provider-v3 Signed-off-by: DjDeveloperr <hey@djdev.me>
…nd DT Address the review comments on the T6030 deep-sleep provider, SPMI interrupt handling, and device tree: - Gate deep-sleep entry in t6030_sleep_begin() and t6030_sleep_final_check() on pcie-apple being bound and every available GP PCIe DART being host-resumed via apple_dart_is_host_resumed(), now backed by the merged #3809 takeover path. - Keep t6030_sleep_map_regs() read-only at probe; defer the one-time hardware setup (boot replay, pwrgate, CPM, auto-pm, AMCC/DCS memory config, PMU boot latch clear) to the first deep-sleep entry in t6030_sleep_display_off(). - Make t6030_boot_replay() atomic-safe with pre-mapped DT reg "mca-switch" (no ioremap_np/fsleep), skip ATC1/ATC2_PCIE pulses when the domain is already active or its parent ATCn_COMMON is off, and preserve the pre-replay DWI power-state word for refusal/wake restoration. - Derive PERST# pin numbers by PCI slot from port reg properties and replace the hardcoded pinctrl offsets in the quiesce tables with t6030_perst_assert(). - Rename the T6030 sleep node to sleep-controller@3642d4000 with reg index 0 = "commit" and index 5 = "ps" (eliminating the W=1 duplicate unit-address warning with power-management@350700000), add the "mca-switch" reg entry and "apple,i2c6" phandle, and drop the unrelated Touch ID / SPI2 / I2C6 edits from t6030-j516s.dts. - Replace the apple,t6030-spmi compatible with DT boolean "apple,keep-pending-irqs" on J516s nub_spmi/nub_spmi_a0 and keep the stuck-IRQ valve from clearing driver-owned or RX-notify bits. - Guard apple_sleep_domain_kept() with pm_suspend_via_firmware() so s2idle does not keep firmware-sleep domains on, with host selftest coverage; narrow the sleep-test.c nmcc check exception to t6030_sleep_ops; drop the unused .cpu_count = 12 field; and document provenance for the macOS 27.2 (26B123) J516s tables. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Addressed the review comments in forward commits
Host tests ( |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Comment review at 8671481c11e1 (no approval, author side). I read the whole change on top of b023a0ebbaad plus the shared files against bbb91e2a416d, and checked review 6165167172 point by point.
| Point in review 6165167172 | What the code does now | Where | Answered |
|---|---|---|---|
| #3809 first, series bisects | #3809 (173d1f2d1b58) is merged into the branch, not rebased under it. The head is complete, but the commits before the merge still hang a J516s on their own. |
efbb66689a86 |
Partly |
Refuse unless every apple,pcie-darts DART is host-resumed |
.begin refuses when the PCIe host isn't bound or a DART isn't host-resumed, and the final check repeats it |
sleep-t6030.h:2060, :2117, :2143 |
Yes |
| Source of the PHY/PLL values, or the tunable path | Not the tunable path. A comment names the macOS 27.2 J516s wake, and says the loader publishes these tables only for the newer ANS (it does return early without nvme-secure-bar) |
sleep-t6030-pcie-wake.h:6, sleep-t6030.h:2838 |
Yes (source stated) |
| Source of the memory, CPM and GPU tables | One sentence each | sleep-t6030.h |
Yes |
| Probe writes hardware | All of it moved to the first deep entry. The ATC1/ATC2_PCIE pulse is skipped when the domain is on or its parent is off, and the earlier DWI word is kept for undo | sleep-t6030.h:1854, :2040, :2163 |
Yes, needs a new row |
| MCA address, I2C6 path, PERST# offset hardcoded | mca-switch reg, apple,i2c6 phandle, PERST# pin from reset-gpios by the port's reg slot |
t6030.dtsi:1102, sleep-t6030.h:1514 |
Yes |
| The sleep driver writes PERST# that pcie-apple owns | Still writes it in the quiesce and in the wake; only the comment changed | sleep-t6030.h:1514, :2942 |
No |
| SPMI valve acks owned sources, and applies to J514s | Owned and notify bits are excluded; on J516s nub_spmi and nub_spmi_a0 only, by apple,keep-pending-irqs |
spmi-apple-controller.c:604, t6030-j516s.dts:222 |
Yes |
domain_kept in s2idle |
Only when the suspend goes through firmware | sleep.c:3299 |
Yes |
| Touch ID, SPI2, I2C6 always-on; unit-address warning | Removed from this PR; node is now at unit address 3642d4000, and the DT sequence rows follow the new block numbers (no other row used block 0 or 5) |
t6030-j516s.dts, t6030.dtsi:1102 |
Yes |
| Deep is the default after two cycles | Unchanged. More rows are the answer, or untested |
t6030_sleep_soc |
Open |
sleep-test.c drops the nmcc check for other SoCs |
Skipped for T6030 only. The first draft also skipped T8122 and T8112; fixed before the push | sleep-test.c:236 |
Yes |
Other Macs. The refusal gate, the first-entry writes and domain_kept are in the T6030 provider only, so no SoC that sleeps today can be refused by them (T6050, T8140, T8132, T8122, T6041, T8112, T8103). T6031 boards don't share the sleep node, the PCIe or the ATC match. J514s keeps the sleep node disabled and no longer gets the SPMI change; it does get the T6030 PCIe and ATC matches. The shared late PCIe resume path belongs to #3809.
Remaining notes, not blockers.
- The first entry now runs the cluster power-gate, CPM and AUTO setup after the other cores are parked and after genpd took domains down, so fewer words get AUTO than at probe. It is bounded and doesn't sleep. It just isn't what the earlier rows measured.
- The commit message says "the merged #3809"; it is merged into this branch, not into main. The PR text still names
f0273427aeceand lists the standalone hang as the current state.
Checked. Head merged with main 8ec8740a1e6f: no conflict, tree 045086ab9d86. Host tests on that tree: sleep 51/51, pmgr 3/3, apple-dart 26/26, dart-sleep 3/3, pcie-apple, pcie-adopted, dart-s2idle, display26 and macsmc 1/1 each, dcp-sleep 5/5, dcpext26-suspend 3/3, dcp-ext-repower 2/2, dcpaud-sleep 9/9, mtp 6/6, t6030 clock/wiring/display/sleep 9/9. Not run here: t6030-pmp-dt (no fdtget on the host), the pciec-policy and ATC suites and the rest of pcie (timed out on a busy host), so the hosted job is the check for those. No compile or DTB build by me.
Verdict. No blocking code finding at this head. Not ready to merge: the earlier J516s receipts don't carry, because the first entry, the I2C6/SPI2 state and the PERST# sequence changed. Owed:
- J516s on this head, one cold boot:
refuse_late=1as the very first entry, then 3 committed deep sleeps (one of at least 185 s), then one s2idle, with display, GPU, Wi-Fi, SD, USB-C and audio checked after. Then one cold boot that commits on its first entry. - J514s: one s2idle with Wi-Fi and SD back (it gets the T6030 PCIe match).
- #3809 merged first, hosted checks green, PR text updated.
…e reasons Update the T6030 sleep and J516s SMC properties to match the J516s ADT: - Add apple,pinctrl-skip-pins = <5 6 17> (from ADT gpio0 no-restore-gpio-pins) to t6030_sleep and document the property in apple,t6030-sleep.yaml so sleep_pins_save/restore leaves those pins untouched. - Update J516s &smc apple,wake-reasons and apple,wake-reason-names to match the J516s ADT smc-pmu event_name-bitN table (codec at bit 10, trackpadkeyboard at bit 12 instead of 35). Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Pushed DT-only follow-up
Answering the remaining open review points:
Fresh J516s cold-boot A + cold-boot B receipts on |
What: Enable firmware suspend-to-RAM (
deep) for J516s (16-inch M3 Pro). The T6030 provider sequences the SMC and PMU handshakes and restores CPU, cache, power-domain, I2C6, and GP PCIe state. J514s keepst6030_sleepdisabled.Clean successor to #3818 branched from
main(bbb91e2a416d), with #3809 (173d1f2d1b58) merged forward (efbb66689a86) and review fixes in8671481c11e1and51a51d390453: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()read-only at probe; defer the one-time hardware setup (boot replay, pwrgate, CPM, auto-pm, AMCC/DCS memory config, PMU boot latch clear) to the first deep-sleep entry (t6030_first_deep_init()), with atomic-safe pre-mapped DT"mca-switch", active/parent-off guards onATC1/ATC2_PCIE, and pre-replay DWI restoration.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.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 J516s&nub_spmi/&nub_spmi_a0, 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").Tested:
8671481c11e1/51a51d390453: arm64W=1builds ofsleep.o,spmi-apple-controller.o,apple-dart.o,pcie-apple.o,t6030-j516s.dtb, andt6030-j514s.dtbwith 0 C warnings and 0sleep-controllerDTB warnings;t6030-sleep-qblk-tests.py,apple-dart-tlb-stall-tests.py --dtc(14/14),display26-tests.py,j613-mtp-s2idle-tests.py, andpmgr-inherited.py(6/6) pass; review-checked host suites (sleep51/51,pmgr3/3,apple-dart26/26,dart-sleep3/3,pcie-apple,dcp-sleep5/5,dcpaud-sleep9/9,mtp6/6,t60309/9) pass.51a51d390453(in progress):refuse_late=1on the first entry, then 3 committed deep-sleep cycles (including one >= 185 s), thens2idlex1, with display/GPU/Wi-Fi/SD/USB-C/audio checks after.Risk: two-way door · T6030 (J516s) plus small shared hooks in SMC, SPMI, ATC PHY, DART, PMP export, PMGR, and
apple-sleep. J514s keepst6030_sleepdisabled; plain revert restores prior behavior.Not yet:
173d1f2d1b58) intomainbefore soc: apple: enable T6030 suspend-to-RAM on J516s #4067 (already merged into this branch atefbb66689a86).51a51d390453: J516s cold boot A + cold boot B (running next), plus one J514ss2idlecheck with Wi-Fi and SD back.