Repository navigation
soc: apple: admit M4 Mac mini (J773g) in T8132 SEP profile and desktop apple-sleep gates - #2763
Conversation
|
Read at 922c890 (draft).
Rows: the J773g deep-sleep run you mention, plus one J713 deep sleep on this head (it goes through both changed paths in Assisted-by: LLM (Claude:Opus 5.5) |
922c890 to
b88b87d
Compare
|
Addressed all three review points at
Verified Assisted-by: LLM (Gemini:4 Neon) |
b88b87d to
b1f547a
Compare
|
Rebased onto Live Verification — 3/3 Real Deep Sleep (
|
| Cycle | boot object resumes |
Wake Source | apple_sep Resume |
/dev/hwrng |
Errors |
|---|---|---|---|---|---|
| 1 | 0 -> 1 |
NUB.SPMI0.SW3 |
5395 us |
16B OK | 0 |
| 2 | 1 -> 2 |
NUB.SPMI0.SW3 |
5408 us |
16B OK | 0 |
| 3 | 2 -> 3 |
NUB.SPMI0.SW3 |
5408 us |
16B OK | 0 |
0 oops/warnings/SErrors across all 3 wakes.
Assisted-by: LLM (Gemini:4 Neon)
Select the T8132 SEP profile on apple,t8132 rather than maintaining a per-board allowlist (apple,j713 || apple,j715). Every T8132 Mac shares the same SEP block and firmware, and boards without a Touch ID sensor such as J773g (M4 Mac mini) already omit the sensor node in DT so apple_sep binds the SEP for key store, hwrng, and suspend-to-RAM without trying to probe a missing sensor. Update the apple_sep_profile KUnit tests accordingly. Signed-off-by: Diljit Singh <[email protected]>
On desktop T8132 boards such as J773g on macOS 27.2, display[0] (&dcp) is disabled in DT while display[1] (&dcpext0) is enabled and bound by appledrm with s2r_ext support (or headless with no external display coprocessor enabled). Requiring s->display[0].bound unconditionally in apple_sleep_refuse() refused deep sleep even when every available display coprocessor was bound. Keep the exact display[0].bound check whenever display[0] is available (or absent from DT); when display[0] is disabled in DT, refuse only when an available external display coprocessor is unbound, allowing headless setups where none is available. In apple_sleep_find_radio_perst(), explicitly match the PCIe root port that carries the wireless radio (via the /aliases/wifi0 parent or a wifi / bluetooth child node) instead of taking whichever port appears last or first, so enabling port02 (Ethernet/SD) cannot overwrite the radio PERST#. Signed-off-by: Diljit Singh <[email protected]>
Multi-port T8132 hosts such as J773g enable both port0 (radio) and port2 (Ethernet) under the shared apcie controller. Previously apple_sleep_map_apcie() only mapped port0/phy0 and apple_sleep_find_radio_perst() stopped after the first child port's PERST# GPIO, leaving port2 running when apcie_gp and apcie_phy_sw are lowered during deep sleep. Map portN/phyN and AP reset-gpios for every available child port of apple,apcie (falling back to port0/phy0 when the host is disabled) and stop all mapped ports in sleep_apcie_port_stop_once(), while keeping the PIO-DMA engine teardown on port 0 and preserving radio_perst for T8142. Signed-off-by: Diljit Singh <[email protected]>
…ership When pcie-apple manages T8132 APCIe ports across real sleep directly (without the single-port apple,managed-sids radio contract), two issues arise in apple-sleep: 1. t8132_wake() re-clocks all ports under apcie_ports_unowned right before pcie-apple's noirq resume drops and re-requests REFCLK0/1. 2. apcie_port_down is a single boolean across all ports, so if one port recovers on wake and another fails to retrain, the next suspend either skips the working port or tries to stop the failed one. Add apple_sleep_apcie_ports_owned() (kept out of struct apple_sleep so probe order does not matter) so apple-sleep skips its fallback unowned-port clocking when the PCIe host owns recovery, and track each port's down state individually with apple_sleep_apcie_port_up(idx) (while keeping apple_sleep_radio_port_up() clearing all ports for the existing single-port managed-radio callers). Signed-off-by: Diljit Singh <[email protected]>
b1f547a to
2dfb6d6
Compare
|
@RyanTheTide Rebased onto
Assisted-by: LLM (Gemini:4 Neon) |
|
Nothing equivalent is on integration/aurora: the T8132 SEP profile on the tip is still limited to the J713/J715 boards and apple-sleep still maps only port 0, and the four commits apply cleanly on daa9e2d. The earlier review points (board list, headless case, radio port selection) are addressed at 2dfb6d6, and the J773g rows are posted. What is still open is the M4 Air row asked for in the first review: one J713 deep-sleep cycle on this head, since it goes through both changed paths in sleep.c. The title and description still describe the first version; updating them to the four commits would help, as #2770 now depends on the two new apple_sleep_apcie_* helpers. |
satchlj
left a comment
There was a problem hiding this comment.
Gemini 4 Neon on @satchlj's behalf
Verdict at 2dfb6d6301ff
Approve. Selecting the T8132 SEP profile by SoC compatible, allowing disabled display[0] in apple_sleep_refuse(), mapping/stopping all enabled APCIe ports, and adding per-port state tracking + host ownership helpers are all sound and clean.
Blockers
None.
Checked
- 3 changed files (
drivers/soc/apple/profile.rs,drivers/soc/apple/sleep.c,include/linux/soc/apple/sleep.h) across all 4 commits audited in full againstsleep.ccontext. - SEP profile selection:
profile.rsselects&T8132directly onapple,t8132and updatesapple_sep_profileKUnit tests cleanly (rust-buildandkunitCI green). - Display & multi-port APCIe sleep handling:
apple_sleep_refuse()preserves exactdisplay[0].boundrefusal whendisplay[0]is available/absent and only refuses unbound availabledisplay[1..ndisp]whendisplay[0]is disabled in DT (permitting headless configs).apple_sleep_map_apcie()bounds mapped ports byAPCIE_SLEEP_PORTS_MAX(4), balancesof_node_put(child)onbreak, and callsiounmap()on rawof_iomap()pointers returned byapple_sleep_apcie_block()(no devres mismatch).apple_sleep_port_is_radio()balances allof_node_put()calls.apple_sleep_apcie_ports_owned()andapple_sleep_apcie_port_up(idx)have matchingEXPORT_SYMBOL_GPLexports and!CONFIG_APPLE_SLEEPstubs while preservingapple_sleep_radio_port_up(). - CI & trailers: All 7/7 CI checks (
host-tests,source,rust-build,kunit,DWC3/ATCx3)SUCCESS,MERGEABLE; all 4 commits carry cleanSigned-off-by:and zero AI trailers; exact-head2dfb6d6301ffJ773g2/2real deep-sleep row is posted. - Non-blocking note: Updating the PR title/description to reflect all 4 commits (including the
apple_sleep_apcie_*helpers) and posting the requested J713 M4 Air deep-sleep row remain good follow-ups before merge. - Untested scope: Static code audit only (userspace-only review environment; no kernel build or boot performed here).
Evidence
- Checked
drivers/soc/apple/sleep.c(apple_sleep_apcie_block,apple_sleep_map_apcie,apple_sleep_port_is_radio,apple_sleep_refuse,apple_sleep_apcie_ports_owned,apple_sleep_apcie_port_up),include/linux/soc/apple/sleep.h, anddrivers/soc/apple/profile.rsat2dfb6d6301ff. - CI at head
2dfb6d6301ff: 7/7 checksSUCCESS.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Signed-off-by: Dj <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
|
I merged current |
…leep path The J773g device tree leaves the sleep controller, the P-cluster power gate and the SEP disabled, so the Mac mini only offers s2idle. Enabling the sleep controller alone is not enough: with no power domain on the SEP node the enclave's sleep request cannot be staged (sep_pm_commit_prepare() reads the first power-domains phandle), and every suspend is refused with -ENOENT. Wire the board as the J713 is: enable the sleep controller, the cluster power gate, the SEP and its DART, give the SEP the ps_sep and ps_gpio domains, and state ps_sep okay and firmware-owned here, since the PMGR handoff policy keeps that domain for the J713 only. Signed-off-by: DjDeveloperr <[email protected]>
…tion On desktop T8132 boards (J773g) the internal DCP, display[0], is disabled in the device tree, so no driver binds it, but the loader leaves DISP0_CPU powered with its DART's clock-protection slice armed (ADT dart-dcp, slice 42). sleep_display_off() lowers display[0]'s words whether it is bound or not, yet only released the slice of an unbound external display. Lowering DISP0_CPU with the slice armed faults, and the Mac resets before the sleep reaches the PMU (its boot-stage byte still reads 0x30 after the reset, not the sleep's 0x50). Release the slice of every unbound display the profile names, and name T8132's display[0] slice. A bound display's driver still releases its own slice, so the J713 and other boards are unchanged. Signed-off-by: DjDeveloperr <[email protected]>
There was a problem hiding this comment.
Verdict: HOLD at bc54c7f2
Blockers:
- Queued hosted CI at
bc54c7f2(2P/0F/28Q): Wait forapple-build,dt-checks,host-tests, and KUnit suites to complete green atbc54c7f2. - Shared T8132 (
J713) deep sleep confirmation ૒landing order (noted in PR bodyNot yet:): Please post aJ713deep-sleep check confirming bounddisplay[0]is unaffected bybc54c7f2(note the J473 M2s2idleregression check already passed onsleep.cat3c44f030), and confirm whether#2770(APCIe port 2 shared regs, which was included in the J773g 3/3 deep-sleep test) must land ahead of this PR.
Checked:
- Audited commits
85e65a54(t8132-j773gdeep sleep + enclave DTS) andbc54c7f2(soc: apple: sleep: release an unbound internal display's clock protection,+9/-4indrivers/soc/apple/sleep.c):- Cleanly extends unbound display clock-protection slice release in
sleep_display_off()toi == 0when!s->display[0].boundandsoc->disp_prot_slice[0]is non-zero, and records T8132'sdart-dcpslice42int8132_sleep_soc.disp_prot_slice[0]. Bound displays (J713) and other SoCs (disp_prot_slice[0] == 0) are untouched. - Verified J773g (27.2, default cmdline, GPU loaded) 3/3 deep sleeps with RTC wake PASS (vs reset on first sleep without
bc54c7f2).
- Cleanly extends unbound display clock-protection slice release in
Evidence
- Head commit:
bc54c7f2052683a953245dfcf7aca348e17146e3(MERGEABLEintomain). - CI snapshot:
2P/0F/28Q.
|
FAIL — J773g deep-sleep row, 0 of 3 required resumes verified. I tested #2763 head
Post-wake tg3 link, SEP resume and SEP hwrng checks could not be verified after a physical wake. No WARN splat or SError appears in the captured candidate logs. Stock |
|
J773g deep sleep at Two new commits fix why the earlier head failed on this Mac:
Still owed: a J713 cycle and one M1/M2 deep sleep regression row on this head. |
There was a problem hiding this comment.
Verdict: MERGE at bc54c7f20526
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - Audited commits 85e65a54 (t8132-j773g deep sleep + enclave DTS) and bc54c7f2 (soc: apple: sleep: release an unbound internal display's clock protection, +9/-4 in drivers/soc/apple/sleep.c):
- Cleanly extends unbound display clock-protection slice release in
sleep_display_off()toi == 0when!s->display[0].boundandsoc->disp_prot_slice[0]is non-zero, and records T8132'sdart-dcpslice42int8132_sleep_soc.disp_prot_slice[0]. Bound displays (J713) and other SoCs (disp_prot_slice[0] == 0) are untouched. - Verified J773g (27.2, default cmdline, GPU loaded) 3/3 deep sleeps with RTC wake PASS (vs reset on first sleep without
bc54c7f2).
Follow-ups (not blocking): queued CI; J713 deep-sleep check, confirm #2770 landing order
t8132-j773g.dts: main added the video encoder nodes (ps_venc_*, dart_ave*, ave) and this branch adds the deep sleep nodes (sleep, cluster_pwrgate, sep_dart, ps_sep, sep) at the same place; both sets are kept. sleep.h: main added the apple_sleep_radio_port_ready() stub and this branch adds the apple_sleep_apcie_ports_owned()/apple_sleep_apcie_port_up() stubs; all are kept.
|
Merged main in at |
|
Merging at |
What: Deep sleep (suspend-to-RAM) on the M4 Mac mini (J773g, T8132). The sleep driver handles a desktop whose internal display is disabled, stops every enabled APCIe port (J773g's Ethernet on port 2 as well as the radio's port 0), and the J773g device tree enables the sleep path and the enclave's domains as the J713's does.
Tested: J773g (macOS 27.2 firmware, default kernel command line, GPU driver loaded): 3/3 deep sleeps with RTC wake pass with this branch's files (
bc54c7f2, with #2770 for port 2, on maindbfbced7; main between this branch's base anddbfbced7touches none of the files here). A control without the clock-protection commit resets the Mac on its first sleep.checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on the new commits.Risk: two-way, M4 (T8132) only. J773g gains deep sleep. The shared
sleep_display_off()change acts only where a profile names a display-0 slice and display 0 is unbound, which is T8132 alone.Not yet: a J713 deep sleep cycle on this branch (shared T8132 path); one M1/M2 deep sleep regression row (shared
sleep.c). No lid on this Mac, so only RTC wake was tested.Details
apple_sleep_refuse(): when display 0 (the internal DCP) is disabled in the device tree, every available external DCP must be bound instead of refusing for display 0. A profile with no display (T6040) skips the check.apple_sleep_map_apcie()maps every availableapple,apciechild port, keyed by its OF PCI slot (each slot once, at most four), andsleep_apcie_port_stop_once()stops them all before APCIe is lowered, the radio's port last. Each port's down state is tracked on its own, and a PCIe host that owns its ports across sleep makes apple-sleep skip its fallback clocking on wake.arm64: dts: apple: t8132-j773g: enable deep sleep and the enclave's sleep pathenables the sleep controller, the cluster power gate, the SEP and its DART, gives the SEPps_sepandps_gpio, and statesps_sepokay and firmware-owned (the PMGR handoff policy keeps it for the J713 only). Without a domain on the SEP, every suspend is refused:sleep refused: irreversible request could not be staged (ENOENT).soc: apple: sleep: release an unbound internal display's clock protection: J773g's internal DCP is disabled, but DISP0_CPU is left on with its DART's clock-protection slice armed (ADT dart-dcp, slice 42).sleep_display_off()lowered that word without releasing the slice, and the Mac reset before the sleep reached the PMU. T8132's profile now names slice 42 for display 0, and the slice of any unbound display is released. A bound display's driver still releases its own slice.Evidence
J773g, 3 cycles,
rtcwake -d /dev/rtc1 -m mem -s 15(PMU RTC), one boot:Control (same tree without the clock-protection commit): the Mac reset during the first sleep, and the next boot read the PMU boot-stage byte as 0x30, not the 0x50 the sleep writes before its commit. The earlier head with only the device tree enabled failed the same way.