Mads Ynddal <mads@xxxxxxxxx> writes: > From: Mads Ynddal <m.ynddal@xxxxxxxxxxx> > > Continuing the refactor of a48e7d9e52 (gdbstub: move guest debug support > check to ops) by removing hardcoded kvm_enabled() from generic cpu.c > code, and replace it with a property of AccelOpsClass. > > Signed-off-by: Mads Ynddal <m.ynddal@xxxxxxxxxxx> Nice. Looks good to me but I'll have a proper look when I go through my gdbstub/next queue. I don't think this is critical for 7.2. > --- > accel/kvm/kvm-accel-ops.c | 1 + > cpu.c | 10 +++++++--- > include/sysemu/accel-ops.h | 1 + > 3 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c > index fbf4fe3497..6ebf9a644f 100644 > --- a/accel/kvm/kvm-accel-ops.c > +++ b/accel/kvm/kvm-accel-ops.c > @@ -99,6 +99,7 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, void *data) > ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm; > > #ifdef KVM_CAP_SET_GUEST_DEBUG > + ops->update_guest_debug = kvm_update_guest_debug; > ops->supports_guest_debug = kvm_supports_guest_debug; > ops->insert_breakpoint = kvm_insert_breakpoint; > ops->remove_breakpoint = kvm_remove_breakpoint; > diff --git a/cpu.c b/cpu.c > index 2a09b05205..ef433a79e3 100644 > --- a/cpu.c > +++ b/cpu.c > @@ -31,8 +31,8 @@ > #include "hw/core/sysemu-cpu-ops.h" > #include "exec/address-spaces.h" > #endif > +#include "sysemu/cpus.h" > #include "sysemu/tcg.h" > -#include "sysemu/kvm.h" > #include "sysemu/replay.h" > #include "exec/cpu-common.h" > #include "exec/exec-all.h" > @@ -378,10 +378,14 @@ void cpu_breakpoint_remove_all(CPUState *cpu, int mask) > void cpu_single_step(CPUState *cpu, int enabled) > { > if (cpu->singlestep_enabled != enabled) { > + const AccelOpsClass *ops = cpus_get_accel(); > + > cpu->singlestep_enabled = enabled; > - if (kvm_enabled()) { > - kvm_update_guest_debug(cpu, 0); > + > + if (ops->update_guest_debug) { > + ops->update_guest_debug(cpu, 0); > } > + > trace_breakpoint_singlestep(cpu->cpu_index, enabled); > } > } > diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h > index 8cc7996def..0a47a2f00c 100644 > --- a/include/sysemu/accel-ops.h > +++ b/include/sysemu/accel-ops.h > @@ -48,6 +48,7 @@ struct AccelOpsClass { > > /* gdbstub hooks */ > bool (*supports_guest_debug)(void); > + int (*update_guest_debug)(CPUState *cpu, unsigned long flags); > int (*insert_breakpoint)(CPUState *cpu, int type, hwaddr addr, hwaddr len); > int (*remove_breakpoint)(CPUState *cpu, int type, hwaddr addr, hwaddr len); > void (*remove_all_breakpoints)(CPUState *cpu); -- Alex Bennée