Skip to content

mte_vatag: add stateen interaction - #103

Merged
Florian Mayer (fmayer) merged 3 commits into
riscv:mainfrom
radimkrcmar:stateen
Aug 6, 2026
Merged

mte_vatag: add stateen interaction#103
Florian Mayer (fmayer) merged 3 commits into
riscv:mainfrom
radimkrcmar:stateen

Conversation

@radimkrcmar

Copy link
Copy Markdown
Contributor

Since the CSRs expose new architectural state that needs to be managed for lower privileges, we must make sure that they do not create unintentional communication channels.

Copilot AI review requested due to automatic review settings June 25, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Svatag specification to describe how access to the tag-table base CSRs interacts with stateen gating, with the goal of preventing unintended communication channels via newly exposed architectural state.

Changes:

  • Add a new “Accessibility of Svatag CSRs” section describing when CSR accesses trap based on Smstateen/Ssstateen and mstateen0/hstateen0 settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/mte_vatag.adoc Outdated
Comment thread src/mte_vatag.adoc Outdated
@radimkrcmar

Copy link
Copy Markdown
Contributor Author

While reviewing #102 (comment), I forgot that we already add a new state for the Svatag, so that comment was unjustified.

This PR currently only handles the existing CSRs, I'll rebase and probably choose a different placement after the other PR gets merged.

Since the MTE CSRs expose new architectural state that needs to be
managed for lower privileges, we add interaction with stateen to make
sure that the CSRs do not create unintentional communication channels.
@radimkrcmar

Copy link
Copy Markdown
Contributor Author

I moved the access restriction from stateen closer to CSR definitions. It avoid the need for another conditional based on whether Zimt/Svatag are supported.

Note that stateen may not be the only solution -- we already have the envcfg bits, which could also be used to avoid access to the CSRs from lower privileges.

@Adam-pi3

Copy link
Copy Markdown
Collaborator

It makes sense, thanks Radim Krčmář (@radimkrcmar). Florian Mayer (@fmayer) and deepak0414 can you take a look as well?

Comment thread src/mte_tag.adoc Outdated
exception if Smstateen is implemented and `mstateen0.MTE=0`.

CSR access to `senvmtagexclude0`, and `senvmtagexclude1` from VS mode causes
virtual instruction exception if Ssstateen is implemented, `hstateen0.MTE=0`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be hstateen0.MT instead?

Signed-off-by: Florian Mayer <fmayer@google.com>
Signed-off-by: Florian Mayer <fmayer@google.com>
@fmayer
Florian Mayer (fmayer) merged commit 555c876 into riscv:main Aug 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants