Skip to content

asahi: translate the retained G15 wire under virtio - #34

Open
arslanrakh wants to merge 1 commit into
omacom:integration/aurorafrom
arslanrakh:fix/g15-virtio
Open

arslanrakh wants to merge 1 commit into
omacom:integration/aurorafrom
arslanrakh:fix/g15-virtio

Conversation

@arslanrakh

Copy link
Copy Markdown

Fixes the guest side of omacom/omarchy#18111: on M3 (G15S), Vulkan inside muvm finds no GPU, so nothing run through muvm + FEX (Steam, x86 games) gets acceleration.

Cause

The retained G15 kernel speaks the Mesa-751 wire. On the native path, agx_open_device normalizes its feature word (agx_g15_wire_features) and agx_submit repacks every command buffer (agx_g15_wire_pack). Both are skipped under virtio (if (!dev->is_virtio && ...), from 97a65d8: "Preserve the canonical paths for other devices and virtio").

virglrenderer forwards GET_PARAMS (group 0) and the SUBMIT command buffer to the same G15 kernel unchanged (asahi_ccmd_get_params / asahi_ccmd_submit). So the guest sees the raw 0x3e features and fails agx_params_native_kernel_abi_supported:

Incompatible native AGX3 kernel contract (features 0x3e); use the kernel matched to this Mesa build; ...

asahi_proto.h is identical to virglrenderer 1.3.0's, so the guest and host protocol already agree.

Change

  • agx_device.c: apply the G15 feature normalization under virtio too, but mask VM_STATUS and VM_STATUS_MIRROR for virtio guests. virglrenderer rejects param_group != 0, and hk_check_status / hk_init_vm_status_mirror issue raw DRM_IOCTL_ASAHI_GET_PARAMS on the guest virtio-gpu fd, which would turn every wait into a device loss.
  • agx_device_virtio.c: when g15_legacy_wire is set, translate the command buffer with agx_g15_wire_pack straight into the ccmd payload (the output is never larger than the input), and shrink cmdbuf_size and hdr.len. Also check the request calloc.

The native host path is unchanged.

Testing

On a 16" M3 Pro (Mac15,7, G15S B1), linux-aurora 7.2.11.aurora14-1, muvm 0.7.0, libkrun 1.19.6, virglrenderer 1.3.0. I used a Vulkan-only build loaded through VK_ICD_FILENAMES, with system packages untouched.

before after
aarch64 guest vulkaninfo Incompatible native AGX3 kernel contract Apple M3 Pro (G15S B1), Borealis
aarch64 guest vkmark headless 1080p, full suite — score 3789–3848, 13/13 scenes
x86_64 guest via FEX vulkaninfo no x86 driver Apple M3 Pro (G15S B1), Borealis
x86_64 guest via FEX vkmark headless 1080p, full suite — score 4011, 13/13 scenes
host vkmark cube 1080p (native path) 7224 fps unchanged

The aarch64 results were first measured on a196911, then rebuilt and retested on this branch (integration/aurora b7b03c5). I built the x86_64 driver from the same patch on a196911 under FEX, with the aarch64-built mesa_clc / vtn_bindgen2 / asahi_clc as --native-file binaries, as in the mesa-aurora PKGBUILD tools stage. There were no asahi kernel errors on the host during any run.

Not tested: i386, GL/Zink in the guest, real games, and the unit test suite (-Dbuild-tests=false).

Packaging follow-up (outside this repo): x86_64 and i386 builds of mesa-aurora with this patch, shipped as a FEX overlay in place of the stock mesa-fex-emu-overlay-*.

🤖 Generated with Claude Code

The retained G15 kernel speaks the Mesa-751 wire. On the native path,
agx_open_device normalizes its feature word and agx_submit repacks every
command buffer with agx_g15_wire_pack, but both are skipped under
virtio. virglrenderer forwards GET_PARAMS (group 0) and SUBMIT to the
same G15 kernel unchanged, so a guest on an M3 sees the raw 0x3e
features, fails agx_params_native_kernel_abi_supported, and enumerates
no GPU inside muvm.

Apply the same normalization under virtio, and translate the command
buffer directly into the ccmd payload in agx_virtio_submit; the
retained wire is never larger than the canonical input. Mask
VM_STATUS and VM_STATUS_MIRROR for virtio guests: virglrenderer rejects
param groups other than 0, and hk_check_status and
hk_init_vm_status_mirror issue raw GET_PARAMS on the guest fd, which
would turn every wait into a device loss.

Also check the calloc result in agx_virtio_submit.

Tested on a 16" M3 Pro (Mac15,7, G15S) inside muvm 0.7.0 with
virglrenderer 1.3.0: aarch64 and x86_64 (via FEX) vulkaninfo now
report Apple M3 Pro (G15S B1), and headless vkmark at 1080p passes
13/13 scenes. The native host path is unchanged.

Refs: omacom/omarchy#18111

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Enables retained G15 wire support for virtio guests without changing the native submission path.

  • G15 Vulkan guests can use the retained GPU through virtio.

No actionable issues found. No builds or tests were run.

Author arslanrakh explicitly identifies disabled VM status checks as intentional: those queries cannot reach the host through the current virtio path.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read GPU parameters] --> B{Retained G15 signature?}
  B -->|No| C[Keep existing path]
  B -->|Yes| D[Normalize features]
  D --> E{Virtio guest?}
  E -->|No| F[Keep native packing path]
  E -->|Yes| G[Mask unsupported VM status features]
  G --> H[Pack commands into request]
  H --> I[Append external resources after packed commands]
  I --> J[Send request with updated length]
Loading

Reviews (1) · Last reviewed commit: "asahi: translate the retained G15 wire u..." · Reviewed by Greptile

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.

1 participant