Repository navigation
soc: apple: sleep: per-SoC data and operations for the sleep sequence - #1769
Merged
Merged
Conversation
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
marked this pull request as ready for review
November 13, 2026 11:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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'swake_mask/wake_status/wake_words(up to 9).Add
struct apple_sleep_opsto 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_opsunchanged 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.obuilds with W=1 and no warnings (arm64, LLVM, fleet config + asahi.config + KUnit).CONFIG_APPLE_SOC_SLEEP_KUNIT_TEST): apple-sleep-soc-data 6/6 passed, the newapple_sleep_test_opsincluded.🤖 Generated with Claude Code