Skip to content

soc: apple: sleep: per-SoC data and operations for the sleep sequence - #1769

Merged
RyanTheTide merged 2 commits into
integration/aurorafrom
refs2r/soc-tables
Nov 13, 2026
Merged

RyanTheTide merged 2 commits into
integration/aurorafrom
refs2r/soc-tables

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The sleep driver binds on T8140 only, and the next SoCs differ from it in what the last steps do, not only in their values: clock parks that wait for a done bit, a cache flush and DRAM access off instead of the MCC lane strobes, other DCS steps and no PMC voter array, CYC_OVRD for the cores' deep WFI, and an AIC2 instead of an AIC3. Match data alone can't describe that.

Two commits:

  1. Move the T8140 constants still written into the code into struct apple_sleep_soc: cluster_cpu[], cpu_start_stride, clk_mux_parked[] + value, cllt[], pmu_usid / pmu_sleep_reg / pmu_sleep_val, spmi_notify_sleep, nmcc / namcc (AMCC up to 16), and the wake block's wake_mask / wake_status / wake_words (up to 9).

  2. Add struct apple_sleep_ops to the match data for the steps that differ in their operations:

    • deep_wfi_arm: what makes a core's last WFI end in a reset (after the shared timer masking).
    • last_mile: the commit from the still-on polls to the mailbox (SoC/DCS states, memory, CPM gates, clusters, clock parks, sleep_ps_save()).
    • wake: back on the boot core after the AIC restore: clusters, gates, words, complex, up to genpd's domains.
    • aic_mask_all / aic_ack / aic_restore.

    The refusals, the coprocessor stops, macOS's power words, the mailbox, the commit word and the WFI loops stay shared. T8140's steps move into t8140_sleep_ops unchanged and in the same order.

No new SoC is matched. A KUnit case checks that every matched SoC has all the operations.

Testing:

  • drivers/soc/apple/sleep.o builds with W=1 and no warnings (arm64, LLVM, fleet config + asahi.config + KUnit).
  • checkpatch --strict on the diff: clean.
  • KUnit (arm64 qemu, CONFIG_APPLE_SOC_SLEEP_KUNIT_TEST): apple-sleep-soc-data 6/6 passed, the new apple_sleep_test_ops included.
  • T8140 (J700), integration/aurora 673f618 + this branch: the driver binds with deep sleep as the default; s2r 3/3 (each a real return through the boot object), H.264 and HEVC 300-frame encodes byte-identical to the baseline after every wake, s2idle 2/2, Wi-Fi/NVMe/display/input/USB/Touch ID unchanged, 0 kernel errors or warnings, 0 AVC, 0 DART faults.

🤖 Generated with Claude Code

The cluster-control words, the CPU start bit layout, the parked clock
muxes, the CLLT clears, the PMU sleep byte and SPMI notify value, the
MCC and AMCC block counts and the wake block layout were still T8140
constants in the code. Other SoCs differ in each of them: T6040 has
three CPU clusters, four parked muxes, no CLLT clears, sixteen AMCC
planes and nine wake words at other offsets.

Move them into struct apple_sleep_soc, map mccN and amccN by the
SoCs counts, and check the counts in KUnit. T8140s values are the
ones the code used, so its sleep is unchanged.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The SoCs that come next differ from T8140 in what the last steps do,
not only in their values: clock parks with a done-bit wait, a cache
flush and DRAM access off instead of MCC lane strobes, other DCS steps
and no PMC voter array, CYC_OVRD for the cores' deep WFI, and an AIC2
instead of an AIC3. Match data can't describe that.

Add struct apple_sleep_ops to the match data: the deep-WFI arm, the
commit's last mile up to the mailbox, the wake up to genpd's domains,
and the AIC mask, ack and restore. The refusals, the coprocessor stops,
macOS's power words, the mailbox, the commit word and the WFI loops
stay shared. T8140's steps move into its ops unchanged and in the
same order. A KUnit case checks that every matched SoC has them all.

No new SoC is matched.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide RyanTheTide changed the title soc: apple: sleep: move the remaining SoC words into the match data soc: apple: sleep: per-SoC data and operations for the sleep sequence Nov 13, 2026
@RyanTheTide
RyanTheTide marked this pull request as ready for review November 13, 2026 11:30
@RyanTheTide
RyanTheTide merged commit 0fca1f6 into integration/aurora Nov 13, 2026
7 checks passed
@RyanTheTide
RyanTheTide deleted the refs2r/soc-tables branch November 13, 2026 11:30
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