Skip to content

Updated arch_test.h interrupt handler defaults#837

Open
SadhviNarayanan wants to merge 2 commits intoriscv:act4from
SadhviNarayanan:trap_handler
Open

Updated arch_test.h interrupt handler defaults#837
SadhviNarayanan wants to merge 2 commits intoriscv:act4from
SadhviNarayanan:trap_handler

Conversation

@SadhviNarayanan
Copy link
Contributor

Updated arch_test.h interrupt handler defaults, for example mapped RVMODEL_MCLR_SSW_INT and RVMODEL_SCLR_SSW_INT to RVMODEL_CLR_SSW_INT instead of the default trap handler, if the individual flavors are not explicitly defined.

@allenjbaum
Copy link
Collaborator

allenjbaum commented Jan 8, 2026 via email

@jordancarlin
Copy link
Collaborator

Why was the M/U mode table removed? The intent of the trap handler is to deal with any hart configuration, and that includes models that don't have Smode.

We ran into an issue when an M-mode interrupt test attempts to write to the supervisor interrupt pending bits of mip (mip.SEIP for example). If S-mode is not supported, mip.SEIP is read-only zero. If S-mode is supported, the interrupt is taken (assuming mideleg is cleared). Writing to the mip.SEIP bit needs to be tested either way. This is an M-mode only test and does not instantiate the supervisor trap handler because it will be run on cores that do not support S-mode, but if the core it is running on does support S-mode, then the machine trap handler needs a way to clear the interrupt. If S-mode is not supported, supervisor interrupts will never be taken and this part of the trap vector table will never be exercised, so it shouldn't matter if the table is fully populated even without S-mode.

A lot of these changes seem unnecessary, e.g. the original names of the form. Why is there a difference between an Mmode macro for an Smode handler, vs just using the Smode macro even if you're in Mmode? Mmode is capable of executing anything that Smode can do. I'm not sure who made those changes

It's unclear to us as well why there are two variants of the S-mode interrupt macros. That's what @davidharrishmc was asking in a recent email. If no-one can think of a good reason to have multiple versions of the interrupt macros, we'd prefer to drop the RVMODEL_MCLR_SSW_INT and RVMODEL_SCLR_SSW_INT macros and just use a RVMODEL_CLR_SSW_INT macro when in both priv modes.

I'm also not sure why the default was replaced with an empty macro (which is what the sequence #ifndef X; #define X X does). If you want that behavior, then just leave it the way it was and add #ifndef RVTEST_DFLT_INT_HNDLR #define RVTEST_DFLT_INT_HNDLR

That's not what this PR is doing. The priv mode specific variants of the macros (eg RVMODEL_MCLR_SSW_INT and RVMODEL_SCLR_SSW_INT) are being defined to use the mode-agnostic RVMODEL_CLR_SSW_INT macro if the priv mode specific variants are not defined.

@allenjbaum
Copy link
Collaborator

allenjbaum commented Jan 13, 2026 via email

@jordancarlin jordancarlin added the ACT4 Issues or PRs applicable to ACT4 label Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ACT4 Issues or PRs applicable to ACT4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants