Skip to content

kboot: T6050: fill the M5 Pro GPU operating points from the ADT - #534

Merged
RyanTheTide merged 5 commits into
aurora-silicon:mainfrom
axboe:feat/t6050-g17s-gpu-opps
Nov 29, 2026
Merged

RyanTheTide merged 5 commits into
aurora-silicon:mainfrom
axboe:feat/t6050-g17s-gpu-opps

Conversation

@axboe

@axboe axboe commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Linux's M5 Pro driver gives every part its board's GPU voltages. They are per part: on the K116s (T6050, M5 Pro) the ADT differs from the J714 table the driver uses at 13 of 14 main states and 5 CS/AFR states.

Change

Where the DT gives the G17S GPU node operating-point tables (aurora-silicon/linux#3255 adds them for the J714s and K116s), dt_set_gpu_t6050() fills them in place from /arm-io/sgx: perf-states and perf-states-sram (two tables of perf-state-count states, one cell per table), afr-perf-states and cs-perf-states (one die) and their SRAM floor. Linux keeps its board's states and takes these voltages where every frequency is its own.

Every ADT value (counts, sizes, a shared rising frequency ladder, voltages up to 1.3 V, CS equal to AFR) and the shape of every DT table is checked before the first write. Anything that does not fit leaves the DT as it is, with a log line, and Linux stays on its board tables. A DT without the tables is left alone. It is built into Stage 2 only: Stage 1 room is tight with some toolchains (the nix job had 4032 B left, under the 4096 B minimum), and on these Macs Stage 1 loads the ESP's Stage 2, which boots Linux. A Stage 1 that boots Linux itself leaves the tables at zero and Linux on its board tables. kboot_gpu.c already reads build_cfg.h on main for the T8142 SRAM fill; the two T6031 host-test scripts that build it get an empty one here. One commit.

Testing

Tested: K116s (T6050, M5 Pro), firmware 27.2, end to end below.

Risk: two-way · M5 Pro (J714s, K116s) with a DT that has the tables.

  • 46484c112b80: rebased onto main 99b6dd1. termg's T8142 SRAM fill (kboot: G17: fill the GPU's SRAM voltages from perf-states-sram #545) made the same build_cfg.h include, FP-object build-cfg dependency and G15 host-test stub, so those lines are dropped here; what is left is the fill in src/kboot_gpu.c, byte-identical to the rowed head below apart from the include main now has, and the empty build_cfg.h for the two T6031 host tests. run-kboot-gpu-g15.sh 136 scenarios pass, run-t6031-unchanged.sh origin/main passes, clang-format clean. The rows below are at 7cea19ee35d3.
  • 7cea19ee35d3 T6050 / K116s (M5 Pro), firmware 27.2: booted through a loader built from main 8521ad7 + this commit + kboot: T6050: hand off the K116s external display engines on 27.2 #535 (release build: RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1), Linux with drm/asahi: g17: M5: take the part's GPU voltages from loader-filled operating points linux#3255 and the DT tables at zero. The loader filled all 99 values (14 main states x two core and two SRAM cells, 14 AFR and 14 CS states, the 775 mV floor), equal to the ADT; Linux logged GPU voltages from the boot loader's ADT tables: 18 states differ from the board's, and its GPU HW data is byte-identical through every perf row to the previous head's boot. 0 error-level kernel lines at boot; one RTC deep sleep (15 s) resumed, Wi-Fi back.
  • Stage 1 with gcc: same room as main (no t6050_gpu_opps in it); the Stage 2 build has the fill.
  • 32fd0577ab9b (same code, built into Stage 1 too) gave the same results end to end, with all five display engines bound.
  • An earlier head of this commit gave the same results end to end, with piglit 557/12 and a 30 s deep sleep. It was larger (2000 B with gcc -Os, now 1256): one log line with a step number for any refusal, CS compared byte for byte with AFR, one two-pass loop that checks the DT tables' shape and then fills them; the voltage range checks Linux already makes (each voltage within 50 mV of its board's) are left to it.
  • make format-check clean.

Still to run

  • J714s: a boot with the DT tables (its own states and voltages filled), and one with an older DT (nothing written).

  • Clean-room: no Apple code, strings, firmware, RE output or tuning values

  • No chip/board/firmware-version gate where a hardware property can decide

  • Works on the default kernel command line; no hacks, delays or lab-only paths (tested on my usual command line, not the default)

  • Safety limits come from the machine, not from constants in code

  • Hardware safety rules followed for every test boot

  • Third-party commits unchanged; reporters and testers credited

  • Commits: human Signed-off-by only; no AI attribution in commits or PR text

  • Tested on the affected hardware; no regression

The M5 Pro driver took every part's GPU voltages from its board's
table. They are per part: on the K116s the ADT differs from the J714
table at 13 of 14 main states and 5 CS/AFR states.

Where the DT gives the GPU node operating-point tables (operating-
points-v2 with one core and one SRAM cell per voltage table, apple,afr-opp,
apple,cs-opp, apple,csafr-min-sram-microvolt), fill them in place from
sgx perf-states and perf-states-sram (two tables), afr-perf-states and
cs-perf-states (one die) and their SRAM floor. Linux keeps its board's
states and takes these voltages where every frequency is its own.

The shapes of the ADT properties and of every DT table are checked
before the first write; anything that does not fit leaves the DT as it
is and the driver on its board tables. A DT without the tables is left
alone. Linux checks every state and voltage against its board's.

It is in Stage 2 only, as the SRAM fill next to it: Stage 1 has little
room left with some toolchains, and on these Macs it loads the ESP's
Stage 2, which boots Linux. The two T6031 host tests that build
kboot_gpu.c now give it an empty build_cfg.h, as the G15 one does.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
@axboe
axboe marked this pull request as ready for review November 28, 2026 13:15
@axboe
axboe requested review from a team as code owners November 28, 2026 13:15
@axboe
axboe requested review from LiamRay11 and malik-na November 28, 2026 13:15
@axboe
axboe force-pushed the feat/t6050-g17s-gpu-opps branch from 7cea19e to 46484c1 Compare November 28, 2026 13:15

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at 46484c11

Blockers: none (wait for the queued CI checks to finish green before merge)

