Skip to content

drm/asahi: g17: consume T6041 v1 calibration handoff from DT when present - #2103

Open
AxxzyWasTaken wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:pr/j616c-macos-hwdata
Open

AxxzyWasTaken wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:pr/j616c-macos-hwdata

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Reworked to consume the optional v1 T6041 calibration handoff published by aura (apple,t6041-handoff-version = 1) when present in DT, falling back cleanly to the existing static tables when absent:

  • Reads and validates apple,t6041-handoff-version, apple,aon-table (fixed [u32; 15] with key validation), apple,perf-map-a/b, apple,perf-relative-b, apple,perf-base-pstate, and cross-checks apple,active-mcc-bit-vector via check_mcc() (no unverified hardware register writes).
  • Keeps static MAX_POWER_MW, leakage coefficients, and hwdata fallback in place for v1 scope (removal of static power/leakage awaits a v2 efuse handoff).
  • Leaves the 40-core 25G83 path untouched when its base AON table is empty.

Testing

  • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.
  • tools/asahi/g17-t6041-initdata-tests.py: PASS.
  • drivers/gpu/drm/asahi/aurora.o cross-compile (ARCH=arm64 LLVM=1): PASS (0 warnings in touched files).
  • Live J616C boot row paired with the companion aura v1 handoff Stage 2 is queued next.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@AxxzyWasTaken AxxzyWasTaken changed the title drm/asahi: J616C 25G83: hardware data and first compute PTC cap as macOS writes them drm/asahi: J616C 25G83: hardware data, power configuration and first compute PTC cap as macOS writes them Nov 16, 2026
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

A gentle ping: this is ready for review. Head bf20bd5 merges cleanly into current integration/aurora and CI passes.

Disclosure: prepared with an AI tool (the commits carry Assisted-by: LLM); tested as described.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 3.

  1. drivers/gpu/drm/asahi/hw/t6041_25g83.rs:151 and :182-195: the GPU power ceiling and the core/SRAM/CS/AFR leakage coefficients are compiled-in constants for one board. They limit how hard the GPU's power controller lets the part run, so a wrong value on another J616C unit (or a future firmware) is a power/thermal problem, and nothing checks it against the machine. The driver already has a machine-sourced path for exactly these values: drivers/gpu/drm/asahi/hw/mod.rs:572-602 reads apple,core-leak-coef, apple,sram-leak-coef, apple,cs-leak-coef, apple,afr-leak-coef from the DT and derives max_power_mw from the OPP table's opp-microwatt. Have the loader publish them for T6041 (from the ADT or whatever node macOS takes them from) and read them in the G17 config; if the J616C's ADT has no source, keep the change out until one is found rather than pinning one unit's numbers.
  2. t6041_25g83.rs:256-525 (POWER_CONFIG_WORDS): about 270 words copied from one capture, which the PR itself says include state macOS had built up by then: timestamps (+0x210, +0x698, +0x63cc..+0x6404 look like timebase values) and per-sensor blocks at +0x3140..+0x3b44 whose values differ sensor by sensor. Replaying one unit's mid-run state at every boot on every J616C is not a configuration, and the bisect already showed two words (+0x0, +0x2a04) that hurt. Split the static words from the runtime ones: diff at least two captures (different boots, ideally two units) and keep only the words that match, with each kept word named; leave the runtime words zero as the firmware initialises them.
  3. The values in commits 1-3 (hardware-data words, power-controller coefficients and filter constants, the PTC cap at :60) are Apple's power and scheduling tuning, taken verbatim from what macOS writes into the firmware's memory, not measurements of the hardware. They should not be published in this tree as literals. Point 1's DT route avoids it for the leakage and power values; for the rest, say what in the machine (ADT property, firmware image field) carries each word and read it from there.

HW row: this exact head (d674c6e, not the daily tree) booted on the J616C on the default command line: firmware up, the ALU and terrain numbers from the PR, 0 GPU recoveries over a 30 min mixed load, 0 new kernel errors and 0 failed units against the base; plus a J614C boot showing its config is unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

@AxxzyWasTaken AxxzyWasTaken changed the title drm/asahi: J616C 25G83: hardware data, power configuration and first compute PTC cap as macOS writes them drm/asahi: g17: consume T6041 v1 calibration handoff from DT when present Nov 22, 2026
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Reworked and pushed 50b03ae29139 (with human Signed-off-by:): now consumes the optional aura v1 DT calibration handoff (apple,t6041-handoff-version = 1) when present in /soc/gpu, keeping static MAX_POWER_MW / leakage / hwdata fallback honest for v1 scope until a v2 efuse handoff exists. Companion aura PR opened; live J616C paired boot row queued next.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the rework. The configuration-word replay and the tuning literals are no longer part of this change, which resolves points 2 and 3 for this PR.

Point 1 is still open:

  • drivers/gpu/drm/asahi/g17/initdata/v25g83.rs:169-170: with the handoff present, the power ceiling and leakage still come from chip.max_power_mw / chip.leakage (hw/t6041.rs:346 and :369, hw/t6041_25g83.rs:149 and :179). The same happens for state.init(chip.max_power_mw) in v26b123.rs:124 and for relative_a (calibration.rs:289 keeps base.relative_a). hw/t6041_25g83.rs:25-27 says these are the M4 Pro's numbers, not this unit's. They set the firmware power controller's limit and leakage model, so they protect the part. They need to come from the machine the way T6040's already do: aura derives max-power-mw, perf-relative-a and the four leak coefficients from efuse and the OPPs, and calibration.rs reads them with no fallback.
  • calibration.rs:199-203: without the handoff, read_opt returns Ok(None) and the GPU starts on the full static profile. For values like these the safe default with no handoff is to leave the GPU off on T6041, as T6040 does, not to run on another chip's constants.

So the order should be: the companion aura change publishes max-power-mw, perf-relative-a and the leak coefficients for T6041 (read-verified on the J616C, as its own comment plans for v2), and the kernel then requires them and drops the static power and leakage values. As it stands this version only moves the performance maps and AON rows to DT. Those are worth having, but they are not the part that needs the machine.

Smaller:

  • The T6040 and T6041 readers use the same property names and differ only in the number of clusters, which the probed GPU id and the OPP cell count already give. One reader with one version property would remove the cfg.chip_id == t6041::CHIP_ID selects in mod.rs and v25g83.rs.
  • check_mcc only compares the popcount of apple,active-mcc-bit-vector with the static slot-3 instance count (hw/t6041.rs:228-229). The DT value could set the instance count directly.
  • apple,perf-relative-b is checked to equal the value recomputed from the OPPs (check_perf_opps), so the property adds nothing the driver cannot compute itself.

Testing: no hardware row yet at 50b03ae. Needed are a J616C boot paired with the aura change (firmware up, the earlier ALU and terrain numbers, 0 GPU recoveries over 30 min of mixed load, 0 new kernel errors), the same J616C with a loader that publishes no handoff showing the intended behaviour, and a J614C boot showing its configuration is unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

@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 50b03ae29139 against the pre-PR checklist (§1–§6) and cross-checked DT/ABI compatibility against aurora-silicon/aura#450 (7e417ad1).

What looks good

  • Cross-repo DT/ABI compatibility with aura#450 (7e417ad1): All seven v1 properties match in type, length, endianness, and validation rules:
    • apple,t6041-handoff-version (u32, must be 1 when present; deleted up front and written last by aura#450).
    • apple,core-mask (u64, 40-bit mask split into four 10-bit cluster masks matching id.core_masks).
    • apple,active-mcc-bit-vector (u32, nonzero 8-bit mask; count_ones() verified against register-map slot 3 instances).
    • apple,perf-base-pstate (u32 == 1).
    • apple,perf-map-a, apple,perf-map-b, apple,perf-relative-b (16 x u32, 11 active states + 5 trailing zeros; integer relative_b ladder formula matches aura#450).
    • apple,aon-table (15 x u32, canonical g0TR..g3TR, r0TR BE 4CC keys round-tripping cleanly in both v25g83 and v26b123).
  • Fallback & non-T6041 safety: Non-T6041 GPUs skip T6041Calibration::read_opt entirely (and T6040's Calibration::check_opps behavior is unchanged via check_perf_opps). Older aura boots without apple,t6041-handoff-version return Ok(None) and cleanly fall back to the static profile. 40-core T6041 on 25G83 keeps aon_va = 0 because !base_aon.is_empty() is false.
  • §4 Attribution: Single commit with human author/committer and human Signed-off-by:; PR body carries Assisted-by:.

Blockers

  1. Failing CI (host-tests — FAIL t6040-calibration-tests, 460/461 passed): tools/asahi/t6040-calibration-tests.py compiles drivers/gpu/drm/asahi/g17/calibration.rs directly against its mock of::Node / Property harness and fails with 2 errors:
    • g17/calibration.rs:201: error[E0599]: no method named 'get_opt_property' found for reference '&of::Node'
    • g17/calibration.rs:208: error[E0277]: the trait bound 'u64: Property' is not satisfied
      Update the mock of::Node and Property impls in tools/asahi/t6040-calibration-tests.py (and add a T6041Calibration::read_opt property-adapter test covering absent, valid v1, wrong version, and malformed/missing property cases) so host-tests passes cleanly.
  2. Missing §5 live hardware verification rows for the live head SHA: Please attach the queued live J616C boot rows once run on the updated head SHA:
    • Paired with aura#450 v1 handoff (apple,t6041-handoff-version = 1) on default cmdline, plus fallback boot without the DT property, including kernel/build IDs and regression counts (0 SELinux denials, 0 failed units, 0 new kernel errors).

(Non-blocking note: on 40-core T6041 26B123, upgrade_26b123 still overrides relative_b with the static float RELATIVE_B array when active_cores == 40, while consuming DT states_a/states_b/aon_table; and 25F84 validates t6041_cal in Gpu::new() without consuming it in its legacy initdata path. Both are harmless for v1 scope.)

Assisted-by: LLM (Gemini 4 Neon)

…sent

Read optional T6041 v1 GPU calibration properties published by aura under
apple,t6041-handoff-version = 1 (apple,core-mask,
apple,active-mcc-bit-vector, apple,aon-table, apple,perf-map-a/b,
apple,perf-relative-b, and apple,perf-base-pstate) while keeping a clean
fallback to the static T6041 profile when the handoff property is absent.

When apple,t6041-handoff-version is present:
- Require version 1 and cross-check apple,core-mask (40-bit across four
  clusters) against the probed hardware core masks in Gpu::new();
- Cross-check popcount(apple,active-mcc-bit-vector) against the
  register-map slot 3 MCC instance count (leaving hwdata +0xf8c untouched
  until verified on hardware);
- Validate both 11-state perf maps and recompute the relative-B ladder
  from the probed 4-cluster OPPs, merging them into T6041 PerfConfig;
- Populate the 25G83/26B123 AON temperature-source table from DT when the
  active firmware profile uses AON (leaving 40-core J614C 25G83 unchanged).

This is the v1 machine-sourced handoff consumer; static MAX_POWER_MW,
leakage coefficients, and remaining per-chip power/hwdata tables in
hw/t6041*.rs remain in place until v2 four-cluster efuse handoff is
verified on hardware.

The T6040 calibration host test now mocks of::Node::get_opt_property and
big-endian two-cell u64 properties, and covers T6041Calibration::read_opt:
absent handoff, a valid v1 handoff, wrong versions, and missing, short or
out-of-range properties.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Updated to 5aa90607a75d:

  • Fixed tools/asahi/t6040-calibration-tests.py host test stubs (of::Node::get_opt_property + big-endian two-cell u64 Property) and added t6041_property_adapter_is_optional_but_complete covering absent handoff, valid v1 handoff, invalid versions (0, 2), missing/short properties, nonzero tails, out-of-range masks/bases, bad relative-B ladders, non-monotonic perf maps, and wrong AON keys.
  • Re-verified t6040-calibration-tests.py (7/7 PASS), g17-t6041-initdata-tests.py PASS, checkpatch.pl --strict (0/0/0), and aurora.o build.

Paired J616C boot rows (with aura#450 fa06504a AND fallback without handoff) are building now and will be posted next.

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.

3 participants