Repository navigation
G17P Mesa: the USC window base container needs a terminating CODE block (fragment-end page fault, found on M4 Pro) #362
jgoyvaerts
started this conversation in
A18
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary. With the G17P Mesa (
agx3bat dba15302), every render after the first fails on an M4 Pro (T6040, J616s, firmware 25G83). The cause is the USC window base page thatagx_open_device()maps for G17P. It holds only the 0x340-byte container lead and then zeros. At the end of every fragment pass, the shader core executes from the first CODE block slot after the lead and keeps going until it reaches an END. Behind a bare lead it runs through the zeroed page into the unmapped guard page and takes a hard page fault. The fix is to follow the lead with one CODE block whose programs are a lone END (the m1n1 witness shape). With that fix, 102 consecutive renders are correct.The same read probably happens on A18 Pro. Whether it shows up there depends on how unmapped reads are handled. The kernel advertises
DRM_ASAHI_FEATURE_SOFT_FAULTS(defaultfault_control=0xb), but as far as I can see the G17 runtime never programsfault_controlinto the firmware. Could someone with an A18 Pro check whether a fault is being silently absorbed there?Setup
0c8a_a322_0396_04c0).drivers/gpu/drm/asahiG17 runtime to T6040, inert unlesst6040_attach=1. Not public yet.aurora-silicon/mesaagx3bdba15302, plus one local patch that admits T6040 as G17P. GL_RENDERER is "Apple A18 Pro (G17P B1)", GLES 3.2.Symptom. Frame 1 reads back correct. The firmware then raises a recovery with reason 3 (page fault), blaming the fragment queue. The render's TA stamp is written, but its fragment-end stamp never is. Every later submit gets EIO.
The MMU fault registers at recovery time, decoded with
regs.rs::get_fault_infofor G14X+:0x4000 is the guard page that follows the 16 KiB "G17P USC window base" BO.
Bisect. I used a temporary env knob to map more pages at the base and to place AGX3 END (
0e 00 00 00) at chosen offsets. Each row is a fresh client on the same boot.So the fault follows the end of whatever is mapped, and any END at or after 0x340 stops it. Something enters at or before 0x340 and runs forward. This contradicts the comment in
agx_device.cthat the lead's own block-size dword "terminates the chain".Fix (1 page as before; confirmed with default settings and with
ASAHI_MESA_DEBUG=sync,nocompress, 102/102 frames each):The patch is free for anyone to take. I can also open it as a PR against
agx3bif that's preferred.Assisted-by: LLM (Claude). The analysis and patch were checked on the hardware above.
All reactions