Repository navigation
drm/asahi: g17: map validated command and queue records firmware-only - #3225
Conversation
Every G17 execution context includes the kernel's upper half. The kernel builds and checks records there that the firmware then reads: kick entries, command descriptors, queue records with their pointer blocks and item rings, per-publication configuration records, and scheduler pages. Several of those mappings also gave the GPU write access: - on G17P, the render kick rings, the render and compute command descriptors, each context's scheduler page and the device-wide compute scheduler; - on G17P and M5, the render queue records, configuration records and support pages, and each compute queue's graph, announcement and configuration records, preemption buffer and usage page. GPU work from any client could therefore rewrite another client's command, or a queue's pointers, owner and context, after the kernel had checked them and before the firmware read them. Map them firmware-only. The GPU reads kick rings and command descriptors through their read-only lower aliases. It reaches a compute queue's preemption buffer and usage page through the aliases a binding maps into its client VM. Neither changes. M5 already mapped its kick rings, descriptors and scheduler pages this way (commits 68e51c0 and 64a142c). Signed-off-by: Dj <[email protected]>
|
Reviewed Two adjacent upper-half
Happy to run a J616C (M4 Max / T6041) hardware row once the G17P test runs are ready. |
|
Thanks for the careful review, and for checking the T6040/T6041 paths. Agreed on both. I'll take them in a follow-up PR with its own J700 smoke, rather than widen this one while its rows are queued:
A J616C row would be very welcome. Please test #3242's head |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict at 59942890: HOLD. I found no code blocker, but it isn't merge-ready.
Missing before merge
- Rebase. It now conflicts in
g17/queue/compute.rsafter #3186 made the G17P compute descriptors firmware-cached. The rebased head combines firmware-only with cached on G17P, which has never booted. That's low risk, because render descriptors already do it, but it needs a row. - A row at the head, on both families.
- The J700 smoke ran at
71bb8d31, before #3186, together with #3242's commits and log-only lines. The head itself was only built. - M5 protections also change: render queue/config records, the render support page, and the compute graph, records, preemption and usage pages. No M5 Mac was booted.
- Needed: J700 (G17P) and J714s (M5) at the new head, with renders, compute and timestamps exercised.
- The J700 smoke ran at
Please confirm
- On M5,
m5_usage()(memory.rs:254) hands addresses in the now firmware-only render support page to the command tail (resolved_tail_value). Does only the firmware write there? - On G17P, the render
Supportpage holds parameter-buffer state and scene entries that point back into it (block_table,counter,statistics). On the parameter-buffer graph you said you'd first check what the tiler writes. The J700 smoke's 0 faults suggests these are firmware-only, but please state it.
Checked
- Every changed upper-half object against GPU use. Preemption, usage and operand pages reach the GPU through client aliases from
bind(), and kick rings and descriptors use the low aliases.m5_timestampsand the G17P compute support page deliberately stay GPU-mapped. - Each pooled family keeps one protection. It removes
is_m5gates and adds none. --only g17220/220.
Non-blocking: a host test pinning the new protections, like #3186's cache-policy check, would keep them from regressing.
#3242 stays held behind this.
Bring the branch up to date with main. main made the G17P compute descriptors firmware-cached (#3186); this branch maps them firmware-only. Keep both: cached on G17P as main does, firmware-only on every G17. Signed-off-by: Ryan Murray <[email protected]>
|
@DjDeveloperr: forward-merged main (normal push, no rebase); new head |
…n-state Take #3225's forward merge of main, which this branch builds on. main made the G17P work-state pages firmware-cached; this branch maps them firmware-only. Keep both: cached on G17P as main does, firmware-only on every G17, which leaves kernel_prot unused, so drop it. Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
Verdict: HOLD at 6bf65945
Blockers:
- Hosted CI checks on
6bf65945are still queued (apple-build,host-tests, KUnit matrix,pr-readiness,pr-text). - Exact-head hardware rows on
6bf65945are still needed on both families — J700 (G17P) and J714s (M5) — exercising render, compute, and timestamps, because forward-mergingmain(#3186) combines G17P firmware-cached compute descriptors (cached_bytes = size) withPROT_FW_SHARED_RWfor the first time. - Two open confirmation questions from the prior review remain unanswered (
m5_usage()inmemory.rsand G17P renderSupportpage self-pointers being firmware-only writes).
Checked:
- Forward-merge resolution (
6bf65945, DCO on both commits,MERGEABLEonmain):drivers/gpu/drm/asahi/g17/queue/compute.rs: cleanly combinesmain's G17P firmware-cached prefix (if alloc.uat.is_m5() { 0 } else { size }) withmmu::PROT_FW_SHARED_RWonDescriptorRing::new(), keepslower = mmu::PROT_GPU_FW_SHARED_RWforoperandandcontext_low, keepssupport_protsplit for#3242, and keepsm5_timestampsGPU+FW mapped.drivers/gpu/drm/asahi/g17/context.rs: preservesmain'sExposureline andkernel_prot(still used forwork_stateuntil#3242), movingscheduler(both M5 pooled and G17P ordinary) toPROT_FW_SHARED_RW.drivers/gpu/drm/asahi/g17/initdata.rs,kick.rs,queue/render/memory.rs:ComputeScheduler, render kick ringhigh, and render descriptors/records/support pages usePROT_FW_SHARED_RWwhile GPU reads lower/client aliases; pooled families keep uniform protection.
- Host tests reported passing locally (
run-host-tests.py --only g17283/283).
Evidence
- Diff vs
main:+30/-24across 5 files, 2 commits (59942890,6bf65945), DCO on both,MERGEABLEonmain. - Code and merge-resolution audit found no blockers; ready to approve once hosted CI is green, exact-head J700 + J714s rows pass, and the two confirmation items are answered.
|
@DjDeveloperr #3225 is now at |
There was a problem hiding this comment.
Verdict: MERGE at 6bf659451f28
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - Forward-merge resolution (6bf65945, DCO on both commits, MERGEABLE on main):
drivers/gpu/drm/asahi/g17/queue/compute.rs: cleanly combinesmain's G17P firmware-cached prefix (if alloc.uat.is_m5() { 0 } else { size }) withmmu::PROT_FW_SHARED_RWonDescriptorRing::new(), keepslower = mmu::PROT_GPU_FW_SHARED_RWforoperandandcontext_low, keepssupport_protsplit for#3242, and keepsm5_timestampsGPU+FW mapped.drivers/gpu/drm/asahi/g17/context.rs: preservesmain'sExposureline andkernel_prot(still used forwork_stateuntil#3242), movingscheduler(both M5 pooled and G17P ordinary) toPROT_FW_SHARED_RW.drivers/gpu/drm/asahi/g17/initdata.rs,kick.rs,queue/render/memory.rs:ComputeScheduler, render kick ringhigh, and render descriptors/records/support pages usePROT_FW_SHARED_RWwhile GPU reads lower/client aliases; pooled families keep uniform protection.- Host tests reported passing locally (
run-host-tests.py --only g17283/283).
Follow-ups (not blocking): queued CI; exact-head J700/J714s rows; answer m5_usage and support-page questions
|
Merging at |
What: Map the G17 records the kernel validates and the firmware then reads firmware-only in the kernel's upper half, which every execution context includes:
GPU work from any client could rewrite these after the kernel checked them and before the firmware read them. The GPU's own access goes through the read-only lower aliases and the client-VM aliases, which don't change. M5 already mapped its kick rings, descriptors and scheduler pages this way (68e51c0, 64a142c).
Tested: Built at
59942890a5fc(asahi profile, Image + modules) with no new warnings. Host tests: G17 220/220, Neo 14/14, M5 97/97, T6040/T6041 1/1 each. J700 (G17P) smoke of the same change at71bb8d314626, together with #3242's commits and log-only lines:The 48 multiview query/timestamp CTS cases that failed on that kernel fail the same way on main without it (#3243).
Risk: Two-way · every G17 GPU (A18 Pro, M4 Pro/Max, M5 family); shared drm/asahi G17 code.
Not yet: J700 (G17P) and J714s (G17S) rows, queued at #3242's head
9583ee437211, which carries this commit unchanged: Vulkan CTS sync, compute, draw and renderpass subsets vs main, GL and VK gpubench smoke, a gpubench-vk ABBA/BAAB perf A/B, and the raw-address shader on both Macs. M4 Pro/Max rows after merge. Textual overlap with #3186 (adjacent lines incontext.rsandqueue/compute.rs); whichever lands second resolves it.protkeeps its name inGraph::new, so #3186's cache-policy test still matches.Details
Only protections change; cache attributes, sizes and placements stay as they were. The pooled families keep one protection per family (descriptors, queue state, queue config, scheduler), so a reused pooled object never comes back with a different one. The compute queue's stamp page and the G17P work-state, stamp and free-list pages follow in a separate PR.