Skip to content

soc: apple: clpc: J616s: tell the SMC about High Power mode - #2655

Closed
RyanTheTide wants to merge 7 commits into
integration/aurorafrom
modes/j616s-high-power-r2-20261121
Closed

RyanTheTide wants to merge 7 commits into
integration/aurorafrom
modes/j616s-high-power-r2-20261121

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #2140, which went into conflict with integration/aurora. Every commit of #2140 is kept as reviewed (head 278c377); the only new commit is a merge of integration/aurora (a1a1fcb) on top.

Problem

The 16-inch M4 Pro (J616s) has High Power mode on macOS, and Linux has no way to ask for it there. The CLPC registers its platform profile only where it has a low-power ceiling (the M4 Max), and the J616s CLPC node has no link to the SMC.

Change

  • The board device tree says which Macs have High Power mode: a boolean apple,high-power-mode on the CLPC node, set in t6040-j616s.dts and t6050-j714s.dts. This replaces the machine compatible in the CLPC match data.
  • On a machine with High Power mode and no low-power ceiling, the platform profile still registers, named apple-smc, so userspace keeps its own low-power CPU budget.
  • Low power samples on time only where it has a CPU ceiling to keep. A High Power-only profile stays deferrable at idle (the review fix, c5ab4e3).
  • t604x.dtsi links the CLPC to the SMC (apple,smc = <&smc>), and the binding documents the new property.
  • The merge: integration now gives T6041 its own CLPC table and dropped low_power_machine and the per-device low_power_khz copy, so the low-power ceiling is read from the matched table (hw->low_power_khz) everywhere. The host-test stub follows.

Testing

  • J616s, one boot, exact kernel code of c5ab4e3 (identical to this PR for the J616s: its table has no low-power ceiling either way): low-power idle equals balanced (CLPC samples/s 193.4 / 196.2 / 177.0, timer irq/s 6767 / 6880 / 6935, system power 7661 / 7714 / 7629 mW for balanced / low-power / balanced). SMC High Power stays off outside performance.
  • J616s High Power rows (11-20): profile apple-smc; performance sends the record and balanced clears it, no SMC write errors. 300 s CPU + GPU soak, balanced vs performance: fan peak 3564/3804 -> 5431/5946 rpm (macOS: 3796 -> 5855), CPU +3.9 % (macOS +4.2 %), GPU +0.4 % (not thermally capped on Linux at this load). 0 failed units, 0 AVC, 0 kernel errors.
  • clpc.o builds clean with W=1 (clang 22, arm64) on the merge. Host tests pass locally (full suite), including the clpc cases.

Still to run

  • Nothing on hardware for the merge itself: it changes only where the ceiling is read from, and the J616s value is the same.
Reviewer detail: the merge resolution

Conflict in apple_clpc_probe() only. The PR side had

if (!clpc->hw->low_power_machine || of_machine_is_compatible(clpc->hw->low_power_machine))
	clpc->low_power_khz = clpc->hw->low_power_khz;

and integration's 48c99cf ("give T6041 its own top-state policy table") removed both low_power_machine and struct apple_clpc::low_power_khz, because T6040 and T6041 now match separate tables (apple,t6041-max-clpc for the M4 Max, apple,t6041-clpc for the M4 Pro). The resolution reads clpc->hw->low_power_khz in the four places the PR used the copy (the deferrable-sampling condition, the two profile-registration conditions, the profile name). For the J616s this is 0, the same as before. For the M4 Max it is 2808000, the same as before.

tools/asahi/clpc-gpu-demand-tests.py: the stub struct no longer carries low_power_khz; check_low_power() gives T6040 a ceiling through a local copy of its table. The case still fails on the code before c5ab4e3 and passes now.

Row evidence: J616s low-power idle row #2140 (comment) ; High Power rows on #2140 (11-20).

Assisted-by: LLM (Claude:Opus 5.5)

RyanTheTide and others added 7 commits November 17, 2026 22:53
The 16-inch MacBook Pro with M4 Pro (J616s) has High Power mode on
macOS. With it on, the SMC lets the fans run to their maximum under a
sustained load: under a 300 s CPU and GPU load on macOS 27 the fans peak
at about 3800 rpm in Automatic and about 5850 rpm in High Power, at the
same CPU and GPU clocks, for 4-5% more sustained throughput and a GPU
about 8 C cooler at the end of the run.

Linux has no way to ask for it on this Mac: the CLPC registers its
platform profile only where it has a low-power ceiling (the M4 Max), and
the J616s CLPC node has no link to the SMC.

Send the J714s High Power record on the J616s too:
- give the T6040 data the J616s as its High Power machine;
- register the platform profile on a machine that has High Power mode
  but no low-power ceiling, named "apple-smc", so that userspace keeps
  its own low-power CPU budget there (aurora-power-budget steps aside
  only for "apple-clpc");
- print the High Power state in debugfs outside the low-power block;
- link the T604x CLPC to the SMC in the device tree, and say in the
  binding that the SMC also receives High Power mode.

Not yet tested on hardware: the J616s needs a test kernel with a
refreshed device tree to check that its SMC acts on the record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Whether a Mac has High Power mode is a property of the board (the
chassis and its cooling), not of the SoC. Until now the CLPC match data
named one machine compatible per SoC that gets it, so every further
board with High Power mode needed a driver change.

Describe it in the board device tree instead: a boolean
"apple,high-power-mode" on the CLPC node. The driver sends the zETM
record when the property is present and the node links an SMC, and
otherwise behaves as before. Set it on the J616s and the J714s, the
two machines the match data named, and document it in the binding.

Signed-off-by: Ryan <ryan@aurorasilicon.org>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…e name

The CLPC now names its platform profile "apple-clpc" or "apple-smc"
depending on whether the machine has a low-power ceiling, so the call is
no longer written with a literal "apple-clpc". Look for the
devm_platform_profile_register() call itself when checking that the
stop action is registered before the profile. The pre-fix reference still
matches.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
With a profile that has High Power but no low-power ceiling (J616s), choosing
low-power sets clpc->low_power, and the sample loop then queues its 4 ms
sample as non-deferrable. apple_clpc_profile_limit() returns at once when
low_power_khz is 0, so those ~250 wakeups/s do nothing and cost idle power in
the mode users pick for battery.

Sample on time in low power only when there is a low-power ceiling to keep.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…ling

The harness stub of struct apple_clpc lacked low_power_khz, which the
sample loop now reads, so the test no longer compiled. Add the field and
a case: idle in low power with no ceiling (High Power only) samples
deferrably, with a ceiling on time, and balanced deferrably again.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Resolve the conflict in apple_clpc_probe() with "soc: apple: clpc: give
T6041 its own top-state policy table": integration dropped
low_power_machine and the per-device low_power_khz copy because T6041
now has its own table, so the low-power ceiling is read from the matched
table (hw->low_power_khz) everywhere, and High Power mode stays selected
by the board's apple,high-power-mode property. The host-test stub
follows: check_low_power() gives T6040 a ceiling through a copy of its
table instead of the removed field.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

No blockers.

I checked the probe split at clpc.c:1510-1532. smc_np is parsed only where there is a ceiling or the board property. high_power needs both the property and the SMC link. The profile name follows hw->low_power_khz. The stop action is still registered before the profile. Adding apple,smc to the shared t604x CLPC node does not change the M4 Max: apple_clpc_hw_t6041 has no low_power_mw and its boards do not set apple,high-power-mode, so the SMC is never looked up there. The deferrable-sampling change at clpc.c:995 is right for a ceiling-less low-power profile, and the J616s idle row backs it.

  1. arch/arm64/boot/dts/apple/t604x.dtsi:1092: the comment in the shared SoC dtsi names one board ("the 16-inch M4 Pro"). Board selection now lives in the board DTS, so say what the link is for instead: "the SMC receives High Power mode where the board sets apple,high-power-mode".
  2. t6041-j616c.dts / t6041-j614c.dts: the M4 Max boards do not set apple,high-power-mode, though macOS offers High Power mode on the M4 Max MacBook Pros too. With the selection in DT, this is now a one-line DTS change per board plus a fan row like the J616s one. Fine as a follow-up, but say so in the PR.
  3. Commit 8e2766c has a Co-Authored-By: Claude trailer and no Signed-off-by.

Assisted-by: LLM (Claude:Opus 5.5)

@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.

Pre-PR checklist review (§1–§6) at 4202943427ac: REQUEST_CHANGES.

Blockers

  1. §4 Attribution (hard): Commit 8e2766c71f10 (soc: apple: clpc: J616s: tell the SMC about High Power mode) carries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> and is missing a human Signed-off-by: trailer. Under §4, commits must carry human author/committer and human Signed-off-by: only, with zero Co-Authored-By: or AI trailers. Please clean the commit history (or squash/cherry-pick onto a clean branch) so every commit carries only human identity and Signed-off-by:.
  2. §1 Chicken-and-egg & cross-Mac proof: Commit 5021a899a8d6 removes .high_power_machine = "apple,j714s" from apple_clpc_hw_t6050 in the same PR that adds apple,high-power-mode to arch/arm64/boot/dts/apple/t6050-j714s.dts. Because Stage-2/ESP DTBs can lag kernel updates (as noted on #2140 for J616s), dropping the fallback before a release carries apple,high-power-mode in DT silently disables High Power mode on J714s machines booting an unrefreshed DTB (§1 chicken-and-egg). Additionally, no J714s (M5 Pro) hardware test row is posted verifying the DT-driven path after removing .high_power_machine.

Verified code & checks

  • drivers/soc/apple/clpc.c:1510-1533: probe logic is sound — apple,smc is parsed after devm_add_action_or_reset(dev, apple_clpc_stop, clpc) (so of_node_put(clpc->smc_np) in apple_clpc_stop cannot leak), clpc->high_power requires both smc_np and apple,high-power-mode, cpufreq_register_notifier is gated on hw->low_power_khz, and High Power-only machines register as "apple-smc". On M4 Max (apple_clpc_hw_t6041, low_power_mw == 0), smc_np is parsed harmlessly and apple_clpc_smc() is never called; on M4 Pro boards without apple,high-power-mode, smc_np is not parsed.
  • drivers/soc/apple/clpc.c:995-997 & 1070-1072: deferrable idle sampling in low-power without a CPU ceiling and debugfs High Power status reporting are correct, and both host tests (clpc-gpu-demand-tests.py, clpc-high-power-cleanup-tests.py) match.
  • CI: 8/8 checks green (dt-checks, host-tests, source, rust-build, kunit, 3× DWC3/ATC). J616s hardware soak and idle-power rows are thorough (0 failed units, 0 AVC, 0 kernel errors).

Nits

  • arch/arm64/boot/dts/apple/t604x.dtsi:1092: comment names a single board (the 16-inch M4 Pro) inside the shared SoC dtsi; reword to reference boards opting in via apple,high-power-mode.
  • Note explicitly in the PR description whether M4 Max boards (t6041-j616c.dts, t6041-j614c.dts) are deferred to a follow-up.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #2784: same code, two clean commits on integration/aurora (human identity + Signed-off-by only), no force push here. Review points: (1) attribution: fixed by the new branch; (2) the J714s fallback .high_power_machine = "apple,j714s" is kept, so an unrefreshed DTB keeps High Power mode; nit: the t604x.dtsi comment no longer names a board; M4 Max boards are stated as out of scope in the new body. Closing this one.

Assisted-by: LLM (Claude:Opus 5.5)

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.

2 participants