Skip to content

drm/asahi: fix G14 compute publication and suspend ordering - #2979

Merged
satchlj merged 4 commits into
satchlj/g14-v27-2-computefrom
gpu/g14-compute-review-followup
Nov 24, 2026
Merged

satchlj merged 4 commits into
satchlj/g14-v27-2-computefrom
gpu/g14-compute-review-followup

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem

The G14 compute path can publish a command before it owns the VM binding. Unbind can also race with submission, and a failure in a later command can signal an error while an earlier command is still running. The handoff guesses an SRAM voltage when the loader omits the table.

Change

Record ownership before publishing the queue entries and keep it through retirement. Close admission before unbind drains the queue. Require the loader’s SRAM operating points and use its firmware compatibility tuple to select the wire layout. Wake suspend as soon as published work drains, including when unpublished commands are held for resume.

Testing

The exact selector and suspend logic passed 4/4 on x86-64 and 4/4 in AArch64 QEMU. The compute transport fixture passed 8/8 in KVM on the J473 trial port. The AArch64 trial module passed modpost, split BTF and signature verification against 7.3.0-aurora-m2gpu1+.

Still to run

On the final module, run J413 and J473 compute, suspend-to-idle, post-resume compute and unbind. Run the 13.5 regression and confirm the default loader handoff. Thermal policy fields still need a machine-sourced contract before enabling higher performance states.

Stack and test scope

This is a follow-on to #2544 based on 4c4f313592fa. The trial build ports the patches through the dedicated G14 Kconfig in #2545 onto the J473 trial kernel. The trial commit is bb6fbdf1b6af. The earlier J473 first-client compute result, including the 1/1 atomic barrier case, is recorded on the parent PR and used an earlier module.

The compatibility selector uses the existing GPU compatible and apple,firmware-compat published by the loader. It checks the tuple before starting the coprocessor. The pending queue and the in-flight list use the same mutex for admission and shutdown. The resulting fence status for a partially published packet is deferred until its last published command retires.

Assisted-by: LLM (Codex)

Stage both ring entries before changing the producers. Store the packet and VM binding in the in-flight list, publish the cursors, then notify the firmware. Keep that ownership if the kick fails or another command in the packet is still in flight.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Close submission admission under the runtime mutex before unbind drains the queue. If staging a later command fails, retain the packet and its VM guard until the already-published prefix retires, then complete the fence with the staging error.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Read each SRAM operating-point voltage from the loader-provided ADT table. Refuse the handoff if the table is absent or inconsistent with the core operating points.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Select the wire layout from the loader compatibility tuple before starting the GPU and pass the register description selected by the GPU compatible.

Notify suspend when the in-flight queue empties. Pending commands stay held until resume, and unrelated wakeups exhaust the original timeout budget.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

MERGETRAIN6 source review at 9111ff5b8874. The new admission check is under the state lock, the CPU records the VM binding before committing staged firmware queue entries, and SRAM voltages are read from the handoff. Those resolve the specific findings in the compute branch.

Blocking: this draft leaves the existing fixed G14 thermal/alarm policy in place. The runtime must get protection inputs from the machine or decline to enable when they are absent. This series also overlaps the render-aware implementation in #3031. Please place one version on the compute base and build the render stack on that result. The J473 m2pub1 trial lacks 9111ff5b8874.

Assisted-by: LLM (Codex)

RyanTheTide added a commit that referenced this pull request Nov 24, 2026
…eries

The four compute follow-up commits (ownership before firmware
publication, drain before completing or stopping, required SRAM voltage
table, select by firmware compatibility + suspend drain) already exist in
this series in render-aware form: queue staging without advancing either
producer is shared by compute and render submissions (stage_work), and
ownership/drain checks cover the in-flight render pair as well. Every
conflict resolves to this series' version; the merged tree is identical
to the series head, so the two branches no longer diverge.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Forward-merged into #3031 (merge commit 6a3cc82, no force push). All four commits here already exist in #3031 in render-aware form, and every conflict in driver.rs, g14_v27_2.rs and gpu/v27_2.rs resolves to the #3031 version. The merged tree is byte-identical to c458904, the head that passed the J473 row. If #2544 takes these commits, #3031 carries them as well. Otherwise #3031 is the single place they land. This PR stays draft as the compute-only view on #2544.

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

Formal pre-PR checklist review (§1–§6) at live head 9111ff5b88741778a2f36778cf90eb80d8144034 (Draft; base: satchlj/g14-v27-2-compute / #2544; 0 CI runs).

Code Verification (Clean Fixes for #2544 Blockers)

  • 27d1f77bb2 (g14_v27_2.rs, gpu/v27_2.rs): Stages both work pointers and submission ring entries (stage_compute) before advancing cursors (ComputePublication::commit), checks ring capacity/fullness (next_head == retired, next_producer == read), records Inflight + _bind before publication becomes firmware-visible, and defers publication_error / release_guard() on partial multi-command failure.
  • 027f0b26de (g14_v27_2.rs): Closes admission via state.accepting = false under self.state.lock() before drain, checks self.healthy() under lock in submit() and pump(), and stores self.healthy = false under lock in stop().
  • 6f67df239d (gpu/v27_2.rs): Removes the §3 (*mv).max(850) fallback and hardcoded 1100 cap; requires /chosen/aurora-gpu-resources/sgx adt-perf-states-sram (ENODEV if absent, EINVAL on length/frequency mismatch or sram_mv < *mv || sram_mv == 0).
  • 9111ff5b88 (driver.rs, g14_v27_2.rs): Removes the §1 literal cfg.chip_id == 0x8112 and apple,firmware-version == [27, 2, 0] gates in favor of ProbeConfig::LegacyWithG14Handoff + apple,firmware-compat == [27, 2, 0], and removes the 50 ms sleep_prepare() polling loop by notifying idle when inflight.is_empty() && asleep.
  • §4 Attribution & §6 Naming: Pass — all 4 commits carry human Signed-off-by: only (zero AI commit trailers); PR body includes Assisted-by:.

Remaining Gates (Why This Stays Draft / Not Approvable Standalone)

  1. §3 Thermal/alarm policy still unresolved upstream in #2544: RootV27_2::controller()'s bare literals (0x22d4, 0x2284, 0x2f30, 5.3) are untouched by this follow-up and must be machine-sourced (failing closed when absent/malformed) before enabling the runtime.
  2. Stack alignment & missing #2543 teardown fix: Stacked on #2544 (4c4f313592fa) / old #2543 (119cce51da, missing 152822e240 UAT teardown PoC clean) and already forward-merged into #3031 (6a3cc8250f). Per thread alignment, carry these 4 signed commits onto #2544 (after restacking on #2543 152822e240) rather than landing #2979 separately.
  3. CI & §5 Evidence: 0 CI checks on feature base and no exact-head J413/J473 hardware row yet.

Assisted-by: LLM (Gemini 4 Neon)

@satchlj
satchlj merged commit db645f4 into satchlj/g14-v27-2-compute Nov 24, 2026
RyanTheTide added a commit that referenced this pull request Nov 24, 2026
Bring in the restacked #2610 (6a15a79: #2545 and #2544 on #2543
152822e, the TTBAT slot PoC clean in UatShared::publish_slot). The
#2979 ownership fixes it also carries are already here. The rewritten
#2545/#2610 commits re-add the compute-only refusals (render rejected in
m3_submit, COMPUTE_ONLY feature flag); this series supports rendering,
so those resolve to this series' version. Net change: the #2543 MMU
teardown fix and its retention test only.

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.

3 participants