Skip to content

drm/asahi: GPU power-ceiling cooling device, J700 GPU die zones - #2336

Draft
RyanTheTide wants to merge 6 commits into
integration/aurorafrom
pwr/gpu-cooling-v3-20261119
Draft

RyanTheTide wants to merge 6 commits into
integration/aurorafrom
pwr/gpu-cooling-v3-20261119

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Under a sustained GPU load the MacBook Neo's hottest GPU die key sits at 107.6 C on Linux, where the GPU firmware's own die limiter holds it, and the frame rate drops 16% on the way. macOS on the same machine holds that key at 104.5-106.3 C (mean 105.5 C) by lowering the GPU to 4.3-4.7 W. The driver writes the firmware's power inputs once at initialization, so no thermal zone can act on the GPU.

Change

A GPU power-ceiling cooling device for drm/asahi, and J700 thermal zones that use it. This replaces #1065 with a version rebased on current integration/aurora and reworked:

  • The policy is plain C shared by every firmware build: cooling state N requests 100 - N percent of the initialized maximum power, never below 25 percent, and several requesters compose by minimum. Only where the words live is per build: the A18 Pro (26A428) and M4 Pro (25G83) builds share a layout. 25F84 and the M5 firmware stay without one, each with the reason in the code.
  • It is enabled by the device tree alone, by #cooling-cells on the GPU node, with no module parameter. It starts unrestricted, so state 0 republishes the initialized values and a GPU that no zone references keeps the firmware's policy. drm: add GPU cooling v2 and J700 thermal bindings #1065 started at the 25 percent floor.
  • The firmware die-limiter target in the shared G17 initialization stays where it was. drm: add GPU cooling v2 and J700 thermal bindings #1065 lowered it for every G17 build to suit one board.
  • #cooling-cells goes on the T8140 GPU node, since the ceiling belongs to the GPU and its firmware rather than to a board.
  • The J700 zones are new. Each of the eight SMC GPU die temperatures gets a zone with an active-trip ladder from 102 C to 106 C (60 down to 25 percent of maximum power). drm: add GPU cooling v2 and J700 thermal bindings #1065's ten chassis, charger and SoC zones had trip points with no measurement behind them, and their SMC channel indices no longer match the key list in the tree.

Testing

The changed driver compiles on arm64 with LLVM=1 and W=1 from the Neo's production configuration, with no new warnings. The KUnit and host cooling suites pass. The J700 DTB compiles, and the eight zones resolve to SMC channels 83-90 (Tg04 to Tg0e) with the GPU as their cooling device. The details are below.

On the Neo (J700), 10 minutes of off-screen glmark2 load in the desktop session, against the same run on the production kernel:

run GPU die peak mean after 2 min frame rate (first -> last minute, mean) firmware crashes
production kernel, no GPU zones 107.75 C 107.66 C 500 -> 441 (460) 0
this PR 107.71 C 105.12 C 458 -> 407 (421, -8.4 %) 0
this PR, 4 C trip hysteresis (DTB variant) 107.77 C 103.67 C 446 -> 396 (410, -10.8 %) 0

The cooling device steps through every state (ceiling 9.55 W down to 2.39 W) under the default governor, and the GPU performance state follows. The mean die temperature drops by 2.5-4 C. The peak does not: even with the ceiling held at 2.39 W, the hottest GPU key jumps from about 102 C to 107.7 C within one 5 s sample. The firmware's own die limiter clamps that peak, not the host ceiling, which the firmware averages over a longer window.

Still to run

  • The peak: macOS keeps the GPU die at or below 105.5 C. That needs the firmware's die-limit target set for this board, from a hardware description rather than a shared constant. A deeper ceiling ladder won't do it.
  • Trip tuning against frame rate once the peak lever is in. The 4 C hysteresis variant runs cooler for 2.4 % more frame-rate loss.
  • M4 Pro boards get no zones in this PR.
Build and test details
  • KUnit, kunit.py run --kunitconfig=drivers/gpu/drm/asahi/.kunitconfig.cooling (UML): asahi-gpu-cooling 5/5 (cap_mapping, cap_composition, cap_startup_and_ppm, cap_failure_and_invalid, cap_recovery_and_limits).
  • tools/testing/selftests/drivers/apple/gpu-cooling.py: the same cases built with the host compiler, plus rustc layout checks of the typed power-state fields. Both pass.
  • make ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/asahi/aurora.ko: cooling.o and the Rust crate compile. The warnings are the dead-code ones already on integration/aurora.
  • t8140-j700.dtb: the GPU node has #cooling-cells = <2>. The zones gpu0-thermal to gpu7-thermal reference smc_hwmon channels 83-90, which are temperature-Tg04, Tg05, Tg0C, Tg0D, Tg0K, Tg0L, Tg0d and Tg0e in the compiled tree. Each zone maps its five active trips (102, 103, 104, 105 and 106 C) to GPU states 40, 48, 55, 62 and 75.
  • Reference data: macOS 26.6.2 on the same Neo, 600 s Metal compute load, SMC keys every 5 s and powermetrics every 2 s. On Linux, glmark2 terrain ran for 600 s on the same machine.
Why not the other GPU thermal paths in the tree
  • g16/glue.c registers a PMP-driven cooling device for the G16 backend. That is a different firmware interface.
  • g17/thermal.rs is an M5-only PI governor on the Region C budget word, behind m5_thermal_governor (default off). Moving it onto this cooling device, with its zones in DT, would remove that parameter. That is follow-up work, and M5 hardware has to confirm it.

Assisted-by: LLM (Claude:Opus 5.5)

…evice

The GPU firmware takes an absolute power ceiling from the host. Allow
#cooling-cells on the GPU node so thermal zones can map cooling states
onto it: state N requests 100 - N percent of the initialized maximum
power, bounded below at 25 percent, and state 0 leaves the firmware's
own policy unchanged.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The G17-family firmware takes two absolute power inputs from the host,
the maximum GPU power in Region C and the power-management budget in
the primary power state. Both are written once at initialization, so
nothing on the host can lower the GPU's power when a board runs hot.

Add a cooling device that owns those words. Cooling state N requests
100 - N percent of the initialized maximum, never less than 25 percent.
Thermal, fast-die, system and manual requesters compose by minimum, so
none can relax another's ceiling. The device starts unrestricted:
state 0 writes back the initialized values, and a GPU that no thermal
zone references keeps the firmware's own policy. Recovery republishes
the committed ceiling before queues reopen.

The policy is plain C shared by every firmware build that describes
the words; the build-specific part is only where the words live. It is
registered when the GPU's device-tree node has #cooling-cells, with no
module parameter. A read-only gpu_power_ceiling attribute and a debugfs
file report the requested and written ceilings.

KUnit and a host build run the same mapping, composition, failure and
recovery cases.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Resolve the Region C maximum-power word and the power state's
power-management budget for the 26A428 (A18 Pro) and 25G83 (M4 Pro)
builds, which share the layout, and hand them to the cooling device
before the firmware is initialized. The power state's two budget words
become typed fields with their existing initial values.

A GPU the device tree makes a cooling device does not start on a build
whose words are not described, rather than run with its thermal zones
silently ignored. Two builds stay without them, each with the reason in
the code: 25F84, whose power state is not the 25G83 one, and the M5
firmware, which takes its host budget at a different Region C offset
that the M5 governor already writes.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The power ceiling is a property of the GPU and its firmware, not of a
board. Mark the T8140 GPU as a cooling device; boards decide whether a
thermal zone uses it. Without one the GPU stays at state 0, its
firmware's own policy.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Under a sustained GPU load macOS 26.6.2 lets the hottest GPU key reach
about 107.7 C, then holds it at 104.5-106.3 C (mean 105.5 C) with the
GPU at 4.3-4.7 W, down from 6.0 W. Linux has no host ceiling and sits
at 107.6 C, where the firmware's die limiter holds it, losing 16% of its
frame rate on the way.

Give each of the eight SMC GPU die temperatures (Tg04 to Tg0e) a zone,
so the hottest one decides. Each zone is a ladder of active trips from
102 C to 106 C that steps the GPU ceiling from 60 to 25 percent of its
initialized maximum, with 1.5 C of hysteresis; about 104 C asks for the
4.3-4.7 W band macOS settles in. The GPU is not a power actor, so the
power allocator runs these trips bang-bang, as it runs fans.

There is no critical trip on these zones: the firmware's die limiter
and the SMC keep their own protection, and the CPU zones keep theirs.
The GPU keys read placeholders while the GPU is off, which the SMC
driver reports as no data.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The GPU firmware keeps its own die limiter, so the host ceiling is an
addition to it, not the only protection. A GPU node with #cooling-cells
on a firmware build whose power inputs are not described refused to
start, which took the whole GPU away for a missing extra.

Warn once and run without the cooling device instead; the thermal zones
then have no GPU ceiling to drive.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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.

1 participant