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

Implement menvcfg #303

Merged
merged 2 commits into from
Oct 12, 2023
Merged

Conversation

Timmmm
Copy link
Collaborator

@Timmmm Timmmm commented Sep 6, 2023

This implements the m/senvcfg(h) CSRs. This CSR is used to enable/disable extensions and behaviours for lower privilege modes. Currently the only implemented bit is FIOM which affects how fences work.

It also affects how atomic memory accesses work in non-cacheable regions, but the model does not currently support PMAs so that can't easily be implemented.

Note there is a partial implementation of menvcfg in #137, so this should simplify that PR a little.

@github-actions
Copy link

github-actions bot commented Sep 6, 2023

Unit Test Results

712 tests  ±0   712 ✔️ ±0   0s ⏱️ ±0s
    6 suites ±0       0 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit da76e06. ± Comparison against base commit 24e3e68.

♻️ This comment has been updated with latest results.

@allenjbaum
Copy link
Collaborator

allenjbaum commented Sep 8, 2023 via email

model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
@Timmmm
Copy link
Collaborator Author

Timmmm commented Sep 8, 2023

I think you need to define precisely what you mean by "disabling virtual memory" means exactly.

Not sure what you are referring to here, but anyway here's the relevant bit of the spec:

If S-mode is not supported, or if satp.MODE is read-only zero (always Bare), the implementation may make FIOM read-only zero.

Now that I read it again, I think I misread it. The Sail model doesn't let you make satp.MODE be read-only zero but you can disable S-mode so that would be a legitimate way to also have FIOM disabled. I'll add an emulator flag.

c_emulator/riscv_sim.c Outdated Show resolved Hide resolved
@Timmmm Timmmm force-pushed the user/timh/menvcfg branch 2 times, most recently from b30113d to 1024784 Compare September 16, 2023 12:47
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, just one question.

model/riscv_sys_regs.sail Outdated Show resolved Hide resolved
@allenjbaum
Copy link
Collaborator

allenjbaum commented Sep 22, 2023 via email

This implements the m/senvcfg(h) CSRs. This CSR is used to enable/disable extensions and behaviours for lower privilege modes. Currently the only implemented bit is FIOM which affects how fences work.

It also affects how atomic memory accesses work in non-cacheable regions, but the model does not currently support PMAs so that can't easily be implemented.
@Timmmm
Copy link
Collaborator Author

Timmmm commented Oct 2, 2023

@arichardson any chance of a final review? Pretty please? :-)

@arichardson
Copy link
Collaborator

@arichardson any chance of a final review? Pretty please? :-)

I'm happy with the change, but you'll need it to be approved by one of the maintainers .

Copy link
Collaborator

@billmcspadden-riscv billmcspadden-riscv left a comment

Choose a reason for hiding this comment

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

Reconsider the command line argument name.

c_emulator/riscv_platform.c Outdated Show resolved Hide resolved
c_emulator/riscv_sim.c Outdated Show resolved Hide resolved
@billmcspadden-riscv billmcspadden-riscv added the tgmm-agenda Tagged for the next Golden Model meeting agenda. label Oct 10, 2023
This is a much clearer name because the option allows code to enable FIOM, it doesn't enable FIOM itself.
@billmcspadden-riscv billmcspadden-riscv merged commit c04cf29 into riscv:master Oct 12, 2023
2 checks passed
@jrtc27
Copy link
Collaborator

jrtc27 commented Oct 17, 2023

Commits were not squashed before merging

@Timmmm
Copy link
Collaborator Author

Timmmm commented Oct 19, 2023

Commits were not squashed before merging

Sorry I didn't know the policy for this project, but I agree. Rebase merging like this is probably the worst of both worlds.

Personally I would disable merge commits and rebase merging in the project settings so you have to use squash merge (i.e. squash and rebase).

@jrtc27
Copy link
Collaborator

jrtc27 commented Oct 19, 2023

Commits were not squashed before merging

Sorry I didn't know the policy for this project, but I agree. Rebase merging like this is probably the worst of both worlds.

Personally I would disable merge commits and rebase merging in the project settings so you have to use squash merge (i.e. squash and rebase).

We use rebase merging in other projects extensively. It works well if people curate their commits in the PR, and allows you to preserve a patch series as a patch series, rather than squashing it into one. Squashing a PR only works when PRs are logically a single change. Both have their uses, people just need to be disciplined when they come to merge to either squash when appropriate or check that the commit series is sensible.

@Timmmm
Copy link
Collaborator Author

Timmmm commented Oct 19, 2023

Doesn't it break git bisect though since only the last commit is actually tested by CI? I personally don't see much value in preserving history for changes that were never on master. Anyway I will squash in future!

@billmcspadden-riscv billmcspadden-riscv removed the tgmm-agenda Tagged for the next Golden Model meeting agenda. label Oct 24, 2023
@Timmmm Timmmm deleted the user/timh/menvcfg branch November 14, 2023 11:03
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.

5 participants