Fix guest page fault cause without RVC - #3571
Open
124107157-KV wants to merge 1 commit into
Open
124107157-KV wants to merge 1 commit into
124107157-KV wants to merge 1 commit into
Conversation
Map FE_INSTR_GUEST_PAGE_FAULT to the architectural instruction guest-page-fault cause in the non-RVC instruction queue path. Add a directed RV64 hypervisor regression covering RVH enabled with RVC disabled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this PR needed?
When the hypervisor extension is enabled and the compressed-instruction extension is disabled (
RVH=1,RVC=0), the non-RVC path ininstr_queueincorrectly maps an incomingFE_INSTR_GUEST_PAGE_FAULTtoriscv::INSTR_PAGE_FAULT.This changes the architectural exception cause from instruction guest-page fault (
mcause = 20) to instruction page fault (mcause = 12).The RVC-enabled path already preserves
FE_INSTR_GUEST_PAGE_FAULTcorrectly. The equivalent mapping was missing from the non-RVC path.What does this PR change?
The non-RVC exception mapping in
core/frontend/instr_queue.svnow handlesFE_INSTR_GUEST_PAGE_FAULTexplicitly when the hypervisor extension is enabled.The resulting mapping is:
A directed RV64 regression is also added for the
RVH=1,RVC=0case.The regression configures pure G-stage translation using:
It installs a valid G-stage leaf mapping for the guest instruction address with execute permission disabled. Entering VS-mode therefore causes a G-stage instruction-fetch permission fault.
The M-mode trap handler reads
mcauseand checks that the architectural exception remains instruction guest-page fault, cause 20.The result is written directly to
tohostwithout using a taken branch before termination.Verification
The regression was checked against Spike and against CVA6 with the hypervisor extension enabled and hardware RVC disabled.
Spike reference
Spike reports the expected exception:
CVA6 with this fix
The first exception reaches the M-mode handler with:
The directed regression then writes the passing result to
tohost.Observed result:
CVA6 with pristine upstream RTL
The same regression and hardware configuration were also run after temporarily restoring the pristine upstream version of
core/frontend/instr_queue.sv.The upstream RTL reports:
The regression fails as expected:
This reproduces issue #3568 and confirms that the RTL change preserves the architectural instruction guest-page-fault cause.
Configuration note
The repository currently does not provide a directly runnable predefined RV64 simulation target combining
RVH=1with hardwareRVC=0.For the before/after CVA6 validation,
cv64a6_imafdch_sv39was used while temporarily settingCVA6ConfigCExtEn=0and keepingCVA6ConfigHExtEn=1.That temporary configuration change was restored after testing and is not part of this pull request.
The directed assembly regression also uses
.option norvcso that the test program itself does not contain compressed instructions.Files changed
core/frontend/instr_queue.svverif/tests/custom/issues/instr-guest-page-fault-rvc0-rv64.Sverif/tests/testlist_issues.yamlFixes #3568