Checked: no Apple material, no AI attribution, human DCO Signed-off-by, Stage 2 only (#ifdef ESP_STAGE2, 0 B Stage 1 delta), DT-driven selection (leaves DTs without operating-points-v2 untouched), two-pass atomic check-before-write (t6040_opp_table() + opp-microvolt-sram shape + apple,csafr-min-sram-microvolt + memcmp(aux, cs, alen) + rising frequency ladder check before any in-place write), T6031 host-test scripts given empty build/build_cfg.h, K116s end-to-end hardware verification (99 values filled identically to ADT, byte-identical Linux GPU HW data, 15 s & 30 s deep sleep, piglit 557/12) + run-kboot-gpu-g15.sh (136 scenarios) + run-t6031-unchanged.sh + clang-format clean, PR body has Tested: and Risk: two-way, branch is MERGEABLE against main.

Evidence
  • Inspected full diff (+108/-1 across src/kboot_gpu.c, tests/run-t6031-handoff.sh, tests/run-t6031-unchanged.sh):
    • t6050_gpu_opps() is strictly wrapped in #ifdef ESP_STAGE2, preserving Stage 1 room across gcc/fedora/nix builds.
    • Pass 0 validates all three OPP tables (operating-points-v2, apple,afr-opp, apple,cs-opp), exact subnode count and cell sizes, opp-microvolt-sram presence/absence, and apple,csafr-min-sram-microvolt length before Pass 1 performs any fdt_setprop_inplace*() write; failures leave the DT untouched with a single diagnostic line.
    • Non-blocking nit: st[2 * i] (src/kboot_gpu.c:87) and sram_uv (src/kboot_gpu.c:103) are u64 narrowed to u32 (safe for valid ADT microvolt values; Linux side validates voltage bounds, and I flagged the missing floor_uv slack check on linux#3255).
  • CI at 46484c11: 21 checks currently QUEUED/PENDING (org runner backlog).

@github-actions github-actions Bot added blast:all Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (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 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Merge readiness at c0c7aa0d: not ready yet

Check Detail
CI at head running running: policy, ESP stage 2 vital size, format-check, pr-text / pr-text, gcc, Pytest (ubuntu-latest + gcc)
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA c0c7aa0d, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · M5 Pro (J714s, K116s) with a DT that has the tables. - 46484c112b80: rebased onto main 99b6dd1. termg's T8142 SRAM fill (#545) made the same build_cfg.h include, FP-object build-cfg dependency and G15 host-test stub, so those lines are dropped here; what is left is the fill in src/kboot_gpu.c, byte-identical to the rowed head below apart from the include main now has, and the empty build_cfg.h for the two T6031 host tests. run-kboot-gpu-g15.sh 136 scenarios pass, run-t6031-unchanged.sh origin/main passes, clang-format clean. The rows below are at 7cea19ee35d3. - 7cea19ee35d3 T6050 / K116s (M5 Pro), firmware 27.2: booted through a loader built from main 8521ad7 + this commit + #535 (release build: RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1), Linux with aurora-silicon/linux#3255 and the DT tables at zero. The loader filled all 99 values (14 main states x two core and two SRAM cells, 14 AFR and 14 CS states, the 775 mV floor), equal to the ADT; Linux logged GPU voltages from the boot loader's ADT tables: 18 states differ from the board's, and its GPU HW data is byte-identical through every perf row to the previous head's boot. 0 error-level kernel lines at boot; one RTC deep sleep (15 s) resumed, Wi-Fi back. - Stage 1 with gcc: same room as main (no t6050_gpu_opps in it); the Stage 2 build has the fill. - 32fd0577ab9b (same code, built into Stage 1 too) gave the same results end to end, with all five display engines bound. - An earlier head of this commit gave the same results end to end, with piglit 557/12 and a 30 s deep sleep. It was larger (2000 B with gcc -Os, now 1256): one log line with a step number for any refusal, CS compared byte for byte with AFR, one two-pass loop that checks the DT tables' shape and then fills them; the voltage range checks Linux already makes (each voltage within 50 mV of its board's) are left to it. - make format-check clean.

Areas: none matched in CODEOWNERS

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

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 29, 2026
… the speaker strap read

test_t6041_atc_usb2_device asserted the old u64/s64 spellings of the
uintptr_t, ptrdiff_t and ssize_t typedefs, which aurora-silicon#476 changed to the
compiler's __UINTPTR_TYPE__/__PTRDIFF_TYPE__. Strip whichever spelling
src/types.h uses, and still require exactly one of each.

kboot_audio.c now reads the speaker ID strap through adt_gpio_by_phandle,
so the DT fuzz replay (pytest and tests/fuzz/build.sh) failed to link.
Build src/adt_gpio.c alongside it.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

@DjDeveloperr code-owner ping: the review App approved this at e9faf507, and the K116s row is above. The only red jobs are the four Pytest jobs that main itself fails (fixed by #570). Once #570 lands I'll update this branch with a merge commit, re-run CI and merge on green. If you want a hold, say so here.

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 29, 2026
… branch

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE after validation at c0c7aa0.

Checked: Recreated the merge of the approved #570 head. It has no manual resolution, and the PR diff against #570 is still the GPU OPP function and two harness scripts. Keep hosted CI and the existing GPU hardware evidence.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 29, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging under the 6-point rule (fast merge policy), at c0c7aa0d. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: author K116s (M5 Pro) row; new code is a T6050-only ADT fill, T6031 unchanged/handoff host tests cover the shared path; only main merges since the row. (5) There's no blocking review. (6) Dj was pinged here 351 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit ef68bfd into aurora-silicon:main Nov 29, 2026
28 checks passed
RyanTheTide added a commit that referenced this pull request Nov 29, 2026
…t-handoff

Conflict in dt_set_gpu_t6050: keep this branch's AURA_XTEXT placement
(the T6050_GPU_INIT/T6050_GPU_TEXT_FN macros are gone here) and main's
ESP Stage 2 t6050_gpu_opps() fill, now also AURA_XTEXT.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants