Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify M-bit behaviour when there's no integer mode #507

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

tariqkurd-repo
Copy link
Collaborator

The spec doesn't currently specify what to do about encodings when Zcherihybrid isn't implemented.
The proposal is:

  • for RV32 - setting M in quadrant 1 gives invalid permissions
  • for RV64 - M is simply a reserved bit

which seems a bit inconsistent, but it's because in RV32 it's part of the permissions encodings, whereas in RV64 it's just a separate bit, and so reserved.

@jrtc27
Copy link
Collaborator

jrtc27 commented Jan 15, 2025

It's not inconsistent if for RV32 it's a reserved encoding?

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Jan 15, 2025 via email

@jrtc27
Copy link
Collaborator

jrtc27 commented Jan 15, 2025

The question is whether it's reserved causing a tag violation on load/store dereference, or invalid permissions causing a permission violation. That's the only distinction I'm aware of between the two cases. We just need to choose one.

How would it ever have a tag?

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Jan 15, 2025 via email

@arichardson
Copy link
Collaborator

arichardson commented Jan 15, 2025

If it's easier for consistency we could move the M bit into AP for RV64 as well? And then just treat it as a reserved permission? IMO this doesn't change anything from an implementation point just the spec wording.

@jrtc27
Copy link
Collaborator

jrtc27 commented Jan 15, 2025

I don't like thinking of it as a permission any more than necessary, it'll confuse people...

@arichardson
Copy link
Collaborator

I don't like thinking of it as a permission any more than necessary, it'll confuse people...

That's a good point since it's not restricted to monotonic behaviour. Probably better to keep it conceptually separate for RV64.

@jamie-melling
Copy link

I've done a review of all the cases where "reserved bits set" and "invalid perms" are checked/used.

Instruction Reserved Bits set Inv perms
ACPERM clear cd tag set all perms to 0
GCPERM - Return 0
jmp/br/ld/st Tag except Perm except
CADD/SCADDR etc clear cd tag -
SCBNDS etc clear cd tag -
SCSS & CBLD clear cd tag clear cd tag
CSR clear CSR tag clear CSR tag
LC data dependent strip* - cd perms =0 or unchanged

LC data dependent strip* -> this is the load mutable and Zcherilevels rules applied to loaded capabilities. The option is to return perms as 0 or not to strip any perms. This is because you wouldn't want to take an invalid/reserved input and legalize it by following the LM + zcherilevel's rules.

@tariqkurd-repo tariqkurd-repo merged commit 0a39109 into riscv:main Jan 16, 2025
3 checks passed
@jrtc27
Copy link
Collaborator

jrtc27 commented Jan 16, 2025

I'm still concerned that for RV32 this is allocating the bit / AP encodings for M even when not implemented, when instead they should all be reserved encodings that can be allocated for a different purpose by another extension. This is particularly important given the limited encoding space available on RV32; it is quite likely that a capability mode-only RV32 implementation would have a use for those encodings.

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Jan 16, 2025 via email

@jrtc27
Copy link
Collaborator

jrtc27 commented Jan 16, 2025

That's fair comment, it's restricting the usage to permissions.

Not just permissions, it's enforcing it as being M.

@tariqkurd-repo
Copy link
Collaborator Author

This is fair comment - the way that the bit is encoded means that it can only represent something which is used for code-capabilities in future - so some other attribute we havne't though of yet. It effectively means that bit 0 of quadrant 1 for RV32 only is up for grabs.

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