Skip to content

drm/asahi: render on the G14 firmware-27.2 runtime - #3031

Open
RyanTheTide wants to merge 21 commits into
satchlj/g14-v27-2-compute-onlyfrom
m2gpu/g14-v27-2-render
Open

RyanTheTide wants to merge 21 commits into
satchlj/g14-v27-2-compute-onlyfrom
m2gpu/g14-v27-2-render

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On the M2 (G14G) with GPU firmware 27.2 (the M2 Mac mini, and M2 Airs on the 27.2 stub), the firmware-27.2 runtime from #2544/#2610 runs compute only. Render commands are refused and the device reports itself compute-only, so GNOME, Firefox and every GL/Vulkan graphics client fall back to software rendering.

Change

This series adds render to the G14 firmware-27.2 runtime. It reuses the shared submission carrier, the UAPI parser, the 26.x wire helpers (#2543) and the adopted UAT from #2544. The G14 queue, event and command layouts sit in the G14 files. Behaviour is selected by the firmware compatibility the boot loader hands over and by what the GPU's ID registers report. There are no board or chip gates and no command-line or module parameters.

  • Render submission: the tiler and fragment commands of a render are staged on both firmware work rings before either is published. They keep their scene and VM binding until both engines retire. Parameter buffers grow on firmware request.
  • Fixes found bringing up the desktop on the J473:
    • parameter-buffer lists mapped GPU read-write (a read-only mapping faulted on the first render);
    • tiler and fragment kick masks set from the ID registers (they were zero, so no render started);
    • completion flushes requested on render commands (the host stamps were never written);
    • completion stamps cache-synchronized for the firmware's UAT;
    • queue backpressure rechecked when the firmware frees a slot without notifying.
  • Depth/stencil compression: admission follows what the queue's command builder encodes, not the M3 envelope. Without this, every GNOME Shell and Firefox frame was refused with ENOTSUPP.
  • Panic fix in shared code: gpu.rs no longer unwraps a missing RTKit transport. Before, a client that created enough queues could panic the kernel from GpuManager::alloc(). Every doorbell now returns ENODEV without a transport. Without device control, freed firmware memory is held rather than flushed (warned once). KUnit tests cover the decision.
  • Timeout diagnostics: on a timeout the runtime logs the MMU fault status, so a stall can be told apart from a page fault.

Stacked on #2610 (base satchlj/g14-v27-2-compute-only). It supersedes our draft #2979: the drain, SRAM-table and firmware-compatibility commits here are render-aware versions of #2979's, and #2979's publication ordering is part of the render submission commit. It also carries the compute start-word commit from #2896, but not #2896's performance-state change.

Testing

  • Build: integration/aurora 0f111a0 with this series merged, arm64 LLVM, the fleet config with CONFIG_DRM_ASAHI_G14_V27_2=y. There are no warnings in drivers/gpu/drm/asahi.
    • Clippy: the new items are fixed. The ones left in the touched files were already there.
    • gpu.rs and the two new files are rustfmt-clean. checkpatch is clean.
    • Host tests: m3 9/9, asahi-g15 1/1, asahi-m4 1/1. The base is a feature branch, so CI does not run them here.
  • J413 (M2 Air, firmware 13.5) regression: the same merged kernel, booted one-shot on the default command line. Gate PASS against the same Mac's production baseline:
    • 3/3 s2idle cycles (15 s RTC wake, same boot) and the Vulkan triangle 1/1 on the 13.5 path;
    • 0 SELinux denials, 0 failed units, 0 GPU, firmware or kernel faults;
    • no new kernel error or warning classes.
  • J473 (M2 mini, G14G, firmware 27.2): earlier one-shot rows on lab kernels carrying this series, all on the default command line. The desktop/CTS and sleep rows ran with commits 1–11. The two-monitor row ran with all 13, plus the DCP 27.2 changes drm/apple: adopt a DCP handed over running (M2 Mac mini HDMI on 27.2) #2853/drm/apple, phy: apple: light a USB-C display from a firmware-27 DCP on a T8103-generation ATC PHY #2868/drm/apple: keep the DP audio and DP PHY domains while the DCP firmware runs #2953 and a Stage 2 of aura main + aura#402.
    • GNOME Shell composites on the GPU with no environment overrides. Both external monitors were driven (USB-C/DP 2560x1440@60 and HDMI 1920x1080@120). Firefox with WebGL and video, vkcube and glxgears all ran.
    • Vulkan CTS depth/stencil + MSAA set: 384 pass, 0 fail, 248 not supported (depthBounds and four formats). This includes the 4x MSAA depth/stencil resolve groups, 140/140.
    • s2idle with the GFX domain kept on through system sleep: 4/4 resumes in the same GNOME session, with vkcube and the triangle passing after each. Without it the Mac reset 2/2 (see limits).
    • The gpu.rs panic: the J473 got past the point that panicked before (2049 queue allocations) with no panic. The KUnit cases for the collection decision pass, and a mutation of the decision is caught.
  • J473 on this exact merged kernel (integration 0f111a0 + this series, Stage 2 with apple,sleep-retained on the GFX domain, default command line):
    • GNOME Shell composites on the GPU (glxinfo: accelerated, Apple M2 (G14G B0)). 24 distinct scanout frames; glxgears 51-58 FPS; Firefox 47-61 fps with video playing.
    • Vulkan CTS depth/stencil + MSAA set: 384 pass, 0 fail, 248 not supported. Group by group this is the same result as the earlier rows.
    • s2idle 3/3 (15 s RTC wake): the same GNOME Shell process survived each cycle, and vkcube and the triangle passed after each wake.
    • 0 GPU fault lines and 0 SELinux denials.
  • KUnit: the suites build with the fleet config, but that config boots with KUnit disabled, so they did not run on the Macs. The collection decision was checked with host tests, including a mutation control.

Still to run / known limits

Commits, layout notes and row details

Commits (on satchlj/g14-v27-2-compute-only 3515e7d):

  1. 471dc3cf G14 firmware 27.2: set the compute start word the 13.5 path sets (also in drm/asahi: G14 firmware 27.2: run every performance state, and set the compute start word the 13.5 path sets #2896, without its performance-state change)
  2. cb9cf343 submit paired tiler and fragment work through G14 firmware (render path; new g14_v27_2_render.rs and g14_v27_2_abi.rs; the KUnit import fix is folded in)
  3. 645c79a5 synchronize G14 completion stamps for the firmware UAT
  4. f15f3d1f drain G14 submissions before completing or stopping (render-aware version of drm/asahi: fix G14 compute publication and suspend ordering #2979's)
  5. 4758c763 require the firmware handoff SRAM voltage table (same as drm/asahi: fix G14 compute publication and suspend ordering #2979's)
  6. c73aedd3 retry G14 firmware queue backpressure
  7. c17c2705 map G14 parameter-buffer lists GPU read-write
  8. ec59bb6f select G14 by firmware compatibility and signal suspend drain (render-aware version of drm/asahi: fix G14 compute publication and suspend ordering #2979's)
  9. ea2ab585 set the G14 tiler and fragment kick masks
  10. d2812fec request completion flushes for G14 render commands
  11. cf467644 admit depth/stencil compression the G14 render builder encodes
  12. 82671c76 never unwrap the RTKit transport on device-control paths (shared gpu.rs; KUnit asahi_gpu_garbage)
  13. 9884f9b4 report the MMU fault status on a G14 firmware 27.2 timeout
  14. c4589049 drop "compute-only" from the G14 firmware-27.2 probe message

What is shared and what is G14-specific:

  • Shared: the submission carrier and UAPI parser (m3_submit.rs), the 26.x wire helpers from drm/asahi: share the 26.x wire helpers and clean bound TTBAT slots #2543, the adopted UAT from drm/asahi: G14 compute on GPU firmware 27.2 #2544 and the 13.5 render structures (fw::vertex / fw::fragment job parameters, tiling parameters).
  • G14-specific: the queue ring, the event record and the 27.2 command placement around those structures, in g14_v27_2*.rs.
  • Selection: the runtime is chosen by the firmware compatibility the boot loader hands over. Kick masks come from the cluster and core counts in the GPU ID registers. Compression admission follows the queue's command builder. There are no chip, board or firmware-version gates.

J413 gate (production fleet kernel vs this kernel, same Mac, same command-line digest):

  • baseline PASS; candidate PASS with s2idle 3/3 (suspended 15.4 / 15.3 / 15.3 s, success +1 each, fail +0);
  • triangle 1/1; AVC 0; hard faults 0; new warning classes none; restore PASS (production running and saved, next entry empty, Enforcing, 0 failed).

J473 rows (lab kernel = this G14 code + #2853/#2868/#2953):

  • desktop: 24 distinct scanout frames over 93 s; 40 desktop actions; 0 render rejections; 0 GPU fault lines; 0 AVC.
  • CTS groups: triangle 1/1; renderpass suballocation simple 5/9 (4 not supported); draw depth_bias 6/6; d32s8 stencil states 8/8; renderpass2 depth_stencil_resolve 32x32 4x MSAA 122/122 and 16x64 6-layer 4x MSAA 18/18; pipeline monolithic depth d32s8 224 pass, 244 not supported.
  • sleep: 1/1, then 3/3 with the retained GFX domain.

Assisted-by: LLM (Claude:Opus 5.5)

satchlj and others added 15 commits November 22, 2026 05:33
The G14 firmware-27.2 runtime reuses the 26.x submission front end
(m3_submit, agx_uapi and their helpers), so it was built only with
CONFIG_DRM_ASAHI_M3_T8122. Give it its own option, DRM_ASAHI_G14_V27_2
(default y), and build the shared front end when either user is enabled:

- m3/mod.rs: agx_uapi, agx_compute, agx_attachments, agx_memory and
  m3_submit build with DRM_ASAHI_M3_T8122 or DRM_ASAHI_G14_V27_2.
- m3_submit.rs: the M3 sink, queue constructor, render validation, CDM
  launch check, timeout handling and fence-timing profile build only
  with the M3 runtime; without it a render command gets EINVAL.
  task_comm() moves here from m3_client.rs, which now calls it here.
- The G14 path's own code is gated on the new option.

Like the M3 runtime, the option depends on DRM_ASAHI_G15: the firmware's
UAT is adopted through that backend's handoff helpers (Uat::new_adopted,
the G15 UAT table cleaning).

Signed-off-by: Satya Benson <satya@benson.earth>
The G14 firmware-27.2 runtime refuses render commands, but nothing in
GET_PARAMS says so. Graphics userspace therefore takes the device for
GL: on phellos (J413) with the GPU published, kmsro picked the aurora
render node for the internal panel, and the greeter's Hyprland and
sddm-greeter-qt aborted after their first renders failed with EINVAL.

Add DRM_ASAHI_FEATURE_COMPUTE_ONLY (bit 41; bits 39 and 40 are claimed by
open PRs #2059 and #2523) and set it on that runtime. It is a property
of the device, not of a board or chip list: Mesa can decline to create
a graphics screen or a graphics queue on a device that reports it, and
fall back to software rendering, while compute keeps working. Kernels
without the bit keep their current behaviour.

Signed-off-by: Satya Benson <satya@benson.earth>
…h sets

The 27.2 G14 compute start operation keeps the 13.5 G14 StartCompute
positions for its pointers (unk_pointer +0x04, job parameters +0x0c,
stats +0x14, queue +0x1c, VM slot +0x24), and its +0x28 word is at the
place of 13.5's unk_28. The 13.5 path always writes 1 there
(queue/compute.rs); this one wrote 0. With 0, an integer dot-product
kernel and a maximum threadgroup-memory dispatch never retire, and the
GPU is unusable until reboot.

Write 1, as 13.5 does.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The G14 firmware 27.2 runtime refused render commands and reported the
device compute-only. Render work needs a tiler and a fragment command
that the firmware runs on separate engines and that share one scene.

Keep the firmware root and compute bootstrap as they are. Stage both
work rings before a render is published, keep its scene and VM binding
until both engines retire, and let one DRM packet continue across
compute and render commands. Keep the parameter-buffer bindings across
render passes and answer the firmware's growth requests only after the
new backing blocks are published.

The render path reuses the common submission carrier and UAPI parser
with the G14 queue and event layouts, so the device no longer reports
itself compute-only.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Clean initial shared stamps and parameter-buffer counters before publication. Read the firmware-driven stamp after cache maintenance when observing retirement. Keep the tiler event-control index consistent between the record and the start operation, and report queue progress on timeout.

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>
Firmware can release a command slot or consume a device-control entry without sending another notification. Recheck those resources on the ordered service queue when progress is blocked and bound the wait before reporting a timeout. Keep a pending growth request on the event ring until its reply is published.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The parameter manager writes the parameter-buffer page and block lists
while the tiler runs, and the firmware rebuilds the page list when the
buffer grows. With the lists in a read-only GPU mapping, the first render
on the J473 (G14G, firmware 27.2) left a pending MMU fault: a write to a
read-only page by the parameter manager, in the client context's VM
slot. The firmware then waited forever for the context's cache flush
after the render, so no host completion stamp was written and later
work stalled.

Allocate both lists from the kernel GPU read-write range, owned by the
buffer, and keep one allocation of that range alive from initialization
so its page tables exist before the firmware window is mirrored. The
13.5 queue keeps its per-VM placement.

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>
Initialization wrote only the compute engine's kick mask in the G14
firmware 27.2 hardware data. The tiler and fragment masks stayed zero, so
the firmware never gave the tiler a kick slot and the first render never
started on the J473.

Set the tiler mask from the cluster count and the fragment mask from the
active core count, as for compute. Both counts come from the GPU's ID
registers.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
On G14 firmware 27.2 the tiler and fragment commands left the job meta's
flush_stamps word clear. The firmware's completion walk then stopped at
those commands: the GPU finished them and reached the firmware stamps,
but the host stamps were never written, the queues never retired, and the
next job timed out.

Set flush_stamps on both render commands, as the G15 firmware 27.2 path
does for every command.

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

The render admission shared with the M3 queues refuses stencil
compression outright and admits compressed depth only for one sample
and one layer, the layouts the M3 render path has been qualified for.
The G14 firmware-27.2 queue builds its render command from the same
UAPI fields, and that builder writes the depth and stencil load,
store and partial compression addresses and strides in every layout.

Mesa compresses depth and stencil by default, so every compositor
frame of GNOME Shell (depth/stencil, one sample) and every WebRender
frame of Firefox (4x MSAA, compressed depth) was rejected with
ENOTSUPP on the G14 queue.

Record per queue whether its render command builder carries the
compression words for every sample and layer count, and admit
compression by that property instead of by the M3 envelope. The M3
queues keep their current envelope. The choice follows the command
builder the queue uses, not a chip or firmware version.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The G14 firmware 27.2 runtime builds its records on a GpuManager graph
but drives the firmware over its own RTKit peer, so that graph's
`rtkit` stays None. Its render path still allocates scenes through
GpuManager::alloc(). Once the freed firmware-private objects passed the
collection limit, alloc() flushed the firmware cache with a legacy
device-control message, and the doorbell unwrapped the missing
transport:

  rust_kernel: panicked at gpu.rs:1882:51:
  called `Option::unwrap()` on a `None` value
  ... GpuManager::alloc <- g14_v27_2 Backend::new_queue <- ASAHI_QUEUE_CREATE

Any client that creates enough queues (piglit textureGather here) could
panic the kernel.

Ring every doorbell through helpers that return ENODEV when the manager
has no transport. A device-control message is queued only after the
transport is known, so no caller waits for an answer that never comes.
alloc() now asks whether the manager has device control: without one it
keeps holding freed firmware memory, because reusing it could hand the
firmware stale cached lines. It warns once instead of failing every
allocation. The 27.2 runtime still needs its own cache-flush request
before that memory can be reused.

Add KUnit tests for the collection decision.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
When a render or compute command times out on the G14 firmware 27.2
runtime, the log shows the queue stamps but not whether the GPU took a
page fault. The native firmware path reads the MMU fault status at that
point; this runtime had no register mapping to do the same.

Map the page that holds the fault status registers when the runtime
starts, choosing the registers by the GPU core as the native path does,
and log the status at every timeout. A pending fault is decoded into
address and unit. An empty status says the work stalled without a page
fault.

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

Copy link
Copy Markdown
Contributor Author

MERGETRAIN6 source review at 9884f9b46ea2. Verified that the m2pub1 build b68382cf includes this exact head. Paired render publication stages both queue posts and records the scene and VM binding before committing them. The required handoff SRAM table removes the earlier fallback.

Blocking for default enablement: the tested branch still lacks the adopted UAT teardown clean in current #2543, and the G14 thermal controller still uses fixed policy values. The runtime must use the machine-provided protection policy before enabling. The stop path also retains the firmware graph and all state even when the firmware has already stopped. Please cover rebind and reclaim after a confirmed stop, with quarantine kept for an unconfirmed stop. The J473 desktop, CTS and sleep results can qualify those exercised paths on this build.

Assisted-by: LLM (Codex)

The G14 firmware-27.2 device renders now, but its probe still logged
"compute-only DRM device registered", which reads as if render commands
were refused. Say that the DRM device is registered, and update the
function's comment to match.

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

RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks. Taking the three points in order:

  1. UAT teardown clean. It is in drm/asahi: share the 26.x wire helpers and clean bound TTBAT slots #2543's new head (152822e), which this stack does not have yet. drm/asahi: G14 compute on GPU firmware 27.2 #2544, drm/asahi: build the G14 firmware-27.2 path without the M3 runtime #2545 and drm/asahi: report the G14 firmware-27.2 device as compute-only #2610 still sit on the older drm/asahi: share the 26.x wire helpers and clean bound TTBAT slots #2543 commits. Once that chain is restacked on the new drm/asahi: share the 26.x wire helpers and clean bound TTBAT slots #2543 head, this PR rebases onto drm/asahi: report the G14 firmware-27.2 device as compute-only #2610 with nothing else changed, and the J473 row will be rerun on that base.
  2. Fixed thermal policy values. The literals at gpu/v27_2.rs controller() (0x22d4/0x2284/0x2f30 and the 5.3 coefficients) come from drm/asahi: G14 compute on GPU firmware 27.2 #2544 and are unchanged here. The fix belongs in drm/asahi: G14 compute on GPU firmware 27.2 #2544, so every path that starts the 27.2 runtime gets it. This PR does not touch those values. Like drm/asahi: report the G14 firmware-27.2 device as compute-only #2610, it should not become anyone's default kernel until drm/asahi: G14 compute on GPU firmware 27.2 #2544 takes the values from the machine.
  3. Stop path. Agreed that a confirmed stop should release the firmware graph and allow rebind, and that an unconfirmed stop should keep its quarantine. That is a lifecycle change to the drm/asahi: G14 compute on GPU firmware 27.2 #2544 runtime on its own. I'll do it as a follow-up on top of this PR, with an unbind/rebind row, rather than grow this one.

Assisted-by: LLM (Claude:Opus 5.5)

…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>

@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 audit (§1–§6) at live head 6a3cc8250f0ea124fd7f4d81afd8ee8dfd295c29 (non-draft; base: satchlj/g14-v27-2-compute-only / #2610).

What Is Verified & Clean

  • Fixes carried from #2979 / #2896: Staged tiler+fragment & compute publication with ownership recorded before cursor publication (cb9cf343), state.accepting + lock-serialized submit()/stop() (f15f3d1f), required handoff SRAM voltage table removing (*mv).max(850) (4758c763), apple,firmware-compat + LegacyWithG14Handoff selection removing literal chip_id/firmware-version gates (ec59bb6f), and safe StartCompute +0x28 = 1 (471dc3cf) without #2896's thermal-alarm disarm or perf-cap lift (STATE_CAP = 100 stays intact).
  • Shared gpu.rs panic fix (82671c76): Removing .unwrap() on self.rtkit in doorbell/device-control paths and adding GarbageAction + KUnit tests (asahi_gpu_garbage) is clean and prevents kernel panics on managers without an RTKit transport.
  • §4 Attribution & §6 Naming: Pass — all 19 commits carry human author/committer and human Signed-off-by: only; PR body ends with Assisted-by:.

Blockers (REQUEST_CHANGES)

  1. §3 Safety — missing #2543 UAT teardown PoC clean (152822e240): This branch still sits on #2610 -> #2545 -> #2544 -> old #2543 (119cce51da), so UatShared::publish_slot() lacks clean_poc write-back on VmInner::drop(). Must restack onto #2543 152822e240 (and the updated #2544–#2610 chain) and drop the duplicate #2979 forward-merge (6a3cc8250f).
  2. §3 Safety — hardcoded thermal/alarm literals inherited from #2544: RootV27_2::controller() still writes bare literals (0x22d4, 11000), (0x2284, 900), (0x2f30, 125), and crate::f32!(5.3) instead of sourcing protection inputs from the machine (failing closed when absent/malformed). Must be resolved in #2544 (and carried here) before default enablement.
  3. Code bug — fail_all() skips vm.status().record(error) for state.rendering (drivers/gpu/drm/asahi/g14_v27_2.rs): For state.inflight, fail_all() records the error on f.packet.vm.status() before finishing the packet, but for state.rendering it calls flight.packet.finish(Err(error)) without calling status.record(error). Render timeouts/crashes therefore fail to report VM fault/reset status to userspace (DRM_ASAHI_PARAM_GROUP_VM_STATUS).
  4. Lifecycle / reclaim on stop() (drivers/gpu/drm/asahi/g14_v27_2.rs): stop() unconditionally core::mem::forgets state and self.graph even after a confirmed firmware stop (only unconfirmed stops should quarantine), preventing clean unbind/rebind and resource reclaim.
  5. Minor §1 / diagnostic nits:
    • QueueRender::prepare() passes literal 1 to get_tiling_params(&to_cmdbuf(r), 1) (g14_v27_2_render.rs) instead of self.graph.dyncfg.id.num_clusters.
    • Runtime::sleep_prepare() timeout log prints state.inflight.len(), which logs 0 commands still running when an in-flight render (state.rendering.is_some()) caused the timeout.
  6. CI & §5 Evidence gaps:
    • CI on 6a3cc8250f is still in progress (rust-build, kunit, DWC3/ATC builtin-modular-atc incomplete) and host-tests does not run until retargeted onto integration/aurora.
    • J473 rows were run without #2543 152822e240; rerun on the restacked head (with bind/unbind/rebind + 0/0/0 regression gate).
    • No M2 Air (J413/J415) firmware-27.2 run has been recorded yet (§1 requires proving across affected Macs with the G14G block), and J473 s2idle resets 2/2 without GFX domain retention (#2715 or J473 DT apple,sleep-retained).

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Head is now 6a3cc82: a merge commit that brings in #2979 (no force push). All four #2979 commits were already here in render-aware form, and every conflict resolves to this series' version, so the tree is byte-identical to c458904, the head the J473 a2 row ran.

Two review items on the G14 firmware-27.2 runtime:

- fail_all() finished the in-flight render pair without recording the
  error on its VM, so the client did not see the device failure the
  compute path reports. Record it for the render pair as for compute.

- stop() kept the firmware graph and runtime state for the rest of the
  boot even when nothing could still reach them. Release them when the
  stop is confirmed: the drain retired every published command, the
  firmware reports itself stopped and no RTKit power-off was needed.
  The state lock is dropped first, so the RTKit teardown does not run
  under it. Any other stop keeps everything the firmware's page tables
  name, as before.

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

Copy link
Copy Markdown
Contributor Author

MERGETRAIN6 re-review at 42964d56f523. The render failure now records status on its VM before completing the packet. The clean stop path drops the locked state only after all published work retired and the firmware reported a voluntary stop. A forced or unconfirmed stop retains the quarantine. The two earlier source findings are addressed by this delta.

The remaining blockers are the actual restack onto the current slot-teardown fix and machine-sourced thermal policy in #2544. Please qualify a normal unbind/rebind after confirmed stop and verify quarantine for an unconfirmed stop. The prior a2 receipt predates this lifetime change.

Assisted-by: LLM (Codex)

QueueRender::prepare() passed a literal cluster count of 1 to the tiling
parameters. Use the GPU's own num_clusters, as the 13.5 render queue
does. The sleep refusal message counted only compute commands; name the
in-flight render pair too, since it also holds sleep off.

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

Copy link
Copy Markdown
Contributor Author

Thanks. Status at 027080f:

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.

Formal pre-PR checklist re-audit (§1–§6) at live head 027080fdc15b1386f204f46b01c5fb8cc36b98cc (non-draft; base: satchlj/g14-v27-2-compute-only / #2610; supersedes review #6033427540 at 6a3cc8250f).

Resolved Since 6a3cc8250f

  • fail_all() VM fault reporting (42964d56f523): drivers/gpu/drm/asahi/g14_v27_2.rs:591-594 now calls status.record(error) on flight.packet.vm.status() for state.rendering before flight.packet.finish(Err(error)), matching state.inflight.
  • §1 cluster count & sleep-refusal diagnostics (027080fdc15b): QueueRender::prepare() (g14_v27_2_render.rs:116-120) now reads dyncfg.id.num_clusters instead of literal 1, and Runtime::sleep_prepare() (g14_v27_2.rs:980-981) reports both compute commands and in-flight render pairs.
  • §4 Attribution & §6 Naming: Pass — all 21 commits (including 42964d56f523 and 027080fdc15b) carry human author/committer and human Signed-off-by: only; PR body ends with Assisted-by:.

Remaining Blockers (REQUEST_CHANGES)

  1. Lifecycle / memory-reclaim bugs in 42964d56f523's stop() path (drivers/gpu/drm/asahi/g14_v27_2.rs:388, 1054-1062 & mmu.rs:4558-4563):
    • Rebind fails with EBUSY and leaves stale page-table pointers: start() (line 388) still unconditionally runs core::mem::forget(window);, so mmu::FirmwareWindow is neither stored in State nor cleared on a confirmed stop. Dropping state and releasing self.graph frees the driver's kernel UAT tables while ttbs[0] and shared_l2 still point to them and handoff.magic_ap/magic_fw stay set to MAGIC_G14_V27_2 — causing a subsequent probe to fail immediately in FirmwareWindow::reserve() (mmu.rs:4559-4562) with Err(EBUSY) (contradicting "so it is released and a later probe starts over"). Store window in State; on a confirmed stop after halting the ASC, clear and PoC-clean ttbs[0], shared_l2, and the handoff magic/lock words before dropping window and graph (retaining core::mem::forget(window) on unconfirmed stops).
    • Confirmed-stop predicate too loose (g14_v27_2.rs:1055): if drained && running == Ok(0) && forced.is_none() does not require allowed.is_ok() or that the runtime was healthy / !state.peer.is_crashed() prior to shutdown. An idle crash (g14_v27_2.rs:899) or idle process_events failure (:905) leaves !state.running(), and if firmware_running() reads Ok(0) even when set_idle_policy(..., true) fails, stop() frees firmware-reachable memory instead of quarantining it. Require was_healthy && !state.peer.is_crashed() && drained && allowed.is_ok() && running == Ok(0) && forced.is_none() (plus ASC halt confirmation).
  2. §3 Safety — missing #2543 UAT teardown PoC clean (152822e240): Still stacked on #2610 -> #2545 -> #2544 -> old #2543 (119cce51da), so UatInner::publish_slot() (mmu.rs:2084-2090) still checks only self.quirks.clean_tables rather than self.clean_poc, and the duplicate #2979 merge commit (6a3cc8250f) remains in history. Restack onto #2543 152822e240 (and updated #2544–#2610).
  3. §3 Safety — hardcoded thermal/alarm literals inherited from #2544: RootV27_2::controller() (drivers/gpu/drm/asahi/gpu/v27_2.rs:1198-1206) still writes bare literals (0x22d4, 11000), (0x2284, 900), (0x2288, 4), (0x2f30, 125), and crate::f32!(5.3) per sensor instead of consuming machine-sourced protection values (paired with aura#402 + linux#2544) and failing closed when absent/malformed.
  4. CI & §5 Evidence:
    • CI checks on 027080fdc15b are still in progress (source, rust-build, kunit, DWC3/ATC matrix) and host-tests will not run until retargeted onto integration/aurora.
    • Prior J473 a2 run predates 42964d56f523/027080fdc15b and #2543 152822e240; rerun exact-head J473 (covering confirmed-stop unbind/rebind, unconfirmed-stop quarantine, and 0/0/0 regression gate) and record an M2 Air (J413/J415) firmware-27.2 run (§1).

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Follow-up source review at 027080fdc15b. I missed the retained firmware window in my first pass over the new stop path. start() still forgets that window. Dropping the graph while the boot handoff retains its table references would leave stale roots and can prevent rebind. Please pair reclamation with teardown of the owned window, or keep the graph quarantined while that window survives. A voluntary stop eligible for release also needs a healthy, non-crashed peer and a successful idle-policy request.

The render VM status update and hardware-derived tiling count address those findings. Hold the rebind hardware row for the corrected ownership path.

Assisted-by: LLM (Codex)

@satchlj
satchlj force-pushed the satchlj/g14-v27-2-compute-only branch from 3515e7d to 6a15a79 Compare November 24, 2026 04:33
The release added for a confirmed stop freed the runtime state and the
firmware graph while the boot handoff window, which start() keeps for
the life of the boot, still references the graph's page tables. That
leaves stale roots behind and can break a later bind. Keep everything
the firmware could reach after any stop again, as before, and say why;
releasing it needs the window torn down first.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Agreed on the retained window: start() keeps the boot handoff window for the life of the boot, so freeing the graph after a stop leaves stale roots. 3cc633f goes back to keeping everything after every stop and says why in the code. Releasing it needs the window torn down first; that is a follow-up, so there is no rebind row for now. The render VM status and tiling cluster fixes stay.

365410a merges the restacked base (#2610 6a15a79, carrying #2545/#2544 on #2543 152822e). The rewritten #2545/#2610 commits re-add the compute-only refusals (render rejected in m3_submit, the COMPUTE_ONLY feature flag), which resolve to this series' version. The net change against 027080f is the #2543 MMU teardown fix and its retention test only, byte-for-byte. asahi_core.o compiles at this head with no warnings in the G14 files.

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.

Formal pre-PR checklist re-audit (§1–§6) at live head 365410a463d98cda63322974c95c8bad664efc59 (non-draft; base: satchlj/g14-v27-2-compute-only / #2610 6a15a79e84dc; supersedes review #6033663928 at 027080fdc15b).

Resolved Since 027080fdc15b

  • Lifecycle / stop() window-reclaim UAF & loose reclaim predicate (3cc633f67993): Resolved by reverting 42964d56f523's partial stop() release. Runtime::stop() (drivers/gpu/drm/asahi/g14_v27_2.rs:1049-1055) now unconditionally retains state and self.graph alongside start()'s retained FirmwareWindow (g14_v27_2.rs:388), eliminating the stale ttbs[0]/shared_l2 page-table pointer hazard and removing the unguarded reclaim predicate. fail_all()'s render-pair vm.status().record(error) fix (g14_v27_2.rs:591-594) and 027080fdc15b's num_clusters / sleep-refusal diagnostic fixes remain intact. (For the deferred window-teardown/rebind follow-up: pair FirmwareWindow teardown and PoC-clean of ttbs[0]/shared_l2/handoff magic/lock words with was_healthy && !state.peer.is_crashed() && drained && allowed.is_ok() && running == Ok(0) && forced.is_none().)
  • §3 Safety — #2543 UAT teardown PoC clean (365410a463d9): Resolved in the live tree. 365410a463d9 merges restacked #2610 (6a15a79e84dc) → #2545 (25ac88ae153c) → #2544 (db645f400852) → #2543 (152822e24034), bringing UatShared::clean_poc into UatShared::publish_slot() (drivers/gpu/drm/asahi/mmu.rs:2087-2093) and the teardown check in tools/testing/selftests/drivers/gpu/asahi-m4/test-mmu-retention.py. Merge resolutions in Kconfig, driver.rs, m3/m3_submit.rs, and m3/mod.rs cleanly preserve the render path against 6a15a79e84dc.
  • §4 Attribution & Commit Hygiene + §6 Naming: Pass — all 21 commits in 6a15a79e84dc..365410a463d9 (including 3cc633f67993 and 365410a463d9) carry human author/committer and human Signed-off-by: only, with zero AI trailers in commits; PR body ends with Assisted-by:.

Remaining Blockers (REQUEST_CHANGES)

  1. §3 Safety — hardcoded thermal/alarm literals in RootV27_2::controller() (drivers/gpu/drm/asahi/gpu/v27_2.rs:1198-1206): Unchanged (inherited from #2544). Still writes bare literals (0x22d4, 11000), (0x2284, 900), (0x2288, 4), (0x229c, crate::f32!(1.0).to_bits()), (0x2f30, 125), (0x2f34, 1), and crate::f32!(5.3) per sensor instead of consuming machine-sourced protection values (paired with aura#402 — still at 7eb35d20e1c4 — and linux#2544) and failing closed when absent/malformed.
  2. CI & §5 Evidence:
    • CI on 365410a463d9: source, rust-build, and all 3 DWC3/ATC matrix jobs passed; kunit is still in progress, and host-tests will not run until retargeted onto integration/aurora.
    • §5 Hardware rows: The recorded J473 a2 run predates 42964d56f523–365410a463d9 (including #2543 152822e24034's UAT teardown PoC clean). Need an exact-head J473 run covering the 0/0/0 regression gate (0 SELinux denials, 0 failed units, 0 new kernel errors) and stop/quarantine verification (rebind deferred to the window-teardown follow-up), plus an M2 Air (J413/J415) firmware-27.2 run (§1) before merge.

Non-Blocking Note

  • Commit history (merge vs rebase): Because 365410a463d9 merged 6a15a79e84dc rather than rebasing onto it, 6a15a79e84dc..365410a463d9 still contains pre-restack duplicates of #2545/#2610 (3d8b62c36688, 3515e7d7d030), the #2979 merge commit (6a3cc8250f0e), the reverted 42964d56f523/3cc633f67993 pair, and merge commit 365410a463d9. The net tree diff against 6a15a79e84dc is clean, so this does not block correctness, but rebasing cleanly once #2543–#2610 land will avoid duplicate history.

Assisted-by: LLM (Gemini 4 Neon)

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