Skip to content

Clarify: non-existent CSR access raises an exception.#791

Merged
Tim Newsome (timsifive) merged 1 commit into
masterfrom
non_existent_csr
Mar 9, 2023
Merged

Clarify: non-existent CSR access raises an exception.#791
Tim Newsome (timsifive) merged 1 commit into
masterfrom
non_existent_csr

Conversation

@timsifive

Copy link
Copy Markdown
Contributor

The privileged spec already requires this.

This addresses a mailing list discussion subject:Clarification of enumeration procedure in Sdtrig ISA extension

@pdonahue-ventana

Copy link
Copy Markdown
Collaborator

This may seem strange, but it's not clear to me what a "CSR" is in this context.

Say that we have a single trigger that is hardwired with type=tmexttrigger. Then tdata3 doesn't exist. So presumably accessing tdata3 will trap. That's fine.

Say that we have two triggers where the first is as above and the second has type=mcontrol6. If tselect points to the second trigger then accessing tdata3 (textra) doesn't trap. But is it supposed to trap if tselect points to the first trigger?

Even worse, say that one of the supported triggers allows type to be either tmexttrigger or mcontrol6. Are accesses to tdata3 supposed to trap based on the type field of tdata1 when tselect points to this trigger?

I'm hoping that "CSR" for purposes of this issue means scontext, hcontext, tselect, tdata1, tdata2, tdata3, tinfo, tcontrol, mcontext, mscontext and that it does not mean the underlying state that is indirectly referenced via tselect.

@timsifive

Copy link
Copy Markdown
Contributor Author

What makes sense to me is that tdataN are implemented if any of the triggers that are implemented require it. So if any of the triggers support type 6, then tdata2 must not trap when accessed, even if the currently selected trigger only supports tmexttrigger.

I think only tdata2 is affected by this. tdata1 is required for any triggers at all, and tdata3 is orthogonal to trigger type.

I think I just wrote that I agree with you. Is that right?

@pdonahue-ventana

Copy link
Copy Markdown
Collaborator

I believe that we agree. Basically, the trap happens solely based on the instruction encoding (specifically the top 12 bits that encode the CSR number) regardless of the values in any other CSRs (such as tselect). That should be clearer in the PR.

@timsifive

Copy link
Copy Markdown
Contributor Author

I think I've clarified this.

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.

I made a comment but it was sitting in a pending review. I visited this page a few times (where the comment was visible to me) to see if you replied. Now I understand why you didn't.

Comment thread Sdtrig.tex Outdated
The privileged spec already requires this.

This addresses a mailing list discussion subject:"Clarification of
enumeration procedure in Sdtrig ISA extension"

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.

👍

@timsifive Tim Newsome (timsifive) merged commit 8232946 into master Mar 9, 2023
@timsifive Tim Newsome (timsifive) deleted the non_existent_csr branch March 9, 2023 01:01
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.

2 participants