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

Hypervisor extension #612

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

defermelowie
Copy link
Contributor

@defermelowie defermelowie commented Nov 6, 2024

This is a version of the hypervisor extension ported on a more recent version of the model. Feel welcome to provide any feedback

In order to verify the modifications & additions to this version of the model, the following tests are used:

PS I closed #334 in favor of this pull request.

- Add several hypervisor extension specific CSRs
- Add fields to existing machine-level CSRs
- Refactor MStatus to use 64 bits and split accesses for RV32
- Impl read_CSR for hypervisor CSRs
- Impl write_CSR for hypervisor CSRs
- Set initial values for hypervisor CSRs
- Set initial value for misa[H]
- Model trap through TrapCause union
- Add H-ext exceptions
- Add H-ext interrupts
- Use TrapContext struct to pass exception exception
- Delegate to virtualized mode based on hedeleg
MPV : 39,
GVA : 38,
MBE : 37,
SBE : 36,

// The SXL and UXL fields don't exist on RV32, so they are modelled
// via explicit getters and setters; see below.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is out of date.


function get_hstatus_VSXL(h : Hstatus) -> arch_xlen = {
if sizeof(xlen) == 32
then arch_to_bits(RV32)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"When HSXLEN=32, VSXL field does not exist." The spec isn't terribly clear on what that means, but I'd assume WPRI, so the read should be 0b00 and not 0b01.

I see this code was inspired by the UXL field of the sstatus register, so I'll send a patch for that, unless you know something I missed.

Thanks.

register mstatush : Mstatush

bitfield Mstatus : xlenbits = {
bitfield Mstatus : bits(64) = {
SD : xlen - 1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't where SD is on RV32 annoyingly. See #639

We should make a separate MR to fix just #639 ideally.

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.

3 participants