Skip to content

Clarify authorisation of PREFETCH.I in integer mode#900

Draft
tariqkurd-repo wants to merge 4 commits intoriscv:mainfrom
tariqkurd-repo:remove_pcc_reference
Draft

Clarify authorisation of PREFETCH.I in integer mode#900
tariqkurd-repo wants to merge 4 commits intoriscv:mainfrom
tariqkurd-repo:remove_pcc_reference

Conversation

@tariqkurd-repo
Copy link
Collaborator

@tariqkurd-repo tariqkurd-repo commented Dec 16, 2025

Clarify authorisaton of prefetch.i in integer mode

@tariqkurd-repo tariqkurd-repo added the documentation Improvements or additions to documentation label Dec 16, 2025
@arichardson
Copy link
Collaborator

Jumps are definitely authorized by PCC and I thought prefetch was as well? I don't recall changing that

@jrtc27
Copy link
Collaborator

jrtc27 commented Dec 16, 2025

How is this "out of date"? This is the place that defines that behaviour!

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Dec 17, 2025

This is hybrid mode text - but in any case jump and branch targets are no longer authorised by PCC - because we removed all of the target exception checks - the only thing which can happen now is detagging the target PCC if the target is unrepresentable - there's no actual authorisation against PCC.

For prefetch.i maybe things aren't quite so clear - but - using PCC bounds to authorise the prefetch isn't implementable - as in a high performance architecture with PCC prediction there may be many sets of PCC bounds in flight at once. As it's a prefetch this leaves us with a few options:

  1. make the rule into a recommendation
  2. delete the authorisation clause - as PREFETCH.I is indistinguishable from a hardware prefetcher
  3. use DDC bounds - as PREFETCH.I is likely to execute in the LSU

...but as it stands, requiring accurately authorising PREFETCH.I with PCC bounds forces only having one set of PCC bounds in flight and so disables PCC prediction, or just makes PREFETCH.I execute as NOP as the authority can't be checked in a sensible way.

@jrtc27
Copy link
Collaborator

jrtc27 commented Dec 17, 2025

It’s authorised by PCC in the same way that capability mode AUIPC reads PCC. If you’re speculating on PCC then that’s what you use. Though you want to be careful about speculative execution attacks…

Also, can we please stop changing the spec in substantive ways? Maybe the branch one is a clarification and nothing more, but PREFETCH.I is not. The spec is supposed to be frozen for ARC review.

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Dec 17, 2025

It’s authorised by PCC in the same way that capability mode AUIPC reads PCC. If you’re speculating on PCC then that’s what you use. Though you want to be careful about speculative execution attacks…

Also, can we please stop changing the spec in substantive ways? Maybe the branch one is a clarification and nothing more, but PREFETCH.I is not. The spec is supposed to be frozen for ARC review.

The idea isn't to change the spec for any purpose but fixing bugs. My intention in the past had been to remove PCC from prefetch.i checks I had obviously failed to do so as that clause remained in the Zyhybrid chapter.

I'll make a separate PR for removing PCC for authorising branches, as that part isn't contentious (#902)

We can have a separate discussion about a more implementable spec for prefetch.i, right now it's not very implementable.

@tariqkurd-repo tariqkurd-repo marked this pull request as draft December 17, 2025 11:24
@tariqkurd-repo tariqkurd-repo changed the title remove out of date PCC reference Clarify authorisaton of PREFETCH.I in integer mode Dec 17, 2025
@tariqkurd-repo tariqkurd-repo changed the title Clarify authorisaton of PREFETCH.I in integer mode Clarify authorisation of PREFETCH.I in integer mode Dec 17, 2025
tariqkurd-repo added a commit that referenced this pull request Dec 18, 2025
There is still a statement about jumps being authorised by PCC in
integer mode.
This is no longer the case, as jumps no longer fault.
There is an associated query about using PCC to authorise `PREFETCH.I`
which is addressed in #900
Signed-off-by: Tariq Kurd <tariq.kurd@codasip.com>
@nwf
Copy link
Collaborator

nwf commented Dec 23, 2025

In at least some proposed uses of hybrid mode, PCC and DDC are not "infinite" capabilities and are likely to be disjoint, so I'd think anything that looks like "instruction address" should be considered PCC-authorized.

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Dec 24, 2025

In at least some proposed uses of hybrid mode, PCC and DDC are not "infinite" capabilities and are likely to be disjoint, so I'd think anything that looks like "instruction address" should be considered PCC-authorized.

Yes - I agree - and for something like AUIPC[C] then clearly PCC needs to be used - as Jess said above.

Prefetches are hints though and for prefetch.i in integer mode only, which is quite niche, it's not worth wiring up access to the speculative PCC to every load unit in a high performance implementation.

Therefore my proposal is to change it to a recommendation that PCC is used for authorisation, but not a normative rule, so a simpler implementation can certainly keep the authorisation, but a more complex one which doesn't have PCC available in the correct place can choose not to. Even with the normative rule in place you can't prove the behaviour due to hardware prefetchers potentially fetching the same line.

@davidchisnall
Copy link
Collaborator

I agree, an implementation that decides to deliberately introduce attack vectors for side channel attacks should be free to do so, just as it is with the cache flush instructions.

@tariqkurd-repo
Copy link
Collaborator Author

I agree, an implementation that decides to deliberately introduce attack vectors for side channel attacks should be free to do so, just as it is with the cache flush instructions.

Yes - it becomes an implementation choice - not an architectural requirement.
There are many tradeoffs between resiliance to side channel attacks and performance in high performance designs, this is another to add to the list.

Copy link
Collaborator

@arichardson arichardson left a comment

Choose a reason for hiding this comment

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

I think this needs a note that using DDC instead of PCC only affects hybrid mode and side-channels, therefore use DDC is fine.

Co-authored-by: Alexander Richardson <mail@alexrichardson.me>
Signed-off-by: Tariq Kurd <tariq.kurd@codasip.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants