Skip to content

drm/asahi: let the G14 27.2 GPU use its full performance-state range - #3075

Merged
RyanTheTide merged 1 commit into
mainfrom
m2gpu/g14-v27-2-pstate
Nov 24, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
m2gpu/g14-v27-2-pstate

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

What: The G14 firmware 27.2 runtime writes the board's performance-state ceiling to two of the three Globals state selectors (+0x88, +0x8c), but it set the third (+0x98) to 100. That is the first state above idle, so on the M2 mini the GPU stayed at its lowest active operating point (444 MHz in the T8112 GPU OPP table) for every workload. G14 13.5, M3 27.2 and M4 27.2 write the ceiling to all three selectors, and this change does the same. The ceiling comes from the board's performance-state table in the device tree. The firmware's power and thermal controller (fast-die loop, thermal thresholds, SoC-hot alarm) is unchanged and still decides how much of that range the GPU uses. The selector offsets move into g14_v27_2_abi.rs, so the host test checks them against the progress-check words.

Tested: J473 (M2 mini, G14G, firmware 27.2), same boot recipe for both kernels (default cmdline), A = main's code (#3055), B = this commit on top:

  • Geekbench 6 Vulkan completes all 8 workloads, twice per kernel. Wall time drops from 152.8/152.4 s to 95.9/95.4 s (1.59x faster).
  • SMC GPU rail voltage under load peaks at 599 mV with A (the 444 MHz point) and 820 mV with B (the 1110 MHz point).
  • GPU power peaks at 1.9 W with A and 8.9 W with B. GPU die temperature peaks at 37.1 C with A and 46.2 C with B; SoC die at 59.6 C and 63.3 C.
  • piglit arb_shader_image_load_store-shader-mem-barrier passes on both.
  • No firmware timeouts, no RTKit crash, no Oops. gnome-shell kept its PID, and fresh vkcube and vulkaninfo returned 0.
  • Production was restored and verified after each run.
  • Host test g14_v27_2_abi.rs: 5/5 pass, 1 of them new.

Risk: two-way · only Macs running the G14 firmware 27.2 runtime (J473 today; any G14G Mac on 27.2). The GPU draws more power under load, which is the intended behaviour. The 13.5 runtime and other GPU generations don't run this code.

Not yet:

  • A longer sustained-load thermal soak. The rows above are about 4 minutes of load each, on a Mac mini with a fan.
Details
  • Selectors: Globals +0x88, +0x8c and +0x98, in hundredths of a state. All three are now perf_max_pstate * 100.
    • G14 13.5 writes the same (initdata), as do M3 27.2 (m3/m3_power_26.rs) and M4 27.2 (g16/fw/initdata.rs, PSTATE_SELECTORS).
  • The removed STATE_CAP = 100 was the only cap. The power-policy initial-state words (+0x2c/+0x30 = base state) are starting values, which the firmware moves away from: M3 writes 1 there.
  • Under GB6 the firmware settled at the 820 mV / 1110 MHz point, not the top state. So the power and thermal controller is limiting the clock as designed, not the selectors.
  • The progress-check intervals from drm/asahi: set the G14 27.2 firmware progress checks and compute watchdog #3055 are unchanged. With the faster clock, piglit and GB6 still finish with no timeouts.
  • An earlier offline audit of the 27.2 Globals against M3 and M4 flagged this selector (its patch 02). This commit adds the shared constant and the host test on top of that patch.
Evidence

Our own traces, traces/gpu/20261125-m2gpu-next/:

The G14 27.2 runtime wrote the board's performance-state ceiling to two of
the three Globals state selectors (+0x88, +0x8c) but left the third (+0x98)
at 100, the first state above idle. That held the GPU at its lowest active
state (about a third of its top clock on the M2) for every workload.

