Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
target/riscv: Set the correct exception for implict G-stage translati…
…on fail

The privileged spec states:
For a memory access made to support VS-stage address translation (such as
to read/write a VS-level page table), permissions are checked as though
for a load or store, not for the original access type. However, any
exception is always reported for the original access type (instruction,
load, or store/AMO).

The current implementation converts the access type to LOAD if implicit
G-stage translation fails which results in only reporting "Load guest-page
fault". This commit removes the convertion of access type, so the reported
exception conforms to the spec.

Signed-off-by: Jason Chien <jason.chien@sifive.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230627074915.7686-1-jason.chien@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
Jason Chien authored and alistair23 committed Jul 10, 2023
1 parent 889caa4 commit 60ef34a
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion target/riscv/cpu_helper.c
Expand Up @@ -1282,7 +1282,6 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
if (ret == TRANSLATE_G_STAGE_FAIL) {
first_stage_error = false;
two_stage_indirect_error = true;
access_type = MMU_DATA_LOAD;
}

qemu_log_mask(CPU_LOG_MMU,
Expand Down

0 comments on commit 60ef34a

Please sign in to comment.