Skip to content

soc: apple: enable T6030 suspend-to-RAM on J516s - #4067

Open
DjDeveloperr wants to merge 17 commits into
mainfrom
feat/t6030-sleep-provider-v3
Open

DjDeveloperr wants to merge 17 commits into
mainfrom
feat/t6030-sleep-provider-v3

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

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 keeps t6030_sleep disabled.

Clean successor to #3818 branched from main (bbb91e2a416d), with #3809 (173d1f2d1b58) merged forward (efbb66689a86) and review fixes in 8671481c11e1 and 51a51d390453:

  • 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 (apple_dart_is_host_resumed()).
  • 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 (t6030_first_deep_init()), with atomic-safe pre-mapped DT "mca-switch", active/parent-off guards on ATC1/ATC2_PCIE, and pre-replay DWI restoration.
  • Preserve the AP pin snapshot and ADT no-restore-gpio-pins skip 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.
  • Derive GP PCIe PERST# pins from each port's reset-gpios by PCI slot reg, replacing hardcoded pinctrl offsets in the quiesce tables.
  • Save and restore I2C6 power state and registers across deep sleep using the apple,i2c6 phandle.
  • Dynamically lower active group == 0 OFF-target PMGR domains in child-before-parent order at commit and restore them parent-before-child on undo so unbound DT consumers holding sync_state() do not block firmware sleep entry; guard apple_sleep_domain_kept() with pm_suspend_via_firmware() so s2idle is unaffected.
  • Scope apple,keep-pending-irqs to J516s &nub_spmi / &nub_spmi_a0, exclude driver-owned and RX-notify bits from the stuck-IRQ valve, match the J516s ADT smc-pmu wake reasons (including codec bit 10 and trackpadkeyboard bit 12), and use sleep-controller@3642d4000 (reg idx 0 = "commit", idx 5 = "ps").

Tested:

  • Host & build checks at 8671481c11e1 / 51a51d390453: arm64 W=1 builds of sleep.o, spmi-apple-controller.o, apple-dart.o, pcie-apple.o, t6030-j516s.dtb, and t6030-j514s.dtb with 0 C warnings and 0 sleep-controller DTB warnings; t6030-sleep-qblk-tests.py, apple-dart-tlb-stall-tests.py --dtc (14/14), display26-tests.py, j613-mtp-s2idle-tests.py, and pmgr-inherited.py (6/6) pass; review-checked host suites (sleep 51/51, pmgr 3/3, apple-dart 26/26, dart-sleep 3/3, pcie-apple, dcp-sleep 5/5, dcpaud-sleep 9/9, mtp 6/6, t6030 9/9) pass.
  • Fresh J516s cold-boot verification on 51a51d390453 (in progress):
    • Cold boot A: refuse_late=1 on the first entry, then 3 committed deep-sleep cycles (including one >= 185 s), then s2idle x1, with display/GPU/Wi-Fi/SD/USB-C/audio checks after.
    • Cold boot B: committed deep sleep on the first entry.

Risk: two-way door · T6030 (J516s) plus small shared hooks in SMC, SPMI, ATC PHY, DART, PMP export, PMGR, and apple-sleep. J514s keeps t6030_sleep disabled; plain revert restores prior behavior.

Not yet:

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>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 3, 2026 05:37
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Merge readiness at 51a51d39: not ready yet

Check Detail
CI at head running running: apple-build, host-tests, dt-checks, KUnit plan, DWC3/ATC
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 51a51d39
Conflicts ok none
PR text ok Risk: two-way · T6030 (J516s) plus small shared hooks in SMC, SPMI, ATC PHY, DART, PMP export, PMGR, and apple-sleep. J514s keeps t6030sleep disabled; plain revert restores prior behavior.

Areas: area:gpu, area:platform, area:power, area:usb

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 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.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

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 (sleep-t6030.h & J516s RTC)

  • t6030_sleep_post_timer() (SPMI_NOTIFY_ENABLE): mask = s->soc->spmi_notify_sleep & ~T6030_SPMI_DONE (0x2000000) clears only BIT(0) (T6030_SPMI_DONE, the AP command-completion status bit polled by t6030_pmu_xfer()) while keeping BIT(25) (PMU peripheral wake notification) enabled. No further AP SPMI transfers run between t6030_sleep_post_timer() and WFI, NUB.SPMI0.SW3 wake delivery stays armed, and t6030_sleep_wake() unconditionally restores t6030.notify_saved[1] on wake.
  • RTC device on J516s: Live J516s exposes a single RTC device (/dev/rtc0, macsmc-rtc; no /dev/rtc1). In t6030.dtsi, apple,smc-rtc points its nvmem-cells directly at pmic1: pmic@b (usid 0xb) registers 0x2000 (rtc_ctrl), 0x2008 (rtc_alarm), and 0x200e (rtc_alarm_mask) with interrupts-extended = <&nub_spmi 2 IRQ_TYPE_EDGE_RISING>, so rtcwake -d /dev/rtc0 -m mem -s <N> programs the usid 0xb SPMI PMU alarm that t6030_alarm_snapshot() and t6030_sleep_post_timer() manage.

2. #4037 lessons across #4067, #3809, and #3763

#4067 is rebased on main (bbb91e2a416d), which already includes merged #4037 (1dd48899bb34):

  • Firmware-27 internal DCP stop — IN: apple_dcp_hw_t6030 sets .v27_early_stop = true and .s2r_layout = &dcp_s2r_t6030, with J516s supplying the firmware-27.2 apple,sleep-*-args properties in t6030-j516s.dts. #3809 covers T6030 PCIe port DART restoration before noirq retraining, and #3763 covers hci_bcm4377 boot-ROM resume verification.
  • dcpext s2r_ext handoff — NOT IN (deferred until T6030 external display is enabled): apple_dcp_hw_t6030_dcpext intentionally omits .s2r_ext / .s2r_layout for now because dcpext0/dcpext1 stay disabled and powered off on default J516s (skip_disp + !sleep_ps_on()). When T6030 external display support is enabled on firmware 27.2, apple_dcp_hw_t6030_dcpext will need the same firmware-27 s2r_ext + apple_dart_display_streams_saved() wiring from #4037 so t6030_gate_coprocs[] (DISPEXT0_CPU / DISPEXT1_CPU, must_stop = true) sees them stopped cleanly.
  • PMP ack and disp-off ordering — IN: t6030_sleep_display_off() performs only reversible power-state staging (t6030_ps_at_display_off() / t6030_ps_undo_display_off()), while t6030_quiesce_at_display_off() runs in t6030_sleep_prepare_regs() past the refuse_late=1 abort boundary; .wdt_wd1 = true is set; PMP DART gating across failed wakes (1b0cf437881c / 90f1d7103656) is in; and #4037's merged pmp-report.c / sleep.c second-pass coprocessor domain checks are inherited directly from main.
  • Stray domains / .coproc_slp_ddr / SIO_CPU ordering — IN: t6030_sleep_soc leaves .coproc_slp_ddr unset (false) so adopted MTP keeps DRAM-off deep sleep, does not list SIO_CPU in .stray, and lowers T6030_PS_SIO_CPU in t6030_sleep_after_early() after pass-1 apple_sleep_coprocs_stop(s, false) stops SIO.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s (T6030, M3 Pro) deep-sleep receipts:

1. Combined qualification (63e5785fcf14, 7.3.0-m3-s2r-g63e5785fcf14, boot_id=b96545e6-2c19-418d-a748-73699b09b98f) — PASS (3/3 committed deep-sleep cycles + refuse_late=1)

  • PR heads inside: #4067 (f0273427aece — identical drivers/soc/apple/*, arch/arm64/boot/dts/apple/t6030*, drivers/pmdomain/*, drivers/pinctrl/*, drivers/gpu/drm/apple/* except 3 KUnit test files) + #3809 (173d1f2d1b58) + #3763 (c5949ba1ab2d) + #4037 (merged 1dd48899bb34).
  • git diff --stat 63e5785fcf14 f0273427aece (44 files): on J516s runtime paths, the only differences are #3809 (drivers/pci/controller/pcie-apple.c, drivers/iommu/apple-dart.c, include/linux/soc/apple/dart.h), #3763 (drivers/bluetooth/hci_bcm4377.c), and merged #3949 (drivers/thermal/apple-pmp-thermal.c); the rest are T8122/T8132/G17/ANE/KUnit/host-test files not active in T6030 sleep.
  • Cycles in one boot (mem_sleep=s2idle [deep]):
    1. refuse_late=1 dry-run (05:53:39Z -> 05:53:43Z): refused cleanly (fail 0 -> 1, last_failed_errno=-16); display, GPU, NVMe, Wi-Fi, and BT stayed live.
    2. Cycle 1 (rtcwake -d /dev/rtc0 -m mem -s 15, 05:53:43Z -> 05:54:05Z): PASS (suspend_stats success 1 -> 2, GPU firmware back in 3972 us, hci_bcm4377 ROM reset + BD_ADDR 60:3e:5f:4a:e8:c8 restored).
    3. Cycle 2 (rtcwake -d /dev/rtc0 -m mem -s 15, 05:54:05Z -> 05:54:27Z): PASS (suspend_stats success 2 -> 3, GPU firmware back in 4824 us, hci_bcm4377 ROM reset + BD_ADDR restored).
    4. Cycle 3 (rtcwake -d /dev/rtc0 -m mem -s 185, 05:54:27Z -> 05:57:39Z): PASS (suspend_stats success 3 -> 4, fail unchanged at 1, V27 wake ... plain-on 0@84, apple_sep back, GPU firmware back in 4902 us, hci_bcm4377 post-sleep before reset: bootstage 2, RTI 2 -> after reset: bootstage 0, RTI 0 + BD_ADDR restored, WDT paused across >180 s power-off).
  • Post-wake parity: eDP-1 connected/enabled, Wi-Fi wld0 UP, BT hci0 60:3E:5F:4A:E8:C8 powered, PCIe (00:00.0, 00:01.0, BCM4388 WLAN+BT, GL9755), NVMe, USB-C partners, and aurora-g16 (failed 0 errno 0 degraded 0, sensor_errors 0) all intact; 0 SError/BUG/WARNING.

2. Standalone exact head (f0273427aece, 7.3.0-m3-s2r-gf0273427aece, boot_id=3ed489fe-b624-4584-a16b-6b5096eeb3ce, without #3809 or #3763) — Cycle 1 hang

  • Entered Cycle 1 (rtcwake -d /dev/rtc0 -m mem -s 15 at 06:05:12Z, wake 06:05:28Z) and did not return to userspace (journal ended at 06:05:11Z); recovered via remote reset and restored stock kernel/boot.bin.
  • Next isolation test (f0273427aece + #3809 173d1f2d1b58 without #3763, 2 committed cycles) is building now to confirm the #3809 merge-order dependency before #4067.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 3, 2026
@aurora-silicon-review

aurora-silicon-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

3. Prerequisite isolation (034a46617f78 = exact #4067 f0273427aece + #3809 173d1f2d1b58, without #3763) — PASS (2/2 committed deep-sleep cycles)

  • Kernel & boot: 7.3.0-m3-s2r-g034a46617f78, boot_id=8c2e7424-cdb3-4cf8-9feb-ebcb4ea7c0b3, mem_sleep=s2idle [deep], suspend_stats: success 0 -> 1 -> 2, fail 0.
  • Cycle 1 (rtcwake -d /dev/rtc0 -m mem -s 15, 06:25:19Z -> 06:25:36Z): PASS — 179 of 224 AP pins changed by the sleep, all put back, MBSE 0x10650, boot object resumes 0 -> 1, wake source: NUB.SPMI0.SW3, apple-dart 594000000.iommu & 595000000.iommu restored before link up, pcie-apple both links back before functions resume, V27 wake ... plain-on 0@85, apple_sep back, aurora-g16 GPU firmware back in 4877 us.
  • Cycle 2 (rtcwake -d /dev/rtc0 -m mem -s 15, 06:25:42Z -> 06:25:59Z): PASS — boot object resumes 1 -> 2, apple-dart 594000000.iommu & 595000000.iommu restored before link up, V27 wake ... plain-on 0@87, apple_sep back, aurora-g16 GPU firmware back in 4848 us.
  • Post-wake parity: card1-eDP-1 connected/enabled, Wi-Fi wld0 UP (5220 MHz, -54 dBm, 585/866.7 MBit/s), aurora-g16 health: failed 0 errno 0 degraded 0, sensor_errors 0, render_ordinal 1024, all PCIe bridges + endpoints (00:00.0, 00:01.0, BCM4388 WLAN+BT, GL9755) intact, 0 SError/BUG/WARNING.
  • Verdict: #3809 (173d1f2d1b58) alone is the merge-order prerequisite before #4067 (f0273427aece); #3763 is not required for clean wake. Stock boot.bin restored.

@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.

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-darts DART 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 with reset-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_kept in 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.c drops 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>
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Dec 3, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Pushed b023a0ebbaad (two commits on f0273427aece) for the two failed jobs.

  • dt-checks: J516s now enables the fingerprint node, whose binding requires firmware-name. Added apple/mesacal-j516s.bin: the string is what apple_sep loads and what the Touch ID setup writes, and J514s (same SoC, sensor and enclave profile) names its calibration alone the same way.
  • host-tests: all four were stand-ins that did not know this PR's new code, not an old base. j613-mtp-s2idle and apple-dart-tlb-stall get the PMP gate fields and check them; display26 compiles the real dart.h; pmgr-inherited runs the real apple_sleep_domain_kept() with a new negative control.

Checked with tools/asahi/run-host-tests.py --only <suite>: 6/6 runs (including --ref and every-dart) pass at this head, and again with main's sleep.c (6985e45ab583) merged in, the only file both sides change. The compiled t6030-j516s.dtb differs from f0273427aece by that one property. A dt-validate run with a subset of the bindings no longer reports the required property; the full CHECK_DTBS is left to the hosted job.

The J516s deep-sleep receipts carry: no kernel object changes, and only apple_sep's calibration load reads the property. Merging after #3809 still applies. Touch ID on J516s is not claimed: its node has no data-ready interrupt yet.

The "only on j516s" lines are annotations; the sleep ones follow from J514s keeping the provider disabled.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 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>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Addressed the review comments in forward commits efbb66689a86 (merging #3809) and 8671481c11e1:

  1. PCIe DART host-resume dependency (#3809) and gate:

    • Merged #3809 (efbb66689a86) so the host-resumed GP PCIe DART path is present in the branch.
    • Added and exported apple_dart_is_host_resumed() in drivers/iommu/apple-dart.c / include/linux/soc/apple/dart.h.
    • Wired .begin = t6030_sleep_begin and checked it in t6030_sleep_final_check(): deep sleep now refuses (-EBUSY) if apple,pcie-host is available without a bound driver or if any available apple,pcie-darts instance is not host-resumed.
  2. No hardware writes at probe (t6030_sleep_map_regs):

    • t6030_sleep_map_regs() is now read-only (maps registers and phandles only).
    • Deferred t6030_boot_replay(), t6030_pwrgate_init(), t6030_cpm_init(), t6030_boot_auto_probe(), t6030_mem_config_apply(), and t6030_last_pmu_boot() to a one-time t6030_first_deep_init() run at the start of the first deep-sleep entry (t6030_sleep_display_off()).
    • Made t6030_boot_replay() atomic-safe (readl_poll_timeout_atomic, t6030_delay_us, pre-mapped DT "mca-switch" reg with no ioremap_np/fsleep).
    • Guarded the ATC2_PCIE/ATC1_PCIE pulses to skip when the domain is already active (ACTUAL/TARGET non-zero) or its parent ATCn_COMMON is off, and saved the pre-replay DWI power-state word into ps_on_saved so refusal or wake restores the pre-entry DWI state.
  3. Device tree, bindings, and W=1 cleanliness:

    • Renamed the node to sleep-controller@3642d4000, swapped reg/reg-names index 0 (commit) and index 5 (ps), updated the two apple,seq-commit block-0 references to block 5, added "mca-switch" (<0x3 0x500400c0 0x0 0x10>) and apple,i2c6 = <&i2c6>, and updated apple,t6030-sleep.yaml accordingly. t6030-j516s.dtb and t6030-j514s.dtb build with zero sleep-controller warnings under W=1.
    • Dropped the unrelated &ps_spi2, &spi2, &mesa, and &ps_i2c6 edits from t6030-j516s.dts.
  4. PERST# pins and quiesce tables:

    • Derived perst_pin[] indexed by PCI slot from each port's reg property in t6030_gp_map().
    • Split t6030_quiesce_sd / t6030_quiesce_wifi into _pre/_post around t6030_perst_assert(), removing the hardcoded pinctrl offsets (0x2a0/0x29c).
    • Added provenance comments documenting the macOS 27.2 (26B123) J516s captures for the GP PCIe wake, quiesce, CPM, AMCC/DCS memory, and GPU wake tables (and why aura's pcie_apcie_tables_fdt() does not emit apple,tunable-* for T6030 GP PCIe).
  5. SPMI apple,keep-pending-irqs and stuck-IRQ valve:

    • Replaced the apple,t6030-spmi compatible with the DT boolean property apple,keep-pending-irqs (documented in apple,spmi.yaml) set on J516s &nub_spmi and &nub_spmi_a0 only.
    • Updated the stuck-IRQ valve in apple_spmi_irq_handler() to exclude irq_used (via bitmap_to_arr32) and the RX notify vector bit so driver-owned interrupts and the RX notify bit are never dropped.
  6. Shared sleep core and tests:

    • Guarded apple_sleep_domain_kept() with !pm_suspend_via_firmware() so s2idle does not keep firmware-sleep domains on, and extended tools/testing/selftests/drivers/apple/pmgr-inherited.py with an s2idle test and "s2idle-keeps-domain" negative control (6/6 pass).
    • Narrowed the nmcc check exception in drivers/soc/apple/sleep-test.c to soc->ops != &t6030_sleep_ops so T8112/T8122 keep full nmcc >= 1 coverage.
    • Dropped the unused .cpu_count = 12 field from t6030_sleep_soc.

Host tests (t6030-sleep-qblk-tests.py, apple-dart-tlb-stall-tests.py --dtc 14/14, display26-tests.py, j613-mtp-s2idle-tests.py, pmgr-inherited.py 6/6) and W=1 object/DTB builds pass. Fresh cold-boot J516s verification on 8671481c11e1 (refuse_late=1 as the first entry, 3 committed deep-sleep cycles including >= 185 s, s2idle, plus post-wake audio/USB-C/Wi-Fi/SD/GPU checks) will follow once the kernel image finishes building.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 f0273427aece and 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:

  1. J516s on this head, one cold boot: refuse_late=1 as 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.
  2. J514s: one s2idle with Wi-Fi and SD back (it gets the T6030 PCIe match).
  3. #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>
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Pushed DT-only follow-up 51a51d390453 (matching the J516s ADT) and updated the PR description:

  • Added apple,pinctrl-skip-pins = <5 6 17> to t6030_sleep in t6030.dtsi (verified against J516s ADT gpio0/no-restore-gpio-pins) and documented it in apple,t6030-sleep.yaml.
  • Updated J516s &smc apple,wake-reasons / apple,wake-reason-names to match the J516s ADT smc-pmu event_name-bitN table (codec at bit 10, trackpadkeyboard at bit 12).

Answering the remaining open review points:

  • PERST# pin ownership (sleep-t6030.h:1514, :2942): pcie-apple owns reset-gpios during runtime, suspend, and resume. The T6030 sleep provider touches the pin only inside the noirq sleep-entry quiesce (after pcie-apple's suspend has already parked the ports, before the AP drops power) and during early noirq wake (after power loss, before pcie-apple's resume runs), matching the macOS 27.2 GP PCIe quiesce/retrain ordering. Using the slot's reset-gpios pin index from DT keeps the pin mapping single-sourced with pcie-apple.
  • Why deep is the default on J516s: matches the other qualified Apple Silicon sleep providers once proven by the multi-cycle cold-boot qualification rows (refuse_late=1 first entry, 3 committed cycles including >= 185 s, s2idle, plus first-entry commit on a second cold boot). s2idle remains selectable via /sys/power/mem_sleep and no longer keeps firmware-sleep domains on.
  • #3809 merge order: #3809 merges to main first (#4067 has #3809 merged at efbb66689a86 so the PR head is self-contained and gates deep sleep on apple_dart_is_host_resumed()).

Fresh J516s cold-boot A + cold-boot B receipts on 51a51d390453 will be posted next.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

This branch has not been deployed

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

Labels

area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants