Repository navigation
fix(dmac): drain GIF DMA chains through IRQ tags to the END-tag CHCR readback - #402
Open
LeandroSSB wants to merge 1 commit into
Open
LeandroSSB wants to merge 1 commit into
LeandroSSB wants to merge 1 commit into
Conversation
…readback The generic DMA chain walk suspended the transfer at the first tag with IRQ set when CHCR.TIE=1. In this runtime DMA is synchronous and the channel interrupt is delivered once at the drain - there is no resume protocol for a suspension. The drain cleared STR/QWC (channel "idle") while CHCR.TAG stayed pinned at the suspending CNT tag. Games that poll completion by reading the terminal tag id in CHCR[31:16] - canonical on the EE: the last tag of a chain is END (id 7) and hardware keeps the processed tag in the readback - then spin forever. On MOH:Vanguard the main thread parked for the whole run on ((CHCR >> 28) & 7) == 7 (5M+ reads, 0 hits), starving the entire pipeline behind it. The walk no longer ends the chain at irq && tieEnabled; the channel interrupt still fires at the drain (queueCompletedDmacCause in processPendingTransfers, unchanged), and the processed tag's upper word still latches into CHCR[31:16] for the readback. Tests: new case "GIF DMA chain with TIE drains through an IRQ tag to the END-tag readback" (kick with TIE=1 over a CNT+IRQ+END chain: both payloads reach the GS in order and the readback latches id 7) and a rework of the old oracle that consecrated the suspension behavior. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The generic DMA chain walk suspended the transfer at the first tag with IRQ set when
CHCR.TIE = 1. In this runtime DMA is synchronous and the channel interrupt is delivered once at the drain — there is no resume protocol for a suspension. The drain then cleared STR/QWC (channel looks "idle") whileCHCR.TAGstayed pinned at the suspending CNT tag (id 1).Games that poll completion by reading the terminal tag id in
CHCR[31:16]— canonical on the EE: the last tag of a chain is END (id 7) and hardware keeps the processed tag in the readback — then spin forever. On MOH:Vanguard the main thread parked for the whole run on((CHCR >> 28) & 7) == 7(5M+ reads, 0 hits), starving the entire pipeline behind it.Fix
The walk no longer ends the chain at
irq && tieEnabled; the reason is recorded for diagnostics and the drain continues to the END tag. The channel interrupt still fires once at the drain (queueCompletedDmacCauseinprocessPendingTransfers, unchanged), and the processed tag's upper word still latches intoCHCR[31:16]for the readback.Test
ps2_memory_tests:Measured (MOH:Vanguard)
Kick
CHCR = 0x90000184(TIE=1) with a CNT+IRQ chain: before, the drain stopped at the IRQ tag and the game spun on the pinned CNT id; after, the drain crosses the IRQ tag to END and the readback latches id 7 — the sync spin is extinct.🤖 Generated with Claude Code
Suite evidence
Fresh configure+build of
ps2x_testson this branch (VS 2022, Release): 447/447 passed, 0 failed.