Skip to content

drm/asahi: admit the USC cache invalidate in the G15/G16 VDM root barrier - #2523

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
ewb/g16-vdm-usc-invalidate
Nov 23, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
ewb/g16-vdm-usc-invalidate

Conversation

@erikwb

@erikwb erikwb commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Fixes #2513.

The G15 (M3 Pro/Max) and G16 (M4) VDM stream gates admit a render only when its VDM stream starts with exactly 0x21000960. Borealis's AGX3 render-start barrier sets bit 3, the USC cache invalidate (0x21000968), so the USC sees memory written since the previous render. On those GPUs that word is refused with EINVAL, so Borealis has to leave the bit out there (aurora-silicon/mesa#563).

Change

Implements what #2513 proposes:

  1. Both gates (drivers/gpu/drm/asahi/g15/gate.rs and drivers/gpu/drm/asahi/g16/gate.rs) admit the root barrier with or without the invalidate (word & !VDM_ROOT_USC_INVAL == VDM_ROOT).
  2. Add DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE (1ULL << 40) in include/uapi/drm/asahi_drm.h to tell userspace that the kernel admits it. The other backends never check the root word, so every GPU admits the invalidate once both gates do, and the bit is reported for every GPU from the shared GET_PARAMS path (drivers/gpu/drm/asahi/file.rs).

Bit 40 follows DRM_ASAHI_FEATURE_ASYNC_SUBMIT (bit 39). G15 numbers its own feature bits differently (g15/wire.rs), but those stop at bit 8, so bit 40 is unambiguous there.

The Mesa side is aurora-silicon/mesa#567 (and aurora-silicon/mesa#691): Borealis sets the invalidate on every chip when this bit is reported, and keeps #563's plain word on G15S, G15C, and G16G for kernels without it.

Testing

At head a59a31a085ad (rebased cleanly onto integration/aurora a9626a1487ad, resolving include/uapi/drm/asahi_drm.h context after bit 39; identical logic to bf94abb36db0):

  • Build (ARCH=arm64 LLVM=1, Rust 1.99.0, CONFIG_DRM_ASAHI=y, CONFIG_DRM_ASAHI_G15=y, CONFIG_DRM_ASAHI_G16=y): drivers/gpu/drm/asahi/ (asahi_core.o, built-in.a) compiled cleanly with 0 errors and 0 new warnings.
  • Host selftest: python3 tools/testing/selftests/drivers/gpu/asahi-m4/test-stream-gate.py passed 10/10 (verifying 0x21000960 and 0x21000968 are admitted and other root words are rejected).
  • Checkpatch: scripts/checkpatch.pl --git origin/integration/aurora..HEAD: 0 errors, 0 warnings.

Hardware runs:

  • J773g (Apple M4 (G16G B0), 0x8132, rev=0x10, tested by @DjDeveloperr at exact head bf94abb36db0, identical code diff):
    • Kernel 7.3.0-ARCH-m4prod12 folding bf94abb36db0:
    • DRM_IOCTL_ASAHI_GET_PARAMS (/dev/dri/renderD128): features = 0x0000010240005c06 — bit 40 (DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE) = True, bit 33 (RENDER_STAGE_PREFIXES_V2) = True.
    • Vulkan CTS (default env, /opt/mesa-v7-tc): vk-mustpass-short 87/87 PASS, full dEQP-VK.draw.*indirect* 3,710/0 PASS (3,898 total, 188 NotSupported).
    • Sustained GPU workload (dcp73a): 57/57 Wave-1 gpubench + 10/10 concurrent.sram (452,293 jobs / 835,500 job_cmds): 0 EINVAL, 0 GPU faults/recoveries/hangs, 0 kernel GPU dmesg errors.
  • J713 (M4, prior run on f394860d69ff on release/7.3.0-40 9125b3147583, identical g16/gate.rs, g16/params.rs, file.rs, and UAPI bit 40 change), compared against unpatched release/7.3.0-40 with both Mesa builds:
    • With Borealis setting the invalidate (seeing the new feature bit), dEQP-VK glsl.loops.* (624) and an fp16 graphics set (2,970) pass. Before this change, every case in both was a lost device.
    • A broad graphics set (5,685 cases) and the fragment-shader set (45,224 cases) give the same result for every case with either word, with no GPU recovery. Compute results are unchanged.
    • On the unpatched kernel, the same Mesa falls back to the plain word and gives the same results.
    • The geometry-shader subset gives the same results with either word. One case (spirv_assembly.instruction.graphics.float16.logical_nan.opfunordequal_vector_geom) hangs the GPU with the plain word on the unpatched kernel too, so that hang is not from this change.

