Skip to content

[2/14] arm64: spin table: hold, call and park-off for Apple sleep, and the pen's deep-sleep WFI - #1773

Closed
DjDeveloperr wants to merge 2 commits into
integration/aurorafrom
m5/sleep-t6050/02-spin-table
Closed

DjDeveloperr wants to merge 2 commits into
integration/aurorafrom
m5/sleep-t6050/02-spin-table

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The T6050 sleep runs the CPU clusters' runtime power-down rounds before its
commit, as macOS does, with the secondary cores held in the spin table:

  • spin_table_hold_parked() already holds the secondaries; a held core can now
    run one function for the sleep (spin_table_call()), and the held cores of a
    cluster can be sent to their own power-down (spin_table_park_off()).
  • A core a round restarted at its reset vector waits in the holding pen; once
    the sleep has committed it takes the Apple deep-sleep bits and WFI there,
    as macOS's parked cores do (spin_table_pen_deep_arm()).
  • cpu_hold/cpu_restore power ops: reversible per-core preparation of a held core.

Measured on the M5 Pro: with the rounds the boot cluster's request is granted
and every cluster's status word reaches macOS's value at the commit (s95,
s96); a real sleep returns with all 18 cores back (s171, s179).


Part 2 of 14 of the M5 Pro (T6050, J714s) deep-sleep series. Each PR carries the ones before it; review only its top commit. Depends on #1772.

Status: draft. Validation of the whole series on the M5 Pro with the stock J714s DT and the stock kernel config, radios included, is in progress; results will be added to the last PR.

🤖 Generated with Claude Code

…eep's last steps

On T6050 (M5 Pro) the sleep stops several coprocessors in its last steps, with
interrupts off and one CPU running, after the point where their drivers' own
.suspend could still refuse. This adds what those stops need:

- RTKit: a polled idle (AP IDLE and the firmware's IDLE_DONE, read from the
  mailbox with no interrupt), the mailbox's receive-enable bit for a client's
  own idle, a saved-context lane for the SMC (one AP message across the commit
  with its acknowledgement tracked), the firmware 27 display stop's two state
  acknowledgements, and early endpoints that start before RX admission.
- Mailbox: send and receive without waiting, for those polled stops.
- SART: T6050's (v4) entries replayed after a sleep, and checked against the
  saved ones before ANS restarts.
- AIC: the sleep's mask-all and its event acknowledge, exported for the M5
  path that masks every interrupt in its last steps.

No change for other SoCs: each piece is used only by the T6050 sleep path.

Measured on the M5 Pro (J714s): with these stops in place the SoC's sleep
engine gets past its coprocessor waits (runs s49-s51); with the full series a
real sleep of about 28 s on the RTC alarm returns with every coprocessor back
(s171, s179).

Signed-off-by: Diljit Singh <[email protected]>
…en's deep-sleep WFI

The T6050 sleep runs the CPU clusters' runtime power-down rounds before its
commit, as macOS does, with the secondary cores held in the spin table:

- spin_table_hold_parked() already holds the secondaries; a held core can now
  run one function for the sleep (spin_table_call()), and the held cores of a
  cluster can be sent to their own power-down (spin_table_park_off()).
- A core a round restarted at its reset vector waits in the holding pen; once
  the sleep has committed it takes the Apple deep-sleep bits and WFI there,
  as macOS's parked cores do (spin_table_pen_deep_arm()).
- cpu_hold/cpu_restore power ops: reversible per-core preparation of a held core.

Measured on the M5 Pro: with the rounds the boot cluster's request is granted
and every cluster's status word reaches macOS's value at the commit (s95,
s96); a real sleep returns with all 18 cores back (s171, s179).

Signed-off-by: Diljit Singh <[email protected]>
@DjDeveloperr
DjDeveloperr force-pushed the m5/sleep-t6050/02-spin-table branch from ffcf890 to 5d44832 Compare November 13, 2026 07:07
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

superseded; reworking privately

@DjDeveloperr
DjDeveloperr deleted the m5/sleep-t6050/02-spin-table branch November 13, 2026 07:22
m0d16l14n1 added a commit to m0d16l14n1/linux that referenced this pull request Nov 16, 2026
…eep's commit

A core that the SoC restarts at its reset vector after a system sleep's
commit comes back through the boot object into secondary_holding_pen and
spins there on WFE. Its cluster can't power down with it running, and the
SoC's sleep sequencer waits on that with no timeout.

Once a sleep has committed, have such a core take the Apple deep-sleep
bits and WFI in the pen instead, as macOS's parked cores do. The flag is
read with the MMU off, set at spin_table_release_stopped() only where the
sleep driver armed it, and cleared before any CPU is started again after
the wake. T8142 arms it.

From aurora-silicon#1773 (T6050), where the cores a cluster round
restarted had to take this WFI before the first engine sequence completed.

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <[email protected]>
DjDeveloperr pushed a commit that referenced this pull request Nov 17, 2026
…eep's commit

A core that the SoC restarts at its reset vector after a system sleep's
commit comes back through the boot object into secondary_holding_pen and
spins there on WFE. Its cluster can't power down with it running, and the
SoC's sleep sequencer waits on that with no timeout.

Once a sleep has committed, have such a core take the Apple deep-sleep
bits and WFI in the pen instead, as macOS's parked cores do. The flag is
read with the MMU off, set at spin_table_release_stopped() only where the
sleep driver armed it, and cleared before any CPU is started again after
the wake. T8142 arms it.

From #1773 (T6050), where the cores a cluster round
restarted had to take this WFI before the first engine sequence completed.

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant