Skip to content

soc: apple: sleep: Skip T6020 SEP PS_ACTUAL poll when AUTO_ENABLE is set - #4218

Merged
DjDeveloperr merged 1 commit into
mainfrom
fix/t6020-sep-wake-auto-poll
Dec 3, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
fix/t6020-sep-wake-auto-poll

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What

Follow-up #1 from #3999 review (6175485736).

On T6020 deep-sleep wake, t6020_sleep_wake() restores T6020_PSE_SEP with its saved PS_AUTO_ENABLE bit (0x1000030f on J414s). Because PS_AUTO_ENABLE lets PMGR power-gate SEP while the enclave idles, PS_ACTUAL reads 0 until SEP wakes, so the 500 ms interrupts-off readl_poll_timeout_atomic() waiting for PS_ACTUAL == 0xf timed out with -ETIMEDOUT (-110) on every wake.

Skip the PS_ACTUAL poll when PS_AUTO_ENABLE is set in the restored T6020_PSE_SEP word (recording sep_ret = 0 and reading back sep_woke), and preserve the existing poll when PS_AUTO_ENABLE is clear.

Tested

Tested: J414s (T6020) PASS at b9bff7416310 in a combined kernel with #4200. Two committed deep sleeps, zero SEP wake timeouts, and a successful SEP trusted-key round trip.

  • Static & build checks:
    • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.
    • ARCH=arm64 LLVM=1 W=1 drivers/soc/apple/sleep.o: 0 warnings.
  • Hardware row on J414s (Mac14,9, T6020, OS firmware 27.2, m1n1/boot.bin sha256 196da4c690882ac64a70932e2dbb5affa0828e533117c975633e1b6705a9bd38):
    • Kernel: 7.3.0-j414s-sepwake+ (90292a6e3345 = b9bff7416310 on main 2eceb1f24262 + #4200 ae343b883fba, Image sha256 f6fc5123ed564817f15264ffc15fd4374cfcde6ac3292b33a15b5a9f18038e6c)
    • Boot ID: c4ceb0f5-34b0-45db-8d31-b4320fdd20ae
    • Single boot: 1× s2idle (15 s, default appledrm.s2r_untested=Y) + 2× committed deep sleeps (100 s + 30 s, suspend_stats/success=3 fail=0, boot object resumes 0 -> 1 -> 2):
      • Deep Cycle 1 (100 s): T6020: halted 0x19, held stuck 0, macOS-off stuck 0, clusters stuck 0x0, sep 0x1000030f at the commit; clusters E 0xf P0 0xf P1 0xf, 26 words back (5 left), sep 0x1000030f (0)
      • Deep Cycle 2 (30 s): T6020: halted 0x19, held stuck 0, macOS-off stuck 0, clusters stuck 0x0, sep 0x1000030f at the commit; clusters E 0xf P0 0x2f P1 0x2f, 28 words back (5 left), sep 0x1000030f (0)
      • Zero -110 timeouts across both wakes (previously sep 0x1000030f (-110) on every wake).
    • Post-Cycle-2 SEP liveness: apple_sep 396400000.sep: the enclave is back from its sleep request on both wakes; diag/{xart=enabled,keystore=open,trusted=ready,xart_guard_refusals=0,xarm_failures=0}; keyctl trusted-key seal/unseal round-trip SEAL_UNSEAL_OK bytes=226.
    • Regression checks across both deep wakes:
      • Display: apple-panel-bl actual=117/500, card1-eDP-1 connected/enabled/On, kwin_wayland active 3024x1964 framebuffer.
      • Audio (plughw:AppleJ414,0, 2.0 s digital silence): 48 kHz 2.193 -> 2.195 -> 2.204 s, 44.1 kHz 2.070 -> 2.097 -> 2.084 s (rc=0).
      • GPU: firmware 27.2 resumed in 4442 us / 3018 us, pending=0, 0 GPU/MMU/RTKit faults.
      • Keyboard LED round-trip 00 -> 02 -> 00; Wi-Fi ping 3/3 (0% loss) after every cycle.
    • Archive: work/j414s-sepwake-20261203/ (SHA256SUMS).

Risk

Two-way · T6020 Macs. Scoped strictly to t6020_sleep_wake() in drivers/soc/apple/sleep-t6020.h; if PS_AUTO_ENABLE is clear in the restored word, the existing readl_poll_timeout_atomic() path runs unchanged.

Not yet

  • Tested on J414s (T6020); not yet tested on T6021/T6022.

On T6020 deep-sleep wake, t6020_sleep_wake() restores T6020_PSE_SEP with
its saved PS_AUTO_ENABLE bit (0x1000030f on J414s/J414c). Under
PS_AUTO_ENABLE, PMGR power-gates SEP while the enclave idles so
PS_ACTUAL stays 0 until SEP wakes, causing the 500 ms interrupts-off
poll for PS_ACTUAL == 0xf to time out with -ETIMEDOUT (-110) on every
wake.

Skip the PS_ACTUAL poll when PS_AUTO_ENABLE is set in the restored word,
and keep the existing poll when PS_AUTO_ENABLE is clear.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 3, 2026 18:55
@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) blast:m2 Macs affected, 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) needs-template PR body lacks Tested or Risk (bot) labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Merge readiness at b9bff741: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
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 b9bff741
Conflicts ok none
PR text ok Risk: two-way · T6020 Macs. Scoped strictly to t6020_sleep_wake() in drivers/soc/apple/sleep-t6020.h; if PS_AUTO_ENABLE is clear in the restored word, the existing readl_poll_timeout_atomic() path runs unchanged.

Areas: area:platform

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

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels 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.

No blocking findings at b9bff74. The branch checks the word written to SEP, so it skips the poll only when automatic gating is enabled. The existing bounded poll still runs with that bit clear. Both paths record the register readback for diagnostics.

The J414s row covers this change. The tested image and the merge with main 24970e1 have identical sleep.c and sleep-t6020.h. #4200 changes only the NCO clock driver. Both committed wakes completed without the SEP timeout, and the trusted-key round trip confirmed the enclave was responsive.

Clang W=1 built sleep.o without warnings, and strict checkpatch passed.

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

Labels

area:platform Area from CODEOWNERS (bot) blast:m2 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (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.

1 participant