Repository navigation
drm/asahi: GPU power-ceiling cooling device, J700 GPU die zones - #2336
Draft
RyanTheTide wants to merge 6 commits into
Draft
RyanTheTide wants to merge 6 commits into
RyanTheTide wants to merge 6 commits into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
#cooling-cellson 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.#cooling-cellsgoes on the T8140 GPU node, since the ceiling belongs to the GPU and its firmware rather than to a board.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:
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
Build and test details
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 zonesgpu0-thermaltogpu7-thermalreference 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.Why not the other GPU thermal paths in the tree
g16/glue.cregisters a PMP-driven cooling device for the G16 backend. That is a different firmware interface.g17/thermal.rsis an M5-only PI governor on the Region C budget word, behindm5_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)