All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Xiaoyao Li" <xiaoyao.li@intel.com>,
	"Chao Liu" <chao.liu.zevorn@gmail.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Daniel Henrique Barboza" <daniel.barboza@oss.qualcomm.com>,
	qemu-ppc@nongnu.org,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags
Date: Wed,  1 Jul 2026 00:00:59 +0200	[thread overview]
Message-ID: <20260630220100.1289-33-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260630220100.1289-1-philmd@oss.qualcomm.com>

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



  parent reply	other threads:[~2026-06-30 22:08 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Philippe Mathieu-Daudé [this message]
2026-07-02 18:11   ` [PATCH 32/33] cpu: Rename CPUState @singlestep_enabled -> @singlestep_flags 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260630220100.1289-33-philmd@oss.qualcomm.com \
    --to=philmd@oss.qualcomm.com \
    --cc=alex.bennee@linaro.org \
    --cc=chao.liu.zevorn@gmail.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=xiaoyao.li@intel.com \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.