Skip to content

fix(agc): correct PRIME_UTCL2 arguments and packets - #19191

Merged
oneandonlydean merged 4 commits into
boykopovar:mainfrom
JJenkx:fix/agc-prime-utcl2-abi
Nov 28, 2026
Merged

oneandonlydean merged 4 commits into
boykopovar:mainfrom
JJenkx:fix/agc-prime-utcl2-abi

Conversation

@JJenkx

@JJenkx JJenkx commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

sceAgcAcbPrimeUtcl2 and sceAgcDcbPrimeUtcl2 took three arguments and wrote a NOP. Correct both public declarations to the measured five-argument interface (command buffer, cache permissions, prime mode, address, page count) and emit the five-dword PRIME_UTCL2 packet (opcode 0x5d), including the graphics engine bit. The public writers mask permission, mode and page-count fields and round the address down to a 16 KiB boundary, matching the recorded console exports. The driver names the opcode and validates the raw packet fields and engine selection when decoding guest command buffers. PRIME_UTCL2 execution preserves guest memory and queue register state.

The contract is from six cases in prosper's pinned console measurements, SHA-256 aa6cc7b818a1016c20732e4547cea8c12b0472aec681bcf11f8f9a3c897f7de3. The earlier 131,072-vector comparison with PPSA06652's bundled compatibility module also matched permissions/mode masks, 16 KiB address rounding, 14-bit page count, engine bit, return pointer and cursor advance. That module is not authenticated retail firmware; this is no new console measurement.

Host GPU translation is managed by the host driver; guest prefetch and acknowledgement timing remain unmodelled and are recorded in debt. Preserve command-buffer allocation failure behavior. No title unblock or FPS gain claimed.

Merged main 54160814c992 into the existing topic at b7bfb7a6fec1. The sole manual conflict is the oracle-status table: retain main's removal of resolved PopMarker rows and this topic's removal of six resolved PrimeUtcl2 rows. All three production prime builder bodies, the opcode 0x5d validator and the focused prime fixture retain their exact source from the previous reviewed head c0dcf418bd01.

Tested

Latest focused merge qualification (2026-11-27 UTC): candidate b7bfb7a6fec1e63d58f3263ee72de149a0b9ee6c, pinned main 54160814c99200758e940191c3c0c249b76fb331.

The same three CTest names pass on both arms, 3/3 each: public_headers, agc_prime_utcl2_tests, and agc_driver_buffer_descriptor_runtime. Each arm uses its own committed fixtures. This covers the public interface, packet writing and validation, and a physical-GPU descriptor regression. It is integration coverage of the merge; no fresh negative-control or oracle comparison was run.

Linux 7.3.5-arch1-1 / GCC16.2.1 / Release / SPIRV-Tools disabled, Ryzen9 7950X / RX6650XT / RADV Mesa26.3.1-2. The GPU case requires physical Vulkan, disables shader caches, and inserts Khronos validation1.4.363 with headers335. One actual layer insertion per arm; zero skips, VUIDs or SYNC-HAZARD messages. Loader traces initialize each arm's own raw driver. Source, executable and driver hashes remain unchanged; 49 matching recursive dependency pins. Each complete arm used the shared FIFO and released its sentinel after terminal cleanup; no fixture processes remain.

Conventions, debt folding and topic whitespace pass. Later main f8a67ff6a6fbe merges cleanly by source-only preview. Earlier full SDK, oracle and Windows evidence remains scoped to its original heads; this adds no title, FPS or console-timing claim. Initial configuration/fixture-selection corrections were retained and excluded before tests: the invalid execution selector was cleared and the mock Graphics case was replaced by the actual GPU runtime case. Both admitted arms and completed build phases exited0.

Complete source/merge checks, commands, logs, JUnit, provider and cleanup receipts — 38 payloads, anonymous download and every payload hash verified; SHA-256 d362bcde84aad2646ac5cf8dc4f3939fe92c4f15cb4b10c8c902c1bbfb397d99.

Earlier Arch Linux qualification (original heads): main e4caa07950f862269fbe664e3502b15544161e1f, fixture-only control 7f8bb51815dcb9a090dc2ea8d701d85b85b72c9e, change c0dcf418bd01ccdf61019e35c234fac47ce4a5fb. AMD Radeon RX 6650 XT, RADV/Mesa 26.2.7, Vulkan validation 1.4.363 (headers 335).

  • Full SDK/relinker and focused builds pass on both arms. Both frozen 836-file native/raw banks have verified commit tags, unchanged hashes and isolated dependencies; mutable source restored.
  • Identical four CTest gates: control has the two expected prime-packet/opcode-catalog failures and passes graphics/mock plus physical alpha-to-coverage; change passes all four. Required Vulkan, no shader cache, one physical-device/layer insertion per GPU arm, zero skips, missing-layer warnings or VUID errors.
  • Common typed compile-time arity adapter calls main's unchanged three-argument declaration or the changed five-argument declaration. The independent raw-register oracle supplies the measured arguments directly, without the adapter.
  • Pinned oracle: 209 compared each; main 137 known findings, change 131. Exactly six Acb/DcbPrimeUtcl2 a/b/c findings disappear. No added findings or kind changes. Thirteen existing AtomicGds/Branch/AtomicMem/DmaData findings vary in raw detail (retained in the evidence); no full ABI claim for those exports. The same six stale AcquireMem ledger entries are inherited from main on both sides; this PR adds none.
  • Conventions pass against upstream/main and origin/main; diff check clean. Structural public-header audit passes: 413 libraries / 34,647 exports. Own debt fragment parses/applies in memory. Global folding hits an unchanged NKWebKit selector on main; separate docs(libSceNKWebKit): remove obsolete inventory-count selector #21531 addresses that documentation defect and is not included in the tested tree.
  • Official overlap scan covers 1697 open heads, with fail-closed shared-context comparisons. Captured and inspected all 10 peer shared patches at live SHAs: none changes PrimeUtcl2/opcode 0x5d or the AtomicMem signature. perf(agc): cut the CPU work of PM4 register writes, submission copies and validation #18914's validation refactor must preserve the new whitelist/validator; fix(libSceAgc): write the console's pop marker tag #19051 removes independent PopMarker ledger rows. No functional dependency or blanket composition claim.
  • No new native-title, FPS, bundled-module, console-timing or Windows result claimed. Earlier Windows evidence targets an older head.

Verified logs, source/control patches, fixtures and qualification report, SHA-256 97a943e3555dc0b353c0bc76d26aea29555c301f67cd528155be371dfb568344; all 76 payloads verified after download.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.3.1-2, Arch Linux 7.3.5-arch1-1 (latest focused qualification); earlier hardware reports retain their original heads below.
  • AI-assisted: yes

Summary by CodeRabbit

  • New Features
    • AGC graphics and compute commands now support UTCL2 priming with configurable cache permissions, prime mode, address, and page count.
    • The graphics command processor now recognizes and validates UTCL2 prime packets, including packet size, control values, address alignment, and page-count limits.

@JJenkx

JJenkx commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@AlexWhitehouse @MauriceSirius: this independent PRIME_UTCL2 correction has mechanical overlap with #16878 (supported-opcode list/catalog count) and #19051 (adjacent, different known.tsv deletions). It does not implement either PR's packet. I propose keeping your older PRs ahead of this one; I will refresh #19191 after either merges, retain both opcode additions (catalog count 58 after #16878), and preserve both sets of oracle removals after #19051. No functional dependency or agreement is assumed. The scoped trial-merge findings are described in the PR.

AI-assisted: yes

@github-actions github-actions Bot added docs agc libSceAgc* labels Nov 13, 2026

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

Reviewed PR 19191: PRIME_UTCL2 arguments and packets — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Head SHA 7404465805094d6a48fd3fefb402420b5d2356c8, base main. No build and no tests were run. The review read the diff and the head text through the reader:

python3 repo_read.py search PrimeUtcl2
python3 repo_read.py search "void Validate("
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 299 330
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 420 470
python3 repo_read.py cat core/libs/prx/libSceAgc/CMakeLists.txt 505 530
python3 repo_read.py cat core/libs/prx/libSceAgc/DcbState/include/Display.hpp 1 8

Results

Check Result Note
Build and ctest (agc_prime_utcl2_tests, agc_driver_pm4) not run Author reports 12/12 passed, three repeats per arm
Six reference packets in tests/PrimeUtcl2.cpp not run Expected words checked by hand against the packet encoding; they agree
Test target links the driver not run CMakeLists.txt links libSceAgcDriver
Opcode catalog count not run 57 with this PR; the count of 58 applies once #16878 is also merged

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgc/DcbState/include/Display.hpp:10 — the new declaration spells std::uint32_t, while the other declarations in this header use bare uint32_t. Matching the neighbours keeps the header consistent:
uint32_t* APS5_VABI sceAgcDcbPrimeUtcl2(CommandBuffer* buf, uint32_t cachePermission, uint32_t primeMode, const volatile void* address, uint32_t pageCount);

Sources

Not verified

  • Build, unit tests and the packet tests were not run here. The author's Linux x86-64 runs are reported, not performed by me.
  • The GPU runs (alpha-to-coverage on RX 6650 XT with validation layers) are author-reported only.
  • The 131,072-vector comparison against the bundled compatibility libSceAgc is author-reported. That module is not retail firmware, and the PR claims no new console measurement.
  • The six console oracle cases in the external prosper golden file were not fetched, so the expected payloads were checked only against the test file.
  • The overlap with #16878 and #19051 and the later-main merge preview were not checked. Windows was not tested, as the author states.
  • Files read: the diff hunks of all 13 files listed in files.json under reviewed. Head text only for Pm4.cpp lines 299–330 and 420–470, CMakeLists.txt lines 505–530 and Display.hpp lines 1–8. No file was read in full. Excluded by rule: none.

To get this to a good state

Nothing is required.

Optional: the uint32_t spelling in Display.hpp:10 above.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 27589 core/libs/prx/libSceAgc/Acb/src/Memory.cpp L48-51 sceAgcAcbPrimeUtcl2
PR 27937 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp L291

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6186 core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
PR 12944 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 15136 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
PR 18914 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 20294 core/libs/prx/libSceAgc/DcbState/src/Display.cpp
tools/library-oracle/known.tsv
PR 21059 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
PR 22029 core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 22156 core/libs/prx/libSceAgc/Command/src/Memory.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 22434 core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 22647 core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 23188 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
tools/library-oracle/known.tsv
PR 27635 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 27684 core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 27807 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
tools/library-oracle/known.tsv

@angrysandhill

Copy link
Copy Markdown
Contributor

Windows check of head 7404465805, merged onto main c76eb6a264 (clean merge). Setup: Windows 10 22H2, AMD Radeon RX 6750 XT (gfx1031), Adrenalin 26.10.1 (driver 32.0.21045.16010), WinLibs GCC 15.2, Release.

  • Tests: ctest -R '^(agc_prime_utcl2_tests|agc_driver_pm4|.*alpha_to_coverage.*)$' passes 9/9. The same tests pass on main.
  • Validation layer: the seven alpha-to-coverage tests also pass under VK_LAYER_KHRONOS_validation 1.4.367 with ANYPS5_REQUIRE_VULKAN=1, with 0 VUID- lines and no missing-layer warnings.
  • Negative control on main:
    • the new tests/PrimeUtcl2.cpp does not build against main's three-argument sceAgcAcbPrimeUtcl2/sceAgcDcbPrimeUtcl2 ("too many arguments");
    • the new libSceAgcDriver/tests/Pm4.cpp alone fails with reference opcode catalog is incomplete.
  • Replay of the pinned agcbuild measurements, same replay executable for both:
    • main: 92 compared, 156 known findings;
    • this PR against main's known.tsv: exactly the six {Acb,Dcb}PrimeUtcl2_a/b/c rows now match, and nothing new appears;
    • this PR with its own known.tsv: 150 known, 0 new, 0 now matching.

Not checked: Linux, real titles.

AI-assisted: yes

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 14, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 14, 2026

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

Reviewed — looks good

The change updates the ACB and DCB PRIME_UTCL2 interfaces to take five arguments and emit the corresponding packet. It adds driver validation and handling for the packet and removes the six corrected cases from the known-differences list.

What I ran

No commands were run. The review read 13 of 13 changed files, 96 of 96 added lines, through the repository reader at head e2da8639d3ae5aeec824b70fb4fafc817aa37119, in 2 parts.

Results

Check Result Note
Change review passed Every added line was read.
Automated checks not run Author-reported results were not independently run.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

  • Console oracle and compatibility library: The packet contract and CPU comparison depend on external console measurements and bundled compatibility-library binaries.
  • Physical GPU behavior: GPU validation-layer runs and physical alpha-to-coverage regression behavior require GPU hardware and measurements.

To get this to a good state

Nothing is required.

@JJenkx
JJenkx force-pushed the fix/agc-prime-utcl2-abi branch from e2da863 to fd11aed Compare November 15, 2026 08:34
@JJenkx

JJenkx commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed on main 324dc5aae57113ce9ed9fa707eb2ef0814eb76dc without merge commits. New head fd11aedf010f6108134150f032f4c2d12b4a0fae preserves main opcode 0x51 plus PRIME_UTCL2 0x5d (catalog 58), migrates the debt edits to a fragment, and adds a typed fixture adapter for a runtime main/change negative control.

Fresh Linux: change passes all four focused gates; control exposes the two expected failures. Raw oracle 209 compared each, 147 to 141 known findings: exactly six PrimeUtcl2 cases fixed, no new/stale AGC-profile findings or kind changes. Physical RX6650XT/validation1.4.363 on each arm, zero skips/VUIDs. Full SDK/relinker builds pass and both 836-file banks stay unchanged. Verified evidence.

Mechanical overlap with #19051 remains separate PopMarker ledger deletions. #18914 refactors validation and must preserve the new opcode handler when composing. No fresh Windows or title-performance claim.

AI-assisted: yes

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

Reviewed — looks good

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head fd11aedf010f6108134150f032f4c2d12b4a0fae using repo_read.py against the prepared diff and pinned repository files. I did not run builds or tests; the qualification results below are author reported.

Results

Check Result Note
Diff and changed code passed Read all changed files listed as reviewed.
Builds and tests not run The description reports Linux qualification; I did not independently verify it.
Security and performance not run No separate runtime audit was performed.

Findings

Blocking

None.

Non-blocking

None.

Not verified

I read all ten changed files listed as reviewed in manifest.json; none were excluded. I did not independently confirm the console measurement provenance, bundled-module comparison, Linux qualification logs, merged-preview build, Windows behavior, or physical-console behavior. The description explicitly notes that its compatibility module is not authenticated retail firmware and that this refresh adds no new console timing measurement. files.json was not available through the reader.

To get this to a good state

Nothing is required.

@JJenkx
JJenkx force-pushed the fix/agc-prime-utcl2-abi branch from fd11aed to c0dcf41 Compare November 16, 2026 10:59
@JJenkx

JJenkx commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Rebased the three owned commits onto main e4caa07950f862269fbe664e3502b15544161e1f; new head c0dcf418bd01ccdf61019e35c234fac47ce4a5fb. The conflict resolution preserves main's newer AtomicMem signature alongside the corrected five-argument PrimeUtcl2 signature; all three prime builder bodies match the previous reviewed code.

Fresh Linux: full SDK/relinker builds pass; identical four gates give the two expected control failures and all four change passes. Physical RX6650XT, required Vulkan/no cache, validation1.4.363 loaded on both arms, zero skips/VUIDs. Oracle209 comparisons each: 137→131 known findings, exactly six prime cases corrected, no new findings/kind changes. The evidence records 13 raw detail variations and the same six stale AcquireMem entries inherited from main; no new title/FPS or Windows claim.

