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

Report the faulting virtual address in tval #304

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

arichardson
Copy link
Collaborator

In some cases we were reporting the translated value instead, but the privileged spec text requires the virtual address:

If mtval is written with a nonzero value when a breakpoint,
address-misaligned, access-fault, or page-fault exception occurs on an
instruction fetch, load, or store, then mtval will contain the faulting
virtual address.

In some cases we were reporting the translated value instead, but the
privileged spec text requires the virtual address:
```
If mtval is written with a nonzero value when a breakpoint,
address-misaligned, access-fault, or page-fault exception occurs on an
instruction fetch, load, or store, then mtval will contain the faulting
virtual address.
```
@jrtc27
Copy link
Collaborator

jrtc27 commented Sep 8, 2023

Somewhat concerning this hadn't yet been found by anything using the Sail model for testing, like RISCOF

@github-actions
Copy link

github-actions bot commented Sep 8, 2023

Unit Test Results

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

Results for commit 3a46146. ± Comparison against base commit 861bd6f.

@allenjbaum
Copy link
Collaborator

allenjbaum commented Sep 8, 2023 via email

@jrtc27
Copy link
Collaborator

jrtc27 commented Sep 8, 2023

We don't have a lot of tests for TVAL yet (especially with translation enabled), and it would depend on what the "some cases" cause was - when does this happen? It looks like store memory exceptions, but precisely which cases?

Floating-point stores, store conditional and AMOs (for both the loading and storing part), unconditionally.

@allenjbaum
Copy link
Collaborator

allenjbaum commented Sep 8, 2023 via email

@billmcspadden-riscv billmcspadden-riscv added the tgmm-agenda Tagged for the next Golden Model meeting agenda. label Sep 12, 2023
@arichardson
Copy link
Collaborator Author

Was this discussed at the meeting? Can it be merged?

@allenjbaum
Copy link
Collaborator

allenjbaum commented Sep 15, 2023 via email

@arichardson
Copy link
Collaborator Author

I think it is ready to be merged... but I don't think it is complete. Floating Load has the same problem, I think,and I think LR/SC does also It wasn't discussed because there was another long discussion about other issues, particularly the process for declaring when an extension's test are done for the purposes of freeze

On Thu, Sep 14, 2023 at 3:03 PM Alexander Richardson < @.> wrote: Was this discussed at the meeting? Can it be merged? — Reply to this email directly, view it on GitHub <#304 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPXVJS2BOBKFLHCNAO2UW3X2N5K3ANCNFSM6AAAAAA4Q4JV7E . You are receiving this because you commented.Message ID: @.>

LR uses the vaddr, and this commit fixes SC, amo* and the floating point loads stores. I did search for all calls to handle_mem_exception and updated all the ones that did not report the vaddr.

@allenjbaum
Copy link
Collaborator

IT's possible (well true)that I didn't follow the code all the way back but:
in model/riscv_insts_aext.sail
·
in val process_loadres
122 MemException(e) => { handle_mem_exception(addr, e); RETIRE_FAIL }

and n model/riscv_insts_fext.sail
function process_fload64(rd, addr, value)
353 MemException(e) => { handle_mem_exception(addr, e); RETIRE_FAIL }
}
function process_fload32(rd, addr, value)
365 MemException(e) => { handle_mem_exception(addr, e); RETIRE_FAIL }

 function process_fload16(rd, addr, value) 

373 MemException(e) => { handle_mem_exception(addr, e); RETIRE_FAIL }
}

in addition to the one that was fixed in function clause execute (STORE_FP(imm, rs2, rs1, width)) = {
461 MemException(e) => { handle_mem_exception(addr, e); RETIRE_FAIL },

@allenjbaum
Copy link
Collaborator

OK, I checked a bit deeper. The "Addr" I see is a function parameter, and it is called with "vaddr" in all the cases I found.
So this is ready to go. My apologies.

@billmcspadden-riscv billmcspadden-riscv merged commit c60091a into riscv:master Sep 20, 2023
2 checks passed
@arichardson arichardson deleted the tval-atomics branch September 20, 2023 16:28
@billmcspadden-riscv billmcspadden-riscv removed the tgmm-agenda Tagged for the next Golden Model meeting agenda. label Oct 24, 2023
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.

4 participants