Repository navigation
soc: apple: clpc: J616s: tell the SMC about High Power mode - #2655
RyanTheTide wants to merge 7 commits into
Conversation
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>
|
No blockers. I checked the probe split at clpc.c:1510-1532.
Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR checklist review (§1–§6) at 4202943427ac: REQUEST_CHANGES.
Blockers
- §4 Attribution (hard): Commit
8e2766c71f10(soc: apple: clpc: J616s: tell the SMC about High Power mode) carriesCo-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>and is missing a humanSigned-off-by:trailer. Under §4, commits must carry human author/committer and humanSigned-off-by:only, with zeroCo-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 andSigned-off-by:. - §1 Chicken-and-egg & cross-Mac proof: Commit
5021a899a8d6removes.high_power_machine = "apple,j714s"fromapple_clpc_hw_t6050in the same PR that addsapple,high-power-modetoarch/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 carriesapple,high-power-modein 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,smcis parsed afterdevm_add_action_or_reset(dev, apple_clpc_stop, clpc)(soof_node_put(clpc->smc_np)inapple_clpc_stopcannot leak),clpc->high_powerrequires bothsmc_npandapple,high-power-mode,cpufreq_register_notifieris gated onhw->low_power_khz, and High Power-only machines register as"apple-smc". On M4 Max (apple_clpc_hw_t6041,low_power_mw == 0),smc_npis parsed harmlessly andapple_clpc_smc()is never called; on M4 Pro boards withoutapple,high-power-mode,smc_npis not parsed.drivers/soc/apple/clpc.c:995-997&1070-1072: deferrable idle sampling inlow-powerwithout 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 viaapple,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)
|
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 Assisted-by: LLM (Claude:Opus 5.5) |
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
apple,high-power-modeon the CLPC node, set int6040-j616s.dtsandt6050-j714s.dts. This replaces the machine compatible in the CLPC match data.apple-smc, so userspace keeps its own low-power CPU budget.t604x.dtsilinks the CLPC to the SMC (apple,smc = <&smc>), and the binding documents the new property.low_power_machineand the per-devicelow_power_khzcopy, so the low-power ceiling is read from the matched table (hw->low_power_khz) everywhere. The host-test stub follows.Testing
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.obuilds clean with W=1 (clang 22, arm64) on the merge. Host tests pass locally (full suite), including the clpc cases.Still to run
Reviewer detail: the merge resolution
Conflict in
apple_clpc_probe()only. The PR side hadand integration's 48c99cf ("give T6041 its own top-state policy table") removed both
low_power_machineandstruct apple_clpc::low_power_khz, because T6040 and T6041 now match separate tables (apple,t6041-max-clpcfor the M4 Max,apple,t6041-clpcfor the M4 Pro). The resolution readsclpc->hw->low_power_khzin 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 carrieslow_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)