-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add support for 32-bit RISC-V #116
Conversation
d043ba8
to
f84b327
Compare
f84b327
to
7189a89
Compare
7189a89
to
2603780
Compare
0423b1d
to
072caef
Compare
d719f48
to
86498c1
Compare
7775309
to
4a7f2c3
Compare
I have booted 32-bit Linux over Bao too. I think this is ready to be fully reviewed @ninolomata @DavidMCerdeira @danielRep |
59a293c
to
8837766
Compare
I still couldn't finish my review , but as a first note we still need a PR on bao-demos to support 32-bit RISC-V as a means to test this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I don't see a huge problem on using compilation macros macros (RV32 and RV64), wouldn't be more cleaner to separate rv32 and rv64 profiles on different arch
folders as we do for aarch32
and aarch64
?
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
Signed-off-by: Jose Martins <[email protected]>
A branch for bao-demos featuring demos targetting qemu-riscv32-virt is available at https://github.com/josecm/bao-demos/tree/feat/rv32. I'll create a PR for that demo once this PR is accepted. |
The difference between rv32 and rv64 is not as stark as from aarch32 to aarch64, so it does not seem necessary to introduce both architectures separately, only a few of those RV32/RV64 macros and a wrapper around csr access so that rv32 can access "64-bit" csrs is enough and avoids a lot of code duplication and indirection. |
Seems reasonable. Ok, looks good to me. |
Good! I'll further test if everything is working correctly on that PR then. |
This PR introduces support for RV32. Because the way the instruction set is written the difference is not much when comparing to RV64. The main areas of modification are:
The PR also includes support for qemu-system-riscv32 virt machine, which is essentially a wrapper over the 64-bit variant.
The main issue with this port is related to the fact that we are required to map all available physical memory to perform page-table walks. Because the address space is so small (4GiB), this might not be possible as for RV64 we simply identity map all physical memory and assume these addresses won't collide with the high virtual addresses used by the hypervisor. This is not the case and we might not be able to map all physical addresses, which already happens for qemu-riscv32-virt if we configure it with memory larger than 1 GiB, since it starts memory at 0x80000000. We might need a dynamic mechanism similar to Linux's "highmem" in the future. I only think this is worth it if a real platform that requires it becomes available. Also, the main purpose of supporting RV32 is to target future MMU-less systems.
Test guest:
Depends on #115