qemu/target
Daniel Henrique Barboza 0260dbf0ac target/riscv: throw debug exception before page fault
In the RISC-V privileged ISA section 3.1.15 table 15, it is determined
that a debug exception that is triggered from a load/store has a higher
priority than a possible fault that this access might trigger.

This is not the case ATM as shown in [1]. Adding a breakpoint in an
address that deliberately will fault is causing a load page fault
instead of a debug exception. The reason is that we're throwing in the
page fault as soon as the fault occurs (end of riscv_cpu_tlb_fill(),
raise_mmu_exception()), not allowing the installed watchpoints to
trigger.

Call cpu_check_watchpoint() in the page fault path to search and execute
any watchpoints that might exist for the address, never returning back
to the fault path. If no watchpoints are found cpu_check_watchpoint()
will return and we'll fall-through the regular path to
raise_mmu_exception().

[1] https://gitlab.com/qemu-project/qemu/-/issues/2627

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2627
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250121170626.1992570-3-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit c86edc5476)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-22 10:52:51 +03:00
..
alpha hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name() 2023-11-07 13:08:48 +01:00
arm target/arm/hvf: sign extend the data for a load operation when SSE=1 2025-03-22 10:52:51 +03:00
avr hw/avr/atmega: Fix wrong initial value of stack pointer 2023-11-28 14:27:12 +01:00
cris hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name() 2023-11-07 13:08:48 +01:00
hexagon target/hexagon: don't look for static glib 2024-08-28 08:37:15 +03:00
hppa target/hppa: Fix PSW V-bit packaging in cpu_hppa_get for hppa64 2024-09-05 23:00:34 +03:00
i386 target/i386/cpu: Fix notes for CPU models 2024-12-29 02:22:55 +03:00
loongarch target/loongarch/gdbstub: Fix gdbstub incorrectly handling some registers 2025-03-22 10:52:51 +03:00
m68k target/m68k: Always return a temporary from gen_lea_mode 2024-10-10 21:08:58 +03:00
microblaze target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
mips target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
nios2 target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
openrisc hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name() 2023-11-07 13:08:48 +01:00
ppc target/ppc: Fix non-maskable interrupt while halted 2024-12-16 15:27:45 +03:00
riscv target/riscv: throw debug exception before page fault 2025-03-22 10:52:51 +03:00
rx target/rx: Use target_ulong for address in LI 2024-08-28 08:37:14 +03:00
s390x target/s390x: Fix MVC not always invalidating translation blocks 2025-02-01 11:59:14 +03:00
sh4 target/sh4: Fix SUBV opcode 2024-05-04 09:37:20 +03:00
sparc target/sparc: Fix gdbstub incorrectly handling registers f32-f62 2025-03-22 10:52:51 +03:00
tricore hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name() 2023-11-07 13:08:48 +01:00
xtensa target/xtensa: fix OOB TLB entry access 2024-01-27 18:04:54 +03:00
Kconfig hw/loongarch: Add support loongson3 virt machine type. 2022-06-06 18:09:03 +00:00
meson.build target/loongarch: Add target build suport 2022-06-06 18:09:03 +00:00