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

apply ACPERM rules in order #427

Merged
merged 21 commits into from
Nov 4, 2024
Merged

Conversation

tariqkurd-repo
Copy link
Collaborator

@tariqkurd-repo tariqkurd-repo commented Oct 17, 2024

fixes #426
fixes #428

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 is correct, but I'd like @LawrenceEsswood to have a look as well.

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Oct 29, 2024

@tomaird @jamie-melling - I can't add you as reviewers but can you check this one?

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.

This looks good to me now - but I'll wait a bit for other to comment on this before merging.

clarify confusing text

Signed-off-by: Tariq Kurd <[email protected]>
@tomaird
Copy link
Contributor

tomaird commented Oct 31, 2024

If we start with the following perms set: R W C X LM ASR EL, mode=1 (int) (i.e. all bits set except SL), e.g from doing an acperm with cs1 having infinite perms and rs2 being 0xfffffff7

Then apply the new rules:

1 - clear ASR because SL is clear
2 - leave C set
3 - leave C set
4 - leave X set
5 - leave W set (beacuse LM set)
6 - leave X set
7 - leave EL set
8 - leave LM set
9 - leave X set
10 - SL was already clear
11 - ASR was cleared by (1)
12 - leave M bit set (int mode)

So we only cleared ASR.

This leaves us with R W C X LM EL, mode=1 (int) which doesn't have an encoding in RV32

So I think we possibly need a new rule to clear X in this case so we end up in quadrant 3, or remove C+LM+EL to stay in quadrant 1 as Execute + Data RW

@arichardson
Copy link
Collaborator

arichardson commented Oct 31, 2024

If we start with the following perms set: R W C X LM ASR EL, mode=1 (int) (i.e. all bits set except SL), e.g from doing an acperm with cs1 having infinite perms and rs2 being 0xfffffff7

Then apply the new rules:

1 - clear ASR because SL is clear
2 - leave C set
3 - leave C set
4 - leave X set
5 - leave W set (beacuse LM set)
6 - leave X set
7 - leave EL set
8 - leave LM set
9 - leave X set
10 - SL was already clear
11 - ASR was cleared by (1)
12 - leave M bit set (int mode)

So we only cleared ASR.

This leaves us with R W C X LM EL, mode=1 (int) which doesn't have an encoding in RV32

So I think we possibly need a new rule to clear X in this case so we end up in quadrant 3, or remove C+LM+EL to stay in quadrant 1 as Execute + Data RW

Good catch - I'd keep X in this case so go for your second suggestion. EDIT: after discussing this the better approach is to just remove X.

@tariqkurd-repo
Copy link
Collaborator Author

One thing to consider is what happens if SL is cleared but is in a N/A state, we could just ignore it

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.

Minor comment otherwise LGTM

@LawrenceEsswood
Copy link
Collaborator

I think I agree with Alex on Quads 3/4. The encoding was meant to align certain bits with SL (possibly inverted).

tariqkurd-repo and others added 5 commits November 4, 2024 09:57
Co-authored-by: Alexander Richardson <[email protected]>
Signed-off-by: Tariq Kurd <[email protected]>
Co-authored-by: Alexander Richardson <[email protected]>
Signed-off-by: Tariq Kurd <[email protected]>
Co-authored-by: Alexander Richardson <[email protected]>
Signed-off-by: Tariq Kurd <[email protected]>
Co-authored-by: Alexander Richardson <[email protected]>
Signed-off-by: Tariq Kurd <[email protected]>
@arichardson arichardson merged commit fcce4a9 into riscv:main Nov 4, 2024
3 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.

Zcherilevels RV32 stripping EL clarification ACPERM RV32 order of rules inconsistency
5 participants