Repository navigation
soc: apple: clpc: J616s: tell the SMC about High Power mode - #2140
RyanTheTide wants to merge 6 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>
RyanTheTide
left a comment
There was a problem hiding this comment.
.high_power_machine = "apple,j616s" makes High Power mode a per-SoC table entry that names one board. High Power mode belongs to the machine, not the SoC: on macOS it exists on the 16-inch MacBook Pros with Max/Pro-class cooling (16-inch M1 Max, 16-inch M2 Max, and later 16-inch and 14-inch Max/Pro models), while other boards on the same SoC have no such mode. Suggestion: describe it in the board DT, for example a boolean apple,high-power-mode on the CLPC (or SMC) node in t6040-j616s.dts, and set clpc->high_power = clpc->smc_np && of_property_read_bool(np, "apple,high-power-mode"). That drops high_power_machine from clpc_hw, lets other boards opt in through their DT once their SMC record is confirmed, and needs no driver change for the next board.
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>
|
Hardware rows on the J616s (MacBook Pro 16" M4 Pro), one boot. Kernel: integration 2c35f50 with these two commits cherry-picked unchanged, fleet75 config. Device tree: the production fleet75 J616s DTB with only the two properties this PR adds on the CLPC node (
With High Power on, the SMC lets the fans run up to the macOS High Power level and the CPU gains about what it gains on macOS. GPU throughput on Linux isn't thermally capped at this load, so the GPU gain doesn't show up here. Gate: 0 failed units, 0 AVC denials, 0 kernel errors, 0 GPU faults. On the J616s the device tree comes from Stage 2, so the new properties only take effect after the next Stage 2 DTB refresh. |
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>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed at efbfe01.
The approach is right. High Power is selected by the board DT (apple,high-power-mode on the CLPC node), replacing .high_power_machine. It is opt-in, since the default profile stays balanced. The only thing it changes is the SMC zETM record (apple_clpc_send_high_power()), which raises the fan ceiling the way macOS's thermalmonitord does. No cpufreq or CPU DVFS cap is touched, and SMC thermal control stays intact. The J616s rows match macOS's High Power delta.
One regression to fix before merge:
drivers/soc/apple/clpc.c:991-993: with the new apple-smc profile (J616s: High Power, no low-power ceiling), choosing low-power sets clpc->low_power. The sample loop then queues apple_clpc_queue(..., ... && !READ_ONCE(clpc->low_power)), so sampling turns non-deferrable at the 4 ms APPLE_CLPC_SAMPLE_MS period. With low_power_khz == 0, apple_clpc_profile_limit() returns at once (clpc.c:859), so those roughly 250 wakeups/s do nothing. They cost idle power in the mode users pick for battery, and only once userspace (aurora-power-modes) can set the profile, which this PR makes possible on J616s. Before this PR, low_power could only be set where a ceiling exists. Suggested fix:
apple_clpc_queue(clpc, !apple_clpc_floor(clpc, state) && !clpc->gpu_on &&
!clpc->ane_qos_khz &&
!(clpc->low_power_khz && READ_ONCE(clpc->low_power)));Smaller: the debugfs block at clpc.c:1056 still prints the low-power state only under if (clpc->low_power_khz). That is fine, but an idle-power row on J616s in low-power, with the fix, would close this out.
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>
|
Idle-power row on the J616s (MacBook Pro 16" M4 Pro) in low-power, with the fix. Kernel: c5ab4e3 (the current head 278c377 only adds a host test on top), fleet75 config. Device tree: production J616s DTB plus only the two CLPC properties from this PR, through a one-shot Stage 2 trial. Platform profile Method: one boot, idle (no load, panel off, AC), balanced, then low-power, then balanced again, 20 s settle and 120 s capture each. Samples/s is the delta of the debugfs
In low-power the sample loop runs at the balanced rate, with no extra ~250 wakeups/s, and system power stays within about 1 % of balanced (+53 / +85 mW, against a per-sample spread of 100-500 mW). One caveat: at this idle level the deferrable sample still fires about 180-195 times a second, because the CPUs wake often anyway, so before the fix the gap here would have been at most 55-70 samples/s. This run measured the fixed kernel only. Assisted-by: LLM (Claude:Opus 5.5) |
The 16-inch M4 Pro (J616s) has High Power mode on macOS. 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.
This sends the J714s High Power record (#2056) on the J616s too:
apple,high-power-modeon the CLPC node, set int6040-j616s.dts(andt6050-j714s.dts, which the match data used to name), replacing the machine compatible in the CLPC match data.apple-smcthere, so userspace keeps its own low-power CPU budget (aurora-power-budget steps aside only forapple-clpc).t604x.dtsilinks the CLPC to the SMC (apple,smc = <&smc>), and the binding text says the SMC also receives High Power mode.macOS reference (J616s, macOS 27, 300 s CPU (14 threads) + GPU ALU load)
The 60 s rows and the 1 / 14 thread CPU rows are the same in both modes. Only the fan headroom changes.
Tests
clpc.ccompiles with-Werror(syntax check against an arm64 build tree)./sys/class/platform-profile/*/namereadsapple-smc.smc high power: on.Fedora's tuned-ppd only drives
/sys/firmware/acpi/platform_profile, which device tree boots don't have. So on Fedora the profile class is switched by aurora-power-modes in aurora-platform, not by tuned-ppd.Consider #2085 (clear High Power mode on removal) with this.
High Power mode is now selected by the board DT property
apple,high-power-modeon the CLPC node rather than by a machine compatible in the driver.Assisted-by: LLM (Claude:Opus 5.5)