Downloaded and verified evidence (76 payloads). Description updated with exact pins, overlap review and the unrelated main debt-fold failure addressed separately by #21531.

AI-assisted: yes.

@JJenkx

JJenkx commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

The historical Windows failure on this PR is from an unrelated libc regression, rather than the PRIME_UTCL2 change.

The failed job checks out main e4caa07950f8 and fails only guest_multibyte_locale, at “wcstombs fills the capacity mid-character”. At that exact checkout, wcstombs delegates to whole-character wcsrtombs; it predates the revert cc1c20e0dd18. This PR's tested head c0dcf418bd01 does not change either codec source file.

I reproduced the boundary result with verbatim production-function components: current Linux and MinGW 16.2/Wine 11.22 agree across 327,680 UTF-16-unit/capacity cases (digest c0ac660fb91701e0) and pass the capacity-four assertion. The old implementation reproduces the assertion failure (digest ce486b3d46dd9ee0). The source/ancestry receipts for the historical CI checkout are included in the evidence archive.

This component result does not replace a fresh full Windows check against current main. It establishes why changing/rebasing this AGC code to address that old codec failure would target the wrong source. No additional change was pushed to this PR.

AI-assisted: yes

@JJenkx

JJenkx commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Windows follow-up on the failing windows check (run 43853898246, 2026-11-16 11:00 UTC, head c0dcf418bd): guest_multibyte_locale aborted with 0xc0000409.

It doesn't reproduce here:

  • this head merged onto current main bfb39f4f5a (973f1b8668, clean merge): guest_multibyte_locale passes in each of 3 runs;
  • current main alone passes it, in a full non-device sweep at b5460b9e94 (4,576 of 4,576).

This PR changes AGC packet code, which the libc locale test doesn't use. So the red status looks stale or runner-related, inferred from it not reproducing. Re-running the windows check would refresh it.

Setup: Windows 11 Enterprise 22621, AMD Ryzen 9 5950X, WinLibs GCC 15.2 UCRT r7, Release.

AI-assisted: yes.

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

Reviewed — comments

Nothing blocks this; the points below are optional.

What I ran

Reviewed head c0dcf418bd01ccdf61019e35c234fac47ce4a5fb. No commands or tests were run; this review used the prepared diff and the pinned repository reader. The description reports qualification results, which I did not independently run.

Results

Check Result Note
Changed code review passed All 12 changed files were read
Tests and builds not run Results in the PR description were not independently verified
Runtime behavior not run No title or console run performed

Findings

Blocking

None.

Non-blocking

  • docs/dev/debt/changes/agc-prime-utcl2.md:3 removes the sceAgcDcbPrimeUtcl2 debt item, but the existing entry in docs/dev/debt/libSceAgc.md:39 remains. The code search found that stale entry still saying both builders write a NOP. Please update the existing ledger entry or confirm the debt-generation process removes it when this fragment is applied.

Not verified

  • No checks or tests were run in this review; the build, CTest, oracle and hardware qualification claims come from the PR description.
  • No new console measurement, title behavior, Windows behavior, or physical timing was verified.
  • Reviewed files: core/libs/prx/libSceAgc/Acb/include/Memory.hpp, core/libs/prx/libSceAgc/Acb/src/Memory.cpp, core/libs/prx/libSceAgc/Command/include/Memory.hpp, core/libs/prx/libSceAgc/Command/src/Memory.cpp, core/libs/prx/libSceAgc/DcbState/include/Display.hpp, core/libs/prx/libSceAgc/DcbState/src/Display.cpp, core/libs/prx/libSceAgc/tests/PrimeUtcl2.cpp, core/libs/prx/libSceAgcDriver/Execution/include/Pm4Opcodes.hpp, core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp, core/libs/prx/libSceAgcDriver/tests/Pm4.cpp, docs/dev/debt/changes/agc-prime-utcl2.md, and tools/library-oracle/known.tsv. All 12 changed files were included in the review folder; none were excluded.

To get this to a good state

Nothing is required. Optionally reconcile the stale debt ledger entry noted above.

@JJenkx

JJenkx commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed against the reviewed head c0dcf418bd01ccdf61019e35c234fac47ce4a5fb: the fragment removes that existing ledger entry when applied.

I verified the exact-head debt_fold.py, check_conventions.py, fragment and both target ledgers, then ran this fragment's two operations through debt_fold.parse / debt_fold.apply in memory. The libSceAgc selector [sceAgcDcbPrimeUtcl2] matches the one existing entry containing the Acb/Dcb NOP wording; after application its count changes 1 → 0, including removal of the stale “Both write a NOP” text. The second operation adds the remaining unmodelled prefetch/acknowledgement timing limitation to libSceAgcDriver.

The raw ledger is intentionally unchanged on this branch: the repository's fragment workflow requires the change through a pending fragment. No direct ledger edit or production-code change is needed for this point. This was an isolated check of this PR's fragment, not a claim that every unrelated pending fragment folds globally.

AI-assisted: yes

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 26, 2026
@JJenkx

JJenkx commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Resolved the main conflict and pushed b7bfb7a6fec1. The oracle table now combines main's resolved PopMarker removals with this topic's six PrimeUtcl2 removals. The three production prime builders, opcode0x5d validation block and prime fixture remain byte-identical to the prior reviewed head.

3/3 focused CTests pass on both candidate and pinned main54160814c992: public headers, PrimeUtcl2 packet checks and the actual physical-RX6650XT buffer-descriptor runtime case. Own committed fixtures per arm; zero skips/VUID/SYNC-HAZARD, validation1.4.363 inserted for each GPU case, own-driver loader traces and unchanged hashes verified. Both reservations released after cleanup. Conventions, debt folding and topic whitespace pass; later mainf8a67ff6a6fbe merges cleanly by source-only preview.

Complete 38-payload evidence — SHA-256 d362bcde84aad2646ac5cf8dc4f3939fe92c4f15cb4b10c8c902c1bbfb397d99; anonymous download and all hashes verified. Description includes setup corrections and full scope. No fresh full SDK, oracle, Windows, title or performance qualification; older reports keep their original pins.

AI-assisted: yes.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: UTCL2 Prime Packet

Layer / File(s) Summary
Prime packet API and emission
core/libs/prx/libSceAgc/.../Memory.hpp, core/libs/prx/libSceAgc/.../Memory.cpp, core/libs/prx/libSceAgc/DcbState/..., core/libs/prx/libSceAgc/tests/PrimeUtcl2.cpp
The ACB and DCB entry points pass cache permission, prime mode, address, and page count to WritePrimeUtcl2. The writer emits opcode 0x5d, encodes control fields, aligns the address to 16 KiB, and masks the page count to 14 bits. Tests check packet contents and writer behavior.
PM4 validation and execution
core/libs/prx/libSceAgcDriver/Execution/..., core/libs/prx/libSceAgcDriver/tests/Pm4.cpp, docs/dev/debt/changes/agc-prime-utcl2.md
The driver catalogs and recognizes opcode 0x5d, validates packet size and fields, rejects graphics-engine packets on compute queues, and executes valid packets without further action. Tests cover validation and state preservation. The documentation describes the implementation’s modeling limits.

Suggested labels: prx

Suggested reviewers: boykopovar, dotdebian, alexwhitehouse

Change: Bug fix

Merge Risk: Minimal · up to b7bfb · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Security architecture risk: Minimal · up to b7bfb

The change corrects how guests request translation-cache priming. The emulator checks the new command but does not use its address to access memory or change GPU state. Commands that follow it still undergo the same checks.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The change broadens which guest command streams the driver accepts, not the authority of the commands in those streams. A valid prime packet no longer causes the whole submission to be rejected, but later packets still pass through the same validation loop.

Trust Boundaries and Controls

  • observed — Submission validation checks that the packet fits within the command stream. The opcode-specific validator then checks the exact length, header and control flags, engine compatibility with the queue, address alignment, and page-count bounds. These are format checks, not authorization to access the supplied address.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 27f939ee-aec0-4465-9171-bb699e03a9e2
Commits

Reviewing files that changed from the base of the PR and between 5416081 and b7bfb7a.

Files ignored due to path filters: 1

  • tools/library-oracle/known.tsv is excluded by !**/*.tsv
Files selected for processing: 11

  • core/libs/prx/libSceAgc/Acb/include/Memory.hpp
  • core/libs/prx/libSceAgc/Acb/src/Memory.cpp
  • core/libs/prx/libSceAgc/Command/include/Memory.hpp
  • core/libs/prx/libSceAgc/Command/src/Memory.cpp
  • core/libs/prx/libSceAgc/DcbState/include/Display.hpp
  • core/libs/prx/libSceAgc/DcbState/src/Display.cpp
  • core/libs/prx/libSceAgc/tests/PrimeUtcl2.cpp
  • core/libs/prx/libSceAgcDriver/Execution/include/Pm4Opcodes.hpp
  • core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
  • core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
  • docs/dev/debt/changes/agc-prime-utcl2.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

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

Reviewed — changes requested

The packet writer silently truncates unsupported argument bits, so callers can receive a successful packet containing different cache permissions, prime mode, address, or page count than they supplied.

What I ran

Reviewed head b7bfb7a6fec1e63d58f3263ee72de149a0b9ee6c using the prepared diff and repo_read.py at the pinned head. No tests were run. The description reports focused CTest results; those are author-reported and were not independently verified here.

Results

Check Result Note
Changed code review passed All changed files were included and read
Tests not run Focused runs are author-reported

Findings

Blocking

  • core/libs/prx/libSceAgc/Command/src/Memory.cpp:54-55 masks cachePermission, primeMode, the address low bits, and pageCount instead of rejecting unsupported encodings. For example, primeMode=2 is encoded as mode 0 and a misaligned address is rounded down, while packet validation sees only the already-truncated packet. This contradicts the description's claim that unsupported encodings are rejected and can make the guest command act on a different request. Validate the original arguments before emitting the packet (including address alignment and field widths).

Non-blocking

None.

Not verified

No tests or build checks were run. The PR description's reported CTest, hardware, oracle, and merge qualification results were not independently confirmed.

To get this to a good state

Reject unsupported permission/mode bits, misaligned addresses, and page-count overflow before packet emission, then add tests that call the public writers with those inputs and assert failure without modifying the command buffer.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 27, 2026
@JJenkx

JJenkx commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10, I clarified the description. The public ACB/DCB writers normalize their arguments as the recorded console exports do. The decoder applies the rejection rules to raw packet words received from the guest.

I rechecked all six pinned console rows against b7bfb7a6fec1. The console returned the packet pointer and wrote five words in all six cases. The pre-emission checks suggested in the review would reject all six.

  • The _b inputs include mode 2 and address 3. The console emits the low mode bit and rounds the address down to zero.
  • The _a inputs also include permissions 0x11111111 and page count 0x44444444. The console emits permissions 1 and page count 0x444, with address 0x33330000. The DCB capture sets the graphics engine bit.

At this head, testReferencePackets already calls both public writers with these inputs and checks the emitted words, return pointer and cursor. testPacketValidation separately checks rejection of malformed raw packets. The linked exact-head Linux qualification passed the fixture. This recheck decoded the existing captures and made no new console measurements. Pinned console rows · Exact-head Linux qualification

AI-assisted: yes

@oneandonlydean
oneandonlydean dismissed MarcZX10’s stale review November 27, 2026 20:55

The writers normalize their arguments the way the console exports do. testReferencePackets in libSceAgc/tests/PrimeUtcl2.cpp pins six recorded console rows for both the ACB and DCB writers, and rejecting before emission would refuse all six. The author answered this on 27 Nov with the row details.

@oneandonlydean
oneandonlydean merged commit 8970cd2 into boykopovar:main Nov 28, 2026
17 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants