dm: Fix / workaround issues with halts during & before resets
#295
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.
This PR contains two commits aimed at addressing flaky/inconsistent JTAG behaviour seen in various OpenTitan tests which appeared to originate from resetting and then halting the hart using the RV_DM over JTAG.
The first commit contains a bug fix to the
pulp_rv_dmwhere harts could be seen as idle/halted across being reset (and no longer being halted), causing halt acknowledgements to not be transmitted due to caching. The second commit contains a work-around (self-contained withindm.cwithout changes to the RISC-V CPU) to address the fact that halt requests sent to unresponsive harts are currently dropped whereas the RISC-V Debug specification states that they should instead be applied immediately when the hart becomes responsive. See the commit messages for more detailed explanations.Also, as a related question (not planning to address in this PR): I have noticed in
dm.cthat upon an NDM reset the entire system is reset (which appears to include the debug module itself, from tracing) despite the fact that the DM itself is not supposed to be reset. I wonder if there's some logic I'm missing that means this reset is not a problem or if this could cause other issues down the line?