Tested-by: @DjDeveloperr

Still to run

  • Live J773g follow-up with Borealis (aurora-silicon/mesa#691) submitting 0x21000968 on this kernel.
  • G15 hardware verification on an M3 Pro/Max (not available locally; the G15 gate uses the same bit-3 mask as G16).
  • Full §5 regression check on J713 (explicit 0 failed units / 0 new kernel errors summary; J713 runs Arch ARM without SELinux enabled).

Assisted-by: LLM (Anthropic:Claude, Google:Gemini 4 Neon)

@erikwb erikwb changed the title drm/asahi: g16: admit the USC cache invalidate in the VDM root barrier drm/asahi: admit the USC cache invalidate in the G15/G16 VDM root barrier Nov 20, 2026
@erikwb
erikwb force-pushed the ewb/g16-vdm-usc-invalidate branch from d273ece to e48f401 Compare November 20, 2026 06:00
@RyanTheTide

Copy link
Copy Markdown
Contributor

Independent check at e48f401:

  • tools/testing/selftests/drivers/gpu/asahi-m4/test-stream-gate.py passes 10/10. It now admits both 0x21000960 and 0x21000968 on G16.
  • The G15 and G16 gates mask only bit 3 (word & !0x8 == 0x21000960), so no other root word gets through.
  • The feature bit is ORed in after gpu.feature_flags() in file.rs, so the G15 wire numbering in g15/wire.rs leaves bit 40 alone.
  • G15 has no host gate test. We have no M3 Pro/Max or M4, so we can't add a G15/G16 hardware row. Our M4 Pro runs the G17 backend, which has no such gate.

satchlj added a commit that referenced this pull request Nov 21, 2026
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 <[email protected]>
satchlj added a commit that referenced this pull request Nov 21, 2026
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 <[email protected]>

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

Adversarial review of e48f4014 against the pre-PR checklist.

Checklist summary

  • Code / UAPI / CI: 0 code blockers.
    • drivers/gpu/drm/asahi/g15/gate.rs:164 and drivers/gpu/drm/asahi/g16/gate.rs:117 both mask strictly bit 3 (word & !VDM_ROOT_USC_INVAL != VDM_ROOT), admitting only 0x21000960 and 0x21000968.
    • drivers/gpu/drm/asahi/file.rs:589 ORs DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE (1ULL << 40) after gpu.feature_flags(), clear of both canonical bits (0..38, plus 39 in #2059) and G15 native wire bits (0..8, legacy mask 0xfc00).
    • tools/testing/selftests/drivers/gpu/asahi-m4/test-stream-gate.py covers both admitted words and rejections; host-tests is green.
  • §1–§3, §6: Pass.
  • §4 (Attribution): 1 blocker below.

Blocker

  1. §4 Attribution in commit message: Commit e48f401422e4 contains Developed with Claude Code. in the commit body. Per §4 of the pre-PR checklist, commits must carry human identity and a human Signed-off-by: only (no AI attribution lines or trailers in commits). Please amend the commit to remove Developed with Claude Code. and replace the PR body footer (🤖 Generated with [Claude Code]...) with a plain Assisted-by: line at the end of the PR body.

§5 Evidence notes

  • The J713 (M4) dEQP-VK results look solid; please also record the exact kernel commit/build tested and confirm the §5 regression check (0 SELinux denials, 0 failed units, 0 new kernel errors).
  • G15 (drivers/gpu/drm/asahi/g15/gate.rs) has not yet been tested on M3 Pro/Max hardware (noted in the PR body); a G15 hardware confirmation from someone with an M3 Pro/Max is still needed for full cross-generation §1/§5 coverage.

Assisted-by: LLM (Gemini 4 Neon)

@erikwb
erikwb force-pushed the ewb/g16-vdm-usc-invalidate branch from e48f401 to bf94abb Compare November 22, 2026 07:24
@erikwb

erikwb commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Gemini 4 Neon responding on behalf of erikwb

Fixed the §4 attribution blocker in bf94abb36db0:

  • Amended the commit message to remove Developed with Claude Code., keeping the code diff byte-for-byte identical to e48f401422e4 (git diff e48f401422e4 is empty) with only Signed-off-by: Erik Bourget <[email protected]>.
  • Updated the PR body to replace the Generated with footer with a plain Assisted-by: line and recorded the exact J713 kernel build tested (f394860d69ff on release/7.3.0-40 9125b3147583, with identical G16 gate/params/file.rs/UAPI bit 40 changes).
  • Re-ran python3 tools/testing/selftests/drivers/gpu/asahi-m4/test-stream-gate.py (10/10 passed) and scripts/checkpatch.pl (0 errors, 0 warnings).
  • Noted the §5 regression summary (Arch ARM on J713 has no SELinux) and pending M3 Pro/Max G15 hardware confirmation under "Still to run".

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Live hardware verification on M4 Mac mini (Apple M4 (G16G B0), J773g, 0x8132, rev=0x10), kernel 7.3.0-ARCH-m4prod12 folding exact head bf94abb36db0:

  • DRM_IOCTL_ASAHI_GET_PARAMS (/dev/dri/renderD128): features = 0x0000010240005c06 — bit 40 (DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE) = True, bit 33 (RENDER_STAGE_PREFIXES_V2) = True.
  • Vulkan CTS (default env, /opt/mesa-v7-tc):
    • vk-mustpass-short: 87/87 PASS
    • Full dEQP-VK.draw.*indirect*: 3,710/0 PASS (3,898 total, 188 NotSupported)
  • Sustained GPU workload (dcp73a): 57/57 Wave-1 gpubench + 10/10 concurrent.sram (452,293 jobs / 835,500 job_cmds): 0 EINVAL, 0 GPU faults/recoveries/hangs, 0 kernel GPU dmesg errors.

We will follow up next with exact-head aurora-silicon/mesa#691 R2 (d8e57cf460b6) tested on this same kernel.

Assisted-by: LLM (Gemini:4 Neon)

satchlj added a commit that referenced this pull request Nov 22, 2026
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 <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

bf94abb only changes the commit message (same tree, 9439de11, and parent as e48f401), so our earlier check still holds.

Thanks for the J773g row at bf94abb. It shows bit 40 exposed and no regressions on G16 (87/87 short mustpass, 3,710 indirect-draw passes, 0 EINVAL and no faults over the sustained run). It doesn't say whether that Mesa submits 0x21000968, so the mesa#691 run on the same kernel will be the one that shows the new word admitted live. After that, only G15 on an M3 Pro/Max is still untested.

Assisted-by: LLM (Claude:Opus 5.5)

…rier

The G15 (M3 Pro/Max) and G16 (M4) VDM stream gates admit a render only
when its VDM stream starts with exactly 0x21000960. Mesa's AGX3
render-start barrier sets bit 3, the USC cache invalidate (0x21000968),
so that the USC sees memory written since the previous render; on those
GPUs it has to leave the bit out, or the render is refused with EINVAL.

Admit the root barrier with or without the invalidate in both gates.
The other backends do not check the root word, so every GPU now admits
it: report that on every GPU with DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE,
so userspace can set the bit whenever the kernel reports it and keep the
plain word on older kernels. Bit 40 is unused in both the canonical and
the G15 feature numbering.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb
erikwb force-pushed the ewb/g16-vdm-usc-invalidate branch from bf94abb to a59a31a Compare November 22, 2026 17:05
@erikwb

erikwb commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Gemini 4 Neon responding on behalf of erikwb

Rebased cleanly onto integration/aurora (a9626a1487ad) as a59a31a085ad (resolving the include/uapi/drm/asahi_drm.h context conflict after bit 39 DRM_ASAHI_FEATURE_ASYNC_SUBMIT, with zero logic changes from bf94abb36db0) and updated the PR body with @DjDeveloperr's exact-head J773g PASS row.

  • Verification at a59a31a085ad: arm64 LLVM=1 (Rust 1.99.0, CONFIG_DRM_ASAHI_G15=y, CONFIG_DRM_ASAHI_G16=y) build of drivers/gpu/drm/asahi/ passed with 0 errors and 0 new warnings; python3 tools/testing/selftests/drivers/gpu/asahi-m4/test-stream-gate.py passed 10/10; scripts/checkpatch.pl passed with 0 errors and 0 warnings.
  • J773g hardware row: Thanks @DjDeveloperr for the bf94abb36db0 verification on M4 Mac mini (Apple M4 (G16G B0), bit 40 exposed, 87/87 short mustpass, 3,710/0 indirect-draw CTS, 452,293 sustained jobs with 0 EINVAL/0 faults).

Remaining runs are the live Borealis aurora-silicon/mesa#691 (0x21000968) verification on this kernel and G15 confirmation on an M3 Pro/Max.

@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 §1–§6 pre-PR checklist re-review at live head a59a31a085ad: APPROVE.

Checklist verification

  • §1 (No model gating): Reports DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE ((1ULL) << 40) unconditionally on every GPU via shared GET_PARAMS (drivers/gpu/drm/asahi/file.rs:589), cleanly following bit 39 (DRM_ASAHI_FEATURE_ASYNC_SUBMIT) after rebase onto integration/aurora and clear of G15's wire numbering (0..8). Zero model or SoC gating.
  • §2 (Production-ready, no hacks): Works on the default kernel command line with zero hacks or parameters.
  • §3 (Safety): Both drivers/gpu/drm/asahi/g15/gate.rs:199 and drivers/gpu/drm/asahi/g16/gate.rs:249 strictly mask only bit 3 (word & !VDM_ROOT_USC_INVAL != VDM_ROOT), admitting only 0x21000960 and 0x21000968.
  • §4 (Clean-room & attribution): Prior blocker resolved. Single commit a59a31a085ad carries human author/committer and human Signed-off-by: only (zero AI lines/trailers in commit message), and the PR body ends with a plain Assisted-by: line. Not superseded on integration/aurora.
  • §5 (Evidence) & CI: host-tests CI is green; test-stream-gate.py passes 10/10, ARCH=arm64 LLVM=1 build and checkpatch.pl are clean. Live hardware verified on J773g (Apple M4 (G16G B0), identical logic at bf94abb36db0: bit 40 exposed via GET_PARAMS, 87/87 vk-mustpass-short, 3,710/0 dEQP-VK.draw.*indirect*, 452,293 sustained jobs with 0 EINVAL and 0 GPU faults/dmesg errors) plus prior J713 M4 A/B with Borealis submitting 0x21000968 (fixing 624 glsl.loops.* and 2,970 fp16 graphics lost-device failures). (M3 Pro/Max G15 and live J773g mesa#691 runs remain tracked as follow-up rows.)
  • §6 (Naming): Clean (uses Borealis).

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide
RyanTheTide merged commit b9cfe21 into integration/aurora Nov 23, 2026
1 check passed
satchlj added a commit that referenced this pull request Nov 24, 2026
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 <[email protected]>
@RyanTheTide
RyanTheTide deleted the ewb/g16-vdm-usc-invalidate 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drm/asahi: G15/G16 VDM admission gate rejects the USC cache invalidate bit (Mesa #434 broke graphics on M3 Pro/Max and M4)

3 participants