aboutsummaryrefslogtreecommitdiff
path: root/qemu-keymap.c
diff options
context:
space:
mode:
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>2024-04-13 13:59:28 +0300
committerAlistair Francis <alistair.francis@wdc.com>2024-06-03 11:12:12 +1000
commit68e7c86927afa240fa450578cb3a4f18926153e4 (patch)
treeb43918e749c182afff936231f0f64b7562adeee4 /qemu-keymap.c
parent93cb52b7a3ccc64e8d28813324818edae07e21d5 (diff)
downloadqemu-68e7c86927afa240fa450578cb3a4f18926153e4.zip
qemu-68e7c86927afa240fa450578cb3a4f18926153e4.tar.gz
qemu-68e7c86927afa240fa450578cb3a4f18926153e4.tar.bz2
target/riscv: prioritize pmp errors in raise_mmu_exception()
raise_mmu_exception(), as is today, is prioritizing guest page faults by checking first if virt_enabled && !first_stage, and then considering the regular inst/load/store faults. There's no mention in the spec about guest page fault being a higher priority that PMP faults. In fact, privileged spec section 3.7.1 says: "Attempting to fetch an instruction from a PMP region that does not have execute permissions raises an instruction access-fault exception. Attempting to execute a load or load-reserved instruction which accesses a physical address within a PMP region without read permissions raises a load access-fault exception. Attempting to execute a store, store-conditional, or AMO instruction which accesses a physical address within a PMP region without write permissions raises a store access-fault exception." So, in fact, we're doing it wrong - PMP faults should always be thrown, regardless of also being a first or second stage fault. The way riscv_cpu_tlb_fill() and get_physical_address() work is adequate: a TRANSLATE_PMP_FAIL error is immediately reported and reflected in the 'pmp_violation' flag. What we need is to change raise_mmu_exception() to prioritize it. Reported-by: Joseph Chan <jchan@ventanamicro.com> Fixes: 82d53adfbb ("target/riscv/cpu_helper.c: Invalid exception on MMU translation stage") Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20240413105929.7030-1-alexei.filippov@syntacore.com> Cc: qemu-stable <qemu-stable@nongnu.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'qemu-keymap.c')
0 files changed, 0 insertions, 0 deletions