* [PATCH 00/33] accel: Unassorted cleanups around debugging
@ 2026-06-30 22:00 Philippe Mathieu-Daudé
2026-06-30 22:00 ` [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer) Philippe Mathieu-Daudé
` (32 more replies)
0 siblings, 33 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Refreshing the `split-accel' preparatory work; this series follows
"accel: Preparatory cleanups for split-accel" from last year:
https://lore.kernel.org/qemu-devel/20250703173248.44995-1-philmd@linaro.org/
Nothing really noteworthy here, generic code refactoring with the
objective to strengthen the various APIs, introducing few enums or
headers.
Philippe Mathieu-Daudé (33):
cpu: Constify CPUState::cc (cached CPUClass pointer)
target/i386: Remove duplicate tlb_flush() call in cpu_post_load()
accel/tcg: Restrict tlb_protect/unprotect_code() to TCG
accel/hvf: Remove left-over comment
accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field
gdbstub: Add trace event for STEP packet handler
gdbstub: Only return E22 when reverse GDB is not supported
accel/kvm: Always define AccelOpsClass::supports_guest_debug
accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG
accel: Change gdbstub_supported_sstep_flags() -> get_gdbstub_config()
gdbstub: Store @can_reverse in GDBState
gdbstub: Make default replay_mode value explicit in stubs
accel: Have get_gdbstub_config() return @can_reverse value
accel: Move supports_guest_debug() declaration to AccelClass
accel/kvm: Hold have_guest_supported in KVMState
accel/kvm: Hold gdbstub_sstep_flags in KVMState
cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h'
cpu: Define BreakpointFlags type
accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints
gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode
gdbstub: Reduce @type variable scope
gdbstub: Introduce GdbBreakpointType enumerator
accel: Use GdbBreakpointType enum
target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint()
target/arm: Factor arm_check_watchpoint_hit() out
target/xtensa: Move watchpoints handling to check_hw_watchpoints()
target/ppc: Ensure TCG is used in ppc_update_daw()
accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers
cpu: Move CPUWatchpoint definition to 'exec/watchpoint.h'
cpu: Better name cpu_single_step() trace event
cpu: Introduce cpu_single_stepping() helper
cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags
cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping()
accel/kvm/kvm-cpus.h | 12 +++--
accel/tcg/system-page-protection.h | 17 +++++++
gdbstub/internals.h | 10 ++--
include/accel/accel-cpu-ops.h | 10 ++--
include/accel/accel-ops.h | 4 +-
include/accel/tcg/cpu-ops.h | 12 +++--
include/exec/breakpoint.h | 26 ++++++----
include/exec/cputlb.h | 8 +--
include/exec/watchpoint.h | 20 ++++++--
include/gdbstub/enums.h | 12 +++--
include/hw/core/cpu.h | 42 ++++++++--------
include/qemu/accel.h | 10 ++--
include/system/hvf_int.h | 11 ++--
include/system/kvm.h | 9 ++--
include/system/kvm_int.h | 2 +
include/system/mshv_int.h | 1 -
include/system/whpx-all.h | 4 +-
target/arm/internals.h | 6 ++-
accel/accel-common.c | 22 ++++++--
accel/hvf/hvf-accel-ops.c | 23 ++++-----
accel/hvf/hvf-all.c | 9 ++--
accel/kvm/kvm-accel-ops.c | 7 ++-
accel/kvm/kvm-all.c | 55 +++++++++++---------
accel/mshv/mshv-all.c | 18 +++----
accel/tcg/cpu-exec-common.c | 2 +-
accel/tcg/cpu-exec.c | 12 ++---
accel/tcg/cputlb.c | 15 +++---
accel/tcg/tb-maint.c | 1 +
accel/tcg/tcg-accel-ops-rr.c | 2 +-
accel/tcg/tcg-accel-ops.c | 31 ++++++------
accel/tcg/tcg-all.c | 16 ++++--
accel/tcg/translate-all.c | 3 +-
accel/tcg/user-exec-stub.c | 11 ++--
accel/tcg/watchpoint.c | 9 ++--
accel/whpx/whpx-accel-ops.c | 7 ---
accel/whpx/whpx-common.c | 1 +
cpu-common.c | 8 +--
cpu-target.c | 10 ++--
gdbstub/gdbstub.c | 11 ++--
gdbstub/system.c | 39 ++++++--------
gdbstub/user.c | 20 ++------
linux-user/riscv/cpu_loop.c | 2 +-
linux-user/s390x/cpu_loop.c | 2 +-
stubs/replay-mode.c | 2 +-
system/cpus.c | 2 +-
system/watchpoint.c | 8 +--
target/arm/hvf/hvf.c | 24 +++++----
target/arm/hyp_gdbstub.c | 9 ++--
target/arm/kvm.c | 14 +++---
target/arm/tcg/debug.c | 81 +++++++++++++++---------------
target/arm/tcg/mte_helper.c | 3 +-
target/arm/whpx/whpx-all.c | 2 +-
target/i386/hvf/hvf.c | 10 ++--
target/i386/kvm/kvm.c | 15 +++---
target/i386/machine.c | 1 -
target/i386/mshv/mshv-cpu.c | 6 +--
target/i386/whpx/whpx-all.c | 8 +--
target/loongarch/kvm/kvm.c | 10 ++--
target/microblaze/translate.c | 2 +-
target/ppc/cpu.c | 4 +-
target/ppc/kvm.c | 20 +++++---
target/ppc/translate.c | 16 +++---
target/riscv/cpu_helper.c | 2 +-
target/riscv/debug.c | 12 ++---
target/riscv/kvm/kvm-cpu.c | 8 +--
target/s390x/kvm/kvm.c | 11 ++--
target/s390x/tcg/debug.c | 3 +-
target/xtensa/dbg_helper.c | 2 +-
target/xtensa/helper.c | 36 ++++++-------
trace-events | 2 +-
70 files changed, 477 insertions(+), 388 deletions(-)
create mode 100644 accel/tcg/system-page-protection.h
--
2.53.0
^ permalink raw reply [flat|nested] 93+ messages in thread
* [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer)
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:16 ` Daniel Henrique Barboza
` (2 more replies)
2026-06-30 22:00 ` [PATCH 02/33] target/i386: Remove duplicate tlb_flush() call in cpu_post_load() Philippe Mathieu-Daudé
` (31 subsequent siblings)
32 siblings, 3 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Various CPUState can share the same CPUClass parent,
and must not update its fields. Protect the CPUClass
by marking the CPUState pointer const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/hw/core/cpu.h | 2 +-
accel/tcg/cpu-exec.c | 2 +-
accel/tcg/translate-all.c | 3 +--
gdbstub/gdbstub.c | 2 +-
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 59d601465b4..60a23d6f38b 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -480,7 +480,7 @@ struct CPUState {
/*< private >*/
DeviceState parent_obj;
/* cache to avoid expensive CPU_GET_CLASS */
- CPUClass *cc;
+ const CPUClass *cc;
/*< public >*/
int nr_threads;
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 9c754b03656..d7f91dce9db 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -460,7 +460,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
* counter hit zero); we must restore the guest PC to the address
* of the start of the TB.
*/
- CPUClass *cc = cpu->cc;
+ const CPUClass *cc = cpu->cc;
const TCGCPUOps *tcg_ops = cc->tcg_ops;
if (tcg_ops->synchronize_from_tb) {
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 3f1a3a28438..328d96aba30 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -575,7 +575,7 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr)
void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
{
TranslationBlock *tb;
- CPUClass *cc;
+ const CPUClass *cc = cpu->cc;
uint32_t n;
tb = tcg_tb_lookup(retaddr);
@@ -591,7 +591,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
* to account for the re-execution of the branch.
*/
n = 1;
- cc = cpu->cc;
if (cc->tcg_ops->io_recompile_replay_branch &&
cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) {
cpu->neg.icount_decr.u16.low++;
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index c3c944e965b..26366acb674 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -578,7 +578,7 @@ static void gdb_register_feature(CPUState *cpu, int base_reg,
static const char *gdb_get_core_xml_file(CPUState *cpu)
{
- CPUClass *cc = cpu->cc;
+ const CPUClass *cc = cpu->cc;
/*
* The CPU class can provide the XML filename via a method,
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 02/33] target/i386: Remove duplicate tlb_flush() call in cpu_post_load()
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
2026-06-30 22:00 ` [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer) Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 16:27 ` Richard Henderson
2026-07-03 0:42 ` Chao Liu
2026-06-30 22:00 ` [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG Philippe Mathieu-Daudé
` (30 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Common vCPU cpu_post_load() handler calls tlb_flush() since
commit 9656f324d25 ("Move interrupt_request and user_mode_only
to common cpu state..."), no need to call it twice.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
target/i386/machine.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/target/i386/machine.c b/target/i386/machine.c
index 1f5c517e562..df0e0c178e4 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -401,7 +401,6 @@ static int cpu_post_load(void *opaque, int version_id)
env->dr[7] = dr7 & ~(DR7_GLOBAL_BP_MASK | DR7_LOCAL_BP_MASK);
cpu_x86_update_dr7(env, dr7);
}
- tlb_flush(cs);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
2026-06-30 22:00 ` [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer) Philippe Mathieu-Daudé
2026-06-30 22:00 ` [PATCH 02/33] target/i386: Remove duplicate tlb_flush() call in cpu_post_load() Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:17 ` Daniel Henrique Barboza
` (2 more replies)
2026-06-30 22:00 ` [PATCH 04/33] accel/hvf: Remove left-over comment Philippe Mathieu-Daudé
` (29 subsequent siblings)
32 siblings, 3 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Both tlb_protect() and tlb_unprotect_code() are only used
within accel/tcg/. Avoid exposing them to the whole code base,
declare them in a new "system-page-protection.h" local header.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
accel/tcg/system-page-protection.h | 17 +++++++++++++++++
include/exec/cputlb.h | 8 ++------
accel/tcg/cputlb.c | 3 ++-
accel/tcg/tb-maint.c | 1 +
4 files changed, 22 insertions(+), 7 deletions(-)
create mode 100644 accel/tcg/system-page-protection.h
diff --git a/accel/tcg/system-page-protection.h b/accel/tcg/system-page-protection.h
new file mode 100644
index 00000000000..52896c6d24a
--- /dev/null
+++ b/accel/tcg/system-page-protection.h
@@ -0,0 +1,17 @@
+/*
+ * QEMU page protection (system emulation)
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+#ifndef SYSTEM_PAGE_PROTECTION_H
+#define SYSTEM_PAGE_PROTECTION_H
+
+#include "system/ram_addr.h"
+
+void tlb_protect_code(ram_addr_t ram_addr);
+void tlb_unprotect_code(ram_addr_t ram_addr);
+
+#endif
+
diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h
index 3a9603a6965..f7f7020382d 100644
--- a/include/exec/cputlb.h
+++ b/include/exec/cputlb.h
@@ -24,14 +24,10 @@
#include "exec/hwaddr.h"
#include "exec/memattrs.h"
#include "exec/vaddr.h"
-#include "system/ram_addr.h"
-
-#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
-void tlb_protect_code(ram_addr_t ram_addr);
-void tlb_unprotect_code(ram_addr_t ram_addr);
-#endif
#ifndef CONFIG_USER_ONLY
+#include "system/ram_addr.h"
+
void tlb_reset_dirty(CPUState *cpu, uintptr_t start, uintptr_t length);
void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
#endif
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 6e66f3c6e93..7f7c208ba12 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1,5 +1,5 @@
/*
- * Common CPU TLB handling
+ * Common CPU TLB handling (system emulation)
*
* Copyright (c) 2003 Fabrice Bellard
*
@@ -47,6 +47,7 @@
#include "tb-hash.h"
#include "tlb-bounds.h"
#include "internal-common.h"
+#include "system-page-protection.h"
#ifdef CONFIG_PLUGIN
#include "qemu/plugin-memory.h"
#endif
diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c
index c33dbf65e7f..4313864d2c5 100644
--- a/accel/tcg/tb-maint.c
+++ b/accel/tcg/tb-maint.c
@@ -38,6 +38,7 @@
#include "user/page-protection.h"
#define runstate_is_running() true
#else
+#include "system-page-protection.h"
#include "system/runstate.h"
#endif
#include "trace.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 04/33] accel/hvf: Remove left-over comment
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:36 ` Daniel Henrique Barboza
2026-07-02 16:29 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field Philippe Mathieu-Daudé
` (28 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Missed in commit 6bf331164c5 ("accel/hvf: Drop hvf_slot and
hvf_find_overlap_slot").
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
accel/hvf/hvf-accel-ops.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index b74a5779c3d..dd2b45b7cb5 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -62,8 +62,6 @@
HVFState *hvf_state;
-/* Memory slots */
-
static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
{
if (!cpu->vcpu_dirty) {
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 04/33] accel/hvf: Remove left-over comment Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:00 ` Philippe Mathieu-Daudé
2026-07-02 16:56 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 06/33] gdbstub: Add trace event for STEP packet handler Philippe Mathieu-Daudé
` (27 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
No need for accel-specific @dirty field when we have
a generic one in CPUState. (Other accelerators already
did that in commits 6f13a0ada01..36ab216b81d).
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/system/mshv_int.h | 1 -
accel/mshv/mshv-all.c | 18 +++++++++---------
target/i386/mshv/mshv-cpu.c | 6 +++---
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
index ba3073888ac..b91c4d661a3 100644
--- a/include/system/mshv_int.h
+++ b/include/system/mshv_int.h
@@ -43,7 +43,6 @@ typedef struct MshvHvCallArgs {
struct AccelCPUState {
int cpufd;
- bool dirty;
MshvHvCallArgs hvcall_args;
};
diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
index 9452504ac28..1959baf6672 100644
--- a/accel/mshv/mshv-all.c
+++ b/accel/mshv/mshv-all.c
@@ -531,7 +531,7 @@ static int mshv_init_vcpu(CPUState *cpu)
}
mshv_arch_init_vcpu(cpu);
- cpu->accel->dirty = true;
+ cpu->vcpu_dirty = true;
return 0;
}
@@ -617,7 +617,7 @@ static int mshv_cpu_exec(CPUState *cpu)
cpu_exec_start(cpu);
do {
- if (cpu->accel->dirty) {
+ if (cpu->vcpu_dirty) {
ret = mshv_arch_store_vcpu_state(cpu);
if (ret) {
error_report("Failed to put registers after init: %s",
@@ -625,7 +625,7 @@ static int mshv_cpu_exec(CPUState *cpu)
ret = -1;
break;
}
- cpu->accel->dirty = false;
+ cpu->vcpu_dirty = false;
}
ret = mshv_run_vcpu(mshv_state->vm, cpu, &mshv_msg, &exit_reason);
@@ -746,7 +746,7 @@ static void do_mshv_cpu_synchronize_post_init(CPUState *cpu,
abort();
}
- cpu->accel->dirty = false;
+ cpu->vcpu_dirty = false;
}
static void mshv_cpu_synchronize_post_init(CPUState *cpu)
@@ -763,13 +763,13 @@ static void mshv_cpu_synchronize_post_reset(CPUState *cpu)
cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
vm_stop(RUN_STATE_INTERNAL_ERROR);
}
- cpu->accel->dirty = false;
+ cpu->vcpu_dirty = false;
}
static void do_mshv_cpu_synchronize_pre_loadvm(CPUState *cpu,
run_on_cpu_data arg)
{
- cpu->accel->dirty = true;
+ cpu->vcpu_dirty = true;
}
static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
@@ -779,7 +779,7 @@ static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
{
- if (!cpu->accel->dirty) {
+ if (!cpu->vcpu_dirty) {
int ret = mshv_arch_load_vcpu_state(cpu);
if (ret < 0) {
error_report("Failed to load registers for vcpu %d",
@@ -789,13 +789,13 @@ static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
vm_stop(RUN_STATE_INTERNAL_ERROR);
}
- cpu->accel->dirty = true;
+ cpu->vcpu_dirty = true;
}
}
static void mshv_cpu_synchronize(CPUState *cpu)
{
- if (!cpu->accel->dirty) {
+ if (!cpu->vcpu_dirty) {
run_on_cpu(cpu, do_mshv_cpu_synchronize, RUN_ON_CPU_NULL);
}
}
diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
index 126ca40b481..1c433c408c8 100644
--- a/target/i386/mshv/mshv-cpu.c
+++ b/target/i386/mshv/mshv-cpu.c
@@ -1692,7 +1692,7 @@ static int pio_write(uint64_t port, const uint8_t *data, uintptr_t size,
return ret;
}
-static int handle_pio_non_str(const CPUState *cpu,
+static int handle_pio_non_str(CPUState *cpu,
hv_x64_io_port_intercept_message *info)
{
size_t len = info->access_info.access_size;
@@ -1748,7 +1748,7 @@ static int handle_pio_non_str(const CPUState *cpu,
return -1;
}
- cpu->accel->dirty = false;
+ cpu->vcpu_dirty = false;
return 0;
}
@@ -1909,7 +1909,7 @@ static int handle_pio_str(CPUState *cpu, hv_x64_io_port_intercept_message *info)
return -1;
}
- cpu->accel->dirty = false;
+ cpu->vcpu_dirty = false;
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 06/33] gdbstub: Add trace event for STEP packet handler
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:18 ` Daniel Henrique Barboza
2026-07-02 13:25 ` Alex Bennée
2026-06-30 22:00 ` [PATCH 07/33] gdbstub: Only return E22 when reverse GDB is not supported Philippe Mathieu-Daudé
` (26 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
gdbstub/gdbstub.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 26366acb674..246e7746300 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -1369,6 +1369,7 @@ static void handle_step(GArray *params, void *user_ctx)
gdb_set_cpu_pc(gdb_get_cmd_param(params, 0)->val_ull);
}
+ trace_gdbstub_op_stepping(gdbserver_state.c_cpu->cpu_index);
cpu_single_step(gdbserver_state.c_cpu, gdbserver_state.sstep_flags);
gdb_continue();
}
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 07/33] gdbstub: Only return E22 when reverse GDB is not supported
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 06/33] gdbstub: Add trace event for STEP packet handler Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:18 ` Daniel Henrique Barboza
2026-07-02 13:26 ` Alex Bennée
2026-06-30 22:00 ` [PATCH 08/33] accel/kvm: Always define AccelOpsClass::supports_guest_debug Philippe Mathieu-Daudé
` (25 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
No need to keep processing the arguments when we know
reverse debugging is not available.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
gdbstub/gdbstub.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 246e7746300..f54415a9db7 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -1378,6 +1378,7 @@ static void handle_backward(GArray *params, void *user_ctx)
{
if (!gdb_can_reverse()) {
gdb_put_packet("E22");
+ return;
}
if (params->len == 1) {
switch (gdb_get_cmd_param(params, 0)->opcode) {
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 08/33] accel/kvm: Always define AccelOpsClass::supports_guest_debug
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 07/33] gdbstub: Only return E22 when reverse GDB is not supported Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:19 ` Daniel Henrique Barboza
2026-07-02 17:16 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 09/33] accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG Philippe Mathieu-Daudé
` (24 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Whether TARGET_KVM_HAVE_GUEST_DEBUG is defined or not,
kvm_supports_guest_debug() still exists and can be called.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
accel/kvm/kvm-accel-ops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index 6d9140e549f..d7967bc922f 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -105,9 +105,9 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
ops->handle_interrupt = generic_handle_interrupt;
+ ops->supports_guest_debug = kvm_supports_guest_debug;
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
ops->update_guest_debug = kvm_update_guest_debug_ops;
- ops->supports_guest_debug = kvm_supports_guest_debug;
ops->insert_breakpoint = kvm_insert_breakpoint;
ops->remove_breakpoint = kvm_remove_breakpoint;
ops->remove_all_breakpoints = kvm_remove_all_breakpoints;
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 09/33] accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 08/33] accel/kvm: Always define AccelOpsClass::supports_guest_debug Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 17:18 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 10/33] accel: Change gdbstub_supported_sstep_flags() -> get_gdbstub_config() Philippe Mathieu-Daudé
` (23 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Simplify #ifdef'ry using TARGET_KVM_HAVE_GUEST_DEBUG in kvm_init().
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
accel/kvm/kvm-all.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 5d55cb45cf7..6cd5f95d06e 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3037,24 +3037,23 @@ static int kvm_init(AccelState *as, MachineState *ms)
kvm_vm_attributes_allowed =
(kvm_check_extension(s, KVM_CAP_VM_ATTRIBUTES) > 0);
+ kvm_sstep_flags = 0;
+
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
kvm_has_guest_debug =
(kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG) > 0);
-#endif
- kvm_sstep_flags = 0;
if (kvm_has_guest_debug) {
kvm_sstep_flags = SSTEP_ENABLE;
-#if defined TARGET_KVM_HAVE_GUEST_DEBUG
int guest_debug_flags =
kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG2);
if (guest_debug_flags & KVM_GUESTDBG_BLOCKIRQ) {
kvm_sstep_flags |= SSTEP_NOIRQ;
}
-#endif
}
+#endif
kvm_state = s;
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 10/33] accel: Change gdbstub_supported_sstep_flags() -> get_gdbstub_config()
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 09/33] accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:50 ` Alex Bennée
2026-06-30 22:00 ` [PATCH 11/33] gdbstub: Store @can_reverse in GDBState Philippe Mathieu-Daudé
` (22 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
In order to have accelerator return multiple gdbstub parameters,
pass @supported_sstep_flags as argument instead of returning it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/accel/accel-ops.h | 2 +-
include/qemu/accel.h | 7 ++++---
accel/accel-common.c | 9 +++++----
accel/hvf/hvf-all.c | 6 +++---
accel/kvm/kvm-all.c | 12 +++++++-----
accel/tcg/tcg-all.c | 8 ++++----
gdbstub/gdbstub.c | 2 +-
7 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/include/accel/accel-ops.h b/include/accel/accel-ops.h
index f46492e3fe1..1bc359ff3e5 100644
--- a/include/accel/accel-ops.h
+++ b/include/accel/accel-ops.h
@@ -37,7 +37,7 @@ struct AccelClass {
hwaddr start_addr, hwaddr size);
/* gdbstub related hooks */
- int (*gdbstub_supported_sstep_flags)(AccelState *as);
+ void (*get_gdbstub_config)(AccelState *as, int *supported_sstep_flags);
bool *allowed;
/*
diff --git a/include/qemu/accel.h b/include/qemu/accel.h
index d3638c7bfda..92f9c538f31 100644
--- a/include/qemu/accel.h
+++ b/include/qemu/accel.h
@@ -74,11 +74,12 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp);
void accel_cpu_common_unrealize(CPUState *cpu);
/**
- * accel_supported_gdbstub_sstep_flags:
+ * accel_get_gdbstub_config:
+ * @supported_sstep_flags: pointer to store the single step modes in
*
- * Returns the supported single step modes for the configured
+ * Set the supported single step modes for the configured
* accelerator.
*/
-int accel_supported_gdbstub_sstep_flags(void);
+void accel_get_gdbstub_config(int *supported_sstep_flags);
#endif /* QEMU_ACCEL_H */
diff --git a/accel/accel-common.c b/accel/accel-common.c
index 62590a7d9a6..526ab2a0cfb 100644
--- a/accel/accel-common.c
+++ b/accel/accel-common.c
@@ -113,14 +113,15 @@ void accel_cpu_common_unrealize(CPUState *cpu)
}
}
-int accel_supported_gdbstub_sstep_flags(void)
+void accel_get_gdbstub_config(int *supported_sstep_flags)
{
AccelState *accel = current_accel();
AccelClass *acc = ACCEL_GET_CLASS(accel);
- if (acc->gdbstub_supported_sstep_flags) {
- return acc->gdbstub_supported_sstep_flags(accel);
+ if (acc->get_gdbstub_config) {
+ acc->get_gdbstub_config(accel, supported_sstep_flags);
+ } else {
+ *supported_sstep_flags = 0;
}
- return 0;
}
static const TypeInfo accel_types[] = {
diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
index 21b9b71a6df..284ce8ebff1 100644
--- a/accel/hvf/hvf-all.c
+++ b/accel/hvf/hvf-all.c
@@ -228,9 +228,9 @@ static int hvf_accel_init(AccelState *as, MachineState *ms)
return hvf_arch_init();
}
-static int hvf_gdbstub_sstep_flags(AccelState *as)
+static void hvf_gdbstub_config(AccelState *as, int *supported_sstep_flags)
{
- return SSTEP_ENABLE | SSTEP_NOIRQ;
+ *supported_sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ;
}
static void hvf_set_kernel_irqchip(Object *obj, Visitor *v,
@@ -278,7 +278,7 @@ static void hvf_accel_class_init(ObjectClass *oc, const void *data)
ac->name = "HVF";
ac->init_machine = hvf_accel_init;
ac->allowed = &hvf_allowed;
- ac->gdbstub_supported_sstep_flags = hvf_gdbstub_sstep_flags;
+ ac->get_gdbstub_config = hvf_gdbstub_config;
hvf_kernel_irqchip_override = false;
hvf_kernel_irqchip = false;
object_class_property_add(oc, "kernel-irqchip", "on|off|split",
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 6cd5f95d06e..72d6eb464db 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -4281,14 +4281,16 @@ static void kvm_accel_instance_init(Object *obj)
}
/**
- * kvm_gdbstub_sstep_flags():
+ * kvm_gdbstub_config():
*
- * Returns: SSTEP_* flags that KVM supports for guest debug. The
+ * Set SSTEP_* flags that KVM supports for guest debug. The
* support is probed during kvm_init()
*/
-static int kvm_gdbstub_sstep_flags(AccelState *as)
+static void kvm_gdbstub_config(AccelState *as, int *supported_sstep_flags)
{
- return kvm_sstep_flags;
+ KVMState *s = KVM_STATE(as);
+
+ *supported_sstep_flags = s->gdbstub_sstep_flags;
}
static void kvm_accel_class_init(ObjectClass *oc, const void *data)
@@ -4299,7 +4301,7 @@ static void kvm_accel_class_init(ObjectClass *oc, const void *data)
ac->rebuild_guest = kvm_reset_vmfd;
ac->has_memory = kvm_accel_has_memory;
ac->allowed = &kvm_allowed;
- ac->gdbstub_supported_sstep_flags = kvm_gdbstub_sstep_flags;
+ ac->get_gdbstub_config = kvm_gdbstub_config;
object_class_property_add(oc, "kernel-irqchip", "on|off|split",
NULL, kvm_set_kernel_irqchip,
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index 8eb4a6b89e8..89f7e025021 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -242,7 +242,7 @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
qatomic_set(&one_insn_per_tb, value);
}
-static int tcg_gdbstub_supported_sstep_flags(AccelState *as)
+static void tcg_gdbstub_config(AccelState *as, int *supported_sstep_flags)
{
/*
* In replay mode all events will come from the log and can't be
@@ -251,9 +251,9 @@ static int tcg_gdbstub_supported_sstep_flags(AccelState *as)
* them occurring every time we single step.
*/
if (replay_mode != REPLAY_MODE_NONE) {
- return SSTEP_ENABLE;
+ *supported_sstep_flags = SSTEP_ENABLE;
} else {
- return SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
+ *supported_sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
}
}
@@ -266,7 +266,7 @@ static void tcg_accel_class_init(ObjectClass *oc, const void *data)
ac->cpu_common_unrealize = tcg_exec_unrealizefn;
ac->get_stats = tcg_get_stats;
ac->allowed = &tcg_allowed;
- ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags;
+ ac->get_gdbstub_config = tcg_gdbstub_config;
object_class_property_add_str(oc, "thread",
tcg_get_thread,
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index f54415a9db7..1e0a6638bff 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -72,7 +72,7 @@ void gdb_init_gdbserver_state(void)
* By default try to use no IRQs and no timers while single
* stepping so as to make single stepping like a typical ICE HW step.
*/
- gdbserver_state.supported_sstep_flags = accel_supported_gdbstub_sstep_flags();
+ accel_get_gdbstub_config(&gdbserver_state.supported_sstep_flags);
gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 11/33] gdbstub: Store @can_reverse in GDBState
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 10/33] accel: Change gdbstub_supported_sstep_flags() -> get_gdbstub_config() Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:20 ` Daniel Henrique Barboza
2026-06-30 22:00 ` [PATCH 12/33] gdbstub: Make default replay_mode value explicit in stubs Philippe Mathieu-Daudé
` (21 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Call gdb_can_reverse() once in gdb_init_gdbserver_state() and
store the result in GDBState.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
gdbstub/internals.h | 1 +
gdbstub/gdbstub.c | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index 9b25bf58b8e..9a1b8d9dd8a 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -85,6 +85,7 @@ typedef struct GDBState {
GByteArray *mem_buf;
int sstep_flags;
int supported_sstep_flags;
+ bool can_reverse;
/*
* Whether we are allowed to send a stop reply packet at this moment.
* Must be set off after sending the stop reply itself.
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 1e0a6638bff..0037704d522 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -75,6 +75,7 @@ void gdb_init_gdbserver_state(void)
accel_get_gdbstub_config(&gdbserver_state.supported_sstep_flags);
gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
+ gdbserver_state.can_reverse = gdb_can_reverse();
}
/* writes 2*len+1 bytes in buf */
@@ -1376,7 +1377,7 @@ static void handle_step(GArray *params, void *user_ctx)
static void handle_backward(GArray *params, void *user_ctx)
{
- if (!gdb_can_reverse()) {
+ if (!gdbserver_state.can_reverse) {
gdb_put_packet("E22");
return;
}
@@ -1684,7 +1685,7 @@ static void handle_query_supported(GArray *params, void *user_ctx)
g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+");
}
- if (gdb_can_reverse()) {
+ if (gdbserver_state.can_reverse) {
g_string_append(gdbserver_state.str_buf,
";ReverseStep+;ReverseContinue+");
}
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 12/33] gdbstub: Make default replay_mode value explicit in stubs
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 11/33] gdbstub: Store @can_reverse in GDBState Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 17:21 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 13/33] accel: Have get_gdbstub_config() return @can_reverse value Philippe Mathieu-Daudé
` (20 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Make explicit @replay_mode is stubbed as REPLAY_MODE_NONE.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
stubs/replay-mode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stubs/replay-mode.c b/stubs/replay-mode.c
index 439d97e4a87..5bc8f7d6589 100644
--- a/stubs/replay-mode.c
+++ b/stubs/replay-mode.c
@@ -1,4 +1,4 @@
#include "qemu/osdep.h"
#include "system/replay.h"
-ReplayMode replay_mode;
+ReplayMode replay_mode = REPLAY_MODE_NONE;
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 13/33] accel: Have get_gdbstub_config() return @can_reverse value
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 12/33] gdbstub: Make default replay_mode value explicit in stubs Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-06-30 22:00 ` [PATCH 14/33] accel: Move supports_guest_debug() declaration to AccelClass Philippe Mathieu-Daudé
` (19 subsequent siblings)
32 siblings, 0 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Have accelerators set @can_reverse in their get_gdbstub_config()
handler. Remove gdb_can_reverse() as now unused.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
gdbstub/internals.h | 1 -
include/accel/accel-ops.h | 3 ++-
include/qemu/accel.h | 5 +++--
accel/accel-common.c | 5 +++--
accel/hvf/hvf-all.c | 4 +++-
accel/kvm/kvm-all.c | 4 +++-
accel/tcg/tcg-all.c | 4 +++-
gdbstub/gdbstub.c | 4 ++--
gdbstub/system.c | 5 -----
gdbstub/user.c | 6 ------
10 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index 9a1b8d9dd8a..dbd6d11eb8c 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -154,7 +154,6 @@ CPUState *gdb_first_attached_cpu(void);
void gdb_append_thread_id(CPUState *cpu, GString *buf);
int gdb_get_cpu_index(CPUState *cpu);
unsigned int gdb_get_max_cpus(void); /* both */
-bool gdb_can_reverse(void); /* system emulation, stub for user */
int gdb_target_sigtrap(void); /* user */
void gdb_create_default_process(GDBState *s);
diff --git a/include/accel/accel-ops.h b/include/accel/accel-ops.h
index 1bc359ff3e5..07241f799a8 100644
--- a/include/accel/accel-ops.h
+++ b/include/accel/accel-ops.h
@@ -37,7 +37,8 @@ struct AccelClass {
hwaddr start_addr, hwaddr size);
/* gdbstub related hooks */
- void (*get_gdbstub_config)(AccelState *as, int *supported_sstep_flags);
+ void (*get_gdbstub_config)(AccelState *as, int *supported_sstep_flags,
+ bool *can_reverse);
bool *allowed;
/*
diff --git a/include/qemu/accel.h b/include/qemu/accel.h
index 92f9c538f31..e740939908a 100644
--- a/include/qemu/accel.h
+++ b/include/qemu/accel.h
@@ -76,10 +76,11 @@ void accel_cpu_common_unrealize(CPUState *cpu);
/**
* accel_get_gdbstub_config:
* @supported_sstep_flags: pointer to store the single step modes in
+ * @can_reverse: pointer to store whether reverse mode is supported
*
- * Set the supported single step modes for the configured
+ * Set the supported single step and reverse modes for the configured
* accelerator.
*/
-void accel_get_gdbstub_config(int *supported_sstep_flags);
+void accel_get_gdbstub_config(int *supported_sstep_flags, bool *can_reverse);
#endif /* QEMU_ACCEL_H */
diff --git a/accel/accel-common.c b/accel/accel-common.c
index 526ab2a0cfb..41f98937426 100644
--- a/accel/accel-common.c
+++ b/accel/accel-common.c
@@ -113,14 +113,15 @@ void accel_cpu_common_unrealize(CPUState *cpu)
}
}
-void accel_get_gdbstub_config(int *supported_sstep_flags)
+void accel_get_gdbstub_config(int *supported_sstep_flags, bool *can_reverse)
{
AccelState *accel = current_accel();
AccelClass *acc = ACCEL_GET_CLASS(accel);
if (acc->get_gdbstub_config) {
- acc->get_gdbstub_config(accel, supported_sstep_flags);
+ acc->get_gdbstub_config(accel, supported_sstep_flags, can_reverse);
} else {
*supported_sstep_flags = 0;
+ *can_reverse = false;
}
}
diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
index 284ce8ebff1..49014de26d1 100644
--- a/accel/hvf/hvf-all.c
+++ b/accel/hvf/hvf-all.c
@@ -228,9 +228,11 @@ static int hvf_accel_init(AccelState *as, MachineState *ms)
return hvf_arch_init();
}
-static void hvf_gdbstub_config(AccelState *as, int *supported_sstep_flags)
+static void hvf_gdbstub_config(AccelState *as, int *supported_sstep_flags,
+ bool *can_reverse)
{
*supported_sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ;
+ *can_reverse = false;
}
static void hvf_set_kernel_irqchip(Object *obj, Visitor *v,
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 72d6eb464db..0019a092d69 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -4286,11 +4286,13 @@ static void kvm_accel_instance_init(Object *obj)
* Set SSTEP_* flags that KVM supports for guest debug. The
* support is probed during kvm_init()
*/
-static void kvm_gdbstub_config(AccelState *as, int *supported_sstep_flags)
+static void kvm_gdbstub_config(AccelState *as, int *supported_sstep_flags,
+ bool *can_reverse)
{
KVMState *s = KVM_STATE(as);
*supported_sstep_flags = s->gdbstub_sstep_flags;
+ *can_reverse = false;
}
static void kvm_accel_class_init(ObjectClass *oc, const void *data)
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index 89f7e025021..2d2aab80d17 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -242,7 +242,8 @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
qatomic_set(&one_insn_per_tb, value);
}
-static void tcg_gdbstub_config(AccelState *as, int *supported_sstep_flags)
+static void tcg_gdbstub_config(AccelState *as, int *supported_sstep_flags,
+ bool *can_reverse)
{
/*
* In replay mode all events will come from the log and can't be
@@ -255,6 +256,7 @@ static void tcg_gdbstub_config(AccelState *as, int *supported_sstep_flags)
} else {
*supported_sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
}
+ *can_reverse = replay_mode == REPLAY_MODE_PLAY;
}
static void tcg_accel_class_init(ObjectClass *oc, const void *data)
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 0037704d522..0a691c95880 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -72,10 +72,10 @@ void gdb_init_gdbserver_state(void)
* By default try to use no IRQs and no timers while single
* stepping so as to make single stepping like a typical ICE HW step.
*/
- accel_get_gdbstub_config(&gdbserver_state.supported_sstep_flags);
+ accel_get_gdbstub_config(&gdbserver_state.supported_sstep_flags,
+ &gdbserver_state.can_reverse);
gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
- gdbserver_state.can_reverse = gdb_can_reverse();
}
/* writes 2*len+1 bytes in buf */
diff --git a/gdbstub/system.c b/gdbstub/system.c
index 2063b63b2f8..1421645c6e5 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -477,11 +477,6 @@ unsigned int gdb_get_max_cpus(void)
return ms->smp.max_cpus;
}
-bool gdb_can_reverse(void)
-{
- return replay_mode == REPLAY_MODE_PLAY;
-}
-
/*
* Softmmu specific command helpers
*/
diff --git a/gdbstub/user.c b/gdbstub/user.c
index 97eb13e796a..2cc851691f7 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -786,12 +786,6 @@ unsigned int gdb_get_max_cpus(void)
return max_cpus;
}
-/* replay not supported for user-mode */
-bool gdb_can_reverse(void)
-{
- return false;
-}
-
/*
* Break/Watch point helpers
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 14/33] accel: Move supports_guest_debug() declaration to AccelClass
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 13/33] accel: Have get_gdbstub_config() return @can_reverse value Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 17:29 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 15/33] accel/kvm: Hold have_guest_supported in KVMState Philippe Mathieu-Daudé
` (18 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
From: Philippe Mathieu-Daudé <philmd@linaro.org>
AccelOpsClass is for methods dealing with vCPUs.
When only dealing with AccelState, AccelClass is sufficient.
In order to have AccelClass methods instrospect their state,
we need to pass AccelState by argument.
Restrict kvm_supports_guest_debug() scope.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
accel/kvm/kvm-cpus.h | 1 -
gdbstub/internals.h | 1 -
include/accel/accel-cpu-ops.h | 1 -
include/accel/accel-ops.h | 1 +
include/qemu/accel.h | 2 ++
include/system/hvf_int.h | 2 +-
include/system/whpx-all.h | 4 +---
accel/accel-common.c | 12 ++++++++++++
accel/hvf/hvf-accel-ops.c | 1 -
accel/hvf/hvf-all.c | 1 +
accel/kvm/kvm-accel-ops.c | 1 -
accel/kvm/kvm-all.c | 3 ++-
accel/tcg/tcg-accel-ops.c | 6 ------
accel/tcg/tcg-all.c | 6 ++++++
accel/whpx/whpx-accel-ops.c | 7 -------
accel/whpx/whpx-common.c | 1 +
gdbstub/system.c | 12 ++----------
gdbstub/user.c | 6 ------
target/arm/hvf/hvf.c | 2 +-
target/arm/whpx/whpx-all.c | 2 +-
target/i386/hvf/hvf.c | 2 +-
target/i386/whpx/whpx-all.c | 2 +-
22 files changed, 33 insertions(+), 43 deletions(-)
diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h
index 688511151c8..3185659562d 100644
--- a/accel/kvm/kvm-cpus.h
+++ b/accel/kvm/kvm-cpus.h
@@ -16,7 +16,6 @@ void kvm_destroy_vcpu(CPUState *cpu);
void kvm_cpu_synchronize_post_reset(CPUState *cpu);
void kvm_cpu_synchronize_post_init(CPUState *cpu);
void kvm_cpu_synchronize_pre_loadvm(CPUState *cpu);
-bool kvm_supports_guest_debug(void);
int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len);
int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len);
void kvm_remove_all_breakpoints(CPUState *cpu);
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index dbd6d11eb8c..dbae07d2577 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -217,7 +217,6 @@ void gdb_syscall_handling(const char *syscall_packet);
* Break/Watch point support - there is an implementation for system
* and user mode.
*/
-bool gdb_supports_guest_debug(void);
int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len);
int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len);
void gdb_breakpoint_remove_all(CPUState *cs);
diff --git a/include/accel/accel-cpu-ops.h b/include/accel/accel-cpu-ops.h
index 9c07a903ea0..b23a0606c7e 100644
--- a/include/accel/accel-cpu-ops.h
+++ b/include/accel/accel-cpu-ops.h
@@ -84,7 +84,6 @@ struct AccelOpsClass {
int64_t (*get_elapsed_ticks)(void);
/* gdbstub hooks */
- bool (*supports_guest_debug)(void);
int (*update_guest_debug)(CPUState *cpu);
int (*insert_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
int (*remove_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
diff --git a/include/accel/accel-ops.h b/include/accel/accel-ops.h
index 07241f799a8..e961f37cd61 100644
--- a/include/accel/accel-ops.h
+++ b/include/accel/accel-ops.h
@@ -37,6 +37,7 @@ struct AccelClass {
hwaddr start_addr, hwaddr size);
/* gdbstub related hooks */
+ bool (*supports_guest_debug)(AccelState *as);
void (*get_gdbstub_config)(AccelState *as, int *supported_sstep_flags,
bool *can_reverse);
diff --git a/include/qemu/accel.h b/include/qemu/accel.h
index e740939908a..c520feaa38d 100644
--- a/include/qemu/accel.h
+++ b/include/qemu/accel.h
@@ -73,6 +73,8 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp);
*/
void accel_cpu_common_unrealize(CPUState *cpu);
+bool accel_supports_guest_debug(void);
+
/**
* accel_get_gdbstub_config:
* @supported_sstep_flags: pointer to store the single step modes in
diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h
index 58fb865ebae..ca0d4034e0f 100644
--- a/include/system/hvf_int.h
+++ b/include/system/hvf_int.h
@@ -107,7 +107,7 @@ int hvf_update_guest_debug(CPUState *cpu);
/*
* Return whether the guest supports debugging.
*/
-bool hvf_arch_supports_guest_debug(void);
+bool hvf_arch_supports_guest_debug(AccelState *as);
bool hvf_arch_cpu_realize(CPUState *cpu, Error **errp);
uint32_t hvf_arch_get_default_ipa_bit_size(void);
diff --git a/include/system/whpx-all.h b/include/system/whpx-all.h
index 4022571ffff..1b4389c052c 100644
--- a/include/system/whpx-all.h
+++ b/include/system/whpx-all.h
@@ -9,6 +9,7 @@ int whpx_vcpu_run(CPUState *cpu);
void whpx_get_registers(CPUState *cpu, WHPXStateLevel level);
void whpx_set_registers(CPUState *cpu, WHPXStateLevel level);
int whpx_accel_init(AccelState *as, MachineState *ms);
+bool whpx_arch_supports_guest_debug(AccelState *as);
void whpx_cpu_instance_init(CPUState *cs);
HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions);
void whpx_apply_breakpoints(
@@ -22,7 +23,4 @@ void whpx_translate_cpu_breakpoints(
void whpx_arch_destroy_vcpu(CPUState *cpu);
void whpx_arch_accel_class_init(ObjectClass *oc);
-/* called by whpx-accel-ops */
-bool whpx_arch_supports_guest_debug(void);
-
#endif
diff --git a/accel/accel-common.c b/accel/accel-common.c
index 41f98937426..db27f96c916 100644
--- a/accel/accel-common.c
+++ b/accel/accel-common.c
@@ -113,6 +113,18 @@ void accel_cpu_common_unrealize(CPUState *cpu)
}
}
+bool accel_supports_guest_debug(void)
+{
+ AccelState *accel = current_accel();
+ AccelClass *acc = ACCEL_GET_CLASS(accel);
+
+ if (acc->supports_guest_debug) {
+ return acc->supports_guest_debug(accel);
+ }
+ return false;
+}
+
+
void accel_get_gdbstub_config(int *supported_sstep_flags, bool *can_reverse)
{
AccelState *accel = current_accel();
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index dd2b45b7cb5..ecc0cd1b558 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -369,7 +369,6 @@ static void hvf_accel_ops_class_init(ObjectClass *oc, const void *data)
ops->remove_breakpoint = hvf_remove_breakpoint;
ops->remove_all_breakpoints = hvf_remove_all_breakpoints;
ops->update_guest_debug = hvf_update_guest_debug;
- ops->supports_guest_debug = hvf_arch_supports_guest_debug;
ops->get_vcpu_stats = hvf_get_vcpu_stats;
};
diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
index 49014de26d1..8ca6d9f5d32 100644
--- a/accel/hvf/hvf-all.c
+++ b/accel/hvf/hvf-all.c
@@ -280,6 +280,7 @@ static void hvf_accel_class_init(ObjectClass *oc, const void *data)
ac->name = "HVF";
ac->init_machine = hvf_accel_init;
ac->allowed = &hvf_allowed;
+ ac->supports_guest_debug = hvf_arch_supports_guest_debug;
ac->get_gdbstub_config = hvf_gdbstub_config;
hvf_kernel_irqchip_override = false;
hvf_kernel_irqchip = false;
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index d7967bc922f..45330327909 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -105,7 +105,6 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
ops->handle_interrupt = generic_handle_interrupt;
- ops->supports_guest_debug = kvm_supports_guest_debug;
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
ops->update_guest_debug = kvm_update_guest_debug_ops;
ops->insert_breakpoint = kvm_insert_breakpoint;
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 0019a092d69..1231c010fce 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3833,7 +3833,7 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
return data.err;
}
-bool kvm_supports_guest_debug(void)
+static bool kvm_supports_guest_debug(AccelState *as)
{
/* probed during kvm_init() */
return kvm_has_guest_debug;
@@ -4303,6 +4303,7 @@ static void kvm_accel_class_init(ObjectClass *oc, const void *data)
ac->rebuild_guest = kvm_reset_vmfd;
ac->has_memory = kvm_accel_has_memory;
ac->allowed = &kvm_allowed;
+ ac->supports_guest_debug = kvm_supports_guest_debug;
ac->get_gdbstub_config = kvm_gdbstub_config;
object_class_property_add(oc, "kernel-irqchip", "on|off|split",
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index c179cd4adeb..927af6c1db0 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -109,11 +109,6 @@ void tcg_handle_interrupt(CPUState *cpu, int mask)
}
}
-static bool tcg_supports_guest_debug(void)
-{
- return true;
-}
-
/* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */
static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
{
@@ -221,7 +216,6 @@ static void tcg_accel_ops_init(AccelClass *ac)
}
ops->cpu_reset_hold = tcg_cpu_reset_hold;
- ops->supports_guest_debug = tcg_supports_guest_debug;
ops->insert_breakpoint = tcg_insert_breakpoint;
ops->remove_breakpoint = tcg_remove_breakpoint;
ops->remove_all_breakpoints = tcg_remove_all_breakpoints;
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index 2d2aab80d17..19d776faf27 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -242,6 +242,11 @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
qatomic_set(&one_insn_per_tb, value);
}
+static bool tcg_supports_guest_debug(AccelState *as)
+{
+ return true;
+}
+
static void tcg_gdbstub_config(AccelState *as, int *supported_sstep_flags,
bool *can_reverse)
{
@@ -268,6 +273,7 @@ static void tcg_accel_class_init(ObjectClass *oc, const void *data)
ac->cpu_common_unrealize = tcg_exec_unrealizefn;
ac->get_stats = tcg_get_stats;
ac->allowed = &tcg_allowed;
+ ac->supports_guest_debug = tcg_supports_guest_debug;
ac->get_gdbstub_config = tcg_gdbstub_config;
object_class_property_add_str(oc, "thread",
diff --git a/accel/whpx/whpx-accel-ops.c b/accel/whpx/whpx-accel-ops.c
index b8f41544cbe..f38bd850ce3 100644
--- a/accel/whpx/whpx-accel-ops.c
+++ b/accel/whpx/whpx-accel-ops.c
@@ -82,12 +82,6 @@ static bool whpx_vcpu_thread_is_idle(CPUState *cpu)
return !whpx_irqchip_in_kernel();
}
-static bool whpx_supports_guest_debug(void)
-{
- return whpx_arch_supports_guest_debug();
-}
-
-
static void whpx_accel_ops_class_init(ObjectClass *oc, const void *data)
{
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
@@ -96,7 +90,6 @@ static void whpx_accel_ops_class_init(ObjectClass *oc, const void *data)
ops->kick_vcpu_thread = whpx_kick_vcpu_thread;
ops->cpu_thread_is_idle = whpx_vcpu_thread_is_idle;
ops->handle_interrupt = generic_handle_interrupt;
- ops->supports_guest_debug = whpx_supports_guest_debug;
ops->synchronize_post_reset = whpx_cpu_synchronize_post_reset;
ops->synchronize_post_init = whpx_cpu_synchronize_post_init;
diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c
index 247e12db812..db1d9d43744 100644
--- a/accel/whpx/whpx-common.c
+++ b/accel/whpx/whpx-common.c
@@ -527,6 +527,7 @@ static void whpx_accel_class_init(ObjectClass *oc, const void *data)
ac->init_machine = whpx_accel_init;
ac->pre_resume_vm = whpx_pre_resume_vm;
ac->allowed = &whpx_allowed;
+ ac->supports_guest_debug = whpx_arch_supports_guest_debug;
object_class_property_add(oc, "kernel-irqchip", "on|off|split",
NULL, whpx_set_kernel_irqchip,
diff --git a/gdbstub/system.c b/gdbstub/system.c
index 1421645c6e5..414aef431ec 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
+#include "qemu/accel.h"
#include "qemu/cutils.h"
#include "exec/gdbstub.h"
#include "gdbstub/syscalls.h"
@@ -343,7 +344,7 @@ bool gdbserver_start(const char *device, Error **errp)
return false;
}
- if (!gdb_supports_guest_debug()) {
+ if (!accel_supports_guest_debug()) {
error_setg(errp, "gdbstub: current accelerator doesn't "
"support guest debugging");
return false;
@@ -622,15 +623,6 @@ int gdb_signal_to_target(int sig)
* Break/Watch point helpers
*/
-bool gdb_supports_guest_debug(void)
-{
- const AccelOpsClass *ops = cpus_get_accel();
- if (ops->supports_guest_debug) {
- return ops->supports_guest_debug();
- }
- return false;
-}
-
int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
{
const AccelOpsClass *ops = cpus_get_accel();
diff --git a/gdbstub/user.c b/gdbstub/user.c
index 2cc851691f7..299388b9f71 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -790,12 +790,6 @@ unsigned int gdb_get_max_cpus(void)
* Break/Watch point helpers
*/
-bool gdb_supports_guest_debug(void)
-{
- /* user-mode == TCG == supported */
- return true;
-}
-
int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
{
CPUState *cpu;
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 8b902c68829..f76bd7bf55d 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -2901,7 +2901,7 @@ void hvf_arch_update_guest_debug(CPUState *cpu)
hvf_arch_set_traps(cpu);
}
-bool hvf_arch_supports_guest_debug(void)
+bool hvf_arch_supports_guest_debug(AccelState *as)
{
return true;
}
diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c
index 3079c6293c8..ec65e332f9c 100644
--- a/target/arm/whpx/whpx-all.c
+++ b/target/arm/whpx/whpx-all.c
@@ -295,7 +295,7 @@ void whpx_translate_cpu_breakpoints(
/* Breakpoints aren’t supported on this platform */
}
-bool whpx_arch_supports_guest_debug(void)
+bool whpx_arch_supports_guest_debug(AccelState *as)
{
return false;
}
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index 2d1a943b96c..bb8a070903c 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -1067,7 +1067,7 @@ void hvf_arch_update_guest_debug(CPUState *cpu)
{
}
-bool hvf_arch_supports_guest_debug(void)
+bool hvf_arch_supports_guest_debug(AccelState *as)
{
return false;
}
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index e626acef2f0..95705522e04 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -1853,7 +1853,7 @@ void whpx_apply_breakpoints(
}
}
-bool whpx_arch_supports_guest_debug(void)
+bool whpx_arch_supports_guest_debug(AccelState *as)
{
return true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 15/33] accel/kvm: Hold have_guest_supported in KVMState
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 14/33] accel: Move supports_guest_debug() declaration to AccelClass Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:22 ` Daniel Henrique Barboza
2026-07-02 17:37 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 16/33] accel/kvm: Hold gdbstub_sstep_flags " Philippe Mathieu-Daudé
` (17 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Prefer to store per-accelerator variables in the per-accelerator
state, rather than as static variables. This is a good practice
to allow concurrent accelerators in the future.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/system/kvm_int.h | 1 +
accel/kvm/kvm-all.c | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/system/kvm_int.h b/include/system/kvm_int.h
index 0876aac938d..49e90cc0235 100644
--- a/include/system/kvm_int.h
+++ b/include/system/kvm_int.h
@@ -113,6 +113,7 @@ struct KVMState
struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
bool coalesced_flush_in_progress;
int vcpu_events;
+ bool have_guest_supported;
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
#endif
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 1231c010fce..80d8ef1a974 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -104,7 +104,6 @@ bool kvm_readonly_mem_allowed;
bool kvm_vm_attributes_allowed;
bool kvm_msi_use_devid;
bool kvm_pre_fault_memory_supported;
-static bool kvm_has_guest_debug;
static int kvm_sstep_flags;
static bool kvm_immediate_exit;
static uint64_t kvm_supported_memory_attributes;
@@ -3040,10 +3039,10 @@ static int kvm_init(AccelState *as, MachineState *ms)
kvm_sstep_flags = 0;
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
- kvm_has_guest_debug =
+ s->have_guest_supported =
(kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG) > 0);
- if (kvm_has_guest_debug) {
+ if (s->have_guest_supported) {
kvm_sstep_flags = SSTEP_ENABLE;
int guest_debug_flags =
@@ -3835,8 +3834,9 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
static bool kvm_supports_guest_debug(AccelState *as)
{
+ KVMState *s = KVM_STATE(as);
/* probed during kvm_init() */
- return kvm_has_guest_debug;
+ return s->have_guest_supported;
}
int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 16/33] accel/kvm: Hold gdbstub_sstep_flags in KVMState
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (14 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 15/33] accel/kvm: Hold have_guest_supported in KVMState Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:22 ` Daniel Henrique Barboza
2026-07-02 17:42 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 17/33] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h' Philippe Mathieu-Daudé
` (16 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Prefer to store per-accelerator variables in the per-accelerator
state, rather than as static variables. This is a good practice
to allow concurrent accelerators in the future.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/system/kvm_int.h | 1 +
accel/kvm/kvm-all.c | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/system/kvm_int.h b/include/system/kvm_int.h
index 49e90cc0235..062759eaa01 100644
--- a/include/system/kvm_int.h
+++ b/include/system/kvm_int.h
@@ -114,6 +114,7 @@ struct KVMState
bool coalesced_flush_in_progress;
int vcpu_events;
bool have_guest_supported;
+ int gdbstub_sstep_flags;
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
#endif
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 80d8ef1a974..76c9ae6d4d4 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -104,7 +104,6 @@ bool kvm_readonly_mem_allowed;
bool kvm_vm_attributes_allowed;
bool kvm_msi_use_devid;
bool kvm_pre_fault_memory_supported;
-static int kvm_sstep_flags;
static bool kvm_immediate_exit;
static uint64_t kvm_supported_memory_attributes;
static bool kvm_guest_memfd_supported;
@@ -3036,20 +3035,20 @@ static int kvm_init(AccelState *as, MachineState *ms)
kvm_vm_attributes_allowed =
(kvm_check_extension(s, KVM_CAP_VM_ATTRIBUTES) > 0);
- kvm_sstep_flags = 0;
+ s->gdbstub_sstep_flags = 0;
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
s->have_guest_supported =
(kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG) > 0);
if (s->have_guest_supported) {
- kvm_sstep_flags = SSTEP_ENABLE;
+ s->gdbstub_sstep_flags = SSTEP_ENABLE;
int guest_debug_flags =
kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG2);
if (guest_debug_flags & KVM_GUESTDBG_BLOCKIRQ) {
- kvm_sstep_flags |= SSTEP_NOIRQ;
+ s->gdbstub_sstep_flags |= SSTEP_NOIRQ;
}
}
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 17/33] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h'
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (15 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 16/33] accel/kvm: Hold gdbstub_sstep_flags " Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:24 ` Daniel Henrique Barboza
2026-07-02 17:43 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 18/33] cpu: Define BreakpointFlags type Philippe Mathieu-Daudé
` (15 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/exec/breakpoint.h | 14 ++++++++++++++
include/hw/core/cpu.h | 14 --------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h
index 95f0482e6d0..cc6fedd09fe 100644
--- a/include/exec/breakpoint.h
+++ b/include/exec/breakpoint.h
@@ -12,6 +12,20 @@
#include "exec/vaddr.h"
#include "exec/memattrs.h"
+/* Breakpoint/watchpoint flags */
+#define BP_MEM_READ 0x01
+#define BP_MEM_WRITE 0x02
+#define BP_MEM_ACCESS (BP_MEM_READ | BP_MEM_WRITE)
+#define BP_STOP_BEFORE_ACCESS 0x04
+/* 0x08 currently unused */
+#define BP_GDB 0x10
+#define BP_CPU 0x20
+#define BP_ANY (BP_GDB | BP_CPU)
+#define BP_HIT_SHIFT 6
+#define BP_WATCHPOINT_HIT_READ (BP_MEM_READ << BP_HIT_SHIFT)
+#define BP_WATCHPOINT_HIT_WRITE (BP_MEM_WRITE << BP_HIT_SHIFT)
+#define BP_WATCHPOINT_HIT (BP_MEM_ACCESS << BP_HIT_SHIFT)
+
typedef struct CPUBreakpoint {
vaddr pc;
int flags; /* BP_* */
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 60a23d6f38b..b1df615792a 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1138,20 +1138,6 @@ void qemu_init_vcpu(CPUState *cpu);
*/
void cpu_single_step(CPUState *cpu, int enabled);
-/* Breakpoint/watchpoint flags */
-#define BP_MEM_READ 0x01
-#define BP_MEM_WRITE 0x02
-#define BP_MEM_ACCESS (BP_MEM_READ | BP_MEM_WRITE)
-#define BP_STOP_BEFORE_ACCESS 0x04
-/* 0x08 currently unused */
-#define BP_GDB 0x10
-#define BP_CPU 0x20
-#define BP_ANY (BP_GDB | BP_CPU)
-#define BP_HIT_SHIFT 6
-#define BP_WATCHPOINT_HIT_READ (BP_MEM_READ << BP_HIT_SHIFT)
-#define BP_WATCHPOINT_HIT_WRITE (BP_MEM_WRITE << BP_HIT_SHIFT)
-#define BP_WATCHPOINT_HIT (BP_MEM_ACCESS << BP_HIT_SHIFT)
-
int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
CPUBreakpoint **breakpoint);
int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags);
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 18/33] cpu: Define BreakpointFlags type
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (16 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 17/33] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h' Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:26 ` Daniel Henrique Barboza
2026-07-02 17:44 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 19/33] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints Philippe Mathieu-Daudé
` (14 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Use the BreakpointFlags typedef to better follow when
we deal with breakpoint flags (BP_*).
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/accel/tcg/cpu-ops.h | 6 ++++--
include/exec/breakpoint.h | 3 ++-
include/exec/watchpoint.h | 8 +++++---
include/hw/core/cpu.h | 11 ++++++-----
accel/tcg/cputlb.c | 12 +++++++-----
accel/tcg/tcg-accel-ops.c | 10 +++++-----
accel/tcg/user-exec-stub.c | 11 ++++++-----
accel/tcg/watchpoint.c | 9 +++++----
cpu-common.c | 8 ++++----
system/watchpoint.c | 8 ++++----
target/arm/tcg/debug.c | 4 ++--
target/arm/tcg/mte_helper.c | 3 ++-
target/ppc/cpu.c | 2 +-
target/ppc/kvm.c | 5 +++--
target/riscv/cpu_helper.c | 2 +-
target/riscv/debug.c | 12 +++++-------
target/s390x/tcg/debug.c | 3 ++-
target/xtensa/dbg_helper.c | 2 +-
18 files changed, 65 insertions(+), 54 deletions(-)
diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
index 710da12b828..f64d94b2b50 100644
--- a/include/accel/tcg/cpu-ops.h
+++ b/include/accel/tcg/cpu-ops.h
@@ -298,7 +298,8 @@ struct TCGCPUOps {
* specified by @flags. Exit via exception with a hit.
*/
void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
- MemTxAttrs attrs, int flags, uintptr_t ra);
+ MemTxAttrs attrs, BreakpointFlags flags,
+ uintptr_t ra);
/**
* cpu_watchpoint_address_matches:
@@ -309,7 +310,8 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
* Return the watchpoint flags that apply to [addr, addr+len).
* If no watchpoint is registered for the range, the result is 0.
*/
-int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len);
+BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu,
+ vaddr addr, vaddr len);
/*
* Common pointer_wrap implementations.
diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h
index cc6fedd09fe..0c3cc0c8ff3 100644
--- a/include/exec/breakpoint.h
+++ b/include/exec/breakpoint.h
@@ -12,6 +12,7 @@
#include "exec/vaddr.h"
#include "exec/memattrs.h"
+typedef int BreakpointFlags;
/* Breakpoint/watchpoint flags */
#define BP_MEM_READ 0x01
#define BP_MEM_WRITE 0x02
@@ -28,7 +29,7 @@
typedef struct CPUBreakpoint {
vaddr pc;
- int flags; /* BP_* */
+ BreakpointFlags flags;
QTAILQ_ENTRY(CPUBreakpoint) entry;
} CPUBreakpoint;
diff --git a/include/exec/watchpoint.h b/include/exec/watchpoint.h
index c4d069425ba..ba148eff3d1 100644
--- a/include/exec/watchpoint.h
+++ b/include/exec/watchpoint.h
@@ -8,11 +8,13 @@
#ifndef EXEC_WATCHPOINT_H
#define EXEC_WATCHPOINT_H
+#include "exec/breakpoint.h"
+
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
- int flags, CPUWatchpoint **watchpoint);
+ BreakpointFlags flags, CPUWatchpoint **watchpoint);
int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
- vaddr len, int flags);
+ vaddr len, BreakpointFlags flags);
void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
-void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
+void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags flags);
#endif /* EXEC_WATCHPOINT_H */
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index b1df615792a..bea8e509a19 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1138,20 +1138,21 @@ void qemu_init_vcpu(CPUState *cpu);
*/
void cpu_single_step(CPUState *cpu, int enabled);
-int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
+int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
CPUBreakpoint **breakpoint);
-int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags);
+int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags);
void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint);
-void cpu_breakpoint_remove_all(CPUState *cpu, int mask);
+void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags flags);
/* Return true if PC matches an installed breakpoint. */
-static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask)
+static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc,
+ BreakpointFlags flags)
{
CPUBreakpoint *bp;
if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) {
QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
- if (bp->pc == pc && (bp->flags & mask)) {
+ if (bp->pc == pc && (bp->flags & flags)) {
return true;
}
}
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 7f7c208ba12..e2911e3aac6 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1033,7 +1033,8 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx,
CPUTLBEntry *te, tn;
hwaddr iotlb, xlat, sz, paddr_page;
vaddr addr_page;
- int asidx, wp_flags, prot;
+ int asidx, prot;
+ BreakpointFlags wp_flags;
bool is_ram, is_romd;
assert_cpu_is_self(cpu);
@@ -1499,8 +1500,8 @@ void *probe_access(CPUArchState *env, vaddr addr, int size,
if (unlikely(flags & (TLB_NOTDIRTY | TLB_WATCHPOINT))) {
/* Handle watchpoints. */
if (flags & TLB_WATCHPOINT) {
- int wp_access = (access_type == MMU_DATA_STORE
- ? BP_MEM_WRITE : BP_MEM_READ);
+ BreakpointFlags wp_access = (access_type == MMU_DATA_STORE
+ ? BP_MEM_WRITE : BP_MEM_READ);
cpu_check_watchpoint(env_cpu(env), addr, size,
full->attrs, wp_access, retaddr);
}
@@ -1702,7 +1703,8 @@ static void mmu_watch_or_dirty(CPUState *cpu, MMULookupPageData *data,
/* On watchpoint hit, this will longjmp out. */
if (flags & TLB_WATCHPOINT) {
- int wp = access_type == MMU_DATA_STORE ? BP_MEM_WRITE : BP_MEM_READ;
+ BreakpointFlags wp = access_type == MMU_DATA_STORE ? BP_MEM_WRITE
+ : BP_MEM_READ;
cpu_check_watchpoint(cpu, addr, size, full->attrs, wp, ra);
flags &= ~TLB_WATCHPOINT;
}
@@ -1885,7 +1887,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi,
}
if (unlikely(tlb_addr & TLB_WATCHPOINT)) {
- int wp_flags = 0;
+ BreakpointFlags wp_flags = 0;
if (full->slow_flags[MMU_DATA_STORE] & TLB_WATCHPOINT) {
wp_flags |= BP_MEM_WRITE;
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 927af6c1db0..26d34c72d9a 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -110,20 +110,20 @@ void tcg_handle_interrupt(CPUState *cpu, int mask)
}
/* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */
-static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
+static inline BreakpointFlags xlat_gdb_type(CPUState *cpu, int gdbtype)
{
- static const int xlat[] = {
+ static const BreakpointFlags xlat[] = {
[GDB_WATCHPOINT_WRITE] = BP_GDB | BP_MEM_WRITE,
[GDB_WATCHPOINT_READ] = BP_GDB | BP_MEM_READ,
[GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS,
};
- int cputype = xlat[gdbtype];
+ BreakpointFlags cpuflags = xlat[gdbtype];
if (cpu->cc->gdb_stop_before_watchpoint) {
- cputype |= BP_STOP_BEFORE_ACCESS;
+ cpuflags |= BP_STOP_BEFORE_ACCESS;
}
- return cputype;
+ return cpuflags;
}
static int tcg_insert_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c
index 28286e11a60..7b6c25c4738 100644
--- a/accel/tcg/user-exec-stub.c
+++ b/accel/tcg/user-exec-stub.c
@@ -22,13 +22,13 @@ void cpu_exec_reset_hold(CPUState *cpu)
}
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
- int flags, CPUWatchpoint **watchpoint)
+ BreakpointFlags flags, CPUWatchpoint **watchpoint)
{
return -ENOSYS;
}
int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
- vaddr len, int flags)
+ vaddr len, BreakpointFlags flags)
{
return -ENOSYS;
}
@@ -37,17 +37,18 @@ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *wp)
{
}
-void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
+void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags flags)
{
}
-int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
+BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu,
+ vaddr addr, vaddr len)
{
return 0;
}
void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
- MemTxAttrs atr, int fl, uintptr_t ra)
+ MemTxAttrs atr, BreakpointFlags flags, uintptr_t ra)
{
}
diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c
index c75ed278459..5ea66e9763a 100644
--- a/accel/tcg/watchpoint.c
+++ b/accel/tcg/watchpoint.c
@@ -52,10 +52,11 @@ static inline bool watchpoint_address_matches(CPUWatchpoint *wp,
}
/* Return flags for watchpoints that match addr + prot. */
-int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
+BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu,
+ vaddr addr, vaddr len)
{
CPUWatchpoint *wp;
- int ret = 0;
+ BreakpointFlags ret = 0;
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
if (watchpoint_address_matches(wp, addr, len)) {
@@ -67,7 +68,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
/* Generate a debug exception if a watchpoint has been hit. */
void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
- MemTxAttrs attrs, int flags, uintptr_t ra)
+ MemTxAttrs attrs, BreakpointFlags flags, uintptr_t ra)
{
CPUWatchpoint *wp;
@@ -91,7 +92,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
assert((flags & ~BP_MEM_ACCESS) == 0);
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
- int hit_flags = wp->flags & flags;
+ BreakpointFlags hit_flags = wp->flags & flags;
if (hit_flags && watchpoint_address_matches(wp, addr, len)) {
if (replay_running_debug()) {
diff --git a/cpu-common.c b/cpu-common.c
index 988d057d844..5afae9c1899 100644
--- a/cpu-common.c
+++ b/cpu-common.c
@@ -389,7 +389,7 @@ void process_queued_cpu_work(CPUState *cpu)
}
/* Add a breakpoint. */
-int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
+int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
CPUBreakpoint **breakpoint)
{
CPUBreakpoint *bp;
@@ -419,7 +419,7 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
}
/* Remove a specific breakpoint. */
-int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
+int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags)
{
CPUBreakpoint *bp;
@@ -446,12 +446,12 @@ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *bp)
}
/* Remove all matching breakpoints. */
-void cpu_breakpoint_remove_all(CPUState *cpu, int mask)
+void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags flags)
{
CPUBreakpoint *bp, *next;
QTAILQ_FOREACH_SAFE(bp, &cpu->breakpoints, entry, next) {
- if (bp->flags & mask) {
+ if (bp->flags & flags) {
cpu_breakpoint_remove_by_ref(cpu, bp);
}
}
diff --git a/system/watchpoint.c b/system/watchpoint.c
index 21d0bb36cae..f96aa24210f 100644
--- a/system/watchpoint.c
+++ b/system/watchpoint.c
@@ -26,7 +26,7 @@
/* Add a watchpoint. */
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
- int flags, CPUWatchpoint **watchpoint)
+ BreakpointFlags flags, CPUWatchpoint **watchpoint)
{
CPUWatchpoint *wp;
vaddr in_page;
@@ -65,7 +65,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
/* Remove a specific watchpoint. */
int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len,
- int flags)
+ BreakpointFlags flags)
{
CPUWatchpoint *wp;
@@ -90,12 +90,12 @@ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint)
}
/* Remove all matching watchpoints. */
-void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
+void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags flags)
{
CPUWatchpoint *wp, *next;
QTAILQ_FOREACH_SAFE(wp, &cpu->watchpoints, entry, next) {
- if (wp->flags & mask) {
+ if (wp->flags & flags) {
cpu_watchpoint_remove_by_ref(cpu, wp);
}
}
diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c
index 07a52643e71..11043ecd589 100644
--- a/target/arm/tcg/debug.c
+++ b/target/arm/tcg/debug.c
@@ -550,7 +550,7 @@ void hw_watchpoint_update(ARMCPU *cpu, int n)
vaddr wvr = env->cp15.dbgwvr[n];
uint64_t wcr = env->cp15.dbgwcr[n];
int mask;
- int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
+ BreakpointFlags flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
if (env->cpu_watchpoint[n]) {
cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[n]);
@@ -656,7 +656,7 @@ void hw_breakpoint_update(ARMCPU *cpu, int n)
uint64_t bcr = env->cp15.dbgbcr[n];
vaddr addr;
int bt;
- int flags = BP_CPU;
+ BreakpointFlags flags = BP_CPU;
if (env->cpu_breakpoint[n]) {
cpu_breakpoint_remove_by_ref(CPU(cpu), env->cpu_breakpoint[n]);
diff --git a/target/arm/tcg/mte_helper.c b/target/arm/tcg/mte_helper.c
index dca4ef5a942..17f920b3f35 100644
--- a/target/arm/tcg/mte_helper.c
+++ b/target/arm/tcg/mte_helper.c
@@ -190,7 +190,8 @@ uint8_t *allocation_tag_mem_probe(CPUARMState *env, int ptr_mmu_idx,
/* Any debug exception has priority over a tag check exception. */
if (!probe && unlikely(flags & TLB_WATCHPOINT)) {
- int wp = ptr_access == MMU_DATA_LOAD ? BP_MEM_READ : BP_MEM_WRITE;
+ BreakpointFlags wp = ptr_access == MMU_DATA_LOAD ? BP_MEM_READ
+ : BP_MEM_WRITE;
assert(ra != 0);
cpu_check_watchpoint(env_cpu(env), ptr, ptr_size, attrs, wp, ra);
}
diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 41edb18643d..913920d55b8 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -145,7 +145,7 @@ void ppc_update_daw(CPUPPCState *env, int rid)
bool sv = extract32(dawrx, PPC_BIT_NR(62), 1);
bool pr = extract32(dawrx, PPC_BIT_NR(62), 1);
vaddr len;
- int flags;
+ BreakpointFlags flags;
if (env->dawr_watchpoint[rid]) {
cpu_watchpoint_remove_by_ref(cs, env->dawr_watchpoint[rid]);
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index b94c2997a07..2a3711fb1df 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1429,7 +1429,7 @@ static int find_hw_breakpoint(target_ulong addr, int type)
return -1;
}
-static int find_hw_watchpoint(target_ulong addr, int *flag)
+static int find_hw_watchpoint(target_ulong addr, BreakpointFlags *flag)
{
int n;
@@ -1575,7 +1575,6 @@ static int kvm_handle_hw_breakpoint(CPUState *cs,
{
int handle = DEBUG_RETURN_GUEST;
int n;
- int flag = 0;
if (nb_hw_breakpoint + nb_hw_watchpoint > 0) {
if (arch_info->status & KVMPPC_DEBUG_BREAKPOINT) {
@@ -1585,6 +1584,8 @@ static int kvm_handle_hw_breakpoint(CPUState *cs,
}
} else if (arch_info->status & (KVMPPC_DEBUG_WATCH_READ |
KVMPPC_DEBUG_WATCH_WRITE)) {
+ BreakpointFlags flag = 0;
+
n = find_hw_watchpoint(arch_info->address, &flag);
if (n >= 0) {
handle = DEBUG_RETURN_GDB;
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index 59edcdd3704..8b9d4bc1f4d 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -1992,7 +1992,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
} else if (probe) {
return false;
} else {
- int wp_access = 0;
+ BreakpointFlags wp_access = 0;
if (access_type == MMU_DATA_LOAD) {
wp_access |= BP_MEM_READ;
diff --git a/target/riscv/debug.c b/target/riscv/debug.c
index 30d39ee5cd0..3046cc896a8 100644
--- a/target/riscv/debug.c
+++ b/target/riscv/debug.c
@@ -479,7 +479,7 @@ static void type2_breakpoint_insert(CPURISCVState *env, target_ulong index)
target_ulong addr = env->tdata2[index];
bool enabled = type2_breakpoint_enabled(ctrl);
CPUState *cs = env_cpu(env);
- int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
+ BreakpointFlags flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
uint32_t size, def_size;
if (!enabled) {
@@ -604,7 +604,7 @@ static void type6_breakpoint_insert(CPURISCVState *env, target_ulong index)
target_ulong addr = env->tdata2[index];
bool enabled = type6_breakpoint_enabled(ctrl);
CPUState *cs = env_cpu(env);
- int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
+ BreakpointFlags flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
uint32_t size;
if (!enabled) {
@@ -992,12 +992,10 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp)
CPURISCVState *env = &cpu->env;
target_ulong ctrl;
target_ulong addr;
- int trigger_type;
- int flags;
- int i;
- for (i = 0; i < RV_MAX_TRIGGERS; i++) {
- trigger_type = get_trigger_type(env, i);
+ for (int i = 0; i < RV_MAX_TRIGGERS; i++) {
+ int trigger_type = get_trigger_type(env, i);
+ BreakpointFlags flags;
if (!trigger_common_match(env, trigger_type, i)) {
continue;
diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c
index 99140b1ac9a..d10e9ed8922 100644
--- a/target/s390x/tcg/debug.c
+++ b/target/s390x/tcg/debug.c
@@ -14,7 +14,8 @@
void s390_cpu_recompute_watchpoints(CPUState *cs)
{
- const int wp_flags = BP_CPU | BP_MEM_WRITE | BP_STOP_BEFORE_ACCESS;
+ const BreakpointFlags wp_flags = BP_CPU | BP_MEM_WRITE
+ | BP_STOP_BEFORE_ACCESS;
CPUS390XState *env = cpu_env(cs);
/* We are called when the watchpoints have changed. First
diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c
index 3b91f7c38ac..990012f60e6 100644
--- a/target/xtensa/dbg_helper.c
+++ b/target/xtensa/dbg_helper.c
@@ -85,7 +85,7 @@ static void set_dbreak(CPUXtensaState *env, unsigned i, uint32_t dbreaka,
uint32_t dbreakc)
{
CPUState *cs = env_cpu(env);
- int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
+ BreakpointFlags flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
uint32_t mask = dbreakc | ~DBREAKC_MASK;
if (env->cpu_watchpoint[i]) {
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 19/33] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (17 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 18/33] cpu: Define BreakpointFlags type Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:45 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 20/33] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode Philippe Mathieu-Daudé
` (13 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
accel/tcg/tcg-accel-ops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 26d34c72d9a..c54acc770e3 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -188,7 +188,7 @@ static int tcg_remove_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
}
}
-static inline void tcg_remove_all_breakpoints(CPUState *cpu)
+static void tcg_remove_all_breakpoints(CPUState *cpu)
{
cpu_breakpoint_remove_all(cpu, BP_GDB);
cpu_watchpoint_remove_all(cpu, BP_GDB);
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 20/33] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (18 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 19/33] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:46 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 21/33] gdbstub: Reduce @type variable scope Philippe Mathieu-Daudé
` (12 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
No need to deref external methods with unused argument to
end up calling a method defined in the same unit file, call
it directly.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
gdbstub/user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdbstub/user.c b/gdbstub/user.c
index 299388b9f71..90d6ee49fb5 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -557,7 +557,7 @@ static void disable_gdbstub(CPUState *thread_cpu)
close(gdbserver_user_state.fd);
gdbserver_user_state.fd = -1;
CPU_FOREACH(cpu) {
- cpu_breakpoint_remove_all(cpu, BP_GDB);
+ gdb_breakpoint_remove_all(cpu);
/* no cpu_watchpoint_remove_all for user-mode */
cpu_single_step(cpu, 0);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 21/33] gdbstub: Reduce @type variable scope
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (19 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 20/33] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:47 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator Philippe Mathieu-Daudé
` (11 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
gdbstub/system.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdbstub/system.c b/gdbstub/system.c
index 414aef431ec..d5e09802323 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -126,7 +126,6 @@ static void gdb_vm_state_change(void *opaque, bool running, RunState state)
CPUState *cpu = gdbserver_state.c_cpu;
g_autoptr(GString) buf = g_string_new(NULL);
g_autoptr(GString) tid = g_string_new(NULL);
- const char *type;
int ret;
if (running || gdbserver_state.state == RS_INACTIVE) {
@@ -152,6 +151,8 @@ static void gdb_vm_state_change(void *opaque, bool running, RunState state)
switch (state) {
case RUN_STATE_DEBUG:
if (cpu->watchpoint_hit) {
+ const char *type;
+
switch (cpu->watchpoint_hit->flags & BP_MEM_ACCESS) {
case BP_MEM_READ:
type = "r";
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (20 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 21/33] gdbstub: Reduce @type variable scope Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:29 ` Daniel Henrique Barboza
2026-07-02 17:50 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 23/33] accel: Use GdbBreakpointType enum Philippe Mathieu-Daudé
` (10 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Introduce the GdbBreakpointType enumerator to better follow
code related to GDB protocol handling.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
gdbstub/internals.h | 7 +++++--
include/gdbstub/enums.h | 12 +++++++-----
gdbstub/system.c | 6 ++++--
gdbstub/user.c | 6 ++++--
4 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index dbae07d2577..32f2520d2ea 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -10,6 +10,7 @@
#define GDBSTUB_INTERNALS_H
#include "exec/cpu-common.h"
+#include "gdbstub/enums.h"
/*
* Most "large" transfers (e.g. memory reads, feature XML
@@ -217,8 +218,10 @@ void gdb_syscall_handling(const char *syscall_packet);
* Break/Watch point support - there is an implementation for system
* and user mode.
*/
-int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len);
-int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len);
+int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
+ vaddr addr, vaddr len);
+int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
+ vaddr addr, vaddr len);
void gdb_breakpoint_remove_all(CPUState *cs);
/**
diff --git a/include/gdbstub/enums.h b/include/gdbstub/enums.h
index c4d54a1d083..e4e2043d92c 100644
--- a/include/gdbstub/enums.h
+++ b/include/gdbstub/enums.h
@@ -12,10 +12,12 @@
#define DEFAULT_GDBSTUB_PORT "1234"
/* GDB breakpoint/watchpoint types */
-#define GDB_BREAKPOINT_SW 0
-#define GDB_BREAKPOINT_HW 1
-#define GDB_WATCHPOINT_WRITE 2
-#define GDB_WATCHPOINT_READ 3
-#define GDB_WATCHPOINT_ACCESS 4
+typedef enum GdbBreakpointType {
+ GDB_BREAKPOINT_SW = 0,
+ GDB_BREAKPOINT_HW = 1,
+ GDB_WATCHPOINT_WRITE = 2,
+ GDB_WATCHPOINT_READ = 3,
+ GDB_WATCHPOINT_ACCESS = 4,
+} GdbBreakpointType;
#endif /* GDBSTUB_ENUMS_H */
diff --git a/gdbstub/system.c b/gdbstub/system.c
index d5e09802323..abeeebea8e2 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -624,7 +624,8 @@ int gdb_signal_to_target(int sig)
* Break/Watch point helpers
*/
-int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
+int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
const AccelOpsClass *ops = cpus_get_accel();
if (ops->insert_breakpoint) {
@@ -633,7 +634,8 @@ int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
return -ENOSYS;
}
-int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len)
+int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
const AccelOpsClass *ops = cpus_get_accel();
if (ops->remove_breakpoint) {
diff --git a/gdbstub/user.c b/gdbstub/user.c
index 90d6ee49fb5..9e6f9a6f376 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -790,7 +790,8 @@ unsigned int gdb_get_max_cpus(void)
* Break/Watch point helpers
*/
-int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
+int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
CPUState *cpu;
int err = 0;
@@ -811,7 +812,8 @@ int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
}
}
-int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len)
+int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
CPUState *cpu;
int err = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 23/33] accel: Use GdbBreakpointType enum
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (21 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:31 ` Daniel Henrique Barboza
2026-07-02 17:52 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 24/33] target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint() Philippe Mathieu-Daudé
` (9 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Include '_gdbstub_' in the AccelOpsClass handlers to emphasize
we are handling gdbstub-related requests.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
accel/kvm/kvm-cpus.h | 11 ++++++++---
include/accel/accel-cpu-ops.h | 9 ++++++---
include/system/hvf_int.h | 9 ++++++---
include/system/kvm.h | 9 ++++++---
target/arm/internals.h | 5 +++--
accel/hvf/hvf-accel-ops.c | 20 +++++++++++---------
accel/kvm/kvm-accel-ops.c | 6 +++---
accel/kvm/kvm-all.c | 14 ++++++++------
accel/tcg/tcg-accel-ops.c | 17 ++++++++++-------
gdbstub/system.c | 12 ++++++------
target/arm/hvf/hvf.c | 12 +++++++-----
target/arm/hyp_gdbstub.c | 8 ++++----
target/arm/kvm.c | 12 +++++++-----
target/i386/hvf/hvf.c | 8 +++++---
target/i386/kvm/kvm.c | 12 +++++++-----
target/loongarch/kvm/kvm.c | 8 +++++---
target/ppc/kvm.c | 12 +++++++-----
target/riscv/kvm/kvm-cpu.c | 8 +++++---
target/s390x/kvm/kvm.c | 8 +++++---
19 files changed, 119 insertions(+), 81 deletions(-)
diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h
index 3185659562d..bc2dd82e68e 100644
--- a/accel/kvm/kvm-cpus.h
+++ b/accel/kvm/kvm-cpus.h
@@ -10,13 +10,18 @@
#ifndef KVM_CPUS_H
#define KVM_CPUS_H
+#include "gdbstub/enums.h"
+
int kvm_init_vcpu(CPUState *cpu, Error **errp);
int kvm_cpu_exec(CPUState *cpu);
void kvm_destroy_vcpu(CPUState *cpu);
void kvm_cpu_synchronize_post_reset(CPUState *cpu);
void kvm_cpu_synchronize_post_init(CPUState *cpu);
void kvm_cpu_synchronize_pre_loadvm(CPUState *cpu);
-int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len);
-int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len);
-void kvm_remove_all_breakpoints(CPUState *cpu);
+int kvm_insert_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
+ vaddr addr, vaddr len);
+int kvm_remove_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
+ vaddr addr, vaddr len);
+void kvm_remove_all_gdbstub_breakpoints(CPUState *cpu);
+
#endif /* KVM_CPUS_H */
diff --git a/include/accel/accel-cpu-ops.h b/include/accel/accel-cpu-ops.h
index b23a0606c7e..f0c7ee7542c 100644
--- a/include/accel/accel-cpu-ops.h
+++ b/include/accel/accel-cpu-ops.h
@@ -13,6 +13,7 @@
#include "qemu/accel.h"
#include "exec/vaddr.h"
#include "qom/object.h"
+#include "gdbstub/enums.h"
#define ACCEL_OPS_SUFFIX "-ops"
#define TYPE_ACCEL_OPS "accel" ACCEL_OPS_SUFFIX
@@ -85,9 +86,11 @@ struct AccelOpsClass {
/* gdbstub hooks */
int (*update_guest_debug)(CPUState *cpu);
- int (*insert_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
- int (*remove_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
- void (*remove_all_breakpoints)(CPUState *cpu);
+ int (*insert_gdbstub_breakpoint)(CPUState *cpu, GdbBreakpointType type,
+ vaddr addr, vaddr len);
+ int (*remove_gdbstub_breakpoint)(CPUState *cpu, GdbBreakpointType type,
+ vaddr addr, vaddr len);
+ void (*remove_all_gdbstub_breakpoints)(CPUState *cpu);
};
void generic_handle_interrupt(CPUState *cpu, int mask);
diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h
index ca0d4034e0f..9cdc622929e 100644
--- a/include/system/hvf_int.h
+++ b/include/system/hvf_int.h
@@ -13,6 +13,7 @@
#include "qemu/queue.h"
#include "exec/vaddr.h"
+#include "gdbstub/enums.h"
#include "qom/object.h"
#include "accel/accel-ops.h"
@@ -91,9 +92,11 @@ int hvf_sw_breakpoints_active(CPUState *cpu);
int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
-int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
-int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
-void hvf_arch_remove_all_hw_breakpoints(void);
+int hvf_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type);
+int hvf_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type);
+void hvf_arch_remove_all_gdbstub_hw_breakpoints(void);
/*
* hvf_update_guest_debug:
diff --git a/include/system/kvm.h b/include/system/kvm.h
index cdd1856ac5f..714b8c7b011 100644
--- a/include/system/kvm.h
+++ b/include/system/kvm.h
@@ -17,6 +17,7 @@
#define QEMU_KVM_H
#include "exec/memattrs.h"
+#include "gdbstub/enums.h"
#include "qemu/accel.h"
#include "accel/accel-route.h"
#include "qom/object.h"
@@ -412,9 +413,11 @@ int kvm_arch_insert_sw_breakpoint(CPUState *cpu,
struct kvm_sw_breakpoint *bp);
int kvm_arch_remove_sw_breakpoint(CPUState *cpu,
struct kvm_sw_breakpoint *bp);
-int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
-int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
-void kvm_arch_remove_all_hw_breakpoints(void);
+int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type);
+int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type);
+void kvm_arch_remove_all_gdbstub_hw_breakpoints(void);
void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg);
diff --git a/target/arm/internals.h b/target/arm/internals.h
index fcce3804f34..067c3f2b8bb 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -29,6 +29,7 @@
#include "exec/vaddr.h"
#include "exec/breakpoint.h"
#include "exec/memop.h"
+#include "gdbstub/enums.h"
#ifdef CONFIG_TCG
#include "accel/tcg/tb-cpu-state.h"
#include "tcg/tcg-gvec-desc.h"
@@ -1968,8 +1969,8 @@ int delete_hw_breakpoint(vaddr pc);
bool check_watchpoint_in_range(int i, vaddr addr);
CPUWatchpoint *find_hw_watchpoint(CPUState *cpu, vaddr addr);
-int insert_hw_watchpoint(vaddr addr, vaddr len, int type);
-int delete_hw_watchpoint(vaddr addr, vaddr len, int type);
+int insert_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType type);
+int delete_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType type);
/* Return the current value of the system counter in ticks */
uint64_t gt_get_countervalue(CPUARMState *env);
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index ecc0cd1b558..d2276d8513e 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -233,7 +233,8 @@ int hvf_update_guest_debug(CPUState *cpu)
return 0;
}
-static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
+static int hvf_insert_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
struct hvf_sw_breakpoint *bp;
int err;
@@ -256,7 +257,7 @@ static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
QTAILQ_INSERT_HEAD(&hvf_state->hvf_sw_breakpoints, bp, entry);
} else {
- err = hvf_arch_insert_hw_breakpoint(addr, len, type);
+ err = hvf_arch_insert_gdbstub_hw_breakpoint(addr, len, type);
if (err) {
return err;
}
@@ -271,7 +272,8 @@ static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
return 0;
}
-static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
+static int hvf_remove_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
struct hvf_sw_breakpoint *bp;
int err;
@@ -295,7 +297,7 @@ static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
QTAILQ_REMOVE(&hvf_state->hvf_sw_breakpoints, bp, entry);
g_free(bp);
} else {
- err = hvf_arch_remove_hw_breakpoint(addr, len, type);
+ err = hvf_arch_remove_gdbstub_hw_breakpoint(addr, len, type);
if (err) {
return err;
}
@@ -310,7 +312,7 @@ static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
return 0;
}
-static void hvf_remove_all_breakpoints(CPUState *cpu)
+static void hvf_remove_all_gdbstub_breakpoints(CPUState *cpu)
{
struct hvf_sw_breakpoint *bp, *next;
CPUState *tmpcpu;
@@ -328,7 +330,7 @@ static void hvf_remove_all_breakpoints(CPUState *cpu)
QTAILQ_REMOVE(&hvf_state->hvf_sw_breakpoints, bp, entry);
g_free(bp);
}
- hvf_arch_remove_all_hw_breakpoints();
+ hvf_arch_remove_all_gdbstub_hw_breakpoints();
CPU_FOREACH(cpu) {
hvf_update_guest_debug(cpu);
@@ -365,9 +367,9 @@ static void hvf_accel_ops_class_init(ObjectClass *oc, const void *data)
ops->synchronize_state = hvf_cpu_synchronize_state;
ops->synchronize_pre_loadvm = hvf_cpu_synchronize_pre_loadvm;
- ops->insert_breakpoint = hvf_insert_breakpoint;
- ops->remove_breakpoint = hvf_remove_breakpoint;
- ops->remove_all_breakpoints = hvf_remove_all_breakpoints;
+ ops->insert_gdbstub_breakpoint = hvf_insert_gdbstub_breakpoint;
+ ops->remove_gdbstub_breakpoint = hvf_remove_gdbstub_breakpoint;
+ ops->remove_all_gdbstub_breakpoints = hvf_remove_all_gdbstub_breakpoints;
ops->update_guest_debug = hvf_update_guest_debug;
ops->get_vcpu_stats = hvf_get_vcpu_stats;
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index 45330327909..c8e7aa38709 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -107,9 +107,9 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
ops->update_guest_debug = kvm_update_guest_debug_ops;
- ops->insert_breakpoint = kvm_insert_breakpoint;
- ops->remove_breakpoint = kvm_remove_breakpoint;
- ops->remove_all_breakpoints = kvm_remove_all_breakpoints;
+ ops->insert_gdbstub_breakpoint = kvm_insert_gdbstub_breakpoint;
+ ops->remove_gdbstub_breakpoint = kvm_remove_gdbstub_breakpoint;
+ ops->remove_all_gdbstub_breakpoints = kvm_remove_all_gdbstub_breakpoints;
#endif
}
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 76c9ae6d4d4..e8ed85f9a3d 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3838,7 +3838,8 @@ static bool kvm_supports_guest_debug(AccelState *as)
return s->have_guest_supported;
}
-int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
+int kvm_insert_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
struct kvm_sw_breakpoint *bp;
int err;
@@ -3861,7 +3862,7 @@ int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
QTAILQ_INSERT_HEAD(&cpu->kvm_state->kvm_sw_breakpoints, bp, entry);
} else {
- err = kvm_arch_insert_hw_breakpoint(addr, len, type);
+ err = kvm_arch_insert_gdbstub_hw_breakpoint(addr, len, type);
if (err) {
return err;
}
@@ -3876,7 +3877,8 @@ int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
return 0;
}
-int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
+int kvm_remove_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
struct kvm_sw_breakpoint *bp;
int err;
@@ -3900,7 +3902,7 @@ int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
QTAILQ_REMOVE(&cpu->kvm_state->kvm_sw_breakpoints, bp, entry);
g_free(bp);
} else {
- err = kvm_arch_remove_hw_breakpoint(addr, len, type);
+ err = kvm_arch_remove_gdbstub_hw_breakpoint(addr, len, type);
if (err) {
return err;
}
@@ -3915,7 +3917,7 @@ int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
return 0;
}
-void kvm_remove_all_breakpoints(CPUState *cpu)
+void kvm_remove_all_gdbstub_breakpoints(CPUState *cpu)
{
struct kvm_sw_breakpoint *bp, *next;
KVMState *s = cpu->kvm_state;
@@ -3933,7 +3935,7 @@ void kvm_remove_all_breakpoints(CPUState *cpu)
QTAILQ_REMOVE(&s->kvm_sw_breakpoints, bp, entry);
g_free(bp);
}
- kvm_arch_remove_all_hw_breakpoints();
+ kvm_arch_remove_all_gdbstub_hw_breakpoints();
CPU_FOREACH(cpu) {
kvm_update_guest_debug(cpu, 0);
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index c54acc770e3..028265c2efd 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -110,7 +110,8 @@ void tcg_handle_interrupt(CPUState *cpu, int mask)
}
/* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */
-static inline BreakpointFlags xlat_gdb_type(CPUState *cpu, int gdbtype)
+static inline BreakpointFlags xlat_gdb_type(CPUState *cpu,
+ GdbBreakpointType gdbtype)
{
static const BreakpointFlags xlat[] = {
[GDB_WATCHPOINT_WRITE] = BP_GDB | BP_MEM_WRITE,
@@ -126,7 +127,8 @@ static inline BreakpointFlags xlat_gdb_type(CPUState *cpu, int gdbtype)
return cpuflags;
}
-static int tcg_insert_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
+static int tcg_insert_gdbstub_breakpoint(CPUState *cs, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
CPUState *cpu;
int err = 0;
@@ -157,7 +159,8 @@ static int tcg_insert_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
}
}
-static int tcg_remove_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
+static int tcg_remove_gdbstub_breakpoint(CPUState *cs, GdbBreakpointType type,
+ vaddr addr, vaddr len)
{
CPUState *cpu;
int err = 0;
@@ -188,7 +191,7 @@ static int tcg_remove_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
}
}
-static void tcg_remove_all_breakpoints(CPUState *cpu)
+static void tcg_remove_all_gdbstub_breakpoints(CPUState *cpu)
{
cpu_breakpoint_remove_all(cpu, BP_GDB);
cpu_watchpoint_remove_all(cpu, BP_GDB);
@@ -216,9 +219,9 @@ static void tcg_accel_ops_init(AccelClass *ac)
}
ops->cpu_reset_hold = tcg_cpu_reset_hold;
- ops->insert_breakpoint = tcg_insert_breakpoint;
- ops->remove_breakpoint = tcg_remove_breakpoint;
- ops->remove_all_breakpoints = tcg_remove_all_breakpoints;
+ ops->insert_gdbstub_breakpoint = tcg_insert_gdbstub_breakpoint;
+ ops->remove_gdbstub_breakpoint = tcg_remove_gdbstub_breakpoint;
+ ops->remove_all_gdbstub_breakpoints = tcg_remove_all_gdbstub_breakpoints;
}
static void tcg_accel_ops_class_init(ObjectClass *oc, const void *data)
diff --git a/gdbstub/system.c b/gdbstub/system.c
index abeeebea8e2..108fe4bafb7 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -628,8 +628,8 @@ int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
vaddr addr, vaddr len)
{
const AccelOpsClass *ops = cpus_get_accel();
- if (ops->insert_breakpoint) {
- return ops->insert_breakpoint(cs, type, addr, len);
+ if (ops->insert_gdbstub_breakpoint) {
+ return ops->insert_gdbstub_breakpoint(cs, type, addr, len);
}
return -ENOSYS;
}
@@ -638,8 +638,8 @@ int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
vaddr addr, vaddr len)
{
const AccelOpsClass *ops = cpus_get_accel();
- if (ops->remove_breakpoint) {
- return ops->remove_breakpoint(cs, type, addr, len);
+ if (ops->remove_gdbstub_breakpoint) {
+ return ops->remove_gdbstub_breakpoint(cs, type, addr, len);
}
return -ENOSYS;
}
@@ -647,8 +647,8 @@ int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
void gdb_breakpoint_remove_all(CPUState *cs)
{
const AccelOpsClass *ops = cpus_get_accel();
- if (ops->remove_all_breakpoints) {
- ops->remove_all_breakpoints(cs);
+ if (ops->remove_all_gdbstub_breakpoints) {
+ ops->remove_all_gdbstub_breakpoints(cs);
}
}
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index f76bd7bf55d..530af305efd 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -2726,7 +2726,8 @@ int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp)
return 0;
}
-int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
+int hvf_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -2734,13 +2735,14 @@ int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
case GDB_WATCHPOINT_READ:
case GDB_WATCHPOINT_WRITE:
case GDB_WATCHPOINT_ACCESS:
- return insert_hw_watchpoint(addr, len, type);
+ return insert_gdbstub_hw_watchpoint(addr, len, type);
default:
return -ENOSYS;
}
}
-int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
+int hvf_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -2748,13 +2750,13 @@ int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
case GDB_WATCHPOINT_READ:
case GDB_WATCHPOINT_WRITE:
case GDB_WATCHPOINT_ACCESS:
- return delete_hw_watchpoint(addr, len, type);
+ return delete_gdbstub_hw_watchpoint(addr, len, type);
default:
return -ENOSYS;
}
}
-void hvf_arch_remove_all_hw_breakpoints(void)
+void hvf_arch_remove_all_gdbstub_hw_breakpoints(void)
{
if (cur_hw_wps > 0) {
g_array_remove_range(hw_watchpoints, 0, cur_hw_wps);
diff --git a/target/arm/hyp_gdbstub.c b/target/arm/hyp_gdbstub.c
index bb5969720ce..dda6946ddaa 100644
--- a/target/arm/hyp_gdbstub.c
+++ b/target/arm/hyp_gdbstub.c
@@ -94,7 +94,7 @@ int delete_hw_breakpoint(vaddr pc)
}
/**
- * insert_hw_watchpoint()
+ * insert_gdbstub_hw_watchpoint()
* @addr: address of watch point
* @len: size of area
* @type: type of watch point
@@ -125,7 +125,7 @@ int delete_hw_breakpoint(vaddr pc)
* need to ensure you mask the address as required and set BAS=0xff
*/
-int insert_hw_watchpoint(vaddr addr, vaddr len, int type)
+int insert_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType type)
{
HWWatchpoint wp = {
.wcr = R_DBGWCR_E_MASK, /* E=1, enable */
@@ -208,13 +208,13 @@ bool check_watchpoint_in_range(int i, vaddr addr)
}
/**
- * delete_hw_watchpoint()
+ * delete_gdbstub_hw_watchpoint()
* @addr: address of breakpoint
*
* Delete a breakpoint and shuffle any above down
*/
-int delete_hw_watchpoint(vaddr addr, vaddr len, int type)
+int delete_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType type)
{
int i;
for (i = 0; i < cur_hw_wps; i++) {
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index a54ef51ec2a..01f42f42538 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1784,7 +1784,8 @@ void kvm_arch_accel_class_init(ObjectClass *oc)
"Eager Page Split chunk size for hugepages. (default: 0, disabled)");
}
-int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -1793,13 +1794,14 @@ int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
case GDB_WATCHPOINT_READ:
case GDB_WATCHPOINT_WRITE:
case GDB_WATCHPOINT_ACCESS:
- return insert_hw_watchpoint(addr, len, type);
+ return insert_gdbstub_hw_watchpoint(addr, len, type);
default:
return -ENOSYS;
}
}
-int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -1807,13 +1809,13 @@ int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
case GDB_WATCHPOINT_READ:
case GDB_WATCHPOINT_WRITE:
case GDB_WATCHPOINT_ACCESS:
- return delete_hw_watchpoint(addr, len, type);
+ return delete_gdbstub_hw_watchpoint(addr, len, type);
default:
return -ENOSYS;
}
}
-void kvm_arch_remove_all_hw_breakpoints(void)
+void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
{
if (cur_hw_wps > 0) {
g_array_remove_range(hw_watchpoints, 0, cur_hw_wps);
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index bb8a070903c..f5c1df18c14 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -1049,17 +1049,19 @@ int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp)
return -ENOSYS;
}
-int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
+int hvf_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
return -ENOSYS;
}
-int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
+int hvf_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
return -ENOSYS;
}
-void hvf_arch_remove_all_hw_breakpoints(void)
+void hvf_arch_remove_all_gdbstub_hw_breakpoints(void)
{
}
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 64cc421abe6..1e09155e92c 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -6159,12 +6159,12 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
static struct {
target_ulong addr;
int len;
- int type;
+ GdbBreakpointType type;
} hw_breakpoint[4];
static int nb_hw_breakpoint;
-static int find_hw_breakpoint(target_ulong addr, int len, int type)
+static int find_hw_breakpoint(target_ulong addr, int len, GdbBreakpointType type)
{
int n;
@@ -6177,7 +6177,8 @@ static int find_hw_breakpoint(target_ulong addr, int len, int type)
return -1;
}
-int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -6217,7 +6218,8 @@ int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
return 0;
}
-int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
int n;
@@ -6231,7 +6233,7 @@ int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
return 0;
}
-void kvm_arch_remove_all_hw_breakpoints(void)
+void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
{
nb_hw_breakpoint = 0;
}
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index d6539c12acd..beda6965f8c 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -1418,17 +1418,19 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
return 0;
}
-int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
return -ENOSYS;
}
-int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
return -ENOSYS;
}
-void kvm_arch_remove_all_hw_breakpoints(void)
+void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
{
}
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 2a3711fb1df..6bdfbbd68d6 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -455,7 +455,7 @@ unsigned long kvm_arch_vcpu_id(CPUState *cpu)
static struct HWBreakpoint {
target_ulong addr;
- int type;
+ GdbBreakpointType type;
} hw_debug_points[MAX_HW_BKPTS];
static CPUWatchpoint hw_watchpoint;
@@ -1412,7 +1412,7 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
return 0;
}
-static int find_hw_breakpoint(target_ulong addr, int type)
+static int find_hw_breakpoint(target_ulong addr, GdbBreakpointType type)
{
int n;
@@ -1454,7 +1454,8 @@ static int find_hw_watchpoint(target_ulong addr, BreakpointFlags *flag)
return -1;
}
-int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
const unsigned breakpoint_index = nb_hw_breakpoint + nb_hw_watchpoint;
if (breakpoint_index >= ARRAY_SIZE(hw_debug_points)) {
@@ -1498,7 +1499,8 @@ int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
return 0;
}
-int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
int n;
@@ -1526,7 +1528,7 @@ int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
return 0;
}
-void kvm_arch_remove_all_hw_breakpoints(void)
+void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
{
nb_hw_breakpoint = nb_hw_watchpoint = 0;
}
diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
index f0de5c3071d..3300f6f71b2 100644
--- a/target/riscv/kvm/kvm-cpu.c
+++ b/target/riscv/kvm/kvm-cpu.c
@@ -2206,19 +2206,21 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
return 0;
}
-int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
/* TODO; To be implemented later. */
return -EINVAL;
}
-int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
/* TODO; To be implemented later. */
return -EINVAL;
}
-void kvm_arch_remove_all_hw_breakpoints(void)
+void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
{
/* TODO; To be implemented later. */
}
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index fdef8f9e8ac..195e39df032 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -907,7 +907,8 @@ static int insert_hw_breakpoint(vaddr addr, int len, int type)
return 0;
}
-int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -925,7 +926,8 @@ int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
return insert_hw_breakpoint(addr, len, type);
}
-int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
+int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
+ GdbBreakpointType type)
{
int size;
struct kvm_hw_breakpoint *bp = find_hw_breakpoint(addr, len, type);
@@ -954,7 +956,7 @@ int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
return 0;
}
-void kvm_arch_remove_all_hw_breakpoints(void)
+void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
{
nb_hw_breakpoints = 0;
g_free(hw_breakpoints);
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 24/33] target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint()
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (22 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 23/33] accel: Use GdbBreakpointType enum Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 17:53 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 25/33] target/arm: Factor arm_check_watchpoint_hit() out Philippe Mathieu-Daudé
` (8 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
check_watchpoints() is called once, by arm_debug_check_watchpoint(),
which doesn't do more than this call. Merge both. No logical change
intended.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
target/arm/tcg/debug.c | 40 +++++++++++++++++-----------------------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c
index 11043ecd589..7171501d400 100644
--- a/target/arm/tcg/debug.c
+++ b/target/arm/tcg/debug.c
@@ -351,28 +351,6 @@ static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_wp)
return true;
}
-static bool check_watchpoints(ARMCPU *cpu)
-{
- CPUARMState *env = &cpu->env;
- int n;
-
- /*
- * If watchpoints are disabled globally or we can't take debug
- * exceptions here then watchpoint firings are ignored.
- */
- if (extract32(env->cp15.mdscr_el1, 15, 1) == 0
- || !arm_generate_debug_exceptions(env)) {
- return false;
- }
-
- for (n = 0; n < ARRAY_SIZE(env->cpu_watchpoint); n++) {
- if (bp_wp_matches(cpu, n, true)) {
- return true;
- }
- }
- return false;
-}
-
bool arm_debug_check_breakpoint(CPUState *cs)
{
ARMCPU *cpu = ARM_CPU(cs);
@@ -426,8 +404,24 @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp)
* is also an architectural watchpoint match.
*/
ARMCPU *cpu = ARM_CPU(cs);
+ CPUARMState *env = &cpu->env;
+ int n;
- return check_watchpoints(cpu);
+ /*
+ * If watchpoints are disabled globally or we can't take debug
+ * exceptions here then watchpoint firings are ignored.
+ */
+ if (extract32(env->cp15.mdscr_el1, 15, 1) == 0
+ || !arm_generate_debug_exceptions(env)) {
+ return false;
+ }
+
+ for (n = 0; n < ARRAY_SIZE(env->cpu_watchpoint); n++) {
+ if (bp_wp_matches(cpu, n, true)) {
+ return true;
+ }
+ }
+ return false;
}
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 25/33] target/arm: Factor arm_check_watchpoint_hit() out
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (23 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 24/33] target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint() Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 18:02 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 26/33] target/xtensa: Move watchpoints handling to check_hw_watchpoints() Philippe Mathieu-Daudé
` (7 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Factor arm_check_watchpoint_hit() out of arm_debug_excp_handler().
No logical change intended.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
target/arm/tcg/debug.c | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c
index 7171501d400..775f1f04c6d 100644
--- a/target/arm/tcg/debug.c
+++ b/target/arm/tcg/debug.c
@@ -455,28 +455,35 @@ static uint32_t arm_debug_exception_fsr(CPUARMState *env)
}
}
+static bool arm_check_watchpoint_hit(CPUState *cs)
+{
+ CPUARMState *env = cpu_env(cs);
+ CPUWatchpoint *wp_hit = cs->watchpoint_hit;
+ bool wnr;
+
+ if (!wp_hit || !(wp_hit->flags & BP_CPU)) {
+ return false;
+ }
+
+ cs->watchpoint_hit = NULL;
+
+ env->exception.fsr = arm_debug_exception_fsr(env);
+ env->exception.vaddress = wp_hit->hitaddr;
+ wnr = (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) != 0;
+ raise_exception_debug(env, EXCP_DATA_ABORT,
+ syn_watchpoint(0, 0, wnr));
+ return true;
+}
+
void arm_debug_excp_handler(CPUState *cs)
{
/*
* Called by core code when a watchpoint or breakpoint fires;
* need to check which one and raise the appropriate exception.
*/
- ARMCPU *cpu = ARM_CPU(cs);
- CPUARMState *env = &cpu->env;
- CPUWatchpoint *wp_hit = cs->watchpoint_hit;
+ CPUARMState *env = cpu_env(cs);
- if (wp_hit) {
- if (wp_hit->flags & BP_CPU) {
- bool wnr = (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) != 0;
-
- cs->watchpoint_hit = NULL;
-
- env->exception.fsr = arm_debug_exception_fsr(env);
- env->exception.vaddress = wp_hit->hitaddr;
- raise_exception_debug(env, EXCP_DATA_ABORT,
- syn_watchpoint(0, 0, wnr));
- }
- } else {
+ if (!arm_check_watchpoint_hit(cs)) {
uint64_t pc = is_a64(env) ? env->pc : env->regs[15];
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 26/33] target/xtensa: Move watchpoints handling to check_hw_watchpoints()
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (24 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 25/33] target/arm: Factor arm_check_watchpoint_hit() out Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 18:06 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 27/33] target/ppc: Ensure TCG is used in ppc_update_daw() Philippe Mathieu-Daudé
` (6 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Rewrite check_hw_watchpoints() by moving related code from
xtensa_breakpoint_handler() to it. No logical change intended.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
target/xtensa/helper.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
index 5a0e8655146..7674a7c1d55 100644
--- a/target/xtensa/helper.c
+++ b/target/xtensa/helper.c
@@ -30,6 +30,7 @@
#include "cpu.h"
#include "exec/cputlb.h"
#include "exec/target_page.h"
+#include "exec/watchpoint.h"
#include "gdbstub/helpers.h"
#include "exec/helper-proto.h"
#include "accel/tcg/cpu-loop.h"
@@ -205,35 +206,36 @@ void xtensa_register_core(XtensaConfigList *node)
g_free((gpointer)type.name);
}
-static uint32_t check_hw_breakpoints(CPUXtensaState *env)
+static bool check_hw_watchpoints(CPUState *cs)
{
- unsigned i;
+ CPUXtensaState *env = cpu_env(cs);
+ CPUWatchpoint *wp_hit = cs->watchpoint_hit;
- for (i = 0; i < env->config->ndbreak; ++i) {
+ if (!wp_hit || !(wp_hit->flags & BP_CPU)) {
+ return false;
+ }
+ cs->watchpoint_hit = NULL;
+ for (int i = 0; i < env->config->ndbreak; ++i) {
if (env->cpu_watchpoint[i] &&
env->cpu_watchpoint[i]->flags & BP_WATCHPOINT_HIT) {
- return DEBUGCAUSE_DB | (i << DEBUGCAUSE_DBNUM_SHIFT);
+
+ uint32_t cause = DEBUGCAUSE_DB | (i << DEBUGCAUSE_DBNUM_SHIFT);
+ if (cause) {
+ debug_exception_env(env, cause);
+ break;
+ }
}
}
- return 0;
+ cpu_loop_exit_noexc(cs);
+
+ return true;
}
void xtensa_breakpoint_handler(CPUState *cs)
{
CPUXtensaState *env = cpu_env(cs);
- if (cs->watchpoint_hit) {
- if (cs->watchpoint_hit->flags & BP_CPU) {
- uint32_t cause;
-
- cs->watchpoint_hit = NULL;
- cause = check_hw_breakpoints(env);
- if (cause) {
- debug_exception_env(env, cause);
- }
- cpu_loop_exit_noexc(cs);
- }
- } else {
+ if (!check_hw_watchpoints(cs)) {
if (cpu_breakpoint_test(cs, env->pc, BP_GDB)
|| !cpu_breakpoint_test(cs, env->pc, BP_CPU)) {
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 27/33] target/ppc: Ensure TCG is used in ppc_update_daw()
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (25 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 26/33] target/xtensa: Move watchpoints handling to check_hw_watchpoints() Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:34 ` Daniel Henrique Barboza
2026-06-30 22:00 ` [PATCH 28/33] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers Philippe Mathieu-Daudé
` (5 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Per commit d5ee641cfc5 ("target/ppc: Implement watchpoint debug
facility for v2.07S"), only TCG is implemented:
ISA v2.07S introduced the watchpoint facility based on the DAWR0
and DAWRX0 SPRs. Implement this in TCG.
^^^^^^^^^^^^^^^^^^^^^
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
target/ppc/cpu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 913920d55b8..36e1209119d 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -147,6 +147,8 @@ void ppc_update_daw(CPUPPCState *env, int rid)
vaddr len;
BreakpointFlags flags;
+ assert(tcg_enabled());
+
if (env->dawr_watchpoint[rid]) {
cpu_watchpoint_remove_by_ref(cs, env->dawr_watchpoint[rid]);
env->dawr_watchpoint[rid] = NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 28/33] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (26 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 27/33] target/ppc: Ensure TCG is used in ppc_update_daw() Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:34 ` Daniel Henrique Barboza
2026-07-02 18:04 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 29/33] cpu: Move CPUWatchpoint definition to 'exec/watchpoint.h' Philippe Mathieu-Daudé
` (4 subsequent siblings)
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Commit d5ee641cfc5 ("target/ppc: Implement watchpoint debug facility
for v2.07S") also implemented TCGCPUOps::debug_check_watchpoint for
PPC: make the comment generic.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/accel/tcg/cpu-ops.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
index f64d94b2b50..568d82cdd32 100644
--- a/include/accel/tcg/cpu-ops.h
+++ b/include/accel/tcg/cpu-ops.h
@@ -250,14 +250,13 @@ struct TCGCPUOps {
int mmu_idx, uintptr_t retaddr);
/**
- * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
+ * @adjust_watchpoint_address: hack for cpu_check_watchpoint (used by ARM)
*/
vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
/**
* @debug_check_watchpoint: return true if the architectural
- * watchpoint whose address has matched should really fire, used by ARM
- * and RISC-V
+ * watchpoint whose address has matched should really fire.
*/
bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 29/33] cpu: Move CPUWatchpoint definition to 'exec/watchpoint.h'
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (27 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 28/33] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 18:06 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 30/33] cpu: Better name cpu_single_step() trace event Philippe Mathieu-Daudé
` (3 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Define CPUWatchpoint in "exec/watchpoint.h", including this
header where appropriate.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/accel/tcg/cpu-ops.h | 1 +
include/exec/breakpoint.h | 9 ---------
include/exec/watchpoint.h | 12 ++++++++++++
target/arm/internals.h | 1 +
gdbstub/system.c | 1 +
target/arm/hyp_gdbstub.c | 1 +
target/i386/kvm/kvm.c | 1 +
target/ppc/kvm.c | 1 +
target/s390x/kvm/kvm.c | 1 +
9 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
index 568d82cdd32..d5994781c39 100644
--- a/include/accel/tcg/cpu-ops.h
+++ b/include/accel/tcg/cpu-ops.h
@@ -20,6 +20,7 @@
#include "exec/memop.h"
#include "exec/mmu-access-type.h"
#include "exec/vaddr.h"
+#include "exec/watchpoint.h"
#include "accel/tcg/tb-cpu-state.h"
#include "tcg/tcg-mo.h"
diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h
index 0c3cc0c8ff3..9d0dd89e7c9 100644
--- a/include/exec/breakpoint.h
+++ b/include/exec/breakpoint.h
@@ -33,13 +33,4 @@ typedef struct CPUBreakpoint {
QTAILQ_ENTRY(CPUBreakpoint) entry;
} CPUBreakpoint;
-typedef struct CPUWatchpoint {
- vaddr vaddr;
- vaddr len;
- vaddr hitaddr;
- MemTxAttrs hitattrs;
- int flags; /* BP_* */
- QTAILQ_ENTRY(CPUWatchpoint) entry;
-} CPUWatchpoint;
-
#endif
diff --git a/include/exec/watchpoint.h b/include/exec/watchpoint.h
index ba148eff3d1..7b72de35aa5 100644
--- a/include/exec/watchpoint.h
+++ b/include/exec/watchpoint.h
@@ -8,7 +8,19 @@
#ifndef EXEC_WATCHPOINT_H
#define EXEC_WATCHPOINT_H
+#include "qemu/queue.h"
#include "exec/breakpoint.h"
+#include "exec/memattrs.h"
+#include "exec/vaddr.h"
+
+typedef struct CPUWatchpoint {
+ vaddr vaddr;
+ vaddr len;
+ vaddr hitaddr;
+ MemTxAttrs hitattrs;
+ BreakpointFlags flags;
+ QTAILQ_ENTRY(CPUWatchpoint) entry;
+} CPUWatchpoint;
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
BreakpointFlags flags, CPUWatchpoint **watchpoint);
diff --git a/target/arm/internals.h b/target/arm/internals.h
index 067c3f2b8bb..72ef3a2bf9c 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -29,6 +29,7 @@
#include "exec/vaddr.h"
#include "exec/breakpoint.h"
#include "exec/memop.h"
+#include "exec/watchpoint.h"
#include "gdbstub/enums.h"
#ifdef CONFIG_TCG
#include "accel/tcg/tb-cpu-state.h"
diff --git a/gdbstub/system.c b/gdbstub/system.c
index 108fe4bafb7..3dccd31cbc0 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -19,6 +19,7 @@
#include "gdbstub/syscalls.h"
#include "gdbstub/commands.h"
#include "exec/hwaddr.h"
+#include "exec/watchpoint.h"
#include "accel/accel-ops.h"
#include "accel/accel-cpu-ops.h"
#include "system/address-spaces.h"
diff --git a/target/arm/hyp_gdbstub.c b/target/arm/hyp_gdbstub.c
index dda6946ddaa..62dd91169dd 100644
--- a/target/arm/hyp_gdbstub.c
+++ b/target/arm/hyp_gdbstub.c
@@ -10,6 +10,7 @@
*/
#include "qemu/osdep.h"
+#include "exec/watchpoint.h"
#include "cpu.h"
#include "internals.h"
#include "gdbstub/enums.h"
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 1e09155e92c..372781ae715 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -70,6 +70,7 @@
#include "migration/blocker.h"
#include "exec/memattrs.h"
#include "exec/target_page.h"
+#include "exec/watchpoint.h"
#include "trace.h"
#include CONFIG_DEVICES
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 6bdfbbd68d6..85b15602396 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -41,6 +41,7 @@
#include "trace.h"
#include "gdbstub/enums.h"
#include "exec/memattrs.h"
+#include "exec/watchpoint.h"
#include "system/ramblock.h"
#include "system/hostmem.h"
#include "qemu/cutils.h"
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 195e39df032..bb329883c97 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -49,6 +49,7 @@
#include "hw/s390x/ipl.h"
#include "hw/s390x/ebcdic.h"
#include "exec/memattrs.h"
+#include "exec/watchpoint.h"
#include "hw/s390x/s390-virtio-ccw.h"
#include "hw/s390x/s390-hypercall.h"
#include "target/s390x/kvm/pv.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 30/33] cpu: Better name cpu_single_step() trace event
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (28 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 29/33] cpu: Move CPUWatchpoint definition to 'exec/watchpoint.h' Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 13:35 ` Daniel Henrique Barboza
2026-06-30 22:00 ` [PATCH 31/33] cpu: Introduce cpu_single_stepping() helper Philippe Mathieu-Daudé
` (2 subsequent siblings)
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
cpu_single_step() is not related to breakpoints. Rename the
trace event.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
cpu-target.c | 4 ++--
trace-events | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cpu-target.c b/cpu-target.c
index f030e2c642e..019906b32eb 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -31,6 +31,8 @@
void cpu_single_step(CPUState *cpu, int enabled)
{
if (cpu->singlestep_enabled != enabled) {
+ trace_cpu_change_singlestep_flags(cpu->cpu_index,
+ cpu->singlestep_enabled, enabled);
cpu->singlestep_enabled = enabled;
#if !defined(CONFIG_USER_ONLY)
@@ -39,8 +41,6 @@ void cpu_single_step(CPUState *cpu, int enabled)
ops->update_guest_debug(cpu);
}
#endif
-
- trace_breakpoint_singlestep(cpu->cpu_index, enabled);
}
}
diff --git a/trace-events b/trace-events
index faeba6242fa..ea1d2b11a22 100644
--- a/trace-events
+++ b/trace-events
@@ -28,7 +28,7 @@
# cpu.c
breakpoint_insert(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x"
breakpoint_remove(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x"
-breakpoint_singlestep(int cpu_index, int enabled) "cpu=%d enable=%d"
+cpu_change_singlestep_flags(int cpu_index, int old_flags, int new_flags) "cpu=%d flags=0x%x -> 0x%x"
cpu_exec_start(int cpu_index) "cpu=%d"
cpu_exec_end(int cpu_index) "cpu=%d"
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 31/33] cpu: Introduce cpu_single_stepping() helper
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (29 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 30/33] cpu: Better name cpu_single_step() trace event Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 18:11 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags Philippe Mathieu-Daudé
2026-06-30 22:01 ` [PATCH 33/33] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping() Philippe Mathieu-Daudé
32 siblings, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Access CPUState::@singlestep_enabled field with a helper.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/hw/core/cpu.h | 11 +++++++++++
accel/kvm/kvm-all.c | 2 +-
accel/tcg/cpu-exec-common.c | 2 +-
accel/tcg/cpu-exec.c | 8 ++++----
linux-user/riscv/cpu_loop.c | 2 +-
linux-user/s390x/cpu_loop.c | 2 +-
system/cpus.c | 2 +-
target/arm/hvf/hvf.c | 8 ++++----
target/arm/kvm.c | 2 +-
target/i386/kvm/kvm.c | 2 +-
target/i386/whpx/whpx-all.c | 6 +++---
target/loongarch/kvm/kvm.c | 2 +-
target/microblaze/translate.c | 2 +-
target/ppc/kvm.c | 2 +-
target/s390x/kvm/kvm.c | 2 +-
15 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index bea8e509a19..37ac218bda3 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1138,6 +1138,17 @@ void qemu_init_vcpu(CPUState *cpu);
*/
void cpu_single_step(CPUState *cpu, int enabled);
+/**
+ * cpu_single_stepping:
+ * @cpu: The vCPU to check
+ *
+ * Returns whether the vCPU has single-stepping enabled.
+ */
+static inline bool cpu_single_stepping(const CPUState *cpu)
+{
+ return cpu->singlestep_enabled;
+}
+
int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
CPUBreakpoint **breakpoint);
int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags);
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index e8ed85f9a3d..c436b1f3751 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3817,7 +3817,7 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
data.dbg.control = reinject_trap;
- if (cpu->singlestep_enabled) {
+ if (cpu_single_stepping(cpu)) {
data.dbg.control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
if (cpu->singlestep_enabled & SSTEP_NOIRQ) {
diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c
index e48ea31373f..44e84344f3b 100644
--- a/accel/tcg/cpu-exec-common.c
+++ b/accel/tcg/cpu-exec-common.c
@@ -47,7 +47,7 @@ uint32_t curr_cflags(CPUState *cpu)
* For singlestep and -d nochain, suppress goto_tb so that
* we can log -d cpu,exec after every TB.
*/
- if (unlikely(cpu->singlestep_enabled)) {
+ if (unlikely(cpu_single_stepping(cpu))) {
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
} else if (qatomic_read(&one_insn_per_tb)) {
cflags |= CF_NO_GOTO_TB | 1;
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index d7f91dce9db..0386ac49551 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -308,7 +308,7 @@ static bool check_for_breakpoints_slow(CPUState *cpu, vaddr pc,
* so that one could (gdb) singlestep into the guest kernel's
* architectural breakpoint handler.
*/
- if (cpu->singlestep_enabled) {
+ if (cpu_single_stepping(cpu)) {
return false;
}
@@ -485,7 +485,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
* raise a debug exception. Single-step with another exception
* is handled in cpu_handle_exception.
*/
- if (unlikely(cpu->singlestep_enabled) && cpu->exception_index == -1) {
+ if (unlikely(cpu_single_stepping(cpu)) && cpu->exception_index == -1) {
cpu->exception_index = EXCP_DEBUG;
cpu_loop_exit(cpu);
}
@@ -732,7 +732,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
bql_unlock();
cpu->exception_index = -1;
- if (unlikely(cpu->singlestep_enabled)) {
+ if (unlikely(cpu_single_stepping(cpu))) {
/*
* After processing the exception, ensure an EXCP_DEBUG is
* raised when single-stepping so that GDB doesn't miss the
@@ -849,7 +849,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
* raised when single-stepping so that GDB doesn't miss the
* next instruction.
*/
- if (unlikely(cpu->singlestep_enabled)) {
+ if (unlikely(cpu_single_stepping(cpu))) {
cpu->exception_index = EXCP_DEBUG;
bql_unlock();
return true;
diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index eecc8d15178..6f27a06da49 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -68,7 +68,7 @@ void cpu_loop(CPURISCVState *env)
} else if (ret != -QEMU_ESIGRETURN && ret != -QEMU_ESETPC) {
env->gpr[xA0] = ret;
}
- if (cs->singlestep_enabled) {
+ if (cpu_single_stepping(cs)) {
goto gdbstep;
}
break;
diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c
index 67d2a803fbc..25f19f725e7 100644
--- a/linux-user/s390x/cpu_loop.c
+++ b/linux-user/s390x/cpu_loop.c
@@ -87,7 +87,7 @@ void cpu_loop(CPUS390XState *env)
env->regs[2] = ret;
}
- if (unlikely(cs->singlestep_enabled)) {
+ if (unlikely(cpu_single_stepping(cs))) {
/*
* cpu_tb_exec() did not raise EXCP_DEBUG, because it has seen
* that EXCP_SVC was already pending.
diff --git a/system/cpus.c b/system/cpus.c
index 49f6daec3cd..2270e58d9cf 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -343,7 +343,7 @@ bool cpu_can_run(CPUState *cpu)
void cpu_handle_guest_debug(CPUState *cpu)
{
if (replay_running_debug()) {
- if (!cpu->singlestep_enabled) {
+ if (!cpu_single_stepping(cpu)) {
/*
* Report about the breakpoint and
* make a single step to skip it
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 530af305efd..e7550cb3b58 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -2340,7 +2340,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
case EC_SOFTWARESTEP: {
ret = EXCP_DEBUG;
- if (!cpu->singlestep_enabled) {
+ if (!cpu_single_stepping(cpu)) {
error_report("EC_SOFTWARESTEP but single-stepping not enabled");
}
break;
@@ -2549,7 +2549,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
assert_hvf_ok(r);
/* Handle single-stepping over instructions which trigger a VM exit */
- if (cpu->singlestep_enabled) {
+ if (cpu_single_stepping(cpu)) {
ret = EXCP_DEBUG;
}
}
@@ -2868,7 +2868,7 @@ void hvf_arch_update_guest_debug(CPUState *cpu)
CPUARMState *env = &arm_cpu->env;
/* Check whether guest debugging is enabled */
- cpu->accel->guest_debug_enabled = cpu->singlestep_enabled ||
+ cpu->accel->guest_debug_enabled = cpu_single_stepping(cpu) ||
hvf_sw_breakpoints_active(cpu) ||
hvf_arm_hw_debug_active(cpu);
@@ -2882,7 +2882,7 @@ void hvf_arch_update_guest_debug(CPUState *cpu)
cpu_synchronize_state(cpu);
/* Enable/disable single-stepping */
- if (cpu->singlestep_enabled) {
+ if (cpu_single_stepping(cpu)) {
env->cp15.mdscr_el1 =
deposit64(env->cp15.mdscr_el1, MDSCR_EL1_SS_SHIFT, 1, 1);
pstate_write(env, pstate_read(env) | PSTATE_SS);
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 01f42f42538..d40a6a98591 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1492,7 +1492,7 @@ static bool kvm_arm_handle_debug(ARMCPU *cpu,
switch (hsr_ec) {
case EC_SOFTWARESTEP:
- if (cs->singlestep_enabled) {
+ if (cpu_single_stepping(cs)) {
return true;
} else {
/*
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 372781ae715..aef981f023f 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -6251,7 +6251,7 @@ static int kvm_handle_debug(X86CPU *cpu,
if (arch_info->exception == EXCP01_DB) {
if (arch_info->dr6 & DR6_BS) {
- if (cs->singlestep_enabled) {
+ if (cpu_single_stepping(cs)) {
ret = EXCP_DEBUG;
}
} else {
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 95705522e04..c87bd1d714d 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -2271,7 +2271,7 @@ int whpx_vcpu_run(CPUState *cpu)
}
}
- if (exclusive_step_mode != WHPX_STEP_NONE || cpu->singlestep_enabled) {
+ if (exclusive_step_mode != WHPX_STEP_NONE || cpu_single_stepping(cpu)) {
whpx_vcpu_configure_single_stepping(cpu, true, NULL);
}
@@ -2288,7 +2288,7 @@ int whpx_vcpu_run(CPUState *cpu)
break;
}
- if (exclusive_step_mode != WHPX_STEP_NONE || cpu->singlestep_enabled) {
+ if (exclusive_step_mode != WHPX_STEP_NONE || cpu_single_stepping(cpu)) {
whpx_vcpu_configure_single_stepping(cpu,
false,
&vcpu->exit_ctx.VpContext.Rflags);
@@ -2653,7 +2653,7 @@ int whpx_vcpu_run(CPUState *cpu)
cpu->exception_index = EXCP_DEBUG;
} else if ((vcpu->exit_ctx.VpException.ExceptionType ==
WHvX64ExceptionTypeDebugTrapOrFault) &&
- !cpu->singlestep_enabled) {
+ !cpu_single_stepping(cpu)) {
/*
* Just finished stepping over a breakpoint, but the
* gdb does not expect us to do single-stepping.
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index beda6965f8c..48cdb78a4ca 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -1440,7 +1440,7 @@ static bool kvm_loongarch_handle_debug(CPUState *cs, struct kvm_run *run)
CPULoongArchState *env = &cpu->env;
kvm_cpu_synchronize_state(cs);
- if (cs->singlestep_enabled) {
+ if (cpu_single_stepping(cs)) {
return true;
}
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index a93f14d6e09..8b219afb5dd 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -1772,7 +1772,7 @@ static void mb_tr_tb_stop(DisasContextBase *dcb, CPUState *cs)
}
/* Finish DISAS_EXIT_* */
- if (unlikely(cs->singlestep_enabled)) {
+ if (unlikely(cpu_single_stepping(cs))) {
gen_raise_exception(dc, EXCP_DEBUG);
} else {
tcg_gen_exit_tb(NULL, 0);
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 85b15602396..b0c446eea7f 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1617,7 +1617,7 @@ static int kvm_handle_debug(PowerPCCPU *cpu, struct kvm_run *run)
CPUPPCState *env = &cpu->env;
struct kvm_debug_exit_arch *arch_info = &run->debug.arch;
- if (cs->singlestep_enabled) {
+ if (cpu_single_stepping(cs)) {
return kvm_handle_singlestep();
}
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index bb329883c97..70f450c71ab 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -1875,7 +1875,7 @@ static int kvm_arch_handle_debug_exit(S390CPU *cpu)
}
break;
case KVM_SINGLESTEP:
- if (cs->singlestep_enabled) {
+ if (cpu_single_stepping(cs)) {
ret = EXCP_DEBUG;
}
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (30 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 31/33] cpu: Introduce cpu_single_stepping() helper Philippe Mathieu-Daudé
@ 2026-06-30 22:00 ` Philippe Mathieu-Daudé
2026-07-02 18:11 ` Richard Henderson
2026-07-03 1:27 ` Xiaoyao Li
2026-06-30 22:01 ` [PATCH 33/33] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping() Philippe Mathieu-Daudé
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
CPUState::singlestep_enabled contains multiple flags since
commit 60897d369f1 ("Debugger single step without interrupts").
Rename to avoid mistakes.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/hw/core/cpu.h | 8 ++++----
accel/kvm/kvm-all.c | 2 +-
accel/tcg/cpu-exec.c | 2 +-
accel/tcg/tcg-accel-ops-rr.c | 2 +-
cpu-target.c | 8 ++++----
target/arm/hvf/hvf.c | 2 +-
target/ppc/translate.c | 16 ++++++++--------
7 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 37ac218bda3..27ee0e54327 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -440,7 +440,7 @@ struct qemu_work_item;
* @stopped: Indicates the CPU has been artificially stopped.
* @unplug: Indicates a pending CPU unplug request.
* @crash_occurred: Indicates the OS reported a crash (panic) for this CPU
- * @singlestep_enabled: Flags for single-stepping.
+ * @singlestep_flags: Flags for single-stepping.
* @icount_extra: Instructions until next timer event.
* @cpu_ases: Pointer to array of CPUAddressSpaces (which define the
* AddressSpaces this CPU has)
@@ -505,7 +505,7 @@ struct CPUState {
int exclusive_context_count;
uint32_t cflags_next_tb;
uint32_t interrupt_request;
- int singlestep_enabled;
+ int singlestep_flags;
int64_t icount_budget;
int64_t icount_extra;
uint64_t random_seed;
@@ -1136,7 +1136,7 @@ void qemu_init_vcpu(CPUState *cpu);
*
* Enables or disables single-stepping for @cpu.
*/
-void cpu_single_step(CPUState *cpu, int enabled);
+void cpu_single_step(CPUState *cpu, int flags);
/**
* cpu_single_stepping:
@@ -1146,7 +1146,7 @@ void cpu_single_step(CPUState *cpu, int enabled);
*/
static inline bool cpu_single_stepping(const CPUState *cpu)
{
- return cpu->singlestep_enabled;
+ return cpu->singlestep_flags;
}
int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index c436b1f3751..30aab1cf49e 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3820,7 +3820,7 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
if (cpu_single_stepping(cpu)) {
data.dbg.control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
- if (cpu->singlestep_enabled & SSTEP_NOIRQ) {
+ if (cpu->singlestep_flags & SSTEP_NOIRQ) {
data.dbg.control |= KVM_GUESTDBG_BLOCKIRQ;
}
}
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 0386ac49551..257211235db 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -828,7 +828,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
return true;
}
- if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) {
+ if (unlikely(cpu->singlestep_flags & SSTEP_NOIRQ)) {
/* Mask out external interrupts for this step. */
interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK;
}
diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index 5b132d3d5d8..cdaa3e11808 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -274,7 +274,7 @@ static void *rr_cpu_thread_fn(void *arg)
current_cpu = cpu;
qemu_clock_enable(QEMU_CLOCK_VIRTUAL,
- (cpu->singlestep_enabled & SSTEP_NOTIMER) == 0);
+ (cpu->singlestep_flags & SSTEP_NOTIMER) == 0);
if (cpu_can_run(cpu)) {
int r;
diff --git a/cpu-target.c b/cpu-target.c
index 019906b32eb..a504540c939 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -28,12 +28,12 @@
/* enable or disable single step mode. EXCP_DEBUG is returned by the
CPU loop after each instruction */
-void cpu_single_step(CPUState *cpu, int enabled)
+void cpu_single_step(CPUState *cpu, int flags)
{
- if (cpu->singlestep_enabled != enabled) {
+ if (cpu->singlestep_flags != flags) {
trace_cpu_change_singlestep_flags(cpu->cpu_index,
- cpu->singlestep_enabled, enabled);
- cpu->singlestep_enabled = enabled;
+ cpu->singlestep_flags, flags);
+ cpu->singlestep_flags = flags;
#if !defined(CONFIG_USER_ONLY)
const AccelOpsClass *ops = cpus_get_accel();
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index e7550cb3b58..3cfa8dd2445 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -2603,7 +2603,7 @@ int hvf_arch_vcpu_exec(CPUState *cpu)
flush_cpu_state(cpu);
do {
- if (!(cpu->singlestep_enabled & SSTEP_NOIRQ) &&
+ if (!(cpu->singlestep_flags & SSTEP_NOIRQ) &&
hvf_inject_interrupts(cpu)) {
return EXCP_INTERRUPT;
}
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 3f6d326cef3..06ed2adf105 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -198,7 +198,7 @@ struct DisasContext {
bool pmu_insn_cnt;
bool bhrb_enable;
ppc_spr_t *spr_cb; /* Needed to check rights for mfspr/mtspr */
- int singlestep_enabled;
+ int singlestep_flags;
uint32_t flags;
uint64_t insns_flags;
uint64_t insns_flags2;
@@ -367,7 +367,7 @@ static void gen_debug_exception(DisasContext *ctx, bool rfi_type)
#if !defined(CONFIG_USER_ONLY)
if (ctx->flags & POWERPC_FLAG_DE) {
target_ulong dbsr = 0;
- if (ctx->singlestep_enabled & CPU_SINGLE_STEP) {
+ if (ctx->singlestep_flags & CPU_SINGLE_STEP) {
dbsr = DBCR0_ICMP;
} else {
/* Must have been branch */
@@ -3645,7 +3645,7 @@ static void pmu_count_insns(DisasContext *ctx)
static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
{
- if (unlikely(ctx->singlestep_enabled)) {
+ if (unlikely(ctx->singlestep_flags)) {
return false;
}
return translator_use_goto_tb(&ctx->base, dest);
@@ -3653,7 +3653,7 @@ static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
static void gen_lookup_and_goto_ptr(DisasContext *ctx)
{
- if (unlikely(ctx->singlestep_enabled)) {
+ if (unlikely(ctx->singlestep_flags)) {
gen_debug_exception(ctx, false);
} else {
/*
@@ -6559,13 +6559,13 @@ static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
ctx->pmu_insn_cnt = (hflags >> HFLAGS_INSN_CNT) & 1;
ctx->bhrb_enable = (hflags >> HFLAGS_BHRB_ENABLE) & 1;
- ctx->singlestep_enabled = 0;
+ ctx->singlestep_flags = 0;
if ((hflags >> HFLAGS_SE) & 1) {
- ctx->singlestep_enabled |= CPU_SINGLE_STEP;
+ ctx->singlestep_flags |= CPU_SINGLE_STEP;
ctx->base.max_insns = 1;
}
if ((hflags >> HFLAGS_BE) & 1) {
- ctx->singlestep_enabled |= CPU_BRANCH_STEP;
+ ctx->singlestep_flags |= CPU_BRANCH_STEP;
}
}
@@ -6641,7 +6641,7 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
}
/* Honor single stepping. */
- if (unlikely(ctx->singlestep_enabled & CPU_SINGLE_STEP)) {
+ if (unlikely(ctx->singlestep_flags & CPU_SINGLE_STEP)) {
bool rfi_type = false;
switch (is_jmp) {
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* [PATCH 33/33] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping()
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
` (31 preceding siblings ...)
2026-06-30 22:00 ` [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags Philippe Mathieu-Daudé
@ 2026-06-30 22:01 ` Philippe Mathieu-Daudé
2026-07-02 13:36 ` Daniel Henrique Barboza
2026-07-02 18:11 ` Richard Henderson
32 siblings, 2 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-30 22:01 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Only the SSTEP_ENABLE bitmask means single-step is enabled.
Fixes: 60897d369f1 ("Debugger single step without interrupts")
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/hw/core/cpu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 27ee0e54327..d092ab8aa5b 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1146,7 +1146,7 @@ void cpu_single_step(CPUState *cpu, int flags);
*/
static inline bool cpu_single_stepping(const CPUState *cpu)
{
- return cpu->singlestep_flags;
+ return cpu->singlestep_flags & SSTEP_ENABLE;
}
int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
--
2.53.0
^ permalink raw reply related [flat|nested] 93+ messages in thread
* Re: [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field
2026-06-30 22:00 ` [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field Philippe Mathieu-Daudé
@ 2026-07-02 13:00 ` Philippe Mathieu-Daudé
2026-07-02 13:41 ` Magnus Kulke
2026-07-02 16:56 ` Richard Henderson
1 sibling, 1 reply; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-07-02 13:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson, Magnus Kulke
Cc'ing Magnus.
On 1/7/26 00:00, Philippe Mathieu-Daudé wrote:
> No need for accel-specific @dirty field when we have
> a generic one in CPUState. (Other accelerators already
> did that in commits 6f13a0ada01..36ab216b81d).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> include/system/mshv_int.h | 1 -
> accel/mshv/mshv-all.c | 18 +++++++++---------
> target/i386/mshv/mshv-cpu.c | 6 +++---
> 3 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
> index ba3073888ac..b91c4d661a3 100644
> --- a/include/system/mshv_int.h
> +++ b/include/system/mshv_int.h
> @@ -43,7 +43,6 @@ typedef struct MshvHvCallArgs {
>
> struct AccelCPUState {
> int cpufd;
> - bool dirty;
> MshvHvCallArgs hvcall_args;
> };
>
> diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
> index 9452504ac28..1959baf6672 100644
> --- a/accel/mshv/mshv-all.c
> +++ b/accel/mshv/mshv-all.c
> @@ -531,7 +531,7 @@ static int mshv_init_vcpu(CPUState *cpu)
> }
>
> mshv_arch_init_vcpu(cpu);
> - cpu->accel->dirty = true;
> + cpu->vcpu_dirty = true;
>
> return 0;
> }
> @@ -617,7 +617,7 @@ static int mshv_cpu_exec(CPUState *cpu)
> cpu_exec_start(cpu);
>
> do {
> - if (cpu->accel->dirty) {
> + if (cpu->vcpu_dirty) {
> ret = mshv_arch_store_vcpu_state(cpu);
> if (ret) {
> error_report("Failed to put registers after init: %s",
> @@ -625,7 +625,7 @@ static int mshv_cpu_exec(CPUState *cpu)
> ret = -1;
> break;
> }
> - cpu->accel->dirty = false;
> + cpu->vcpu_dirty = false;
> }
>
> ret = mshv_run_vcpu(mshv_state->vm, cpu, &mshv_msg, &exit_reason);
> @@ -746,7 +746,7 @@ static void do_mshv_cpu_synchronize_post_init(CPUState *cpu,
> abort();
> }
>
> - cpu->accel->dirty = false;
> + cpu->vcpu_dirty = false;
> }
>
> static void mshv_cpu_synchronize_post_init(CPUState *cpu)
> @@ -763,13 +763,13 @@ static void mshv_cpu_synchronize_post_reset(CPUState *cpu)
> cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
> vm_stop(RUN_STATE_INTERNAL_ERROR);
> }
> - cpu->accel->dirty = false;
> + cpu->vcpu_dirty = false;
> }
>
> static void do_mshv_cpu_synchronize_pre_loadvm(CPUState *cpu,
> run_on_cpu_data arg)
> {
> - cpu->accel->dirty = true;
> + cpu->vcpu_dirty = true;
> }
>
> static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
> @@ -779,7 +779,7 @@ static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
>
> static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
> {
> - if (!cpu->accel->dirty) {
> + if (!cpu->vcpu_dirty) {
> int ret = mshv_arch_load_vcpu_state(cpu);
> if (ret < 0) {
> error_report("Failed to load registers for vcpu %d",
> @@ -789,13 +789,13 @@ static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
> vm_stop(RUN_STATE_INTERNAL_ERROR);
> }
>
> - cpu->accel->dirty = true;
> + cpu->vcpu_dirty = true;
> }
> }
>
> static void mshv_cpu_synchronize(CPUState *cpu)
> {
> - if (!cpu->accel->dirty) {
> + if (!cpu->vcpu_dirty) {
> run_on_cpu(cpu, do_mshv_cpu_synchronize, RUN_ON_CPU_NULL);
> }
> }
> diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
> index 126ca40b481..1c433c408c8 100644
> --- a/target/i386/mshv/mshv-cpu.c
> +++ b/target/i386/mshv/mshv-cpu.c
> @@ -1692,7 +1692,7 @@ static int pio_write(uint64_t port, const uint8_t *data, uintptr_t size,
> return ret;
> }
>
> -static int handle_pio_non_str(const CPUState *cpu,
> +static int handle_pio_non_str(CPUState *cpu,
> hv_x64_io_port_intercept_message *info)
> {
> size_t len = info->access_info.access_size;
> @@ -1748,7 +1748,7 @@ static int handle_pio_non_str(const CPUState *cpu,
> return -1;
> }
>
> - cpu->accel->dirty = false;
> + cpu->vcpu_dirty = false;
>
> return 0;
> }
> @@ -1909,7 +1909,7 @@ static int handle_pio_str(CPUState *cpu, hv_x64_io_port_intercept_message *info)
> return -1;
> }
>
> - cpu->accel->dirty = false;
> + cpu->vcpu_dirty = false;
>
> return 0;
> }
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer)
2026-06-30 22:00 ` [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer) Philippe Mathieu-Daudé
@ 2026-07-02 13:16 ` Daniel Henrique Barboza
2026-07-02 16:08 ` Richard Henderson
2026-07-03 0:41 ` Chao Liu
2 siblings, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:16 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Various CPUState can share the same CPUClass parent,
> and must not update its fields. Protect the CPUClass
> by marking the CPUState pointer const.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> include/hw/core/cpu.h | 2 +-
> accel/tcg/cpu-exec.c | 2 +-
> accel/tcg/translate-all.c | 3 +--
> gdbstub/gdbstub.c | 2 +-
> 4 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 59d601465b4..60a23d6f38b 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -480,7 +480,7 @@ struct CPUState {
> /*< private >*/
> DeviceState parent_obj;
> /* cache to avoid expensive CPU_GET_CLASS */
> - CPUClass *cc;
> + const CPUClass *cc;
> /*< public >*/
>
> int nr_threads;
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 9c754b03656..d7f91dce9db 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -460,7 +460,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
> * counter hit zero); we must restore the guest PC to the address
> * of the start of the TB.
> */
> - CPUClass *cc = cpu->cc;
> + const CPUClass *cc = cpu->cc;
> const TCGCPUOps *tcg_ops = cc->tcg_ops;
>
> if (tcg_ops->synchronize_from_tb) {
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 3f1a3a28438..328d96aba30 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -575,7 +575,7 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr)
> void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
> {
> TranslationBlock *tb;
> - CPUClass *cc;
> + const CPUClass *cc = cpu->cc;
> uint32_t n;
>
> tb = tcg_tb_lookup(retaddr);
> @@ -591,7 +591,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
> * to account for the re-execution of the branch.
> */
> n = 1;
> - cc = cpu->cc;
> if (cc->tcg_ops->io_recompile_replay_branch &&
> cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) {
> cpu->neg.icount_decr.u16.low++;
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index c3c944e965b..26366acb674 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -578,7 +578,7 @@ static void gdb_register_feature(CPUState *cpu, int base_reg,
>
> static const char *gdb_get_core_xml_file(CPUState *cpu)
> {
> - CPUClass *cc = cpu->cc;
> + const CPUClass *cc = cpu->cc;
>
> /*
> * The CPU class can provide the XML filename via a method,
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG
2026-06-30 22:00 ` [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG Philippe Mathieu-Daudé
@ 2026-07-02 13:17 ` Daniel Henrique Barboza
2026-07-02 16:29 ` Richard Henderson
2026-07-03 3:13 ` Chao Liu
2 siblings, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:17 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Both tlb_protect() and tlb_unprotect_code() are only used
> within accel/tcg/. Avoid exposing them to the whole code base,
> declare them in a new "system-page-protection.h" local header.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> accel/tcg/system-page-protection.h | 17 +++++++++++++++++
> include/exec/cputlb.h | 8 ++------
> accel/tcg/cputlb.c | 3 ++-
> accel/tcg/tb-maint.c | 1 +
> 4 files changed, 22 insertions(+), 7 deletions(-)
> create mode 100644 accel/tcg/system-page-protection.h
>
> diff --git a/accel/tcg/system-page-protection.h b/accel/tcg/system-page-protection.h
> new file mode 100644
> index 00000000000..52896c6d24a
> --- /dev/null
> +++ b/accel/tcg/system-page-protection.h
> @@ -0,0 +1,17 @@
> +/*
> + * QEMU page protection (system emulation)
> + *
> + * Copyright (c) 2003 Fabrice Bellard
> + *
> + * SPDX-License-Identifier: LGPL-2.1-or-later
> + */
> +#ifndef SYSTEM_PAGE_PROTECTION_H
> +#define SYSTEM_PAGE_PROTECTION_H
> +
> +#include "system/ram_addr.h"
> +
> +void tlb_protect_code(ram_addr_t ram_addr);
> +void tlb_unprotect_code(ram_addr_t ram_addr);
> +
> +#endif
> +
> diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h
> index 3a9603a6965..f7f7020382d 100644
> --- a/include/exec/cputlb.h
> +++ b/include/exec/cputlb.h
> @@ -24,14 +24,10 @@
> #include "exec/hwaddr.h"
> #include "exec/memattrs.h"
> #include "exec/vaddr.h"
> -#include "system/ram_addr.h"
> -
> -#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
> -void tlb_protect_code(ram_addr_t ram_addr);
> -void tlb_unprotect_code(ram_addr_t ram_addr);
> -#endif
>
> #ifndef CONFIG_USER_ONLY
> +#include "system/ram_addr.h"
> +
> void tlb_reset_dirty(CPUState *cpu, uintptr_t start, uintptr_t length);
> void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
> #endif
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index 6e66f3c6e93..7f7c208ba12 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -1,5 +1,5 @@
> /*
> - * Common CPU TLB handling
> + * Common CPU TLB handling (system emulation)
> *
> * Copyright (c) 2003 Fabrice Bellard
> *
> @@ -47,6 +47,7 @@
> #include "tb-hash.h"
> #include "tlb-bounds.h"
> #include "internal-common.h"
> +#include "system-page-protection.h"
> #ifdef CONFIG_PLUGIN
> #include "qemu/plugin-memory.h"
> #endif
> diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c
> index c33dbf65e7f..4313864d2c5 100644
> --- a/accel/tcg/tb-maint.c
> +++ b/accel/tcg/tb-maint.c
> @@ -38,6 +38,7 @@
> #include "user/page-protection.h"
> #define runstate_is_running() true
> #else
> +#include "system-page-protection.h"
> #include "system/runstate.h"
> #endif
> #include "trace.h"
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 06/33] gdbstub: Add trace event for STEP packet handler
2026-06-30 22:00 ` [PATCH 06/33] gdbstub: Add trace event for STEP packet handler Philippe Mathieu-Daudé
@ 2026-07-02 13:18 ` Daniel Henrique Barboza
2026-07-02 13:25 ` Alex Bennée
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> gdbstub/gdbstub.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index 26366acb674..246e7746300 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -1369,6 +1369,7 @@ static void handle_step(GArray *params, void *user_ctx)
> gdb_set_cpu_pc(gdb_get_cmd_param(params, 0)->val_ull);
> }
>
> + trace_gdbstub_op_stepping(gdbserver_state.c_cpu->cpu_index);
> cpu_single_step(gdbserver_state.c_cpu, gdbserver_state.sstep_flags);
> gdb_continue();
> }
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 07/33] gdbstub: Only return E22 when reverse GDB is not supported
2026-06-30 22:00 ` [PATCH 07/33] gdbstub: Only return E22 when reverse GDB is not supported Philippe Mathieu-Daudé
@ 2026-07-02 13:18 ` Daniel Henrique Barboza
2026-07-02 13:26 ` Alex Bennée
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> No need to keep processing the arguments when we know
> reverse debugging is not available.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> gdbstub/gdbstub.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index 246e7746300..f54415a9db7 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -1378,6 +1378,7 @@ static void handle_backward(GArray *params, void *user_ctx)
> {
> if (!gdb_can_reverse()) {
> gdb_put_packet("E22");
> + return;
> }
> if (params->len == 1) {
> switch (gdb_get_cmd_param(params, 0)->opcode) {
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 08/33] accel/kvm: Always define AccelOpsClass::supports_guest_debug
2026-06-30 22:00 ` [PATCH 08/33] accel/kvm: Always define AccelOpsClass::supports_guest_debug Philippe Mathieu-Daudé
@ 2026-07-02 13:19 ` Daniel Henrique Barboza
2026-07-02 17:16 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:19 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Whether TARGET_KVM_HAVE_GUEST_DEBUG is defined or not,
> kvm_supports_guest_debug() still exists and can be called.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> accel/kvm/kvm-accel-ops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
> index 6d9140e549f..d7967bc922f 100644
> --- a/accel/kvm/kvm-accel-ops.c
> +++ b/accel/kvm/kvm-accel-ops.c
> @@ -105,9 +105,9 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
> ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
> ops->handle_interrupt = generic_handle_interrupt;
>
> + ops->supports_guest_debug = kvm_supports_guest_debug;
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> ops->update_guest_debug = kvm_update_guest_debug_ops;
> - ops->supports_guest_debug = kvm_supports_guest_debug;
> ops->insert_breakpoint = kvm_insert_breakpoint;
> ops->remove_breakpoint = kvm_remove_breakpoint;
> ops->remove_all_breakpoints = kvm_remove_all_breakpoints;
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 11/33] gdbstub: Store @can_reverse in GDBState
2026-06-30 22:00 ` [PATCH 11/33] gdbstub: Store @can_reverse in GDBState Philippe Mathieu-Daudé
@ 2026-07-02 13:20 ` Daniel Henrique Barboza
0 siblings, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:20 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Call gdb_can_reverse() once in gdb_init_gdbserver_state() and
> store the result in GDBState.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> gdbstub/internals.h | 1 +
> gdbstub/gdbstub.c | 5 +++--
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/gdbstub/internals.h b/gdbstub/internals.h
> index 9b25bf58b8e..9a1b8d9dd8a 100644
> --- a/gdbstub/internals.h
> +++ b/gdbstub/internals.h
> @@ -85,6 +85,7 @@ typedef struct GDBState {
> GByteArray *mem_buf;
> int sstep_flags;
> int supported_sstep_flags;
> + bool can_reverse;
> /*
> * Whether we are allowed to send a stop reply packet at this moment.
> * Must be set off after sending the stop reply itself.
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index 1e0a6638bff..0037704d522 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -75,6 +75,7 @@ void gdb_init_gdbserver_state(void)
> accel_get_gdbstub_config(&gdbserver_state.supported_sstep_flags);
> gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
> gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
> + gdbserver_state.can_reverse = gdb_can_reverse();
> }
>
> /* writes 2*len+1 bytes in buf */
> @@ -1376,7 +1377,7 @@ static void handle_step(GArray *params, void *user_ctx)
>
> static void handle_backward(GArray *params, void *user_ctx)
> {
> - if (!gdb_can_reverse()) {
> + if (!gdbserver_state.can_reverse) {
> gdb_put_packet("E22");
> return;
> }
> @@ -1684,7 +1685,7 @@ static void handle_query_supported(GArray *params, void *user_ctx)
> g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+");
> }
>
> - if (gdb_can_reverse()) {
> + if (gdbserver_state.can_reverse) {
> g_string_append(gdbserver_state.str_buf,
> ";ReverseStep+;ReverseContinue+");
> }
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 15/33] accel/kvm: Hold have_guest_supported in KVMState
2026-06-30 22:00 ` [PATCH 15/33] accel/kvm: Hold have_guest_supported in KVMState Philippe Mathieu-Daudé
@ 2026-07-02 13:22 ` Daniel Henrique Barboza
2026-07-02 17:37 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Prefer to store per-accelerator variables in the per-accelerator
> state, rather than as static variables. This is a good practice
> to allow concurrent accelerators in the future.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> include/system/kvm_int.h | 1 +
> accel/kvm/kvm-all.c | 8 ++++----
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/include/system/kvm_int.h b/include/system/kvm_int.h
> index 0876aac938d..49e90cc0235 100644
> --- a/include/system/kvm_int.h
> +++ b/include/system/kvm_int.h
> @@ -113,6 +113,7 @@ struct KVMState
> struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
> bool coalesced_flush_in_progress;
> int vcpu_events;
> + bool have_guest_supported;
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
> #endif
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 1231c010fce..80d8ef1a974 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -104,7 +104,6 @@ bool kvm_readonly_mem_allowed;
> bool kvm_vm_attributes_allowed;
> bool kvm_msi_use_devid;
> bool kvm_pre_fault_memory_supported;
> -static bool kvm_has_guest_debug;
> static int kvm_sstep_flags;
> static bool kvm_immediate_exit;
> static uint64_t kvm_supported_memory_attributes;
> @@ -3040,10 +3039,10 @@ static int kvm_init(AccelState *as, MachineState *ms)
> kvm_sstep_flags = 0;
>
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> - kvm_has_guest_debug =
> + s->have_guest_supported =
> (kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG) > 0);
>
> - if (kvm_has_guest_debug) {
> + if (s->have_guest_supported) {
> kvm_sstep_flags = SSTEP_ENABLE;
>
> int guest_debug_flags =
> @@ -3835,8 +3834,9 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
>
> static bool kvm_supports_guest_debug(AccelState *as)
> {
> + KVMState *s = KVM_STATE(as);
> /* probed during kvm_init() */
> - return kvm_has_guest_debug;
> + return s->have_guest_supported;
> }
>
> int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 16/33] accel/kvm: Hold gdbstub_sstep_flags in KVMState
2026-06-30 22:00 ` [PATCH 16/33] accel/kvm: Hold gdbstub_sstep_flags " Philippe Mathieu-Daudé
@ 2026-07-02 13:22 ` Daniel Henrique Barboza
2026-07-02 17:42 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Prefer to store per-accelerator variables in the per-accelerator
> state, rather than as static variables. This is a good practice
> to allow concurrent accelerators in the future.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> include/system/kvm_int.h | 1 +
> accel/kvm/kvm-all.c | 7 +++----
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/system/kvm_int.h b/include/system/kvm_int.h
> index 49e90cc0235..062759eaa01 100644
> --- a/include/system/kvm_int.h
> +++ b/include/system/kvm_int.h
> @@ -114,6 +114,7 @@ struct KVMState
> bool coalesced_flush_in_progress;
> int vcpu_events;
> bool have_guest_supported;
> + int gdbstub_sstep_flags;
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
> #endif
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 80d8ef1a974..76c9ae6d4d4 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -104,7 +104,6 @@ bool kvm_readonly_mem_allowed;
> bool kvm_vm_attributes_allowed;
> bool kvm_msi_use_devid;
> bool kvm_pre_fault_memory_supported;
> -static int kvm_sstep_flags;
> static bool kvm_immediate_exit;
> static uint64_t kvm_supported_memory_attributes;
> static bool kvm_guest_memfd_supported;
> @@ -3036,20 +3035,20 @@ static int kvm_init(AccelState *as, MachineState *ms)
> kvm_vm_attributes_allowed =
> (kvm_check_extension(s, KVM_CAP_VM_ATTRIBUTES) > 0);
>
> - kvm_sstep_flags = 0;
> + s->gdbstub_sstep_flags = 0;
>
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> s->have_guest_supported =
> (kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG) > 0);
>
> if (s->have_guest_supported) {
> - kvm_sstep_flags = SSTEP_ENABLE;
> + s->gdbstub_sstep_flags = SSTEP_ENABLE;
>
> int guest_debug_flags =
> kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG2);
>
> if (guest_debug_flags & KVM_GUESTDBG_BLOCKIRQ) {
> - kvm_sstep_flags |= SSTEP_NOIRQ;
> + s->gdbstub_sstep_flags |= SSTEP_NOIRQ;
> }
> }
> #endif
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 17/33] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h'
2026-06-30 22:00 ` [PATCH 17/33] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h' Philippe Mathieu-Daudé
@ 2026-07-02 13:24 ` Daniel Henrique Barboza
2026-07-02 17:43 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> include/exec/breakpoint.h | 14 ++++++++++++++
> include/hw/core/cpu.h | 14 --------------
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h
> index 95f0482e6d0..cc6fedd09fe 100644
> --- a/include/exec/breakpoint.h
> +++ b/include/exec/breakpoint.h
> @@ -12,6 +12,20 @@
> #include "exec/vaddr.h"
> #include "exec/memattrs.h"
>
> +/* Breakpoint/watchpoint flags */
> +#define BP_MEM_READ 0x01
> +#define BP_MEM_WRITE 0x02
> +#define BP_MEM_ACCESS (BP_MEM_READ | BP_MEM_WRITE)
> +#define BP_STOP_BEFORE_ACCESS 0x04
> +/* 0x08 currently unused */
> +#define BP_GDB 0x10
> +#define BP_CPU 0x20
> +#define BP_ANY (BP_GDB | BP_CPU)
> +#define BP_HIT_SHIFT 6
> +#define BP_WATCHPOINT_HIT_READ (BP_MEM_READ << BP_HIT_SHIFT)
> +#define BP_WATCHPOINT_HIT_WRITE (BP_MEM_WRITE << BP_HIT_SHIFT)
> +#define BP_WATCHPOINT_HIT (BP_MEM_ACCESS << BP_HIT_SHIFT)
> +
> typedef struct CPUBreakpoint {
> vaddr pc;
> int flags; /* BP_* */
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 60a23d6f38b..b1df615792a 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -1138,20 +1138,6 @@ void qemu_init_vcpu(CPUState *cpu);
> */
> void cpu_single_step(CPUState *cpu, int enabled);
>
> -/* Breakpoint/watchpoint flags */
> -#define BP_MEM_READ 0x01
> -#define BP_MEM_WRITE 0x02
> -#define BP_MEM_ACCESS (BP_MEM_READ | BP_MEM_WRITE)
> -#define BP_STOP_BEFORE_ACCESS 0x04
> -/* 0x08 currently unused */
> -#define BP_GDB 0x10
> -#define BP_CPU 0x20
> -#define BP_ANY (BP_GDB | BP_CPU)
> -#define BP_HIT_SHIFT 6
> -#define BP_WATCHPOINT_HIT_READ (BP_MEM_READ << BP_HIT_SHIFT)
> -#define BP_WATCHPOINT_HIT_WRITE (BP_MEM_WRITE << BP_HIT_SHIFT)
> -#define BP_WATCHPOINT_HIT (BP_MEM_ACCESS << BP_HIT_SHIFT)
> -
> int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
> CPUBreakpoint **breakpoint);
> int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags);
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 06/33] gdbstub: Add trace event for STEP packet handler
2026-06-30 22:00 ` [PATCH 06/33] gdbstub: Add trace event for STEP packet handler Philippe Mathieu-Daudé
2026-07-02 13:18 ` Daniel Henrique Barboza
@ 2026-07-02 13:25 ` Alex Bennée
1 sibling, 0 replies; 93+ messages in thread
From: Alex Bennée @ 2026-07-02 13:25 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-s390x, Peter Maydell, Paolo Bonzini, Xiaoyao Li,
Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> writes:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> gdbstub/gdbstub.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index 26366acb674..246e7746300 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -1369,6 +1369,7 @@ static void handle_step(GArray *params, void *user_ctx)
> gdb_set_cpu_pc(gdb_get_cmd_param(params, 0)->val_ull);
> }
>
> + trace_gdbstub_op_stepping(gdbserver_state.c_cpu->cpu_index);
> cpu_single_step(gdbserver_state.c_cpu, gdbserver_state.sstep_flags);
> gdb_continue();
> }
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 07/33] gdbstub: Only return E22 when reverse GDB is not supported
2026-06-30 22:00 ` [PATCH 07/33] gdbstub: Only return E22 when reverse GDB is not supported Philippe Mathieu-Daudé
2026-07-02 13:18 ` Daniel Henrique Barboza
@ 2026-07-02 13:26 ` Alex Bennée
1 sibling, 0 replies; 93+ messages in thread
From: Alex Bennée @ 2026-07-02 13:26 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-s390x, Peter Maydell, Paolo Bonzini, Xiaoyao Li,
Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> writes:
> No need to keep processing the arguments when we know
> reverse debugging is not available.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> gdbstub/gdbstub.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index 246e7746300..f54415a9db7 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -1378,6 +1378,7 @@ static void handle_backward(GArray *params, void *user_ctx)
> {
> if (!gdb_can_reverse()) {
> gdb_put_packet("E22");
> + return;
> }
> if (params->len == 1) {
> switch (gdb_get_cmd_param(params, 0)->opcode) {
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 18/33] cpu: Define BreakpointFlags type
2026-06-30 22:00 ` [PATCH 18/33] cpu: Define BreakpointFlags type Philippe Mathieu-Daudé
@ 2026-07-02 13:26 ` Daniel Henrique Barboza
2026-07-02 13:57 ` Philippe Mathieu-Daudé
2026-07-02 17:44 ` Richard Henderson
1 sibling, 1 reply; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:26 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
Hello fine sir,
This patch fails to apply to master due to a riscv conflict down there:
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Use the BreakpointFlags typedef to better follow when
> we deal with breakpoint flags (BP_*).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> include/accel/tcg/cpu-ops.h | 6 ++++--
> include/exec/breakpoint.h | 3 ++-
> include/exec/watchpoint.h | 8 +++++---
> include/hw/core/cpu.h | 11 ++++++-----
> accel/tcg/cputlb.c | 12 +++++++-----
> accel/tcg/tcg-accel-ops.c | 10 +++++-----
> accel/tcg/user-exec-stub.c | 11 ++++++-----
> accel/tcg/watchpoint.c | 9 +++++----
> cpu-common.c | 8 ++++----
> system/watchpoint.c | 8 ++++----
> target/arm/tcg/debug.c | 4 ++--
> target/arm/tcg/mte_helper.c | 3 ++-
> target/ppc/cpu.c | 2 +-
> target/ppc/kvm.c | 5 +++--
> target/riscv/cpu_helper.c | 2 +-
> target/riscv/debug.c | 12 +++++-------
> target/s390x/tcg/debug.c | 3 ++-
> target/xtensa/dbg_helper.c | 2 +-
> 18 files changed, 65 insertions(+), 54 deletions(-)
>
> diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
> index 710da12b828..f64d94b2b50 100644
> --- a/include/accel/tcg/cpu-ops.h
> +++ b/include/accel/tcg/cpu-ops.h
> @@ -298,7 +298,8 @@ struct TCGCPUOps {
> * specified by @flags. Exit via exception with a hit.
> */
> void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
> - MemTxAttrs attrs, int flags, uintptr_t ra);
> + MemTxAttrs attrs, BreakpointFlags flags,
> + uintptr_t ra);
>
> /**
> * cpu_watchpoint_address_matches:
> @@ -309,7 +310,8 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
> * Return the watchpoint flags that apply to [addr, addr+len).
> * If no watchpoint is registered for the range, the result is 0.
> */
> -int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len);
> +BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu,
> + vaddr addr, vaddr len);
>
> /*
> * Common pointer_wrap implementations.
> diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h
> index cc6fedd09fe..0c3cc0c8ff3 100644
> --- a/include/exec/breakpoint.h
> +++ b/include/exec/breakpoint.h
> @@ -12,6 +12,7 @@
> #include "exec/vaddr.h"
> #include "exec/memattrs.h"
>
> +typedef int BreakpointFlags;
> /* Breakpoint/watchpoint flags */
> #define BP_MEM_READ 0x01
> #define BP_MEM_WRITE 0x02
> @@ -28,7 +29,7 @@
>
> typedef struct CPUBreakpoint {
> vaddr pc;
> - int flags; /* BP_* */
> + BreakpointFlags flags;
> QTAILQ_ENTRY(CPUBreakpoint) entry;
> } CPUBreakpoint;
>
> diff --git a/include/exec/watchpoint.h b/include/exec/watchpoint.h
> index c4d069425ba..ba148eff3d1 100644
> --- a/include/exec/watchpoint.h
> +++ b/include/exec/watchpoint.h
> @@ -8,11 +8,13 @@
> #ifndef EXEC_WATCHPOINT_H
> #define EXEC_WATCHPOINT_H
>
> +#include "exec/breakpoint.h"
> +
> int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
> - int flags, CPUWatchpoint **watchpoint);
> + BreakpointFlags flags, CPUWatchpoint **watchpoint);
> int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
> - vaddr len, int flags);
> + vaddr len, BreakpointFlags flags);
> void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
> -void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
> +void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags flags);
>
> #endif /* EXEC_WATCHPOINT_H */
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index b1df615792a..bea8e509a19 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -1138,20 +1138,21 @@ void qemu_init_vcpu(CPUState *cpu);
> */
> void cpu_single_step(CPUState *cpu, int enabled);
>
> -int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
> +int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
> CPUBreakpoint **breakpoint);
> -int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags);
> +int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags);
> void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint);
> -void cpu_breakpoint_remove_all(CPUState *cpu, int mask);
> +void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags flags);
>
> /* Return true if PC matches an installed breakpoint. */
> -static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask)
> +static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc,
> + BreakpointFlags flags)
> {
> CPUBreakpoint *bp;
>
> if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) {
> QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
> - if (bp->pc == pc && (bp->flags & mask)) {
> + if (bp->pc == pc && (bp->flags & flags)) {
> return true;
> }
> }
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index 7f7c208ba12..e2911e3aac6 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -1033,7 +1033,8 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx,
> CPUTLBEntry *te, tn;
> hwaddr iotlb, xlat, sz, paddr_page;
> vaddr addr_page;
> - int asidx, wp_flags, prot;
> + int asidx, prot;
> + BreakpointFlags wp_flags;
> bool is_ram, is_romd;
>
> assert_cpu_is_self(cpu);
> @@ -1499,8 +1500,8 @@ void *probe_access(CPUArchState *env, vaddr addr, int size,
> if (unlikely(flags & (TLB_NOTDIRTY | TLB_WATCHPOINT))) {
> /* Handle watchpoints. */
> if (flags & TLB_WATCHPOINT) {
> - int wp_access = (access_type == MMU_DATA_STORE
> - ? BP_MEM_WRITE : BP_MEM_READ);
> + BreakpointFlags wp_access = (access_type == MMU_DATA_STORE
> + ? BP_MEM_WRITE : BP_MEM_READ);
> cpu_check_watchpoint(env_cpu(env), addr, size,
> full->attrs, wp_access, retaddr);
> }
> @@ -1702,7 +1703,8 @@ static void mmu_watch_or_dirty(CPUState *cpu, MMULookupPageData *data,
>
> /* On watchpoint hit, this will longjmp out. */
> if (flags & TLB_WATCHPOINT) {
> - int wp = access_type == MMU_DATA_STORE ? BP_MEM_WRITE : BP_MEM_READ;
> + BreakpointFlags wp = access_type == MMU_DATA_STORE ? BP_MEM_WRITE
> + : BP_MEM_READ;
> cpu_check_watchpoint(cpu, addr, size, full->attrs, wp, ra);
> flags &= ~TLB_WATCHPOINT;
> }
> @@ -1885,7 +1887,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi,
> }
>
> if (unlikely(tlb_addr & TLB_WATCHPOINT)) {
> - int wp_flags = 0;
> + BreakpointFlags wp_flags = 0;
>
> if (full->slow_flags[MMU_DATA_STORE] & TLB_WATCHPOINT) {
> wp_flags |= BP_MEM_WRITE;
> diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
> index 927af6c1db0..26d34c72d9a 100644
> --- a/accel/tcg/tcg-accel-ops.c
> +++ b/accel/tcg/tcg-accel-ops.c
> @@ -110,20 +110,20 @@ void tcg_handle_interrupt(CPUState *cpu, int mask)
> }
>
> /* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */
> -static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
> +static inline BreakpointFlags xlat_gdb_type(CPUState *cpu, int gdbtype)
> {
> - static const int xlat[] = {
> + static const BreakpointFlags xlat[] = {
> [GDB_WATCHPOINT_WRITE] = BP_GDB | BP_MEM_WRITE,
> [GDB_WATCHPOINT_READ] = BP_GDB | BP_MEM_READ,
> [GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS,
> };
>
> - int cputype = xlat[gdbtype];
> + BreakpointFlags cpuflags = xlat[gdbtype];
>
> if (cpu->cc->gdb_stop_before_watchpoint) {
> - cputype |= BP_STOP_BEFORE_ACCESS;
> + cpuflags |= BP_STOP_BEFORE_ACCESS;
> }
> - return cputype;
> + return cpuflags;
> }
>
> static int tcg_insert_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
> diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c
> index 28286e11a60..7b6c25c4738 100644
> --- a/accel/tcg/user-exec-stub.c
> +++ b/accel/tcg/user-exec-stub.c
> @@ -22,13 +22,13 @@ void cpu_exec_reset_hold(CPUState *cpu)
> }
>
> int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
> - int flags, CPUWatchpoint **watchpoint)
> + BreakpointFlags flags, CPUWatchpoint **watchpoint)
> {
> return -ENOSYS;
> }
>
> int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
> - vaddr len, int flags)
> + vaddr len, BreakpointFlags flags)
> {
> return -ENOSYS;
> }
> @@ -37,17 +37,18 @@ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *wp)
> {
> }
>
> -void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
> +void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags flags)
> {
> }
>
> -int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
> +BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu,
> + vaddr addr, vaddr len)
> {
> return 0;
> }
>
> void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
> - MemTxAttrs atr, int fl, uintptr_t ra)
> + MemTxAttrs atr, BreakpointFlags flags, uintptr_t ra)
> {
> }
>
> diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c
> index c75ed278459..5ea66e9763a 100644
> --- a/accel/tcg/watchpoint.c
> +++ b/accel/tcg/watchpoint.c
> @@ -52,10 +52,11 @@ static inline bool watchpoint_address_matches(CPUWatchpoint *wp,
> }
>
> /* Return flags for watchpoints that match addr + prot. */
> -int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
> +BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu,
> + vaddr addr, vaddr len)
> {
> CPUWatchpoint *wp;
> - int ret = 0;
> + BreakpointFlags ret = 0;
>
> QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
> if (watchpoint_address_matches(wp, addr, len)) {
> @@ -67,7 +68,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
>
> /* Generate a debug exception if a watchpoint has been hit. */
> void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
> - MemTxAttrs attrs, int flags, uintptr_t ra)
> + MemTxAttrs attrs, BreakpointFlags flags, uintptr_t ra)
> {
> CPUWatchpoint *wp;
>
> @@ -91,7 +92,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
>
> assert((flags & ~BP_MEM_ACCESS) == 0);
> QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
> - int hit_flags = wp->flags & flags;
> + BreakpointFlags hit_flags = wp->flags & flags;
>
> if (hit_flags && watchpoint_address_matches(wp, addr, len)) {
> if (replay_running_debug()) {
> diff --git a/cpu-common.c b/cpu-common.c
> index 988d057d844..5afae9c1899 100644
> --- a/cpu-common.c
> +++ b/cpu-common.c
> @@ -389,7 +389,7 @@ void process_queued_cpu_work(CPUState *cpu)
> }
>
> /* Add a breakpoint. */
> -int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
> +int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
> CPUBreakpoint **breakpoint)
> {
> CPUBreakpoint *bp;
> @@ -419,7 +419,7 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
> }
>
> /* Remove a specific breakpoint. */
> -int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
> +int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags)
> {
> CPUBreakpoint *bp;
>
> @@ -446,12 +446,12 @@ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *bp)
> }
>
> /* Remove all matching breakpoints. */
> -void cpu_breakpoint_remove_all(CPUState *cpu, int mask)
> +void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags flags)
> {
> CPUBreakpoint *bp, *next;
>
> QTAILQ_FOREACH_SAFE(bp, &cpu->breakpoints, entry, next) {
> - if (bp->flags & mask) {
> + if (bp->flags & flags) {
> cpu_breakpoint_remove_by_ref(cpu, bp);
> }
> }
> diff --git a/system/watchpoint.c b/system/watchpoint.c
> index 21d0bb36cae..f96aa24210f 100644
> --- a/system/watchpoint.c
> +++ b/system/watchpoint.c
> @@ -26,7 +26,7 @@
>
> /* Add a watchpoint. */
> int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
> - int flags, CPUWatchpoint **watchpoint)
> + BreakpointFlags flags, CPUWatchpoint **watchpoint)
> {
> CPUWatchpoint *wp;
> vaddr in_page;
> @@ -65,7 +65,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
>
> /* Remove a specific watchpoint. */
> int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len,
> - int flags)
> + BreakpointFlags flags)
> {
> CPUWatchpoint *wp;
>
> @@ -90,12 +90,12 @@ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint)
> }
>
> /* Remove all matching watchpoints. */
> -void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
> +void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags flags)
> {
> CPUWatchpoint *wp, *next;
>
> QTAILQ_FOREACH_SAFE(wp, &cpu->watchpoints, entry, next) {
> - if (wp->flags & mask) {
> + if (wp->flags & flags) {
> cpu_watchpoint_remove_by_ref(cpu, wp);
> }
> }
> diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c
> index 07a52643e71..11043ecd589 100644
> --- a/target/arm/tcg/debug.c
> +++ b/target/arm/tcg/debug.c
> @@ -550,7 +550,7 @@ void hw_watchpoint_update(ARMCPU *cpu, int n)
> vaddr wvr = env->cp15.dbgwvr[n];
> uint64_t wcr = env->cp15.dbgwcr[n];
> int mask;
> - int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
> + BreakpointFlags flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
>
> if (env->cpu_watchpoint[n]) {
> cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[n]);
> @@ -656,7 +656,7 @@ void hw_breakpoint_update(ARMCPU *cpu, int n)
> uint64_t bcr = env->cp15.dbgbcr[n];
> vaddr addr;
> int bt;
> - int flags = BP_CPU;
> + BreakpointFlags flags = BP_CPU;
>
> if (env->cpu_breakpoint[n]) {
> cpu_breakpoint_remove_by_ref(CPU(cpu), env->cpu_breakpoint[n]);
> diff --git a/target/arm/tcg/mte_helper.c b/target/arm/tcg/mte_helper.c
> index dca4ef5a942..17f920b3f35 100644
> --- a/target/arm/tcg/mte_helper.c
> +++ b/target/arm/tcg/mte_helper.c
> @@ -190,7 +190,8 @@ uint8_t *allocation_tag_mem_probe(CPUARMState *env, int ptr_mmu_idx,
>
> /* Any debug exception has priority over a tag check exception. */
> if (!probe && unlikely(flags & TLB_WATCHPOINT)) {
> - int wp = ptr_access == MMU_DATA_LOAD ? BP_MEM_READ : BP_MEM_WRITE;
> + BreakpointFlags wp = ptr_access == MMU_DATA_LOAD ? BP_MEM_READ
> + : BP_MEM_WRITE;
> assert(ra != 0);
> cpu_check_watchpoint(env_cpu(env), ptr, ptr_size, attrs, wp, ra);
> }
> diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
> index 41edb18643d..913920d55b8 100644
> --- a/target/ppc/cpu.c
> +++ b/target/ppc/cpu.c
> @@ -145,7 +145,7 @@ void ppc_update_daw(CPUPPCState *env, int rid)
> bool sv = extract32(dawrx, PPC_BIT_NR(62), 1);
> bool pr = extract32(dawrx, PPC_BIT_NR(62), 1);
> vaddr len;
> - int flags;
> + BreakpointFlags flags;
>
> if (env->dawr_watchpoint[rid]) {
> cpu_watchpoint_remove_by_ref(cs, env->dawr_watchpoint[rid]);
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index b94c2997a07..2a3711fb1df 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -1429,7 +1429,7 @@ static int find_hw_breakpoint(target_ulong addr, int type)
> return -1;
> }
>
> -static int find_hw_watchpoint(target_ulong addr, int *flag)
> +static int find_hw_watchpoint(target_ulong addr, BreakpointFlags *flag)
> {
> int n;
>
> @@ -1575,7 +1575,6 @@ static int kvm_handle_hw_breakpoint(CPUState *cs,
> {
> int handle = DEBUG_RETURN_GUEST;
> int n;
> - int flag = 0;
>
> if (nb_hw_breakpoint + nb_hw_watchpoint > 0) {
> if (arch_info->status & KVMPPC_DEBUG_BREAKPOINT) {
> @@ -1585,6 +1584,8 @@ static int kvm_handle_hw_breakpoint(CPUState *cs,
> }
> } else if (arch_info->status & (KVMPPC_DEBUG_WATCH_READ |
> KVMPPC_DEBUG_WATCH_WRITE)) {
> + BreakpointFlags flag = 0;
> +
> n = find_hw_watchpoint(arch_info->address, &flag);
> if (n >= 0) {
> handle = DEBUG_RETURN_GDB;
> diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
> index 59edcdd3704..8b9d4bc1f4d 100644
> --- a/target/riscv/cpu_helper.c
> +++ b/target/riscv/cpu_helper.c
> @@ -1992,7 +1992,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
> } else if (probe) {
> return false;
> } else {
> - int wp_access = 0;
> + BreakpointFlags wp_access = 0;
>
> if (access_type == MMU_DATA_LOAD) {
> wp_access |= BP_MEM_READ;
> diff --git a/target/riscv/debug.c b/target/riscv/debug.c
> index 30d39ee5cd0..3046cc896a8 100644
> --- a/target/riscv/debug.c
> +++ b/target/riscv/debug.c
> @@ -479,7 +479,7 @@ static void type2_breakpoint_insert(CPURISCVState *env, target_ulong index)
> target_ulong addr = env->tdata2[index];
> bool enabled = type2_breakpoint_enabled(ctrl);
> CPUState *cs = env_cpu(env);
> - int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
> + BreakpointFlags flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
> uint32_t size, def_size;
>
> if (!enabled) {
> @@ -604,7 +604,7 @@ static void type6_breakpoint_insert(CPURISCVState *env, target_ulong index)
> target_ulong addr = env->tdata2[index];
> bool enabled = type6_breakpoint_enabled(ctrl);
> CPUState *cs = env_cpu(env);
> - int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
> + BreakpointFlags flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
> uint32_t size;
>
> if (!enabled) {
> @@ -992,12 +992,10 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp)
> CPURISCVState *env = &cpu->env;
> target_ulong ctrl;
> target_ulong addr;
> - int trigger_type;
> - int flags;
> - int i;
>
> - for (i = 0; i < RV_MAX_TRIGGERS; i++) {
> - trigger_type = get_trigger_type(env, i);
> + for (int i = 0; i < RV_MAX_TRIGGERS; i++) {
> + int trigger_type = get_trigger_type(env, i);
> + BreakpointFlags flags;
Here ^ the reason is we're not using RV_MAX_TRIGGERS anymore but env->num_triggers.
Patch LGTM otherwise. For the RISC-V bits:
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
>
> if (!trigger_common_match(env, trigger_type, i)) {
> continue;
> diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c
> index 99140b1ac9a..d10e9ed8922 100644
> --- a/target/s390x/tcg/debug.c
> +++ b/target/s390x/tcg/debug.c
> @@ -14,7 +14,8 @@
>
> void s390_cpu_recompute_watchpoints(CPUState *cs)
> {
> - const int wp_flags = BP_CPU | BP_MEM_WRITE | BP_STOP_BEFORE_ACCESS;
> + const BreakpointFlags wp_flags = BP_CPU | BP_MEM_WRITE
> + | BP_STOP_BEFORE_ACCESS;
> CPUS390XState *env = cpu_env(cs);
>
> /* We are called when the watchpoints have changed. First
> diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c
> index 3b91f7c38ac..990012f60e6 100644
> --- a/target/xtensa/dbg_helper.c
> +++ b/target/xtensa/dbg_helper.c
> @@ -85,7 +85,7 @@ static void set_dbreak(CPUXtensaState *env, unsigned i, uint32_t dbreaka,
> uint32_t dbreakc)
> {
> CPUState *cs = env_cpu(env);
> - int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
> + BreakpointFlags flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
> uint32_t mask = dbreakc | ~DBREAKC_MASK;
>
> if (env->cpu_watchpoint[i]) {
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 19/33] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints
2026-06-30 22:00 ` [PATCH 19/33] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints Philippe Mathieu-Daudé
@ 2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:45 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> accel/tcg/tcg-accel-ops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
> index 26d34c72d9a..c54acc770e3 100644
> --- a/accel/tcg/tcg-accel-ops.c
> +++ b/accel/tcg/tcg-accel-ops.c
> @@ -188,7 +188,7 @@ static int tcg_remove_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
> }
> }
>
> -static inline void tcg_remove_all_breakpoints(CPUState *cpu)
> +static void tcg_remove_all_breakpoints(CPUState *cpu)
> {
> cpu_breakpoint_remove_all(cpu, BP_GDB);
> cpu_watchpoint_remove_all(cpu, BP_GDB);
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 20/33] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode
2026-06-30 22:00 ` [PATCH 20/33] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode Philippe Mathieu-Daudé
@ 2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:46 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> No need to deref external methods with unused argument to
> end up calling a method defined in the same unit file, call
> it directly.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> gdbstub/user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdbstub/user.c b/gdbstub/user.c
> index 299388b9f71..90d6ee49fb5 100644
> --- a/gdbstub/user.c
> +++ b/gdbstub/user.c
> @@ -557,7 +557,7 @@ static void disable_gdbstub(CPUState *thread_cpu)
> close(gdbserver_user_state.fd);
> gdbserver_user_state.fd = -1;
> CPU_FOREACH(cpu) {
> - cpu_breakpoint_remove_all(cpu, BP_GDB);
> + gdb_breakpoint_remove_all(cpu);
> /* no cpu_watchpoint_remove_all for user-mode */
> cpu_single_step(cpu, 0);
> }
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 21/33] gdbstub: Reduce @type variable scope
2026-06-30 22:00 ` [PATCH 21/33] gdbstub: Reduce @type variable scope Philippe Mathieu-Daudé
@ 2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:47 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> gdbstub/system.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gdbstub/system.c b/gdbstub/system.c
> index 414aef431ec..d5e09802323 100644
> --- a/gdbstub/system.c
> +++ b/gdbstub/system.c
> @@ -126,7 +126,6 @@ static void gdb_vm_state_change(void *opaque, bool running, RunState state)
> CPUState *cpu = gdbserver_state.c_cpu;
> g_autoptr(GString) buf = g_string_new(NULL);
> g_autoptr(GString) tid = g_string_new(NULL);
> - const char *type;
> int ret;
>
> if (running || gdbserver_state.state == RS_INACTIVE) {
> @@ -152,6 +151,8 @@ static void gdb_vm_state_change(void *opaque, bool running, RunState state)
> switch (state) {
> case RUN_STATE_DEBUG:
> if (cpu->watchpoint_hit) {
> + const char *type;
> +
> switch (cpu->watchpoint_hit->flags & BP_MEM_ACCESS) {
> case BP_MEM_READ:
> type = "r";
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator
2026-06-30 22:00 ` [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator Philippe Mathieu-Daudé
@ 2026-07-02 13:29 ` Daniel Henrique Barboza
2026-07-02 13:53 ` Philippe Mathieu-Daudé
2026-07-02 17:50 ` Richard Henderson
1 sibling, 1 reply; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:29 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Introduce the GdbBreakpointType enumerator to better follow
> code related to GDB protocol handling.
I've been thinking about using enums a lot more lately ... not only
because it's more idiomatic but it's also a built-in guard for allowed
values.
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> gdbstub/internals.h | 7 +++++--
> include/gdbstub/enums.h | 12 +++++++-----
> gdbstub/system.c | 6 ++++--
> gdbstub/user.c | 6 ++++--
> 4 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/gdbstub/internals.h b/gdbstub/internals.h
> index dbae07d2577..32f2520d2ea 100644
> --- a/gdbstub/internals.h
> +++ b/gdbstub/internals.h
> @@ -10,6 +10,7 @@
> #define GDBSTUB_INTERNALS_H
>
> #include "exec/cpu-common.h"
> +#include "gdbstub/enums.h"
>
> /*
> * Most "large" transfers (e.g. memory reads, feature XML
> @@ -217,8 +218,10 @@ void gdb_syscall_handling(const char *syscall_packet);
> * Break/Watch point support - there is an implementation for system
> * and user mode.
> */
> -int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len);
> -int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len);
> +int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
> + vaddr addr, vaddr len);
> +int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
> + vaddr addr, vaddr len);
> void gdb_breakpoint_remove_all(CPUState *cs);
>
> /**
> diff --git a/include/gdbstub/enums.h b/include/gdbstub/enums.h
> index c4d54a1d083..e4e2043d92c 100644
> --- a/include/gdbstub/enums.h
> +++ b/include/gdbstub/enums.h
> @@ -12,10 +12,12 @@
> #define DEFAULT_GDBSTUB_PORT "1234"
>
> /* GDB breakpoint/watchpoint types */
> -#define GDB_BREAKPOINT_SW 0
> -#define GDB_BREAKPOINT_HW 1
> -#define GDB_WATCHPOINT_WRITE 2
> -#define GDB_WATCHPOINT_READ 3
> -#define GDB_WATCHPOINT_ACCESS 4
> +typedef enum GdbBreakpointType {
> + GDB_BREAKPOINT_SW = 0,
> + GDB_BREAKPOINT_HW = 1,
> + GDB_WATCHPOINT_WRITE = 2,
> + GDB_WATCHPOINT_READ = 3,
> + GDB_WATCHPOINT_ACCESS = 4,
> +} GdbBreakpointType;
>
> #endif /* GDBSTUB_ENUMS_H */
> diff --git a/gdbstub/system.c b/gdbstub/system.c
> index d5e09802323..abeeebea8e2 100644
> --- a/gdbstub/system.c
> +++ b/gdbstub/system.c
> @@ -624,7 +624,8 @@ int gdb_signal_to_target(int sig)
> * Break/Watch point helpers
> */
>
> -int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
> +int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> const AccelOpsClass *ops = cpus_get_accel();
> if (ops->insert_breakpoint) {
> @@ -633,7 +634,8 @@ int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
> return -ENOSYS;
> }
>
> -int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len)
> +int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> const AccelOpsClass *ops = cpus_get_accel();
> if (ops->remove_breakpoint) {
> diff --git a/gdbstub/user.c b/gdbstub/user.c
> index 90d6ee49fb5..9e6f9a6f376 100644
> --- a/gdbstub/user.c
> +++ b/gdbstub/user.c
> @@ -790,7 +790,8 @@ unsigned int gdb_get_max_cpus(void)
> * Break/Watch point helpers
> */
>
> -int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
> +int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> CPUState *cpu;
> int err = 0;
> @@ -811,7 +812,8 @@ int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
> }
> }
>
> -int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len)
> +int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> CPUState *cpu;
> int err = 0;
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 23/33] accel: Use GdbBreakpointType enum
2026-06-30 22:00 ` [PATCH 23/33] accel: Use GdbBreakpointType enum Philippe Mathieu-Daudé
@ 2026-07-02 13:31 ` Daniel Henrique Barboza
2026-07-02 17:52 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:31 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Include '_gdbstub_' in the AccelOpsClass handlers to emphasize
> we are handling gdbstub-related requests.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> accel/kvm/kvm-cpus.h | 11 ++++++++---
> include/accel/accel-cpu-ops.h | 9 ++++++---
> include/system/hvf_int.h | 9 ++++++---
> include/system/kvm.h | 9 ++++++---
> target/arm/internals.h | 5 +++--
> accel/hvf/hvf-accel-ops.c | 20 +++++++++++---------
> accel/kvm/kvm-accel-ops.c | 6 +++---
> accel/kvm/kvm-all.c | 14 ++++++++------
> accel/tcg/tcg-accel-ops.c | 17 ++++++++++-------
> gdbstub/system.c | 12 ++++++------
> target/arm/hvf/hvf.c | 12 +++++++-----
> target/arm/hyp_gdbstub.c | 8 ++++----
> target/arm/kvm.c | 12 +++++++-----
> target/i386/hvf/hvf.c | 8 +++++---
> target/i386/kvm/kvm.c | 12 +++++++-----
> target/loongarch/kvm/kvm.c | 8 +++++---
> target/ppc/kvm.c | 12 +++++++-----
> target/riscv/kvm/kvm-cpu.c | 8 +++++---
> target/s390x/kvm/kvm.c | 8 +++++---
> 19 files changed, 119 insertions(+), 81 deletions(-)
>
> diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h
> index 3185659562d..bc2dd82e68e 100644
> --- a/accel/kvm/kvm-cpus.h
> +++ b/accel/kvm/kvm-cpus.h
> @@ -10,13 +10,18 @@
> #ifndef KVM_CPUS_H
> #define KVM_CPUS_H
>
> +#include "gdbstub/enums.h"
> +
> int kvm_init_vcpu(CPUState *cpu, Error **errp);
> int kvm_cpu_exec(CPUState *cpu);
> void kvm_destroy_vcpu(CPUState *cpu);
> void kvm_cpu_synchronize_post_reset(CPUState *cpu);
> void kvm_cpu_synchronize_post_init(CPUState *cpu);
> void kvm_cpu_synchronize_pre_loadvm(CPUState *cpu);
> -int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len);
> -int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len);
> -void kvm_remove_all_breakpoints(CPUState *cpu);
> +int kvm_insert_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
> + vaddr addr, vaddr len);
> +int kvm_remove_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
> + vaddr addr, vaddr len);
> +void kvm_remove_all_gdbstub_breakpoints(CPUState *cpu);
> +
> #endif /* KVM_CPUS_H */
> diff --git a/include/accel/accel-cpu-ops.h b/include/accel/accel-cpu-ops.h
> index b23a0606c7e..f0c7ee7542c 100644
> --- a/include/accel/accel-cpu-ops.h
> +++ b/include/accel/accel-cpu-ops.h
> @@ -13,6 +13,7 @@
> #include "qemu/accel.h"
> #include "exec/vaddr.h"
> #include "qom/object.h"
> +#include "gdbstub/enums.h"
>
> #define ACCEL_OPS_SUFFIX "-ops"
> #define TYPE_ACCEL_OPS "accel" ACCEL_OPS_SUFFIX
> @@ -85,9 +86,11 @@ struct AccelOpsClass {
>
> /* gdbstub hooks */
> int (*update_guest_debug)(CPUState *cpu);
> - int (*insert_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
> - int (*remove_breakpoint)(CPUState *cpu, int type, vaddr addr, vaddr len);
> - void (*remove_all_breakpoints)(CPUState *cpu);
> + int (*insert_gdbstub_breakpoint)(CPUState *cpu, GdbBreakpointType type,
> + vaddr addr, vaddr len);
> + int (*remove_gdbstub_breakpoint)(CPUState *cpu, GdbBreakpointType type,
> + vaddr addr, vaddr len);
> + void (*remove_all_gdbstub_breakpoints)(CPUState *cpu);
> };
>
> void generic_handle_interrupt(CPUState *cpu, int mask);
> diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h
> index ca0d4034e0f..9cdc622929e 100644
> --- a/include/system/hvf_int.h
> +++ b/include/system/hvf_int.h
> @@ -13,6 +13,7 @@
>
> #include "qemu/queue.h"
> #include "exec/vaddr.h"
> +#include "gdbstub/enums.h"
> #include "qom/object.h"
> #include "accel/accel-ops.h"
>
> @@ -91,9 +92,11 @@ int hvf_sw_breakpoints_active(CPUState *cpu);
>
> int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
> int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
> -int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
> -int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
> -void hvf_arch_remove_all_hw_breakpoints(void);
> +int hvf_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type);
> +int hvf_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type);
> +void hvf_arch_remove_all_gdbstub_hw_breakpoints(void);
>
> /*
> * hvf_update_guest_debug:
> diff --git a/include/system/kvm.h b/include/system/kvm.h
> index cdd1856ac5f..714b8c7b011 100644
> --- a/include/system/kvm.h
> +++ b/include/system/kvm.h
> @@ -17,6 +17,7 @@
> #define QEMU_KVM_H
>
> #include "exec/memattrs.h"
> +#include "gdbstub/enums.h"
> #include "qemu/accel.h"
> #include "accel/accel-route.h"
> #include "qom/object.h"
> @@ -412,9 +413,11 @@ int kvm_arch_insert_sw_breakpoint(CPUState *cpu,
> struct kvm_sw_breakpoint *bp);
> int kvm_arch_remove_sw_breakpoint(CPUState *cpu,
> struct kvm_sw_breakpoint *bp);
> -int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
> -int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
> -void kvm_arch_remove_all_hw_breakpoints(void);
> +int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type);
> +int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type);
> +void kvm_arch_remove_all_gdbstub_hw_breakpoints(void);
>
> void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg);
>
> diff --git a/target/arm/internals.h b/target/arm/internals.h
> index fcce3804f34..067c3f2b8bb 100644
> --- a/target/arm/internals.h
> +++ b/target/arm/internals.h
> @@ -29,6 +29,7 @@
> #include "exec/vaddr.h"
> #include "exec/breakpoint.h"
> #include "exec/memop.h"
> +#include "gdbstub/enums.h"
> #ifdef CONFIG_TCG
> #include "accel/tcg/tb-cpu-state.h"
> #include "tcg/tcg-gvec-desc.h"
> @@ -1968,8 +1969,8 @@ int delete_hw_breakpoint(vaddr pc);
>
> bool check_watchpoint_in_range(int i, vaddr addr);
> CPUWatchpoint *find_hw_watchpoint(CPUState *cpu, vaddr addr);
> -int insert_hw_watchpoint(vaddr addr, vaddr len, int type);
> -int delete_hw_watchpoint(vaddr addr, vaddr len, int type);
> +int insert_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType type);
> +int delete_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType type);
>
> /* Return the current value of the system counter in ticks */
> uint64_t gt_get_countervalue(CPUARMState *env);
> diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
> index ecc0cd1b558..d2276d8513e 100644
> --- a/accel/hvf/hvf-accel-ops.c
> +++ b/accel/hvf/hvf-accel-ops.c
> @@ -233,7 +233,8 @@ int hvf_update_guest_debug(CPUState *cpu)
> return 0;
> }
>
> -static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> +static int hvf_insert_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> struct hvf_sw_breakpoint *bp;
> int err;
> @@ -256,7 +257,7 @@ static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
>
> QTAILQ_INSERT_HEAD(&hvf_state->hvf_sw_breakpoints, bp, entry);
> } else {
> - err = hvf_arch_insert_hw_breakpoint(addr, len, type);
> + err = hvf_arch_insert_gdbstub_hw_breakpoint(addr, len, type);
> if (err) {
> return err;
> }
> @@ -271,7 +272,8 @@ static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> return 0;
> }
>
> -static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> +static int hvf_remove_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> struct hvf_sw_breakpoint *bp;
> int err;
> @@ -295,7 +297,7 @@ static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> QTAILQ_REMOVE(&hvf_state->hvf_sw_breakpoints, bp, entry);
> g_free(bp);
> } else {
> - err = hvf_arch_remove_hw_breakpoint(addr, len, type);
> + err = hvf_arch_remove_gdbstub_hw_breakpoint(addr, len, type);
> if (err) {
> return err;
> }
> @@ -310,7 +312,7 @@ static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> return 0;
> }
>
> -static void hvf_remove_all_breakpoints(CPUState *cpu)
> +static void hvf_remove_all_gdbstub_breakpoints(CPUState *cpu)
> {
> struct hvf_sw_breakpoint *bp, *next;
> CPUState *tmpcpu;
> @@ -328,7 +330,7 @@ static void hvf_remove_all_breakpoints(CPUState *cpu)
> QTAILQ_REMOVE(&hvf_state->hvf_sw_breakpoints, bp, entry);
> g_free(bp);
> }
> - hvf_arch_remove_all_hw_breakpoints();
> + hvf_arch_remove_all_gdbstub_hw_breakpoints();
>
> CPU_FOREACH(cpu) {
> hvf_update_guest_debug(cpu);
> @@ -365,9 +367,9 @@ static void hvf_accel_ops_class_init(ObjectClass *oc, const void *data)
> ops->synchronize_state = hvf_cpu_synchronize_state;
> ops->synchronize_pre_loadvm = hvf_cpu_synchronize_pre_loadvm;
>
> - ops->insert_breakpoint = hvf_insert_breakpoint;
> - ops->remove_breakpoint = hvf_remove_breakpoint;
> - ops->remove_all_breakpoints = hvf_remove_all_breakpoints;
> + ops->insert_gdbstub_breakpoint = hvf_insert_gdbstub_breakpoint;
> + ops->remove_gdbstub_breakpoint = hvf_remove_gdbstub_breakpoint;
> + ops->remove_all_gdbstub_breakpoints = hvf_remove_all_gdbstub_breakpoints;
> ops->update_guest_debug = hvf_update_guest_debug;
>
> ops->get_vcpu_stats = hvf_get_vcpu_stats;
> diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
> index 45330327909..c8e7aa38709 100644
> --- a/accel/kvm/kvm-accel-ops.c
> +++ b/accel/kvm/kvm-accel-ops.c
> @@ -107,9 +107,9 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
>
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> ops->update_guest_debug = kvm_update_guest_debug_ops;
> - ops->insert_breakpoint = kvm_insert_breakpoint;
> - ops->remove_breakpoint = kvm_remove_breakpoint;
> - ops->remove_all_breakpoints = kvm_remove_all_breakpoints;
> + ops->insert_gdbstub_breakpoint = kvm_insert_gdbstub_breakpoint;
> + ops->remove_gdbstub_breakpoint = kvm_remove_gdbstub_breakpoint;
> + ops->remove_all_gdbstub_breakpoints = kvm_remove_all_gdbstub_breakpoints;
> #endif
> }
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 76c9ae6d4d4..e8ed85f9a3d 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -3838,7 +3838,8 @@ static bool kvm_supports_guest_debug(AccelState *as)
> return s->have_guest_supported;
> }
>
> -int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> +int kvm_insert_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> struct kvm_sw_breakpoint *bp;
> int err;
> @@ -3861,7 +3862,7 @@ int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
>
> QTAILQ_INSERT_HEAD(&cpu->kvm_state->kvm_sw_breakpoints, bp, entry);
> } else {
> - err = kvm_arch_insert_hw_breakpoint(addr, len, type);
> + err = kvm_arch_insert_gdbstub_hw_breakpoint(addr, len, type);
> if (err) {
> return err;
> }
> @@ -3876,7 +3877,8 @@ int kvm_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> return 0;
> }
>
> -int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> +int kvm_remove_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> struct kvm_sw_breakpoint *bp;
> int err;
> @@ -3900,7 +3902,7 @@ int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> QTAILQ_REMOVE(&cpu->kvm_state->kvm_sw_breakpoints, bp, entry);
> g_free(bp);
> } else {
> - err = kvm_arch_remove_hw_breakpoint(addr, len, type);
> + err = kvm_arch_remove_gdbstub_hw_breakpoint(addr, len, type);
> if (err) {
> return err;
> }
> @@ -3915,7 +3917,7 @@ int kvm_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
> return 0;
> }
>
> -void kvm_remove_all_breakpoints(CPUState *cpu)
> +void kvm_remove_all_gdbstub_breakpoints(CPUState *cpu)
> {
> struct kvm_sw_breakpoint *bp, *next;
> KVMState *s = cpu->kvm_state;
> @@ -3933,7 +3935,7 @@ void kvm_remove_all_breakpoints(CPUState *cpu)
> QTAILQ_REMOVE(&s->kvm_sw_breakpoints, bp, entry);
> g_free(bp);
> }
> - kvm_arch_remove_all_hw_breakpoints();
> + kvm_arch_remove_all_gdbstub_hw_breakpoints();
>
> CPU_FOREACH(cpu) {
> kvm_update_guest_debug(cpu, 0);
> diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
> index c54acc770e3..028265c2efd 100644
> --- a/accel/tcg/tcg-accel-ops.c
> +++ b/accel/tcg/tcg-accel-ops.c
> @@ -110,7 +110,8 @@ void tcg_handle_interrupt(CPUState *cpu, int mask)
> }
>
> /* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */
> -static inline BreakpointFlags xlat_gdb_type(CPUState *cpu, int gdbtype)
> +static inline BreakpointFlags xlat_gdb_type(CPUState *cpu,
> + GdbBreakpointType gdbtype)
> {
> static const BreakpointFlags xlat[] = {
> [GDB_WATCHPOINT_WRITE] = BP_GDB | BP_MEM_WRITE,
> @@ -126,7 +127,8 @@ static inline BreakpointFlags xlat_gdb_type(CPUState *cpu, int gdbtype)
> return cpuflags;
> }
>
> -static int tcg_insert_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
> +static int tcg_insert_gdbstub_breakpoint(CPUState *cs, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> CPUState *cpu;
> int err = 0;
> @@ -157,7 +159,8 @@ static int tcg_insert_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
> }
> }
>
> -static int tcg_remove_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
> +static int tcg_remove_gdbstub_breakpoint(CPUState *cs, GdbBreakpointType type,
> + vaddr addr, vaddr len)
> {
> CPUState *cpu;
> int err = 0;
> @@ -188,7 +191,7 @@ static int tcg_remove_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
> }
> }
>
> -static void tcg_remove_all_breakpoints(CPUState *cpu)
> +static void tcg_remove_all_gdbstub_breakpoints(CPUState *cpu)
> {
> cpu_breakpoint_remove_all(cpu, BP_GDB);
> cpu_watchpoint_remove_all(cpu, BP_GDB);
> @@ -216,9 +219,9 @@ static void tcg_accel_ops_init(AccelClass *ac)
> }
>
> ops->cpu_reset_hold = tcg_cpu_reset_hold;
> - ops->insert_breakpoint = tcg_insert_breakpoint;
> - ops->remove_breakpoint = tcg_remove_breakpoint;
> - ops->remove_all_breakpoints = tcg_remove_all_breakpoints;
> + ops->insert_gdbstub_breakpoint = tcg_insert_gdbstub_breakpoint;
> + ops->remove_gdbstub_breakpoint = tcg_remove_gdbstub_breakpoint;
> + ops->remove_all_gdbstub_breakpoints = tcg_remove_all_gdbstub_breakpoints;
> }
>
> static void tcg_accel_ops_class_init(ObjectClass *oc, const void *data)
> diff --git a/gdbstub/system.c b/gdbstub/system.c
> index abeeebea8e2..108fe4bafb7 100644
> --- a/gdbstub/system.c
> +++ b/gdbstub/system.c
> @@ -628,8 +628,8 @@ int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
> vaddr addr, vaddr len)
> {
> const AccelOpsClass *ops = cpus_get_accel();
> - if (ops->insert_breakpoint) {
> - return ops->insert_breakpoint(cs, type, addr, len);
> + if (ops->insert_gdbstub_breakpoint) {
> + return ops->insert_gdbstub_breakpoint(cs, type, addr, len);
> }
> return -ENOSYS;
> }
> @@ -638,8 +638,8 @@ int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
> vaddr addr, vaddr len)
> {
> const AccelOpsClass *ops = cpus_get_accel();
> - if (ops->remove_breakpoint) {
> - return ops->remove_breakpoint(cs, type, addr, len);
> + if (ops->remove_gdbstub_breakpoint) {
> + return ops->remove_gdbstub_breakpoint(cs, type, addr, len);
> }
> return -ENOSYS;
> }
> @@ -647,8 +647,8 @@ int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
> void gdb_breakpoint_remove_all(CPUState *cs)
> {
> const AccelOpsClass *ops = cpus_get_accel();
> - if (ops->remove_all_breakpoints) {
> - ops->remove_all_breakpoints(cs);
> + if (ops->remove_all_gdbstub_breakpoints) {
> + ops->remove_all_gdbstub_breakpoints(cs);
> }
> }
>
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index f76bd7bf55d..530af305efd 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -2726,7 +2726,8 @@ int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp)
> return 0;
> }
>
> -int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int hvf_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> switch (type) {
> case GDB_BREAKPOINT_HW:
> @@ -2734,13 +2735,14 @@ int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> case GDB_WATCHPOINT_READ:
> case GDB_WATCHPOINT_WRITE:
> case GDB_WATCHPOINT_ACCESS:
> - return insert_hw_watchpoint(addr, len, type);
> + return insert_gdbstub_hw_watchpoint(addr, len, type);
> default:
> return -ENOSYS;
> }
> }
>
> -int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int hvf_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> switch (type) {
> case GDB_BREAKPOINT_HW:
> @@ -2748,13 +2750,13 @@ int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> case GDB_WATCHPOINT_READ:
> case GDB_WATCHPOINT_WRITE:
> case GDB_WATCHPOINT_ACCESS:
> - return delete_hw_watchpoint(addr, len, type);
> + return delete_gdbstub_hw_watchpoint(addr, len, type);
> default:
> return -ENOSYS;
> }
> }
>
> -void hvf_arch_remove_all_hw_breakpoints(void)
> +void hvf_arch_remove_all_gdbstub_hw_breakpoints(void)
> {
> if (cur_hw_wps > 0) {
> g_array_remove_range(hw_watchpoints, 0, cur_hw_wps);
> diff --git a/target/arm/hyp_gdbstub.c b/target/arm/hyp_gdbstub.c
> index bb5969720ce..dda6946ddaa 100644
> --- a/target/arm/hyp_gdbstub.c
> +++ b/target/arm/hyp_gdbstub.c
> @@ -94,7 +94,7 @@ int delete_hw_breakpoint(vaddr pc)
> }
>
> /**
> - * insert_hw_watchpoint()
> + * insert_gdbstub_hw_watchpoint()
> * @addr: address of watch point
> * @len: size of area
> * @type: type of watch point
> @@ -125,7 +125,7 @@ int delete_hw_breakpoint(vaddr pc)
> * need to ensure you mask the address as required and set BAS=0xff
> */
>
> -int insert_hw_watchpoint(vaddr addr, vaddr len, int type)
> +int insert_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType type)
> {
> HWWatchpoint wp = {
> .wcr = R_DBGWCR_E_MASK, /* E=1, enable */
> @@ -208,13 +208,13 @@ bool check_watchpoint_in_range(int i, vaddr addr)
> }
>
> /**
> - * delete_hw_watchpoint()
> + * delete_gdbstub_hw_watchpoint()
> * @addr: address of breakpoint
> *
> * Delete a breakpoint and shuffle any above down
> */
>
> -int delete_hw_watchpoint(vaddr addr, vaddr len, int type)
> +int delete_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType type)
> {
> int i;
> for (i = 0; i < cur_hw_wps; i++) {
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index a54ef51ec2a..01f42f42538 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -1784,7 +1784,8 @@ void kvm_arch_accel_class_init(ObjectClass *oc)
> "Eager Page Split chunk size for hugepages. (default: 0, disabled)");
> }
>
> -int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> switch (type) {
> case GDB_BREAKPOINT_HW:
> @@ -1793,13 +1794,14 @@ int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> case GDB_WATCHPOINT_READ:
> case GDB_WATCHPOINT_WRITE:
> case GDB_WATCHPOINT_ACCESS:
> - return insert_hw_watchpoint(addr, len, type);
> + return insert_gdbstub_hw_watchpoint(addr, len, type);
> default:
> return -ENOSYS;
> }
> }
>
> -int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> switch (type) {
> case GDB_BREAKPOINT_HW:
> @@ -1807,13 +1809,13 @@ int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> case GDB_WATCHPOINT_READ:
> case GDB_WATCHPOINT_WRITE:
> case GDB_WATCHPOINT_ACCESS:
> - return delete_hw_watchpoint(addr, len, type);
> + return delete_gdbstub_hw_watchpoint(addr, len, type);
> default:
> return -ENOSYS;
> }
> }
>
> -void kvm_arch_remove_all_hw_breakpoints(void)
> +void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
> {
> if (cur_hw_wps > 0) {
> g_array_remove_range(hw_watchpoints, 0, cur_hw_wps);
> diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
> index bb8a070903c..f5c1df18c14 100644
> --- a/target/i386/hvf/hvf.c
> +++ b/target/i386/hvf/hvf.c
> @@ -1049,17 +1049,19 @@ int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp)
> return -ENOSYS;
> }
>
> -int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int hvf_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> return -ENOSYS;
> }
>
> -int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int hvf_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> return -ENOSYS;
> }
>
> -void hvf_arch_remove_all_hw_breakpoints(void)
> +void hvf_arch_remove_all_gdbstub_hw_breakpoints(void)
> {
> }
>
> diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
> index 64cc421abe6..1e09155e92c 100644
> --- a/target/i386/kvm/kvm.c
> +++ b/target/i386/kvm/kvm.c
> @@ -6159,12 +6159,12 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
> static struct {
> target_ulong addr;
> int len;
> - int type;
> + GdbBreakpointType type;
> } hw_breakpoint[4];
>
> static int nb_hw_breakpoint;
>
> -static int find_hw_breakpoint(target_ulong addr, int len, int type)
> +static int find_hw_breakpoint(target_ulong addr, int len, GdbBreakpointType type)
> {
> int n;
>
> @@ -6177,7 +6177,8 @@ static int find_hw_breakpoint(target_ulong addr, int len, int type)
> return -1;
> }
>
> -int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> switch (type) {
> case GDB_BREAKPOINT_HW:
> @@ -6217,7 +6218,8 @@ int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> return 0;
> }
>
> -int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> int n;
>
> @@ -6231,7 +6233,7 @@ int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> return 0;
> }
>
> -void kvm_arch_remove_all_hw_breakpoints(void)
> +void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
> {
> nb_hw_breakpoint = 0;
> }
> diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
> index d6539c12acd..beda6965f8c 100644
> --- a/target/loongarch/kvm/kvm.c
> +++ b/target/loongarch/kvm/kvm.c
> @@ -1418,17 +1418,19 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
> return 0;
> }
>
> -int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> return -ENOSYS;
> }
>
> -int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> return -ENOSYS;
> }
>
> -void kvm_arch_remove_all_hw_breakpoints(void)
> +void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
> {
> }
>
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 2a3711fb1df..6bdfbbd68d6 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -455,7 +455,7 @@ unsigned long kvm_arch_vcpu_id(CPUState *cpu)
>
> static struct HWBreakpoint {
> target_ulong addr;
> - int type;
> + GdbBreakpointType type;
> } hw_debug_points[MAX_HW_BKPTS];
>
> static CPUWatchpoint hw_watchpoint;
> @@ -1412,7 +1412,7 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
> return 0;
> }
>
> -static int find_hw_breakpoint(target_ulong addr, int type)
> +static int find_hw_breakpoint(target_ulong addr, GdbBreakpointType type)
> {
> int n;
>
> @@ -1454,7 +1454,8 @@ static int find_hw_watchpoint(target_ulong addr, BreakpointFlags *flag)
> return -1;
> }
>
> -int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> const unsigned breakpoint_index = nb_hw_breakpoint + nb_hw_watchpoint;
> if (breakpoint_index >= ARRAY_SIZE(hw_debug_points)) {
> @@ -1498,7 +1499,8 @@ int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> return 0;
> }
>
> -int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> int n;
>
> @@ -1526,7 +1528,7 @@ int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> return 0;
> }
>
> -void kvm_arch_remove_all_hw_breakpoints(void)
> +void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
> {
> nb_hw_breakpoint = nb_hw_watchpoint = 0;
> }
> diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
> index f0de5c3071d..3300f6f71b2 100644
> --- a/target/riscv/kvm/kvm-cpu.c
> +++ b/target/riscv/kvm/kvm-cpu.c
> @@ -2206,19 +2206,21 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
> return 0;
> }
>
> -int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> /* TODO; To be implemented later. */
> return -EINVAL;
> }
>
> -int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> /* TODO; To be implemented later. */
> return -EINVAL;
> }
>
> -void kvm_arch_remove_all_hw_breakpoints(void)
> +void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
> {
> /* TODO; To be implemented later. */
> }
> diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
> index fdef8f9e8ac..195e39df032 100644
> --- a/target/s390x/kvm/kvm.c
> +++ b/target/s390x/kvm/kvm.c
> @@ -907,7 +907,8 @@ static int insert_hw_breakpoint(vaddr addr, int len, int type)
> return 0;
> }
>
> -int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_insert_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> switch (type) {
> case GDB_BREAKPOINT_HW:
> @@ -925,7 +926,8 @@ int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> return insert_hw_breakpoint(addr, len, type);
> }
>
> -int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> +int kvm_arch_remove_gdbstub_hw_breakpoint(vaddr addr, vaddr len,
> + GdbBreakpointType type)
> {
> int size;
> struct kvm_hw_breakpoint *bp = find_hw_breakpoint(addr, len, type);
> @@ -954,7 +956,7 @@ int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
> return 0;
> }
>
> -void kvm_arch_remove_all_hw_breakpoints(void)
> +void kvm_arch_remove_all_gdbstub_hw_breakpoints(void)
> {
> nb_hw_breakpoints = 0;
> g_free(hw_breakpoints);
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 27/33] target/ppc: Ensure TCG is used in ppc_update_daw()
2026-06-30 22:00 ` [PATCH 27/33] target/ppc: Ensure TCG is used in ppc_update_daw() Philippe Mathieu-Daudé
@ 2026-07-02 13:34 ` Daniel Henrique Barboza
0 siblings, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:34 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Per commit d5ee641cfc5 ("target/ppc: Implement watchpoint debug
> facility for v2.07S"), only TCG is implemented:
>
> ISA v2.07S introduced the watchpoint facility based on the DAWR0
> and DAWRX0 SPRs. Implement this in TCG.
> ^^^^^^^^^^^^^^^^^^^^^
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
I remember this one, so I feel comfortable giving an ack.
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> target/ppc/cpu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
> index 913920d55b8..36e1209119d 100644
> --- a/target/ppc/cpu.c
> +++ b/target/ppc/cpu.c
> @@ -147,6 +147,8 @@ void ppc_update_daw(CPUPPCState *env, int rid)
> vaddr len;
> BreakpointFlags flags;
>
> + assert(tcg_enabled());
> +
> if (env->dawr_watchpoint[rid]) {
> cpu_watchpoint_remove_by_ref(cs, env->dawr_watchpoint[rid]);
> env->dawr_watchpoint[rid] = NULL;
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 28/33] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers
2026-06-30 22:00 ` [PATCH 28/33] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers Philippe Mathieu-Daudé
@ 2026-07-02 13:34 ` Daniel Henrique Barboza
2026-07-02 18:04 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:34 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Commit d5ee641cfc5 ("target/ppc: Implement watchpoint debug facility
> for v2.07S") also implemented TCGCPUOps::debug_check_watchpoint for
> PPC: make the comment generic.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> include/accel/tcg/cpu-ops.h | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
> index f64d94b2b50..568d82cdd32 100644
> --- a/include/accel/tcg/cpu-ops.h
> +++ b/include/accel/tcg/cpu-ops.h
> @@ -250,14 +250,13 @@ struct TCGCPUOps {
> int mmu_idx, uintptr_t retaddr);
>
> /**
> - * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
> + * @adjust_watchpoint_address: hack for cpu_check_watchpoint (used by ARM)
> */
> vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
>
> /**
> * @debug_check_watchpoint: return true if the architectural
> - * watchpoint whose address has matched should really fire, used by ARM
> - * and RISC-V
> + * watchpoint whose address has matched should really fire.
> */
> bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
>
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 30/33] cpu: Better name cpu_single_step() trace event
2026-06-30 22:00 ` [PATCH 30/33] cpu: Better name cpu_single_step() trace event Philippe Mathieu-Daudé
@ 2026-07-02 13:35 ` Daniel Henrique Barboza
0 siblings, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:35 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> cpu_single_step() is not related to breakpoints. Rename the
> trace event.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> cpu-target.c | 4 ++--
> trace-events | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/cpu-target.c b/cpu-target.c
> index f030e2c642e..019906b32eb 100644
> --- a/cpu-target.c
> +++ b/cpu-target.c
> @@ -31,6 +31,8 @@
> void cpu_single_step(CPUState *cpu, int enabled)
> {
> if (cpu->singlestep_enabled != enabled) {
> + trace_cpu_change_singlestep_flags(cpu->cpu_index,
> + cpu->singlestep_enabled, enabled);
> cpu->singlestep_enabled = enabled;
>
> #if !defined(CONFIG_USER_ONLY)
> @@ -39,8 +41,6 @@ void cpu_single_step(CPUState *cpu, int enabled)
> ops->update_guest_debug(cpu);
> }
> #endif
> -
> - trace_breakpoint_singlestep(cpu->cpu_index, enabled);
> }
> }
>
> diff --git a/trace-events b/trace-events
> index faeba6242fa..ea1d2b11a22 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -28,7 +28,7 @@
> # cpu.c
> breakpoint_insert(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x"
> breakpoint_remove(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x"
> -breakpoint_singlestep(int cpu_index, int enabled) "cpu=%d enable=%d"
> +cpu_change_singlestep_flags(int cpu_index, int old_flags, int new_flags) "cpu=%d flags=0x%x -> 0x%x"
> cpu_exec_start(int cpu_index) "cpu=%d"
> cpu_exec_end(int cpu_index) "cpu=%d"
>
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 33/33] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping()
2026-06-30 22:01 ` [PATCH 33/33] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping() Philippe Mathieu-Daudé
@ 2026-07-02 13:36 ` Daniel Henrique Barboza
2026-07-02 18:11 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:01 PM, Philippe Mathieu-Daudé wrote:
> Only the SSTEP_ENABLE bitmask means single-step is enabled.
>
> Fixes: 60897d369f1 ("Debugger single step without interrupts")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> include/hw/core/cpu.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 27ee0e54327..d092ab8aa5b 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -1146,7 +1146,7 @@ void cpu_single_step(CPUState *cpu, int flags);
> */
> static inline bool cpu_single_stepping(const CPUState *cpu)
> {
> - return cpu->singlestep_flags;
> + return cpu->singlestep_flags & SSTEP_ENABLE;
> }
>
> int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 04/33] accel/hvf: Remove left-over comment
2026-06-30 22:00 ` [PATCH 04/33] accel/hvf: Remove left-over comment Philippe Mathieu-Daudé
@ 2026-07-02 13:36 ` Daniel Henrique Barboza
2026-07-02 16:29 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-02 13:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
> Missed in commit 6bf331164c5 ("accel/hvf: Drop hvf_slot and
> hvf_find_overlap_slot").
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
Trivial stuff even for non-HVF people, so:
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> accel/hvf/hvf-accel-ops.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
> index b74a5779c3d..dd2b45b7cb5 100644
> --- a/accel/hvf/hvf-accel-ops.c
> +++ b/accel/hvf/hvf-accel-ops.c
> @@ -62,8 +62,6 @@
>
> HVFState *hvf_state;
>
> -/* Memory slots */
> -
> static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
> {
> if (!cpu->vcpu_dirty) {
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field
2026-07-02 13:00 ` Philippe Mathieu-Daudé
@ 2026-07-02 13:41 ` Magnus Kulke
0 siblings, 0 replies; 93+ messages in thread
From: Magnus Kulke @ 2026-07-02 13:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-s390x, Peter Maydell, Alex Bennée,
Paolo Bonzini, Xiaoyao Li, Chao Liu, Zhao Liu,
Daniel Henrique Barboza, qemu-ppc, Richard Henderson
On Thu, Jul 02, 2026 at 03:00:07PM +0200, Philippe Mathieu-Daudé wrote:
> Cc'ing Magnus.
>
> On 1/7/26 00:00, Philippe Mathieu-Daudé wrote:
> > No need for accel-specific @dirty field when we have
> > a generic one in CPUState. (Other accelerators already
> > did that in commits 6f13a0ada01..36ab216b81d).
> >
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> > ---
> > include/system/mshv_int.h | 1 -
> > accel/mshv/mshv-all.c | 18 +++++++++---------
> > target/i386/mshv/mshv-cpu.c | 6 +++---
> > 3 files changed, 12 insertions(+), 13 deletions(-)
> >
> > diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
> > index ba3073888ac..b91c4d661a3 100644
> > --- a/include/system/mshv_int.h
> > +++ b/include/system/mshv_int.h
> > @@ -43,7 +43,6 @@ typedef struct MshvHvCallArgs {
> > struct AccelCPUState {
> > int cpufd;
> > - bool dirty;
> > MshvHvCallArgs hvcall_args;
> > };
> > diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
> > index 9452504ac28..1959baf6672 100644
> > --- a/accel/mshv/mshv-all.c
> > +++ b/accel/mshv/mshv-all.c
> > @@ -531,7 +531,7 @@ static int mshv_init_vcpu(CPUState *cpu)
> > }
> > mshv_arch_init_vcpu(cpu);
> > - cpu->accel->dirty = true;
> > + cpu->vcpu_dirty = true;
> > return 0;
> > }
> > @@ -617,7 +617,7 @@ static int mshv_cpu_exec(CPUState *cpu)
> > cpu_exec_start(cpu);
> > do {
> > - if (cpu->accel->dirty) {
> > + if (cpu->vcpu_dirty) {
> > ret = mshv_arch_store_vcpu_state(cpu);
> > if (ret) {
> > error_report("Failed to put registers after init: %s",
> > @@ -625,7 +625,7 @@ static int mshv_cpu_exec(CPUState *cpu)
> > ret = -1;
> > break;
> > }
> > - cpu->accel->dirty = false;
> > + cpu->vcpu_dirty = false;
> > }
> > ret = mshv_run_vcpu(mshv_state->vm, cpu, &mshv_msg, &exit_reason);
> > @@ -746,7 +746,7 @@ static void do_mshv_cpu_synchronize_post_init(CPUState *cpu,
> > abort();
> > }
> > - cpu->accel->dirty = false;
> > + cpu->vcpu_dirty = false;
> > }
> > static void mshv_cpu_synchronize_post_init(CPUState *cpu)
> > @@ -763,13 +763,13 @@ static void mshv_cpu_synchronize_post_reset(CPUState *cpu)
> > cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
> > vm_stop(RUN_STATE_INTERNAL_ERROR);
> > }
> > - cpu->accel->dirty = false;
> > + cpu->vcpu_dirty = false;
> > }
> > static void do_mshv_cpu_synchronize_pre_loadvm(CPUState *cpu,
> > run_on_cpu_data arg)
> > {
> > - cpu->accel->dirty = true;
> > + cpu->vcpu_dirty = true;
> > }
> > static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
> > @@ -779,7 +779,7 @@ static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
> > static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
> > {
> > - if (!cpu->accel->dirty) {
> > + if (!cpu->vcpu_dirty) {
> > int ret = mshv_arch_load_vcpu_state(cpu);
> > if (ret < 0) {
> > error_report("Failed to load registers for vcpu %d",
> > @@ -789,13 +789,13 @@ static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
> > vm_stop(RUN_STATE_INTERNAL_ERROR);
> > }
> > - cpu->accel->dirty = true;
> > + cpu->vcpu_dirty = true;
> > }
> > }
> > static void mshv_cpu_synchronize(CPUState *cpu)
> > {
> > - if (!cpu->accel->dirty) {
> > + if (!cpu->vcpu_dirty) {
> > run_on_cpu(cpu, do_mshv_cpu_synchronize, RUN_ON_CPU_NULL);
> > }
> > }
> > diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
> > index 126ca40b481..1c433c408c8 100644
> > --- a/target/i386/mshv/mshv-cpu.c
> > +++ b/target/i386/mshv/mshv-cpu.c
> > @@ -1692,7 +1692,7 @@ static int pio_write(uint64_t port, const uint8_t *data, uintptr_t size,
> > return ret;
> > }
> > -static int handle_pio_non_str(const CPUState *cpu,
> > +static int handle_pio_non_str(CPUState *cpu,
> > hv_x64_io_port_intercept_message *info)
> > {
> > size_t len = info->access_info.access_size;
> > @@ -1748,7 +1748,7 @@ static int handle_pio_non_str(const CPUState *cpu,
> > return -1;
> > }
> > - cpu->accel->dirty = false;
> > + cpu->vcpu_dirty = false;
> > return 0;
> > }
> > @@ -1909,7 +1909,7 @@ static int handle_pio_str(CPUState *cpu, hv_x64_io_port_intercept_message *info)
> > return -1;
> > }
> > - cpu->accel->dirty = false;
> > + cpu->vcpu_dirty = false;
> > return 0;
> > }
thanks, applied and tested.
Tested-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 10/33] accel: Change gdbstub_supported_sstep_flags() -> get_gdbstub_config()
2026-06-30 22:00 ` [PATCH 10/33] accel: Change gdbstub_supported_sstep_flags() -> get_gdbstub_config() Philippe Mathieu-Daudé
@ 2026-07-02 13:50 ` Alex Bennée
2026-07-02 13:58 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 93+ messages in thread
From: Alex Bennée @ 2026-07-02 13:50 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-s390x, Peter Maydell, Paolo Bonzini, Xiaoyao Li,
Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> writes:
> In order to have accelerator return multiple gdbstub parameters,
> pass @supported_sstep_flags as argument instead of returning it.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> include/accel/accel-ops.h | 2 +-
> include/qemu/accel.h | 7 ++++---
> accel/accel-common.c | 9 +++++----
> accel/hvf/hvf-all.c | 6 +++---
> accel/kvm/kvm-all.c | 12 +++++++-----
> accel/tcg/tcg-all.c | 8 ++++----
> gdbstub/gdbstub.c | 2 +-
> 7 files changed, 25 insertions(+), 21 deletions(-)
>
> diff --git a/include/accel/accel-ops.h b/include/accel/accel-ops.h
> index f46492e3fe1..1bc359ff3e5 100644
> --- a/include/accel/accel-ops.h
> +++ b/include/accel/accel-ops.h
> @@ -37,7 +37,7 @@ struct AccelClass {
> hwaddr start_addr, hwaddr size);
>
> /* gdbstub related hooks */
> - int (*gdbstub_supported_sstep_flags)(AccelState *as);
> + void (*get_gdbstub_config)(AccelState *as, int
> *supported_sstep_flags);
Is there anything wrong with just returning a structure rather than each
individual config being passed by reference?
--8<---------------cut here---------------start------------->8---
modified include/accel/accel-ops.h
@@ -15,6 +15,11 @@ struct AccelState {
Object parent_obj;
};
+struct AccelGdbConfig {
+ int supported_sstep_flags;
+ bool can_reverse;
+};
+
struct AccelClass {
ObjectClass parent_class;
@@ -38,8 +43,7 @@ struct AccelClass {
/* gdbstub related hooks */
bool (*supports_guest_debug)(AccelState *as);
- void (*get_gdbstub_config)(AccelState *as, int *supported_sstep_flags,
- bool *can_reverse);
+ struct AccelGdbConfig (*get_gdbstub_config)(AccelState *as);
bool *allowed;
--8<---------------cut here---------------end--------------->8---
>
> bool *allowed;
> /*
> diff --git a/include/qemu/accel.h b/include/qemu/accel.h
> index d3638c7bfda..92f9c538f31 100644
> --- a/include/qemu/accel.h
> +++ b/include/qemu/accel.h
> @@ -74,11 +74,12 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp);
> void accel_cpu_common_unrealize(CPUState *cpu);
>
> /**
> - * accel_supported_gdbstub_sstep_flags:
> + * accel_get_gdbstub_config:
> + * @supported_sstep_flags: pointer to store the single step modes in
> *
> - * Returns the supported single step modes for the configured
> + * Set the supported single step modes for the configured
> * accelerator.
> */
> -int accel_supported_gdbstub_sstep_flags(void);
> +void accel_get_gdbstub_config(int *supported_sstep_flags);
>
> #endif /* QEMU_ACCEL_H */
> diff --git a/accel/accel-common.c b/accel/accel-common.c
> index 62590a7d9a6..526ab2a0cfb 100644
> --- a/accel/accel-common.c
> +++ b/accel/accel-common.c
> @@ -113,14 +113,15 @@ void accel_cpu_common_unrealize(CPUState *cpu)
> }
> }
>
> -int accel_supported_gdbstub_sstep_flags(void)
> +void accel_get_gdbstub_config(int *supported_sstep_flags)
> {
> AccelState *accel = current_accel();
> AccelClass *acc = ACCEL_GET_CLASS(accel);
> - if (acc->gdbstub_supported_sstep_flags) {
> - return acc->gdbstub_supported_sstep_flags(accel);
> + if (acc->get_gdbstub_config) {
> + acc->get_gdbstub_config(accel, supported_sstep_flags);
> + } else {
> + *supported_sstep_flags = 0;
> }
> - return 0;
> }
>
> static const TypeInfo accel_types[] = {
> diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
> index 21b9b71a6df..284ce8ebff1 100644
> --- a/accel/hvf/hvf-all.c
> +++ b/accel/hvf/hvf-all.c
> @@ -228,9 +228,9 @@ static int hvf_accel_init(AccelState *as, MachineState *ms)
> return hvf_arch_init();
> }
>
> -static int hvf_gdbstub_sstep_flags(AccelState *as)
> +static void hvf_gdbstub_config(AccelState *as, int *supported_sstep_flags)
> {
> - return SSTEP_ENABLE | SSTEP_NOIRQ;
> + *supported_sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ;
> }
>
> static void hvf_set_kernel_irqchip(Object *obj, Visitor *v,
> @@ -278,7 +278,7 @@ static void hvf_accel_class_init(ObjectClass *oc, const void *data)
> ac->name = "HVF";
> ac->init_machine = hvf_accel_init;
> ac->allowed = &hvf_allowed;
> - ac->gdbstub_supported_sstep_flags = hvf_gdbstub_sstep_flags;
> + ac->get_gdbstub_config = hvf_gdbstub_config;
> hvf_kernel_irqchip_override = false;
> hvf_kernel_irqchip = false;
> object_class_property_add(oc, "kernel-irqchip", "on|off|split",
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 6cd5f95d06e..72d6eb464db 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -4281,14 +4281,16 @@ static void kvm_accel_instance_init(Object *obj)
> }
>
> /**
> - * kvm_gdbstub_sstep_flags():
> + * kvm_gdbstub_config():
> *
> - * Returns: SSTEP_* flags that KVM supports for guest debug. The
> + * Set SSTEP_* flags that KVM supports for guest debug. The
> * support is probed during kvm_init()
> */
> -static int kvm_gdbstub_sstep_flags(AccelState *as)
> +static void kvm_gdbstub_config(AccelState *as, int *supported_sstep_flags)
> {
> - return kvm_sstep_flags;
> + KVMState *s = KVM_STATE(as);
> +
> + *supported_sstep_flags = s->gdbstub_sstep_flags;
> }
>
> static void kvm_accel_class_init(ObjectClass *oc, const void *data)
> @@ -4299,7 +4301,7 @@ static void kvm_accel_class_init(ObjectClass *oc, const void *data)
> ac->rebuild_guest = kvm_reset_vmfd;
> ac->has_memory = kvm_accel_has_memory;
> ac->allowed = &kvm_allowed;
> - ac->gdbstub_supported_sstep_flags = kvm_gdbstub_sstep_flags;
> + ac->get_gdbstub_config = kvm_gdbstub_config;
>
> object_class_property_add(oc, "kernel-irqchip", "on|off|split",
> NULL, kvm_set_kernel_irqchip,
> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index 8eb4a6b89e8..89f7e025021 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -242,7 +242,7 @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
> qatomic_set(&one_insn_per_tb, value);
> }
>
> -static int tcg_gdbstub_supported_sstep_flags(AccelState *as)
> +static void tcg_gdbstub_config(AccelState *as, int *supported_sstep_flags)
> {
> /*
> * In replay mode all events will come from the log and can't be
> @@ -251,9 +251,9 @@ static int tcg_gdbstub_supported_sstep_flags(AccelState *as)
> * them occurring every time we single step.
> */
> if (replay_mode != REPLAY_MODE_NONE) {
> - return SSTEP_ENABLE;
> + *supported_sstep_flags = SSTEP_ENABLE;
> } else {
> - return SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
> + *supported_sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
> }
> }
>
> @@ -266,7 +266,7 @@ static void tcg_accel_class_init(ObjectClass *oc, const void *data)
> ac->cpu_common_unrealize = tcg_exec_unrealizefn;
> ac->get_stats = tcg_get_stats;
> ac->allowed = &tcg_allowed;
> - ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags;
> + ac->get_gdbstub_config = tcg_gdbstub_config;
>
> object_class_property_add_str(oc, "thread",
> tcg_get_thread,
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index f54415a9db7..1e0a6638bff 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -72,7 +72,7 @@ void gdb_init_gdbserver_state(void)
> * By default try to use no IRQs and no timers while single
> * stepping so as to make single stepping like a typical ICE HW step.
> */
> - gdbserver_state.supported_sstep_flags = accel_supported_gdbstub_sstep_flags();
> + accel_get_gdbstub_config(&gdbserver_state.supported_sstep_flags);
> gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
> gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
> }
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator
2026-07-02 13:29 ` Daniel Henrique Barboza
@ 2026-07-02 13:53 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-07-02 13:53 UTC (permalink / raw)
To: Daniel Henrique Barboza, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 2/7/26 15:29, Daniel Henrique Barboza wrote:
>
>
> On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
>> Introduce the GdbBreakpointType enumerator to better follow
>> code related to GDB protocol handling.
>
> I've been thinking about using enums a lot more lately ... not only
> because it's more idiomatic but it's also a built-in guard for allowed
> values.
Here or in general?
For me the direct benefit is finding all the API uses (call,
implementation) with a single 'git grep GdbBreakpointType';
that would have been helpful 20 years ago (now we have clever
IDEs).
> Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Thanks :)
>
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
>> ---
>> gdbstub/internals.h | 7 +++++--
>> include/gdbstub/enums.h | 12 +++++++-----
>> gdbstub/system.c | 6 ++++--
>> gdbstub/user.c | 6 ++++--
>> 4 files changed, 20 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 18/33] cpu: Define BreakpointFlags type
2026-07-02 13:26 ` Daniel Henrique Barboza
@ 2026-07-02 13:57 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-07-02 13:57 UTC (permalink / raw)
To: Daniel Henrique Barboza, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, qemu-ppc, Richard Henderson
On 2/7/26 15:26, Daniel Henrique Barboza wrote:
> Hello fine sir,
>
> This patch fails to apply to master due to a riscv conflict down there:
>
> On 6/30/2026 7:00 PM, Philippe Mathieu-Daudé wrote:
>> Use the BreakpointFlags typedef to better follow when
>> we deal with breakpoint flags (BP_*).
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
>> ---
>> include/accel/tcg/cpu-ops.h | 6 ++++--
>> include/exec/breakpoint.h | 3 ++-
>> include/exec/watchpoint.h | 8 +++++---
>> include/hw/core/cpu.h | 11 ++++++-----
>> accel/tcg/cputlb.c | 12 +++++++-----
>> accel/tcg/tcg-accel-ops.c | 10 +++++-----
>> accel/tcg/user-exec-stub.c | 11 ++++++-----
>> accel/tcg/watchpoint.c | 9 +++++----
>> cpu-common.c | 8 ++++----
>> system/watchpoint.c | 8 ++++----
>> target/arm/tcg/debug.c | 4 ++--
>> target/arm/tcg/mte_helper.c | 3 ++-
>> target/ppc/cpu.c | 2 +-
>> target/ppc/kvm.c | 5 +++--
>> target/riscv/cpu_helper.c | 2 +-
>> target/riscv/debug.c | 12 +++++-------
>> target/s390x/tcg/debug.c | 3 ++-
>> target/xtensa/dbg_helper.c | 2 +-
>> 18 files changed, 65 insertions(+), 54 deletions(-)
>> @@ -992,12 +992,10 @@ bool riscv_cpu_debug_check_watchpoint(CPUState
>> *cs, CPUWatchpoint *wp)
>> CPURISCVState *env = &cpu->env;
>> target_ulong ctrl;
>> target_ulong addr;
>> - int trigger_type;
>> - int flags;
>> - int i;
>> - for (i = 0; i < RV_MAX_TRIGGERS; i++) {
>> - trigger_type = get_trigger_type(env, i);
>> + for (int i = 0; i < RV_MAX_TRIGGERS; i++) {
>> + int trigger_type = get_trigger_type(env, i);
>> + BreakpointFlags flags;
>
> Here ^ the reason is we're not using RV_MAX_TRIGGERS anymore but env-
> >num_triggers.
Yeah I am aware of this, I was waiting for the RISCV queue to be
merged but the soft-freeze date is approaching so I preferred to
post for review, and re-post just after, no other alternative when
updating a core API used by all subsystems. -- this workflow issue
has been discussed elsewhere recently --.
>
>
> Patch LGTM otherwise. For the RISC-V bits:
>
>
> Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Thanks!
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 10/33] accel: Change gdbstub_supported_sstep_flags() -> get_gdbstub_config()
2026-07-02 13:50 ` Alex Bennée
@ 2026-07-02 13:58 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-07-02 13:58 UTC (permalink / raw)
To: Alex Bennée
Cc: qemu-devel, qemu-s390x, Peter Maydell, Paolo Bonzini, Xiaoyao Li,
Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
On 2/7/26 15:50, Alex Bennée wrote:
> Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> writes:
>
>> In order to have accelerator return multiple gdbstub parameters,
>> pass @supported_sstep_flags as argument instead of returning it.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
>> ---
>> include/accel/accel-ops.h | 2 +-
>> include/qemu/accel.h | 7 ++++---
>> accel/accel-common.c | 9 +++++----
>> accel/hvf/hvf-all.c | 6 +++---
>> accel/kvm/kvm-all.c | 12 +++++++-----
>> accel/tcg/tcg-all.c | 8 ++++----
>> gdbstub/gdbstub.c | 2 +-
>> 7 files changed, 25 insertions(+), 21 deletions(-)
>>
>> diff --git a/include/accel/accel-ops.h b/include/accel/accel-ops.h
>> index f46492e3fe1..1bc359ff3e5 100644
>> --- a/include/accel/accel-ops.h
>> +++ b/include/accel/accel-ops.h
>> @@ -37,7 +37,7 @@ struct AccelClass {
>> hwaddr start_addr, hwaddr size);
>>
>> /* gdbstub related hooks */
>> - int (*gdbstub_supported_sstep_flags)(AccelState *as);
>> + void (*get_gdbstub_config)(AccelState *as, int
>> *supported_sstep_flags);
>
> Is there anything wrong with just returning a structure rather than each
> individual config being passed by reference?
Sure, will update and respin.
>
> --8<---------------cut here---------------start------------->8---
> modified include/accel/accel-ops.h
> @@ -15,6 +15,11 @@ struct AccelState {
> Object parent_obj;
> };
>
> +struct AccelGdbConfig {
> + int supported_sstep_flags;
> + bool can_reverse;
> +};
> +
> struct AccelClass {
> ObjectClass parent_class;
>
> @@ -38,8 +43,7 @@ struct AccelClass {
>
> /* gdbstub related hooks */
> bool (*supports_guest_debug)(AccelState *as);
> - void (*get_gdbstub_config)(AccelState *as, int *supported_sstep_flags,
> - bool *can_reverse);
> + struct AccelGdbConfig (*get_gdbstub_config)(AccelState *as);
>
> bool *allowed;
> --8<---------------cut here---------------end--------------->8---
>
>
>>
>> bool *allowed;
>> /*
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer)
2026-06-30 22:00 ` [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer) Philippe Mathieu-Daudé
2026-07-02 13:16 ` Daniel Henrique Barboza
@ 2026-07-02 16:08 ` Richard Henderson
2026-07-03 0:41 ` Chao Liu
2 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 16:08 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Various CPUState can share the same CPUClass parent,
> and must not update its fields. Protect the CPUClass
> by marking the CPUState pointer const.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/hw/core/cpu.h | 2 +-
> accel/tcg/cpu-exec.c | 2 +-
> accel/tcg/translate-all.c | 3 +--
> gdbstub/gdbstub.c | 2 +-
> 4 files changed, 4 insertions(+), 5 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 02/33] target/i386: Remove duplicate tlb_flush() call in cpu_post_load()
2026-06-30 22:00 ` [PATCH 02/33] target/i386: Remove duplicate tlb_flush() call in cpu_post_load() Philippe Mathieu-Daudé
@ 2026-07-02 16:27 ` Richard Henderson
2026-07-03 0:42 ` Chao Liu
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 16:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Common vCPU cpu_post_load() handler calls tlb_flush() since
> commit 9656f324d25 ("Move interrupt_request and user_mode_only
> to common cpu state..."), no need to call it twice.
While that commit is where things were moved, using the modern function name would be
helpful here in the commit message: cpu_common_post_load.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> target/i386/machine.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/target/i386/machine.c b/target/i386/machine.c
> index 1f5c517e562..df0e0c178e4 100644
> --- a/target/i386/machine.c
> +++ b/target/i386/machine.c
> @@ -401,7 +401,6 @@ static int cpu_post_load(void *opaque, int version_id)
> env->dr[7] = dr7 & ~(DR7_GLOBAL_BP_MASK | DR7_LOCAL_BP_MASK);
> cpu_x86_update_dr7(env, dr7);
> }
> - tlb_flush(cs);
> return 0;
> }
>
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG
2026-06-30 22:00 ` [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG Philippe Mathieu-Daudé
2026-07-02 13:17 ` Daniel Henrique Barboza
@ 2026-07-02 16:29 ` Richard Henderson
2026-07-03 3:13 ` Chao Liu
2 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 16:29 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Both tlb_protect() and tlb_unprotect_code() are only used
> within accel/tcg/. Avoid exposing them to the whole code base,
> declare them in a new "system-page-protection.h" local header.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> accel/tcg/system-page-protection.h | 17 +++++++++++++++++
> include/exec/cputlb.h | 8 ++------
> accel/tcg/cputlb.c | 3 ++-
> accel/tcg/tb-maint.c | 1 +
> 4 files changed, 22 insertions(+), 7 deletions(-)
> create mode 100644 accel/tcg/system-page-protection.h
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 04/33] accel/hvf: Remove left-over comment
2026-06-30 22:00 ` [PATCH 04/33] accel/hvf: Remove left-over comment Philippe Mathieu-Daudé
2026-07-02 13:36 ` Daniel Henrique Barboza
@ 2026-07-02 16:29 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 16:29 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Missed in commit 6bf331164c5 ("accel/hvf: Drop hvf_slot and
> hvf_find_overlap_slot").
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> accel/hvf/hvf-accel-ops.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
> index b74a5779c3d..dd2b45b7cb5 100644
> --- a/accel/hvf/hvf-accel-ops.c
> +++ b/accel/hvf/hvf-accel-ops.c
> @@ -62,8 +62,6 @@
>
> HVFState *hvf_state;
>
> -/* Memory slots */
> -
> static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
> {
> if (!cpu->vcpu_dirty) {
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field
2026-06-30 22:00 ` [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field Philippe Mathieu-Daudé
2026-07-02 13:00 ` Philippe Mathieu-Daudé
@ 2026-07-02 16:56 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 16:56 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> No need for accel-specific @dirty field when we have
> a generic one in CPUState. (Other accelerators already
> did that in commits 6f13a0ada01..36ab216b81d).
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/system/mshv_int.h | 1 -
> accel/mshv/mshv-all.c | 18 +++++++++---------
> target/i386/mshv/mshv-cpu.c | 6 +++---
> 3 files changed, 12 insertions(+), 13 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 08/33] accel/kvm: Always define AccelOpsClass::supports_guest_debug
2026-06-30 22:00 ` [PATCH 08/33] accel/kvm: Always define AccelOpsClass::supports_guest_debug Philippe Mathieu-Daudé
2026-07-02 13:19 ` Daniel Henrique Barboza
@ 2026-07-02 17:16 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:16 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Whether TARGET_KVM_HAVE_GUEST_DEBUG is defined or not,
> kvm_supports_guest_debug() still exists and can be called.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> accel/kvm/kvm-accel-ops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 09/33] accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG
2026-06-30 22:00 ` [PATCH 09/33] accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG Philippe Mathieu-Daudé
@ 2026-07-02 17:18 ` Richard Henderson
0 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Simplify #ifdef'ry using TARGET_KVM_HAVE_GUEST_DEBUG in kvm_init().
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> accel/kvm/kvm-all.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 5d55cb45cf7..6cd5f95d06e 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -3037,24 +3037,23 @@ static int kvm_init(AccelState *as, MachineState *ms)
> kvm_vm_attributes_allowed =
> (kvm_check_extension(s, KVM_CAP_VM_ATTRIBUTES) > 0);
>
> + kvm_sstep_flags = 0;
> +
You don't need this, since the global is zero-initialized by default.
Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> kvm_has_guest_debug =
> (kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG) > 0);
> -#endif
>
> - kvm_sstep_flags = 0;
> if (kvm_has_guest_debug) {
> kvm_sstep_flags = SSTEP_ENABLE;
>
> -#if defined TARGET_KVM_HAVE_GUEST_DEBUG
> int guest_debug_flags =
> kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG2);
>
> if (guest_debug_flags & KVM_GUESTDBG_BLOCKIRQ) {
> kvm_sstep_flags |= SSTEP_NOIRQ;
> }
> -#endif
> }
> +#endif
>
> kvm_state = s;
>
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 12/33] gdbstub: Make default replay_mode value explicit in stubs
2026-06-30 22:00 ` [PATCH 12/33] gdbstub: Make default replay_mode value explicit in stubs Philippe Mathieu-Daudé
@ 2026-07-02 17:21 ` Richard Henderson
0 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:21 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Make explicit @replay_mode is stubbed as REPLAY_MODE_NONE.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> stubs/replay-mode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/stubs/replay-mode.c b/stubs/replay-mode.c
> index 439d97e4a87..5bc8f7d6589 100644
> --- a/stubs/replay-mode.c
> +++ b/stubs/replay-mode.c
> @@ -1,4 +1,4 @@
> #include "qemu/osdep.h"
> #include "system/replay.h"
>
> -ReplayMode replay_mode;
> +ReplayMode replay_mode = REPLAY_MODE_NONE;
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 14/33] accel: Move supports_guest_debug() declaration to AccelClass
2026-06-30 22:00 ` [PATCH 14/33] accel: Move supports_guest_debug() declaration to AccelClass Philippe Mathieu-Daudé
@ 2026-07-02 17:29 ` Richard Henderson
0 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:29 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé<philmd@linaro.org>
>
> AccelOpsClass is for methods dealing with vCPUs.
> When only dealing with AccelState, AccelClass is sufficient.
>
> In order to have AccelClass methods instrospect their state,
> we need to pass AccelState by argument.
>
> Restrict kvm_supports_guest_debug() scope.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> Reviewed-by: Richard Henderson<richard.henderson@linaro.org>
> Reviewed-by: Xiaoyao Li<xiaoyao.li@intel.com>
> Reviewed-by: Zhao Liu<zhao1.liu@intel.com>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Ideally there wouldn't be two different accel callbacks to init gdbserver state. But this
is a small step in the right direction.
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 15/33] accel/kvm: Hold have_guest_supported in KVMState
2026-06-30 22:00 ` [PATCH 15/33] accel/kvm: Hold have_guest_supported in KVMState Philippe Mathieu-Daudé
2026-07-02 13:22 ` Daniel Henrique Barboza
@ 2026-07-02 17:37 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:37 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Prefer to store per-accelerator variables in the per-accelerator
> state, rather than as static variables. This is a good practice
> to allow concurrent accelerators in the future.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/system/kvm_int.h | 1 +
> accel/kvm/kvm-all.c | 8 ++++----
> 2 files changed, 5 insertions(+), 4 deletions(-)
This doesn't really preclude concurrent accelerators, since there will only ever be one
KVMState instance. But it's also not unreasonable.
That said,
> diff --git a/include/system/kvm_int.h b/include/system/kvm_int.h
> index 0876aac938d..49e90cc0235 100644
> --- a/include/system/kvm_int.h
> +++ b/include/system/kvm_int.h
> @@ -113,6 +113,7 @@ struct KVMState
> struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
> bool coalesced_flush_in_progress;
> int vcpu_events;
> + bool have_guest_supported;
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
> #endif
you could sort the members by size to avoid extra structure holes. There's a lot of them
already due to existing poor ordering.
Anyway,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 16/33] accel/kvm: Hold gdbstub_sstep_flags in KVMState
2026-06-30 22:00 ` [PATCH 16/33] accel/kvm: Hold gdbstub_sstep_flags " Philippe Mathieu-Daudé
2026-07-02 13:22 ` Daniel Henrique Barboza
@ 2026-07-02 17:42 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Prefer to store per-accelerator variables in the per-accelerator
> state, rather than as static variables. This is a good practice
> to allow concurrent accelerators in the future.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/system/kvm_int.h | 1 +
> accel/kvm/kvm-all.c | 7 +++----
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/system/kvm_int.h b/include/system/kvm_int.h
> index 49e90cc0235..062759eaa01 100644
> --- a/include/system/kvm_int.h
> +++ b/include/system/kvm_int.h
> @@ -114,6 +114,7 @@ struct KVMState
> bool coalesced_flush_in_progress;
> int vcpu_events;
> bool have_guest_supported;
> + int gdbstub_sstep_flags;
> #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
> QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
> #endif
Same comments as for patch 15.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 17/33] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h'
2026-06-30 22:00 ` [PATCH 17/33] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h' Philippe Mathieu-Daudé
2026-07-02 13:24 ` Daniel Henrique Barboza
@ 2026-07-02 17:43 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:43 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/exec/breakpoint.h | 14 ++++++++++++++
> include/hw/core/cpu.h | 14 --------------
> 2 files changed, 14 insertions(+), 14 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 18/33] cpu: Define BreakpointFlags type
2026-06-30 22:00 ` [PATCH 18/33] cpu: Define BreakpointFlags type Philippe Mathieu-Daudé
2026-07-02 13:26 ` Daniel Henrique Barboza
@ 2026-07-02 17:44 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:44 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Use the BreakpointFlags typedef to better follow when
> we deal with breakpoint flags (BP_*).
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/accel/tcg/cpu-ops.h | 6 ++++--
> include/exec/breakpoint.h | 3 ++-
> include/exec/watchpoint.h | 8 +++++---
> include/hw/core/cpu.h | 11 ++++++-----
> accel/tcg/cputlb.c | 12 +++++++-----
> accel/tcg/tcg-accel-ops.c | 10 +++++-----
> accel/tcg/user-exec-stub.c | 11 ++++++-----
> accel/tcg/watchpoint.c | 9 +++++----
> cpu-common.c | 8 ++++----
> system/watchpoint.c | 8 ++++----
> target/arm/tcg/debug.c | 4 ++--
> target/arm/tcg/mte_helper.c | 3 ++-
> target/ppc/cpu.c | 2 +-
> target/ppc/kvm.c | 5 +++--
> target/riscv/cpu_helper.c | 2 +-
> target/riscv/debug.c | 12 +++++-------
> target/s390x/tcg/debug.c | 3 ++-
> target/xtensa/dbg_helper.c | 2 +-
> 18 files changed, 65 insertions(+), 54 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 19/33] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints
2026-06-30 22:00 ` [PATCH 19/33] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
@ 2026-07-02 17:45 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:45 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> accel/tcg/tcg-accel-ops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
> index 26d34c72d9a..c54acc770e3 100644
> --- a/accel/tcg/tcg-accel-ops.c
> +++ b/accel/tcg/tcg-accel-ops.c
> @@ -188,7 +188,7 @@ static int tcg_remove_breakpoint(CPUState *cs, int type, vaddr addr, vaddr len)
> }
> }
>
> -static inline void tcg_remove_all_breakpoints(CPUState *cpu)
> +static void tcg_remove_all_breakpoints(CPUState *cpu)
> {
> cpu_breakpoint_remove_all(cpu, BP_GDB);
> cpu_watchpoint_remove_all(cpu, BP_GDB);
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 20/33] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode
2026-06-30 22:00 ` [PATCH 20/33] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
@ 2026-07-02 17:46 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:46 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> No need to deref external methods with unused argument to
> end up calling a method defined in the same unit file, call
> it directly.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> gdbstub/user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdbstub/user.c b/gdbstub/user.c
> index 299388b9f71..90d6ee49fb5 100644
> --- a/gdbstub/user.c
> +++ b/gdbstub/user.c
> @@ -557,7 +557,7 @@ static void disable_gdbstub(CPUState *thread_cpu)
> close(gdbserver_user_state.fd);
> gdbserver_user_state.fd = -1;
> CPU_FOREACH(cpu) {
> - cpu_breakpoint_remove_all(cpu, BP_GDB);
> + gdb_breakpoint_remove_all(cpu);
> /* no cpu_watchpoint_remove_all for user-mode */
> cpu_single_step(cpu, 0);
> }
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 21/33] gdbstub: Reduce @type variable scope
2026-06-30 22:00 ` [PATCH 21/33] gdbstub: Reduce @type variable scope Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
@ 2026-07-02 17:47 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:47 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> gdbstub/system.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gdbstub/system.c b/gdbstub/system.c
> index 414aef431ec..d5e09802323 100644
> --- a/gdbstub/system.c
> +++ b/gdbstub/system.c
> @@ -126,7 +126,6 @@ static void gdb_vm_state_change(void *opaque, bool running, RunState state)
> CPUState *cpu = gdbserver_state.c_cpu;
> g_autoptr(GString) buf = g_string_new(NULL);
> g_autoptr(GString) tid = g_string_new(NULL);
> - const char *type;
> int ret;
>
> if (running || gdbserver_state.state == RS_INACTIVE) {
> @@ -152,6 +151,8 @@ static void gdb_vm_state_change(void *opaque, bool running, RunState state)
> switch (state) {
> case RUN_STATE_DEBUG:
> if (cpu->watchpoint_hit) {
> + const char *type;
> +
> switch (cpu->watchpoint_hit->flags & BP_MEM_ACCESS) {
> case BP_MEM_READ:
> type = "r";
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator
2026-06-30 22:00 ` [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator Philippe Mathieu-Daudé
2026-07-02 13:29 ` Daniel Henrique Barboza
@ 2026-07-02 17:50 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:50 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Introduce the GdbBreakpointType enumerator to better follow
> code related to GDB protocol handling.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> gdbstub/internals.h | 7 +++++--
> include/gdbstub/enums.h | 12 +++++++-----
> gdbstub/system.c | 6 ++++--
> gdbstub/user.c | 6 ++++--
> 4 files changed, 20 insertions(+), 11 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 23/33] accel: Use GdbBreakpointType enum
2026-06-30 22:00 ` [PATCH 23/33] accel: Use GdbBreakpointType enum Philippe Mathieu-Daudé
2026-07-02 13:31 ` Daniel Henrique Barboza
@ 2026-07-02 17:52 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:52 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Include '_gdbstub_' in the AccelOpsClass handlers to emphasize
> we are handling gdbstub-related requests.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> accel/kvm/kvm-cpus.h | 11 ++++++++---
> include/accel/accel-cpu-ops.h | 9 ++++++---
> include/system/hvf_int.h | 9 ++++++---
> include/system/kvm.h | 9 ++++++---
> target/arm/internals.h | 5 +++--
> accel/hvf/hvf-accel-ops.c | 20 +++++++++++---------
> accel/kvm/kvm-accel-ops.c | 6 +++---
> accel/kvm/kvm-all.c | 14 ++++++++------
> accel/tcg/tcg-accel-ops.c | 17 ++++++++++-------
> gdbstub/system.c | 12 ++++++------
> target/arm/hvf/hvf.c | 12 +++++++-----
> target/arm/hyp_gdbstub.c | 8 ++++----
> target/arm/kvm.c | 12 +++++++-----
> target/i386/hvf/hvf.c | 8 +++++---
> target/i386/kvm/kvm.c | 12 +++++++-----
> target/loongarch/kvm/kvm.c | 8 +++++---
> target/ppc/kvm.c | 12 +++++++-----
> target/riscv/kvm/kvm-cpu.c | 8 +++++---
> target/s390x/kvm/kvm.c | 8 +++++---
> 19 files changed, 119 insertions(+), 81 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 24/33] target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint()
2026-06-30 22:00 ` [PATCH 24/33] target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint() Philippe Mathieu-Daudé
@ 2026-07-02 17:53 ` Richard Henderson
0 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 17:53 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> check_watchpoints() is called once, by arm_debug_check_watchpoint(),
> which doesn't do more than this call. Merge both. No logical change
> intended.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> target/arm/tcg/debug.c | 40 +++++++++++++++++-----------------------
> 1 file changed, 17 insertions(+), 23 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 25/33] target/arm: Factor arm_check_watchpoint_hit() out
2026-06-30 22:00 ` [PATCH 25/33] target/arm: Factor arm_check_watchpoint_hit() out Philippe Mathieu-Daudé
@ 2026-07-02 18:02 ` Richard Henderson
0 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 18:02 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Factor arm_check_watchpoint_hit() out of arm_debug_excp_handler().
> No logical change intended.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> target/arm/tcg/debug.c | 37 ++++++++++++++++++++++---------------
> 1 file changed, 22 insertions(+), 15 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Note for future work: I really dislike having these separate "check breakpoint" and "check
watchpoint" hooks, then having one single "do debug exception" that then has to work out
what happened. And clear the "watchpoint_hit" state.
Ideally we'd reorganize this to "raise watchpoint" and "raise breakpoint" hooks, which are
given the CPU{Break,Watch}point structure in progress.
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 28/33] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers
2026-06-30 22:00 ` [PATCH 28/33] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers Philippe Mathieu-Daudé
2026-07-02 13:34 ` Daniel Henrique Barboza
@ 2026-07-02 18:04 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 18:04 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Commit d5ee641cfc5 ("target/ppc: Implement watchpoint debug facility
> for v2.07S") also implemented TCGCPUOps::debug_check_watchpoint for
> PPC: make the comment generic.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> include/accel/tcg/cpu-ops.h | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
> index f64d94b2b50..568d82cdd32 100644
> --- a/include/accel/tcg/cpu-ops.h
> +++ b/include/accel/tcg/cpu-ops.h
> @@ -250,14 +250,13 @@ struct TCGCPUOps {
> int mmu_idx, uintptr_t retaddr);
>
> /**
> - * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
> + * @adjust_watchpoint_address: hack for cpu_check_watchpoint (used by ARM)
> */
> vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
>
> /**
> * @debug_check_watchpoint: return true if the architectural
> - * watchpoint whose address has matched should really fire, used by ARM
> - * and RISC-V
> + * watchpoint whose address has matched should really fire.
> */
> bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 26/33] target/xtensa: Move watchpoints handling to check_hw_watchpoints()
2026-06-30 22:00 ` [PATCH 26/33] target/xtensa: Move watchpoints handling to check_hw_watchpoints() Philippe Mathieu-Daudé
@ 2026-07-02 18:06 ` Richard Henderson
0 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 18:06 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Rewrite check_hw_watchpoints() by moving related code from
> xtensa_breakpoint_handler() to it. No logical change intended.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> target/xtensa/helper.c | 36 +++++++++++++++++++-----------------
> 1 file changed, 19 insertions(+), 17 deletions(-)
Eh. I gave you an r-b plus future work for the previous, but if we're going to start
adjuting all of the backends, let's do it right.
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 29/33] cpu: Move CPUWatchpoint definition to 'exec/watchpoint.h'
2026-06-30 22:00 ` [PATCH 29/33] cpu: Move CPUWatchpoint definition to 'exec/watchpoint.h' Philippe Mathieu-Daudé
@ 2026-07-02 18:06 ` Richard Henderson
0 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 18:06 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Define CPUWatchpoint in "exec/watchpoint.h", including this
> header where appropriate.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/accel/tcg/cpu-ops.h | 1 +
> include/exec/breakpoint.h | 9 ---------
> include/exec/watchpoint.h | 12 ++++++++++++
> target/arm/internals.h | 1 +
> gdbstub/system.c | 1 +
> target/arm/hyp_gdbstub.c | 1 +
> target/i386/kvm/kvm.c | 1 +
> target/ppc/kvm.c | 1 +
> target/s390x/kvm/kvm.c | 1 +
> 9 files changed, 19 insertions(+), 9 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 31/33] cpu: Introduce cpu_single_stepping() helper
2026-06-30 22:00 ` [PATCH 31/33] cpu: Introduce cpu_single_stepping() helper Philippe Mathieu-Daudé
@ 2026-07-02 18:11 ` Richard Henderson
0 siblings, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 18:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> Access CPUState::@singlestep_enabled field with a helper.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> include/hw/core/cpu.h | 11 +++++++++++
> accel/kvm/kvm-all.c | 2 +-
> accel/tcg/cpu-exec-common.c | 2 +-
> accel/tcg/cpu-exec.c | 8 ++++----
> linux-user/riscv/cpu_loop.c | 2 +-
> linux-user/s390x/cpu_loop.c | 2 +-
> system/cpus.c | 2 +-
> target/arm/hvf/hvf.c | 8 ++++----
> target/arm/kvm.c | 2 +-
> target/i386/kvm/kvm.c | 2 +-
> target/i386/whpx/whpx-all.c | 6 +++---
> target/loongarch/kvm/kvm.c | 2 +-
> target/microblaze/translate.c | 2 +-
> target/ppc/kvm.c | 2 +-
> target/s390x/kvm/kvm.c | 2 +-
> 15 files changed, 33 insertions(+), 22 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags
2026-06-30 22:00 ` [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags Philippe Mathieu-Daudé
@ 2026-07-02 18:11 ` Richard Henderson
2026-07-03 1:27 ` Xiaoyao Li
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 18:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:00, Philippe Mathieu-Daudé wrote:
> CPUState::singlestep_enabled contains multiple flags since
> commit 60897d369f1 ("Debugger single step without interrupts").
> Rename to avoid mistakes.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/hw/core/cpu.h | 8 ++++----
> accel/kvm/kvm-all.c | 2 +-
> accel/tcg/cpu-exec.c | 2 +-
> accel/tcg/tcg-accel-ops-rr.c | 2 +-
> cpu-target.c | 8 ++++----
> target/arm/hvf/hvf.c | 2 +-
> target/ppc/translate.c | 16 ++++++++--------
> 7 files changed, 20 insertions(+), 20 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 33/33] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping()
2026-06-30 22:01 ` [PATCH 33/33] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping() Philippe Mathieu-Daudé
2026-07-02 13:36 ` Daniel Henrique Barboza
@ 2026-07-02 18:11 ` Richard Henderson
1 sibling, 0 replies; 93+ messages in thread
From: Richard Henderson @ 2026-07-02 18:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Xiaoyao Li, Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc
On 6/30/26 15:01, Philippe Mathieu-Daudé wrote:
> Only the SSTEP_ENABLE bitmask means single-step is enabled.
>
> Fixes: 60897d369f1 ("Debugger single step without interrupts")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> include/hw/core/cpu.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 27ee0e54327..d092ab8aa5b 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -1146,7 +1146,7 @@ void cpu_single_step(CPUState *cpu, int flags);
> */
> static inline bool cpu_single_stepping(const CPUState *cpu)
> {
> - return cpu->singlestep_flags;
> + return cpu->singlestep_flags & SSTEP_ENABLE;
> }
>
> int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer)
2026-06-30 22:00 ` [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer) Philippe Mathieu-Daudé
2026-07-02 13:16 ` Daniel Henrique Barboza
2026-07-02 16:08 ` Richard Henderson
@ 2026-07-03 0:41 ` Chao Liu
2 siblings, 0 replies; 93+ messages in thread
From: Chao Liu @ 2026-07-03 0:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-s390x, Peter Maydell, Alex Bennée,
Paolo Bonzini, Xiaoyao Li, Zhao Liu, Daniel Henrique Barboza,
qemu-ppc, Richard Henderson
On Wed, Jul 01, 2026 at 12:00:28AM +0800, Philippe Mathieu-Daudé wrote:
> Various CPUState can share the same CPUClass parent,
> and must not update its fields. Protect the CPUClass
> by marking the CPUState pointer const.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Thanks,
Chao
> ---
> include/hw/core/cpu.h | 2 +-
> accel/tcg/cpu-exec.c | 2 +-
> accel/tcg/translate-all.c | 3 +--
> gdbstub/gdbstub.c | 2 +-
> 4 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 59d601465b4..60a23d6f38b 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -480,7 +480,7 @@ struct CPUState {
> /*< private >*/
> DeviceState parent_obj;
> /* cache to avoid expensive CPU_GET_CLASS */
> - CPUClass *cc;
> + const CPUClass *cc;
> /*< public >*/
>
> int nr_threads;
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 9c754b03656..d7f91dce9db 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -460,7 +460,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
> * counter hit zero); we must restore the guest PC to the address
> * of the start of the TB.
> */
> - CPUClass *cc = cpu->cc;
> + const CPUClass *cc = cpu->cc;
> const TCGCPUOps *tcg_ops = cc->tcg_ops;
>
> if (tcg_ops->synchronize_from_tb) {
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 3f1a3a28438..328d96aba30 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -575,7 +575,7 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr)
> void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
> {
> TranslationBlock *tb;
> - CPUClass *cc;
> + const CPUClass *cc = cpu->cc;
> uint32_t n;
>
> tb = tcg_tb_lookup(retaddr);
> @@ -591,7 +591,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
> * to account for the re-execution of the branch.
> */
> n = 1;
> - cc = cpu->cc;
> if (cc->tcg_ops->io_recompile_replay_branch &&
> cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) {
> cpu->neg.icount_decr.u16.low++;
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index c3c944e965b..26366acb674 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -578,7 +578,7 @@ static void gdb_register_feature(CPUState *cpu, int base_reg,
>
> static const char *gdb_get_core_xml_file(CPUState *cpu)
> {
> - CPUClass *cc = cpu->cc;
> + const CPUClass *cc = cpu->cc;
>
> /*
> * The CPU class can provide the XML filename via a method,
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 02/33] target/i386: Remove duplicate tlb_flush() call in cpu_post_load()
2026-06-30 22:00 ` [PATCH 02/33] target/i386: Remove duplicate tlb_flush() call in cpu_post_load() Philippe Mathieu-Daudé
2026-07-02 16:27 ` Richard Henderson
@ 2026-07-03 0:42 ` Chao Liu
1 sibling, 0 replies; 93+ messages in thread
From: Chao Liu @ 2026-07-03 0:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-s390x, Peter Maydell, Alex Bennée,
Paolo Bonzini, Xiaoyao Li, Zhao Liu, Daniel Henrique Barboza,
qemu-ppc, Richard Henderson
On Wed, Jul 01, 2026 at 12:00:29AM +0800, Philippe Mathieu-Daudé wrote:
> Common vCPU cpu_post_load() handler calls tlb_flush() since
> commit 9656f324d25 ("Move interrupt_request and user_mode_only
> to common cpu state..."), no need to call it twice.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
> ---
> target/i386/machine.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/target/i386/machine.c b/target/i386/machine.c
> index 1f5c517e562..df0e0c178e4 100644
> --- a/target/i386/machine.c
> +++ b/target/i386/machine.c
> @@ -401,7 +401,6 @@ static int cpu_post_load(void *opaque, int version_id)
> env->dr[7] = dr7 & ~(DR7_GLOBAL_BP_MASK | DR7_LOCAL_BP_MASK);
> cpu_x86_update_dr7(env, dr7);
> }
> - tlb_flush(cs);
> return 0;
> }
>
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags
2026-06-30 22:00 ` [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags Philippe Mathieu-Daudé
2026-07-02 18:11 ` Richard Henderson
@ 2026-07-03 1:27 ` Xiaoyao Li
2026-07-03 1:50 ` Philippe Mathieu-Daudé
1 sibling, 1 reply; 93+ messages in thread
From: Xiaoyao Li @ 2026-07-03 1:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
On 7/1/2026 6:00 AM, Philippe Mathieu-Daudé wrote:
> CPUState::singlestep_enabled contains multiple flags since
> commit 60897d369f1 ("Debugger single step without interrupts").
> Rename to avoid mistakes.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
> include/hw/core/cpu.h | 8 ++++----
> accel/kvm/kvm-all.c | 2 +-
> accel/tcg/cpu-exec.c | 2 +-
> accel/tcg/tcg-accel-ops-rr.c | 2 +-
> cpu-target.c | 8 ++++----
> target/arm/hvf/hvf.c | 2 +-
> target/ppc/translate.c | 16 ++++++++--------
> 7 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 37ac218bda3..27ee0e54327 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -440,7 +440,7 @@ struct qemu_work_item;
> * @stopped: Indicates the CPU has been artificially stopped.
> * @unplug: Indicates a pending CPU unplug request.
> * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU
> - * @singlestep_enabled: Flags for single-stepping.
> + * @singlestep_flags: Flags for single-stepping.
> * @icount_extra: Instructions until next timer event.
> * @cpu_ases: Pointer to array of CPUAddressSpaces (which define the
> * AddressSpaces this CPU has)
> @@ -505,7 +505,7 @@ struct CPUState {
> int exclusive_context_count;
> uint32_t cflags_next_tb;
> uint32_t interrupt_request;
> - int singlestep_enabled;
> + int singlestep_flags;
can we also change the type to uint32_t?
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags
2026-07-03 1:27 ` Xiaoyao Li
@ 2026-07-03 1:50 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 93+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-07-03 1:50 UTC (permalink / raw)
To: Xiaoyao Li, qemu-devel
Cc: qemu-s390x, Peter Maydell, Alex Bennée, Paolo Bonzini,
Chao Liu, Zhao Liu, Daniel Henrique Barboza, qemu-ppc,
Richard Henderson
On 3/7/26 03:27, Xiaoyao Li wrote:
> On 7/1/2026 6:00 AM, Philippe Mathieu-Daudé wrote:
>> CPUState::singlestep_enabled contains multiple flags since
>> commit 60897d369f1 ("Debugger single step without interrupts").
>> Rename to avoid mistakes.
>>
>> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
>> ---
>> include/hw/core/cpu.h | 8 ++++----
>> accel/kvm/kvm-all.c | 2 +-
>> accel/tcg/cpu-exec.c | 2 +-
>> accel/tcg/tcg-accel-ops-rr.c | 2 +-
>> cpu-target.c | 8 ++++----
>> target/arm/hvf/hvf.c | 2 +-
>> target/ppc/translate.c | 16 ++++++++--------
>> 7 files changed, 20 insertions(+), 20 deletions(-)
>> @@ -505,7 +505,7 @@ struct CPUState {
>> int exclusive_context_count;
>> uint32_t cflags_next_tb;
>> uint32_t interrupt_request;
>> - int singlestep_enabled;
>> + int singlestep_flags;
>
> can we also change the type to uint32_t?
Good suggestion, sure.
^ permalink raw reply [flat|nested] 93+ messages in thread
* Re: [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG
2026-06-30 22:00 ` [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG Philippe Mathieu-Daudé
2026-07-02 13:17 ` Daniel Henrique Barboza
2026-07-02 16:29 ` Richard Henderson
@ 2026-07-03 3:13 ` Chao Liu
2 siblings, 0 replies; 93+ messages in thread
From: Chao Liu @ 2026-07-03 3:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-s390x, Peter Maydell, Alex Bennée,
Paolo Bonzini, Xiaoyao Li, Zhao Liu, Daniel Henrique Barboza,
qemu-ppc, Richard Henderson
On Wed, Jul 01, 2026 at 12:00:30AM +0800, Philippe Mathieu-Daudé wrote:
> Both tlb_protect() and tlb_unprotect_code() are only used
> within accel/tcg/. Avoid exposing them to the whole code base,
> declare them in a new "system-page-protection.h" local header.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
> ---
> accel/tcg/system-page-protection.h | 17 +++++++++++++++++
> include/exec/cputlb.h | 8 ++------
> accel/tcg/cputlb.c | 3 ++-
> accel/tcg/tb-maint.c | 1 +
> 4 files changed, 22 insertions(+), 7 deletions(-)
> create mode 100644 accel/tcg/system-page-protection.h
>
> diff --git a/accel/tcg/system-page-protection.h b/accel/tcg/system-page-protection.h
> new file mode 100644
> index 00000000000..52896c6d24a
> --- /dev/null
> +++ b/accel/tcg/system-page-protection.h
> @@ -0,0 +1,17 @@
> +/*
> + * QEMU page protection (system emulation)
> + *
> + * Copyright (c) 2003 Fabrice Bellard
> + *
> + * SPDX-License-Identifier: LGPL-2.1-or-later
> + */
> +#ifndef SYSTEM_PAGE_PROTECTION_H
> +#define SYSTEM_PAGE_PROTECTION_H
> +
> +#include "system/ram_addr.h"
> +
> +void tlb_protect_code(ram_addr_t ram_addr);
> +void tlb_unprotect_code(ram_addr_t ram_addr);
> +
> +#endif
> +
> diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h
> index 3a9603a6965..f7f7020382d 100644
> --- a/include/exec/cputlb.h
> +++ b/include/exec/cputlb.h
> @@ -24,14 +24,10 @@
> #include "exec/hwaddr.h"
> #include "exec/memattrs.h"
> #include "exec/vaddr.h"
> -#include "system/ram_addr.h"
> -
> -#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
> -void tlb_protect_code(ram_addr_t ram_addr);
> -void tlb_unprotect_code(ram_addr_t ram_addr);
> -#endif
>
> #ifndef CONFIG_USER_ONLY
> +#include "system/ram_addr.h"
> +
> void tlb_reset_dirty(CPUState *cpu, uintptr_t start, uintptr_t length);
> void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
> #endif
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index 6e66f3c6e93..7f7c208ba12 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -1,5 +1,5 @@
> /*
> - * Common CPU TLB handling
> + * Common CPU TLB handling (system emulation)
> *
> * Copyright (c) 2003 Fabrice Bellard
> *
> @@ -47,6 +47,7 @@
> #include "tb-hash.h"
> #include "tlb-bounds.h"
> #include "internal-common.h"
> +#include "system-page-protection.h"
> #ifdef CONFIG_PLUGIN
> #include "qemu/plugin-memory.h"
> #endif
> diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c
> index c33dbf65e7f..4313864d2c5 100644
> --- a/accel/tcg/tb-maint.c
> +++ b/accel/tcg/tb-maint.c
> @@ -38,6 +38,7 @@
> #include "user/page-protection.h"
> #define runstate_is_running() true
> #else
> +#include "system-page-protection.h"
> #include "system/runstate.h"
> #endif
> #include "trace.h"
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 93+ messages in thread
end of thread, other threads:[~2026-07-03 3:14 UTC | newest]
Thread overview: 93+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 22:00 [PATCH 00/33] accel: Unassorted cleanups around debugging Philippe Mathieu-Daudé
2026-06-30 22:00 ` [PATCH 01/33] cpu: Constify CPUState::cc (cached CPUClass pointer) Philippe Mathieu-Daudé
2026-07-02 13:16 ` Daniel Henrique Barboza
2026-07-02 16:08 ` Richard Henderson
2026-07-03 0:41 ` Chao Liu
2026-06-30 22:00 ` [PATCH 02/33] target/i386: Remove duplicate tlb_flush() call in cpu_post_load() Philippe Mathieu-Daudé
2026-07-02 16:27 ` Richard Henderson
2026-07-03 0:42 ` Chao Liu
2026-06-30 22:00 ` [PATCH 03/33] accel/tcg: Restrict tlb_protect/unprotect_code() to TCG Philippe Mathieu-Daudé
2026-07-02 13:17 ` Daniel Henrique Barboza
2026-07-02 16:29 ` Richard Henderson
2026-07-03 3:13 ` Chao Liu
2026-06-30 22:00 ` [PATCH 04/33] accel/hvf: Remove left-over comment Philippe Mathieu-Daudé
2026-07-02 13:36 ` Daniel Henrique Barboza
2026-07-02 16:29 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 05/33] accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field Philippe Mathieu-Daudé
2026-07-02 13:00 ` Philippe Mathieu-Daudé
2026-07-02 13:41 ` Magnus Kulke
2026-07-02 16:56 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 06/33] gdbstub: Add trace event for STEP packet handler Philippe Mathieu-Daudé
2026-07-02 13:18 ` Daniel Henrique Barboza
2026-07-02 13:25 ` Alex Bennée
2026-06-30 22:00 ` [PATCH 07/33] gdbstub: Only return E22 when reverse GDB is not supported Philippe Mathieu-Daudé
2026-07-02 13:18 ` Daniel Henrique Barboza
2026-07-02 13:26 ` Alex Bennée
2026-06-30 22:00 ` [PATCH 08/33] accel/kvm: Always define AccelOpsClass::supports_guest_debug Philippe Mathieu-Daudé
2026-07-02 13:19 ` Daniel Henrique Barboza
2026-07-02 17:16 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 09/33] accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG Philippe Mathieu-Daudé
2026-07-02 17:18 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 10/33] accel: Change gdbstub_supported_sstep_flags() -> get_gdbstub_config() Philippe Mathieu-Daudé
2026-07-02 13:50 ` Alex Bennée
2026-07-02 13:58 ` Philippe Mathieu-Daudé
2026-06-30 22:00 ` [PATCH 11/33] gdbstub: Store @can_reverse in GDBState Philippe Mathieu-Daudé
2026-07-02 13:20 ` Daniel Henrique Barboza
2026-06-30 22:00 ` [PATCH 12/33] gdbstub: Make default replay_mode value explicit in stubs Philippe Mathieu-Daudé
2026-07-02 17:21 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 13/33] accel: Have get_gdbstub_config() return @can_reverse value Philippe Mathieu-Daudé
2026-06-30 22:00 ` [PATCH 14/33] accel: Move supports_guest_debug() declaration to AccelClass Philippe Mathieu-Daudé
2026-07-02 17:29 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 15/33] accel/kvm: Hold have_guest_supported in KVMState Philippe Mathieu-Daudé
2026-07-02 13:22 ` Daniel Henrique Barboza
2026-07-02 17:37 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 16/33] accel/kvm: Hold gdbstub_sstep_flags " Philippe Mathieu-Daudé
2026-07-02 13:22 ` Daniel Henrique Barboza
2026-07-02 17:42 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 17/33] cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h' Philippe Mathieu-Daudé
2026-07-02 13:24 ` Daniel Henrique Barboza
2026-07-02 17:43 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 18/33] cpu: Define BreakpointFlags type Philippe Mathieu-Daudé
2026-07-02 13:26 ` Daniel Henrique Barboza
2026-07-02 13:57 ` Philippe Mathieu-Daudé
2026-07-02 17:44 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 19/33] accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:45 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 20/33] gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:46 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 21/33] gdbstub: Reduce @type variable scope Philippe Mathieu-Daudé
2026-07-02 13:27 ` Daniel Henrique Barboza
2026-07-02 17:47 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 22/33] gdbstub: Introduce GdbBreakpointType enumerator Philippe Mathieu-Daudé
2026-07-02 13:29 ` Daniel Henrique Barboza
2026-07-02 13:53 ` Philippe Mathieu-Daudé
2026-07-02 17:50 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 23/33] accel: Use GdbBreakpointType enum Philippe Mathieu-Daudé
2026-07-02 13:31 ` Daniel Henrique Barboza
2026-07-02 17:52 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 24/33] target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint() Philippe Mathieu-Daudé
2026-07-02 17:53 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 25/33] target/arm: Factor arm_check_watchpoint_hit() out Philippe Mathieu-Daudé
2026-07-02 18:02 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 26/33] target/xtensa: Move watchpoints handling to check_hw_watchpoints() Philippe Mathieu-Daudé
2026-07-02 18:06 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 27/33] target/ppc: Ensure TCG is used in ppc_update_daw() Philippe Mathieu-Daudé
2026-07-02 13:34 ` Daniel Henrique Barboza
2026-06-30 22:00 ` [PATCH 28/33] accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers Philippe Mathieu-Daudé
2026-07-02 13:34 ` Daniel Henrique Barboza
2026-07-02 18:04 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 29/33] cpu: Move CPUWatchpoint definition to 'exec/watchpoint.h' Philippe Mathieu-Daudé
2026-07-02 18:06 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 30/33] cpu: Better name cpu_single_step() trace event Philippe Mathieu-Daudé
2026-07-02 13:35 ` Daniel Henrique Barboza
2026-06-30 22:00 ` [PATCH 31/33] cpu: Introduce cpu_single_stepping() helper Philippe Mathieu-Daudé
2026-07-02 18:11 ` Richard Henderson
2026-06-30 22:00 ` [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags Philippe Mathieu-Daudé
2026-07-02 18:11 ` Richard Henderson
2026-07-03 1:27 ` Xiaoyao Li
2026-07-03 1:50 ` Philippe Mathieu-Daudé
2026-06-30 22:01 ` [PATCH 33/33] cpu: Only check SSTEP_ENABLE flag in cpu_single_stepping() Philippe Mathieu-Daudé
2026-07-02 13:36 ` Daniel Henrique Barboza
2026-07-02 18:11 ` Richard Henderson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.