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 setting of satp to MODE=Bare #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SamuelWAnderson45
Copy link
Contributor

@SamuelWAnderson45 SamuelWAnderson45 commented Jun 25, 2024

Since sedna only supports Sv39 and Sv48 paging modes, writeCSR checks writes to satp to make sure one of those modes has been selected, else the write is ignored. However, we need to also allow returning to bare mode (i.e. no address translation). This patch adds SATP_MODE_NONE to the allowed modes.
When the kernel added support for sv48 in 5.17, it added autodetection of which paging modes the CPU supports. This works by temporarily changing to sv48 mode, checking satp to see if it changed, and then setting satp back to 0 (bare). This last step breaks before this patch and crashes the kernel. After this patch, I can boot a 6.6 kernel successfully.
https://github.com/torvalds/linux/blob/f443e374ae131c168a065ea1748feac6b2e76613/arch/riscv/mm/init.c#L585

Fixes #18

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.

Kernel 6.2 and higher does not run in the emulator
1 participant