Skip to content

soc: apple: clpc: hold ANE memory and fabric floor on T8152 - #3977

Merged
DjDeveloperr merged 1 commit into
aurora-silicon:mainfrom
lookevink:clpc-t8152-ane-floor
Dec 2, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-silicon:mainfrom
lookevink:clpc-t8152-ane-floor

Conversation

@lookevink

Copy link
Copy Markdown

What: Add "apple,t8152-clpc" to apple_clpc_ane_providers[] and set apple_clpc_hw_t8152.ane to { [APPLE_CLPC_DCS] = 7, [APPLE_CLPC_SOC] = 4 } (matching the top states apple_clpc_hw_t8152.map already holds for CPU and G18 GPU demand), with KUnit and host-test coverage.
Tested: At e53036fbe08f: tools/asahi/clpc-gpu-demand-tests.py (including new check_t8152_ane() and all negative controls) and tools/asahi/clpc-high-power-cleanup-tests.py pass; scripts/checkpatch.pl --strict --git HEAD~1..HEAD reports 0 errors, 0 warnings, and 0 checks. On J873g M6 Mac mini (apple,t8152, Linux 7.3.0): raising T8152 PMC agent-1 from (0, 0) to (7, 3) with CPUs pinned at minimum frequency cut H18G 256x256 FP16 matvec median kernel execution time 2.2x (643.0 us -> 290.1 us on ane0, 285.7 us on ane1, bit-exact max_abs_err=0), and T8152 CLPC with .ane = { 7, 4 } ran across a 5-minute sustained multi-engine load and cold reboots with 0 CLPC update errors.
Risk: two-way door · M6 (T8152) only; zero behavioral change for any other Mac or CLPC compatible.
Not yet: Live boot on J873g M6 at exact head e53036fbe08f, end-to-end apple_clpc_ane_set_active() voting once upstream T8152 ANE driver and DT nodes land, a SOC 3 vs SOC 4 power sweep across heavier H18G workloads, and other T8152 boards (J804, J833ct).

Details

Problem

apple_clpc_hw_t8152 defines DCS states 0-7 and SoC fabric states 0-4 and already takes G18 GPU input (gpu_input = true) at the top of its map (DCS 7, SOC 4, floor word 0x47), while t8152-j873-pmc.dtsi declares compatible = "apple,t8152-clpc". However, drivers/soc/apple/clpc.c omits "apple,t8152-clpc" from apple_clpc_ane_providers[] and leaves apple_clpc_hw_t8152.ane all-zero, so clpc->ane is never allocated and ANE work with idle or lightly loaded CPUs leaves both rails at low states.

Changes

  • drivers/soc/apple/clpc.c:
    • Add { .compatible = "apple,t8152-clpc" } to apple_clpc_ane_providers[] so apple_clpc_ane_get() binds T8152 ANE clients (both via explicit apple,clpc phandle and fallback matching).
    • Set apple_clpc_hw_t8152.ane = { [APPLE_CLPC_DCS] = 7, [APPLE_CLPC_SOC] = 4 }, using the top states already qualified in apple_clpc_hw_t8152.map for CPU and G18 GPU work (runtime tunable via debugfs ane_states). No CPU cluster frequency floor (ane_cluster_khz = 0) is set, so this has zero interaction or conflict with soc: apple: clpc: take the ANE cluster floor and High Power from the DT #3741 (apple,ane-cluster-floor).
    • Extend apple_clpc_ane_demand_hold_test() and apple_clpc_ane_cluster_test() in the apple-clpc-gpu KUnit suite to verify T8152's (7, 4) ANE demand and ane_cluster_khz == 0.
  • tools/asahi/clpc-gpu-demand-tests.py:
    • Extract apple_clpc_hw_t8152 alongside the other SoC tables and add check_t8152_ane() exercising apple_clpc_sample() for idle (0x00), active ANE demand (0x47, reason=32), sub-sample pending capture, HOLD_MS hold boundary (reason=16), and idle release (0x00, queued_idle).

No devicetree or binding changes are required (apple,t8152-clpc is already documented in Documentation/devicetree/bindings/power/apple,pmc.yaml and present in arch/arm64/boot/dts/apple/t8152-j873-pmc.dtsi).

Follow-up note

T8152 carries two ANE engines (ane0 and ane1), whereas apple_clpc_ane_get() currently enforces a single publisher (refcount == 1). Extending apple_clpc_ane to track multiple concurrent publishers is intentionally kept out of scope here for a dedicated follow-up once upstream T8152 ANE driver support lands.

Evidence

Local checks at e53036fbe08f (base origin/main bf7d80caf)

$ perl scripts/checkpatch.pl --strict --git HEAD~1..HEAD
total: 0 errors, 0 warnings, 0 checks, 98 lines checked
Commit e53036fbe08f ("soc: apple: clpc: hold ANE memory and fabric floor on T8152") has no obvious style problems and is ready for submission.

$ python3 tools/asahi/clpc-gpu-demand-tests.py
PASS: g17 BusyShare (...)
PASS: T6040, T6041 and T8132 host demand; DT GPU busy share and down-step hold; T8140/T604x ANE, streaming, dense work, read errors and PMP backoff; idle release
[all 47 negative controls PASS]

$ python3 tools/asahi/clpc-high-power-cleanup-tests.py
CLPC High Power: profile state, cleanup ordering, zETM off, SMC failures and GPU cap passed

Hardware measurement (J873g M6 Mac mini, apple,t8152)

Workload: H18G 1x256 @ [256, 256] FP16 matvec (256/256 bit-exact against CPU FP16 reference, max_abs_err=0), CPUs pinned at powersave minimum (1.440 GHz / 0.972 GHz):

Arm Engine Calls Kernel median (min) Wall Accuracy
PMC floor OFF (0, 0) ane0 100 643.0 us (550.9 us) 725.2 us bit-exact (max_abs_err=0)
PMC floor ON (7, 3) ane0 200 290.1 us (257.7 us) 332.3 us bit-exact (max_abs_err=0)
PMC floor ON (7, 3) ane1 200 285.7 us (262.0 us) 326.4 us bit-exact (max_abs_err=0)

CLPC agent-1 with apple_clpc_hw_t8152.ane = { 7, 4 } (0x47) also ran cleanly on J873g across a 5-minute sustained multi-engine load and unattended cold reboots with 0 CLPC update errors.

Apple T8152 (M6) defines DCS states 0-7 and SoC fabric states 0-4 in
apple_clpc_hw_t8152 and already accepts G18 GPU demand at the top of
that map (DCS 7, fabric 4), but omits "apple,t8152-clpc" from
apple_clpc_ane_providers[] and leaves apple_clpc_hw_t8152.ane unset.
When CPUs are idle or lightly loaded during ANE execution, both rails
drop to low states.

Add "apple,t8152-clpc" to apple_clpc_ane_providers[] and set
apple_clpc_hw_t8152.ane to { [APPLE_CLPC_DCS] = 7, [APPLE_CLPC_SOC] = 4 },
matching the top states the T8152 table already uses for CPU and G18 GPU
demand (with no CPU cluster frequency floor). On J873g (M6 Mac mini)
with CPUs pinned at minimum frequency, raising the T8152 PMC agent-1
floor from (0, 0) to (7, 3) cut H18G 256x256 FP16 matvec median kernel
execution time 2.2x (643.0 to 290.1 us on ane0; 285.7 us on ane1),
bit-exact.

Extend the apple-clpc-gpu KUnit suite and clpc-gpu-demand host test to
verify T8152 ANE demand (0x47), sub-sample pending capture, vote hold,
and idle release.

Signed-off-by: Kevin loo <kevin@loo.ski>
@lookevink
lookevink requested review from a team and DjDeveloperr as code owners December 2, 2026 19:00
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at e53036fb: not ready yet

Check Detail
CI at head ok 4 checks passed
Review no approved by sithglan, but GitHub does not count it yet (code owner from Core or Omarchy Mac needed, or approval went stale)
Requested changes ok none
Hardware row at head ok in the PR body at e53036fb
Conflicts ok not computed yet
PR text ok Risk: two-way · M6 (T8152) only; zero behavioral change for any other Mac or CLPC compatible.

Areas: area:gpu, area:platform

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

@sithglan sithglan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J873g (M6 Mac mini, apple,j873g / apple,t8152) exact-head hardware row at e53036fbe08f3eb1b0b2e1e0751653ab17d0cf4f (7.3.0-aurora-pr3977+, one-shot aura-try, clean default cmdline console=tty0 rdinit=/init root=LABEL=debian): PASS.

  • Boot & peripherals: All 12 CPUs 0-11 online, 0 failed units, end0 10GbE and wlp1s0f0 Wi-Fi UP, Vulkan 1.4.363 (Apple M6 (G18G B1)), 0 CLPC/PMC errors.
  • Live KUnit on J873g: apple-clpc-gpu 16/16 PASS (including apple_clpc_ane_demand_hold_test, apple_clpc_ane_states_test, apple_clpc_ane_cluster_test, apple_clpc_ane_no_provider_test, apple_clpc_ane_wake_removal_test); apple-clpc-policy 6/6 PASS.
  • Live CLPC & PMC debugfs (302800000.power-management:performance-controller@1):
    • ane_states: 7 4 at boot; writable round-trip 7 4 -> 6 3 -> 7 4 verified; no ane_cluster_khz floor (0).
    • PMC agent 1 floor held 0x00000047 (dcs 7, soc 4, honoured: 0x00000047) under load and released cleanly to 0x00000000 (honoured: 0x00000000, last_vote: 0x0 reason_bits 0x0) after 2 s idle; samples: 10851 update errors: 0.
  • Host test: python3 tools/asahi/clpc-gpu-demand-tests.py PASS (all positive and negative controls).
  • (End-to-end apple_clpc_ane_set_active() voting from an upstream T8152 ANE driver remains on Not yet until T8152 ANE DT/driver nodes land, as noted in the PR body.)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at e53036fbe08f3eb1b0b2e1e0751653ab17d0cf4f. I read the change itself and checked it on a local merge with current main (b924bf47f0c9, so with #2856, #3992 and #3227 in). The merge is clean: tree b1b57953352c, and the only files that differ from main are the two in this PR. main has since moved to e1543c36a962, which touches only two T8142 USB4 dtsi files; the merge is still clean there.

Code

  • apple,t8152-clpc in apple_clpc_ane_providers[] is the compatible that apple_clpc_of_match[] already binds and apple,pmc.yaml already documents. Only t8152-j873-pmc.dtsi uses it.
  • .ane = { 7, 4 } equals the top of this SoC's own map on both rails, so the ane_states clamp allows it and the vote can't go above what CPU and GPU work already ask for (floor word 0x47). There is no cluster floor: with no apple,ane-cpu-opp and ane_cluster_khz 0, probe takes the same path as T8140.
  • No ANE node on main binds to it yet, so nothing publishes ANE work on T8152 until one lands; until then the only change is the allocated input and the ane_states debugfs file. A second ANE engine gets no vote because the input takes one publisher; the body says so.
  • The forward static const declaration sits in the KUnit block next to the T6050 one, and the plain build does not contain it.

Run on the merge (local, hosted jobs are skipped for this fork PR)

  • run-host-tests.py --only clpc in the Ubuntu 24.04 host-test image with the workflow's pinned toolchain: 9/9 (gpu-demand, high-power-cleanup with and without --old-ref, ane-cpu-opp with its 5 mutations).
  • The merged clpc-gpu-demand-tests.py fails at the new check_t8152_ane assertion against main's clpc.c, and with .ane removed, set to (7, 3), or set to (6, 4). main's own script passes on main.
  • checkpatch --strict on the commit and on the merge diff: 0 errors, 0 warnings, 0 checks.
  • arm64 clpc.o, clang 23, defconfig + asahi.config, W=1: 0 warnings with CONFIG_KUNIT off and with CONFIG_KUNIT=y; the KUnit object contains the changed test cases.
  • No conflict with #3868 (82166dde5c7d) or #3882 (491e031bb680), and the three clpc host tests pass on each of those trees combined with this one.

Not run by me: the apple-clpc-gpu and apple-clpc-policy KUnit suites. They need arm64 (CPU_FREQ is not available on UML). The J873g row at this head ran them live: 16/16 and 6/6.

Nit, not blocking

The table comment cites a measurement at (7, 3) for a value of (7, 4). The body already lists the SOC 3 against SOC 4 sweep as open; when it is done, put its numbers in that comment.

@DjDeveloperr
DjDeveloperr merged commit 5fe340a into aurora-silicon:main Dec 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (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.

3 participants