Repository navigation
smp, pmgr: fix T6020 S2R wake path - #639
Conversation
On Apple T6020 (M2 Pro, verified on J414s / system-fw 26.6.2, os-fw 13.5),
returning from hardware SLP_S2R via Aura requires four fixes:
1. Power-gate /arm-io/apcie domains in reverse ADT order (plus a 2 ms
settle delay) before pcie_reinit_after_sleep() so the PCIe complex
reinitializes cleanly after a power cut.
2. Skip pmgr_adt_power_enable("/arm-io/ans") on T6020; Linux's
nvme-apple driver handles ANS2 reset and cold start on resume.
3. On unlocked-RVBAR SoCs (apple_sysregs_unlocked), rewrite secondary
CPU RVBARs back to _vectors_start before returning to the OS, since
SLP_S2R resets secondary RVBARs to their power-on defaults.
4. Restore clean HCR_EL2 (API | APK | E2H | RW) alongside SCTLR_EL2
before jumping to the OS resume entry so Linux cpu_resume does not
fault on PAC/EL2 handoff.
Tested end-to-end on J414s (M2 Pro 10-core) with full Linux desktop
deep sleep and wake (aurora-silicon/linux#3336).
Signed-off-by: Pim Jeursen <pim@green-dna.nl>
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
JJRPF
left a comment
There was a problem hiding this comment.
Reviewed the diff (src/pmgr.c, src/pmgr.h, src/smp.c) and tested ae08762a on a second J414s (10-core M2 Pro, apple_sleep.deep=1 driver route):
pmgr_adt_power_off_reverse("/arm-io/apcie")+ 2 ms delay, skippingpmgr_adt_power_enable("/arm-io/ans")onT6020, rewriting unlocked secondary RVBARs to_vectors_start, and restoringHCR_EL2(API|APK|E2H|RW) alongsideSCTLR_EL2all look clean and match what Aura 130 needed on T6020.- In our C50 RAM-root test (
ae08762a+apple_pmp.defer_commit=0), the J414s woke out ofSLP_S2Rand resumed cleanly through Aura into Linuxapple_sleep_report()(0x7e, all 10 CPUs online,dpm_resume_noirq+dpm_resume_earlycomplete) before hitting an older-branchnvme-appleresume issue indpm_resume(). - We are rebasing our kernel onto
main+linux#3811next and will follow up with a fullTested:verification row onceWAKE_S=240and 3x wakes pass end-to-end.
|
J414c M2 Max (T6021) at |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE
Blockers: none (code clean, 8/8 CI checks passed, 0 conflicts, and exact-head hardware rows on two independent J414s M2 Pro machines plus J414c boot/s2idle regression check).
Checked:
src/pmgr.{c,h}:pmgr_adt_power_off_reverse()walks ADT devices in reverse order safely (handlesn_devices == 0, skips missing/protected devices while propagating-1, power-gates each valid domain).src/smp.c(smp_s2r_pcie_reinit()): on T6020, power-gates/arm-io/apciein reverse ADT order with a 2 ms settle beforepcie_reinit_after_sleep()and skips/arm-io/ans(handled bynvme-appleon resume), leaving other SoCs unchanged.src/smp.c(smp_s2r_return_to_os()): rewrites unlocked secondary RVBARs (!(read64(cpu->impl_reg) & RVBAR_LOCK)) back to_vectors_startwithdsb sy, and restores clean EL2hHCR_EL2(API | APK | E2H | RW, clearingTGE | TEA | AMO | IMO | FMOset byexception_initialize()) alongsideSCTLR_EL2before returning to the OS.
Evidence
- Head audited:
ae08762a3b0e(mergeable=true, 0 conflicts). - CI at head: 8/8 checks passed (
readinessok). - Hardware rows at
ae08762a: J414s M2 Pro (T6020) 4x consecutive hardwareSLP_S2Rdeep sleeps (including 13h49m overnight ~284 mW) and full wakes (~0.48 s); independent second J414s confirmation by @JJRPF; J414c (T6021) boot + s2idle confirmation by @muness.
|
Status at What's left before merge is one second-generation hardware row. The Small one: line 712 could use the |
|
J414s MacBook Pro 14" M2 Pro (T6020) hardware row at
(Tested on RAM-root |
|
J700 (MacBook Neo, T8140) S2R row for aura at exact head
|
|
J414s (MacBook Pro 14" M2 Pro, T6020) update at
Full desktop UKI + camera verification is next. |
|
Merging at |
What: Fix the Aura hardware deep-sleep (
SLP_S2R) wake path for Apple T6020 (M2 Pro) by power-gating/arm-io/apciein reverse ADT order beforepcie_reinit_after_sleep(), skipping/arm-io/anson T6020, rewriting unlocked secondary CPU RVBARs back to_vectors_start, and restoringHCR_EL2(API|APK|E2H|RW) alongsideSCTLR_EL2before returning to the OS. Ref aurora-silicon/linux#3336Tested: J414s M2 Pro (T6020, 10-core, system-fw 26.6.2 / os-fw 13.5) at
ae08762a: 4 consecutive hardwareSLP_S2Rdeep sleeps (including a 13h49m overnight sleep at ~0.28 W, 95% -> 90%) and full desktop wakes (~0.48 s wake, 0 failed units); second J414s wake confirmed by @JJRPF; J414c M2 Max (T6021) boot + s2idle confirmed atae08762aby @muness.Risk: two-way door · T6020 (
apcie/ANS wake branch) and unlocked-RVBAR / EL2 Macs (secondary RVBAR rewrite +HCR_EL2restore onsmp_s2r_return_to_os())Not yet: T6021/T6022 hardware
SLP_S2Rwake path (no T6021/T6022apple_sleepprovider onlinux@mainyet).Details
/arm-io/apciepower-gate (pmgr_adt_power_off_reverse()) + 2 ms settle: On T6020, power-gating/arm-io/apciein reverse ADT order beforepcie_reinit_after_sleep()ensures the PCIe complex reinitializes cleanly after a power cut.pmgr_adt_power_enable("/arm-io/ans")on T6020: Callingpmgr_adt_power_enable("/arm-io/ans")during Aura's wake path failed/blocked wake on T6020; Linux'snvme-appledriver handles ANS2 reset and cold start on resume.cpu_features->apple_sysregs_unlocked: HardwareSLP_S2Rresets secondary CPU RVBARs to their power-on defaults on unlocked-RVBAR SoCs; pointing them back to_vectors_startlets Linux bring all secondary CPUs online cleanly.HCR_EL2(API | APK | E2H | RW) alongsideSCTLR_EL2: Ensures Linuxcpu_resumeenters EL2h with PAC enabled cleanly without faulting.Thanks to @JJRPF for reviewing and verifying on a second J414s, and @muness for the J414c (T6021) hardware check.
Evidence
7.3.0-t6020s2r+,apple_sleep.deep=1):SLP_S2Rcycles (boot object resumes 0 -> 4), including a 13h49m overnight sleep (18:12:23 -> 08:01:22, 95% -> 90%, ~284 mW sleep draw, keyboard wakeMBSE 0x10030).clusters E 0xf P0 0xf P1 0xf), 194/252 AP GPIO pins, internal 13.5 DCP (3024x1964@120Hz + backlight), G14S GPU, NVMe ANS2, Wi-Fi, Bluetooth, SD, and MCA/TAS2764 audio return cleanly in ~0.48 s.ae08762aby @muness (comment above).ae08762a.