Add gentag exclusion-mask CSRs - #102
Conversation
Add pairs of CSRs to hold a 128-bit tag generation exclusion mask for gentag. The mask controls which pointer tag values gentag may generate, allowing software to exclude special values such as zero for untagged pointers. Define mask semantics for 4-bit and 7-bit pointer tags, clarify that the mask affects only gentag, and leave CSR addresses to be allocated. This commit addresses riscv#92.
Luís Fiolhais (lfiolhais)
left a comment
There was a problem hiding this comment.
As a final point on my side, we also need to address the fact that the addition
of these CSRs create a data syntactic dependency in the memory model between
gentag and the *tagexclude CSRs. Specifically, the dependency as the
*tagexclude as sources and the destination operand of gentag as the
destination.
I can add the following sentence: |
|
|
||
| When `pointer_tag_width = 7` is supported by the implementation, bits `[127:0]` | ||
| are writable, subject to the requirement that the read-back value leaves at | ||
| least one tag value permitted for every supported `pointer_tag_width`. |
There was a problem hiding this comment.
"requirement that the read-back value leaves at
least one tag value permitted for every supported pointer_tag_width"
isn't that requirement also needed for tag_width = 4?
There was a problem hiding this comment.
I guess my actual comment: this shouldn't be in the same sentence as "When pointer_tag_width = 7"
There was a problem hiding this comment.
Florian Mayer (@fmayer) what about #102 (comment)
LGTM 👍 |
Clarify that gentag depends on the active exclusion-mask CSRs for memory-model syntactic dependencies. Also specify that the exclusion-mask CSRs are legalized on write, that changing pointer_tag_width does not modify the mask, and that at least one tag value in the mandatory 4-bit tag range must remain permitted.
|
Thanks for the PR Adam 'pi3' Zabrocki (@Adam-pi3). All of my concerns were addressed. Apologies for the sparse replies. I'm at the EU Sumit and don't have much time to look at my laptop. |
|
I didn't notice this PR before the meeting, sorry. When adding new architectural state, we also have to provide protection against side channel usage on software that doesn't context-switch it. A bit in |
| | `henvmtagexclude1:henvmtagexclude0` | ||
|
|
||
| | VU | ||
| | `senvmtagexclude1:senvmtagexclude0` |
There was a problem hiding this comment.
Out of curiosity -- are there performance reasons against providing a single CSR pair for all privilege levels?
There was a problem hiding this comment.
Thanks. For the `stateen point, I understand your later comment that this is already covered by the existing new state added for Svatag, so I did not add a separate stateen bit in this PR.
On the single-CSR-pair question: I don't think the main reason for separate CSR pairs is performance. The intent was to mirror the existing per-execution- environment MT_MODE structure and allow M, S/HS, U/HU, and VS/VU contexts to have independent gentag exclusion policies. A single global pair would be simpler architecturally, but it would couple host/guest/kernel/user/M-mode policy and could require extra save/restore when switching between domains that want different excluded tags.
Add pairs of CSRs to hold a 128-bit tag generation exclusion mask for gentag. The mask controls which pointer tag values gentag may generate, allowing software to exclude special values such as zero for untagged pointers.
Define mask semantics for 4-bit and 7-bit pointer tags, clarify that the mask affects only gentag, and leave CSR addresses to be allocated.
This commit addresses #92.