Skip to content

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

Closed
RyanTheTide wants to merge 6 commits into
integration/aurorafrom
modes/j616s-high-power-20261117
Closed

RyanTheTide wants to merge 6 commits into
integration/aurorafrom
modes/j616s-high-power-20261117

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • 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, which the match data used to name), replacing the machine compatible in the CLPC match data.
  • The platform profile also registers on a machine that has High Power mode but no low-power ceiling. It is named apple-smc there, so userspace keeps its own low-power CPU budget (aurora-power-budget steps aside only for apple-clpc).
  • debugfs prints the High Power state outside the low-power block.
  • t604x.dtsi links 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)

Automatic High Power
fan peak 3796 rpm 5855 rpm
GPU temperature at the end 58 C 49.7 C
CPU iterations 367680 M 383204 M (+4.2 %)
GPU GFLOPS 5054 5299 (+4.8 %)
CPU / GPU clocks 3177/3175 MHz, 1530 MHz 3338/3351 MHz, 1531 MHz

The 60 s rows and the 1 / 14 thread CPU rows are the same in both modes. Only the fan headroom changes.

Tests

  • clpc.c compiles with -Werror (syntax check against an arm64 build tree).
  • Not run on hardware yet. It needs a J616s test kernel with a refreshed device tree, because the J616s DTB comes from Stage 2. Check:
    • /sys/class/platform-profile/*/name reads apple-smc.
    • performance makes debugfs show smc high power: on.
    • Fan peak and throughput under the same 300 s soak, balanced vs performance.

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-mode on the CLPC node rather than by a machine compatible in the driver.

Assisted-by: LLM (Claude:Opus 5.5)

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 RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

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 (apple,high-power-mode, apple,smc = <&smc>), loaded through a one-shot Stage 2 trial.

  • /sys/class/platform-profile/platform-profile-0/name = apple-smc, choices low-power balanced performance.
  • debugfs: balanced smc high power: off (0 records sent), performance on (1 records sent), back to balanced off (2 records sent). No SMC write errors.
  • 300 s CPU (14 threads) + GPU ALU soak, same boot, balanced then performance:
balanced performance (High Power) macOS 27 Automatic / High Power
fan peak (fan1 / fan2) 3564 / 3804 rpm 5431 / 5946 rpm 3796 / 5855 rpm
CPU iterations 303137 M 315023 M (+3.9 %) +4.2 %
GPU GFLOPS 7128 7153 (+0.4 %) +4.8 %
mean system power 75.3 W 80.2 W 89.0 / 97.6 W
GPU temperature, steady 90-93 C 85-86 C

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.

@RyanTheTide
RyanTheTide marked this pull request as ready for review November 20, 2026 07:13
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 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.

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

Copy link
Copy Markdown
Contributor Author

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 apple-smc, choices low-power balanced performance.

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 samples: counter, timer irq/s is the arch timer summed over all CPUs, power is SMC total system power at 4 Hz.

profile CLPC samples/s timer irq/s system power
balanced 193.4 6767 7.66 W
low-power 196.2 6880 7.71 W
balanced 177.0 6935 7.63 W

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). smc high power stayed off with 0 records sent in all three. 0 failed units, 0 AVC denials, 0 kernel errors.

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)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #2655 (this branch went into conflict with integration/aurora). It keeps every commit here unchanged (head 278c377) and adds one merge of integration/aurora on top; the review fix c5ab4e3 and the J616s rows carry over.

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