On 7/16/26 05:35, Daniel Henrique Barboza wrote:
From: Nicholas Piggin <[email protected]>

itrigger_enabled is relevant to the !icount_enabled() path, the test in
debug_post_load() is inverted.

While we're at it, move debug CPU post_load details into debug.c since
there's no need for machine.c to know internals of how debug.c maintains
debug state.

Fixes: 577f028694 ("target/riscv: Add itrigger_enabled field to CPURISCVState")
Signed-off-by: Nicholas Piggin <[email protected]>
Reviewed-by: Daniel Henrique Barboza <[email protected]>
---
  target/riscv/machine.c   | 13 ++++++++-----
  target/riscv/tcg/debug.c |  9 ++++++++-
  target/riscv/tcg/debug.h |  2 +-
  3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/target/riscv/machine.c b/target/riscv/machine.c
index 0ab613a298..82d2e11eb3 100644
--- a/target/riscv/machine.c
+++ b/target/riscv/machine.c
@@ -228,18 +228,21 @@ static bool debug_needed(void *opaque)
  {
      RISCVCPU *cpu = opaque;
- return cpu->cfg.debug;
+    if (kvm_enabled()) {
+        return false;
+    }
+
+    return tcg_enabled() && cpu->cfg.debug;
  }

kvm_enabled is redundant with tcg_enabled here -- only one will be true.

r~

Reply via email to