G14 13.5, M3 27.2 and M4 27.2 write the ceiling to all three selectors.
Do the same: the value comes from the board's performance-state table in
the device tree, and the firmware's power and thermal controller (fast-die
loop, thermal thresholds, SoC-hot alarm, all unchanged) decides how much of
that range the GPU may use. The selector offsets move into the 27.2 ABI
module so the host test checks them against the progress-check words.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide requested review from a team and DjDeveloperr as code owners November 24, 2026 15:28
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J473 row: 9f1d55b8 on the J473 (M2 mini, G14G firmware 27.2): pass. Geekbench 6 Vulkan 8/8 in 95.4-95.9 s (152.4-152.8 s without the change), piglit shader-mem-barrier pass, 0 firmware timeouts, 0 failed units after restore.

Evidence

traces/gpu/20261125-m2gpu-next/20261125-021804-j473-h9b-m2n1 (B, this head) and 20261125-020707-j473-h9b-m2h7 (A, main's code). The PR body has the numbers.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 9f1d55b8: ready to merge

Check Detail
CI at head ok 2 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok comment at 9f1d55b8
Conflicts ok none
PR text ok Risk: two-way · only Macs running the G14 firmware 27.2 runtime (J473 today; any G14G Mac on 27.2). The GPU draws more power under load, which is the intended behaviour. The 13.5 runtime and other GPU generations don't run this code.

Areas: area:gpu
Merge: gh pr merge 3075 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Verdict at 9f1d55b83b4ffd383bdc08d27895d4c7bbdd2bcb: Source pass. Finish the shared regression and thermal qualification.

Blockers: No source issue. The current J473 row measures several minutes under load. Record the planned sustained-load health row and the J413 13.5 shared build control before merge.

Checked: The ceiling is the last index of the existing operating-points-v2 table. The change writes it in the same units as the other selectors, leaves the firmware power and thermal settings in place, and introduces no runtime switch. Exact ABI host tests pass 5/5 with warnings treated as errors. J473 A/B covers all eight Vulkan workloads and returns to saved fleet87. The performance gain comes with the higher measured GPU power and temperature stated in the PR.

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

Verdict: FINISH at 9f1d55b8

Blockers:

  • CI (host-tests): still in_progress at 9f1d55b8 — wait for green completion before merge. (0 code or safety blockers.)

Checked: §1–§6 pre-PR checklist, full diff (drivers/gpu/drm/asahi/g14_v27_2_abi.rs, drivers/gpu/drm/asahi/gpu/v27_2.rs), commit hygiene (9f1d55b8), CI status (pr-text and readiness green, host-tests running), local g14_v27_2_abi.rs host tests (5/5 pass with -D warnings), and exact-head J473 A/B hardware row.

Evidence
  • Code & safety audit (drivers/gpu/drm/asahi/gpu/v27_2.rs, drivers/gpu/drm/asahi/g14_v27_2_abi.rs):
    • Removes hardcoded STATE_CAP = 100 at Globals +0x98 and moves [0x88, 0x8c, 0x98] to GLOBALS_PSTATE_SELECTORS, writing pwr.perf_max_pstate * 100 to all three selectors — matching G14 13.5 (initdata.rs), M3 27.2 (m3/m3_power_26.rs), and M4 27.2 (g16/fw/initdata.rs).
    • Bounds & malformed-DT safety verified in RootV27_2::build: states.len() is validated to 2..=16 (COMMON26_HW_PERF_ROWS), strictly increasing frequency/power, perf_max_pstate == states.len() - 1 (1..=15) matching hwdata_b.max_pstate, and per-state core/SRAM voltages validated against adt-perf-states-sram. Thus pwr.perf_max_pstate * 100 is bounded to 100..=1500 with no overflow or OOB risk.
    • Power budget (0x84 = pwr.max_power_mw), fast-die loop, thermal thresholds, SoC-hot alarm, sensor masks/coefficients, PID gains, and progress-check intervals are untouched.
    • No unsafe added or modified; put32 writes within the 0xe48-byte Globals buffer, and g14_v27_2_abi.rs unit tests check alignment, bounds, pairwise non-overlap of selectors, and disjointness from GLOBALS_PROGRESS.
    • Scoped strictly to CONFIG_DRM_ASAHI_G14_V27_2 (RootV27_2::build); zero runtime impact on G13, G14 13.5, G15, G16, G17, or G18.
  • §1 No model gating: Pass — no chip/board/firmware gates added; ceiling comes from DT operating-points-v2.
  • §2 Production-ready: Pass — default cmdline, removes hardcoded cap (STATE_CAP = 100), no new module params or workarounds.
  • §3 Safety: Pass — all limits remain DT/hardware-derived and firmware power/thermal controls are intact.
  • §4 IP & attribution: Pass — single commit 9f1d55b83b4ffd383bdc08d27895d4c7bbdd2bcb by Ryan Murray <[email protected]> with matching human Signed-off-by:; clean title, body, and comments; no copyrighted Apple material.
  • §5 Evidence & PR structure: What:, Tested:, Risk: (two-way), and Not yet: present; pr-text green. Exact-head J473 (M2 mini, G14G 27.2) A/B row reports GB6 Vulkan 8/8 twice per kernel (152.8/152.4 s → 95.9/95.4 s), peak rail voltage 599 mV → 820 mV (1110 MHz), GPU power 1.9 W → 8.9 W, GPU die 37.1 C → 46.2 C, piglit shader-mem-barrier pass, 0 firmware timeouts / Oops / failed units after restore.
  • §6 Naming: Pass.
  • CI at 9f1d55b8: pr-text / pr-text SUCCESS, readiness / readiness SUCCESS, host-tests IN_PROGRESS (rustc --test -D warnings on g14_v27_2_abi.rs passed 5/5 locally).
  • Non-blocking notes:
    • Include explicit 0 SELinux denials in the J473 regression check alongside the planned sustained-load thermal soak and J413 13.5 control row noted in the thread.
    • Optional nit: pstate_selectors_are_aligned_distinct_words_of_the_globals could also assert disjointness against the power offsets (0x58..0x84) in addition to GLOBALS_PROGRESS (currently disjoint by inspection: 0x84 + 4 == 0x88).

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

Verdict: MERGE at 9f1d55b8

Blockers: none

Checked: host-tests is now green alongside pr-text and readiness at exact head 9f1d55b83b4f. G14 27.2 P-state selector bounds, thermal/power-budget isolation, §1–§6 policy hygiene, and exact-head J473 A/B hardware results were verified in the prior pass on this same head.

Evidence
  • Exact head: 9f1d55b83b4ffd383bdc08d27895d4c7bbdd2bcb (MERGEABLE onto main).
  • CI at head: pr-text PASS, readiness PASS, host-tests PASS.
  • Prior review: Promoting from FINISH (review #6042366722) to MERGE now that all checks are green.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 24, 2026
@RyanTheTide
RyanTheTide merged commit 1b09b76 into main Nov 24, 2026
5 checks passed
techmore pushed a commit to techmore/linux that referenced this pull request Nov 24, 2026
…e range"

This reverts the merge of aurora-silicon#3075 (1b09b76). With all three Globals
state selectors at the board's ceiling, the M2 mini's GPU runs up to
the 944 mV operating point, and the G14 firmware 27.2 then hangs under
sustained load. Both a native GL render (fragment never retired) and a
deep compute queue (commands fetched but never retired) time out with
no MMU fault and no firmware timeout event, and the GPU is lost for
every client.

The same kernel with +0x98 back at 100 ran the gpubench GL plan five
times in a row with every case passing and no timeout. Its rail never
went above 600 mV. The rows that justified aurora-silicon#3075 (piglit and Geekbench
6) did not reach these hangs.

Restore the cap until the firmware's behaviour at the higher states is
understood.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide deleted the m2gpu/g14-v27-2-pstate branch November 27, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants