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

Fix RISCV and CHERI soft-tlb non page-aligned #214

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

LawrenceEsswood
Copy link
Contributor

The QEMU softtlb only caches (target) page sized ranges. In the case another size is probed, the TLB is filled in but marked as invalid.

CHERI tag setting needs to acknowledge this case.

RISCV also had a completely broken implementation that worked out if the PMP covered an entire page. It tried to mask with a number that was not a power of two, and masking was not appropriate in the first place even had the number been a power of two.

It also ignored priority rules on PMP entry matching, and rules concerning PMP entry matching in M-Mode, and matching rules in non M-Mode where there are no PMP entries.

A lot of these changes could go away if we merged with upstream. They fix the PMP issues, and offer a new probe that returns the struct that tagmem needs without the current ugly hack.

The QEMU softtlb only caches (target) page sized ranges. In the case
another size is probed, the TLB is filled in but marked as invalid.

CHERI tag setting needs to acknowledge this case.

RISCV also had a completely broken implementation that worked out if the
PMP covered an entire page. It tried to mask with a number that was not
a power of two, and masking was not appropriate in the first place even
had the number been a power of two.

It also ignored priority rules on PMP entry matching, and rules concerning
PMP entry matching in M-Mode, and matching rules in non M-Mode where
there are no PMP entries.

A lot of these changes could go away if we merged with upstream. They
fix the PMP issues, and offer a new probe that returns the struct that
tagmem needs without the current ugly hack.
@arichardson
Copy link
Member

This all looks sensible but maybe better to wait until an overdue upstream merge?

@LawrenceEsswood
Copy link
Contributor Author

Sounds sensible. Upstream fixes the whole nonsense page alignment part. All we would have to keep are the tagmem fixes.

@arichardson arichardson marked this pull request as draft July 31, 2023 22:37
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