From: Jan Kiszka <[email protected]>

Corresponding support for qemu-kvm.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index ad58d87..d1e1dfc 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1019,6 +1019,7 @@ void kvm_arch_load_regs(CPUState *env, int level)
     }
 
     kvm_put_vcpu_events(env, level);
+    kvm_put_debugregs(env);
 
     /* must be last */
     kvm_guest_debug_workarounds(env);
@@ -1192,6 +1193,7 @@ void kvm_arch_save_regs(CPUState *env)
     kvm_arch_save_mpstate(env);
     kvm_save_lapic(env);
     kvm_get_vcpu_events(env);
+    kvm_get_debugregs(env);
 }
 
 static void do_cpuid_ent(struct kvm_cpuid_entry2 *e, uint32_t function,
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 2233a37..7772434 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -2114,6 +2114,11 @@ static int kvm_create_context(void)
     kvm_state->vcpu_events = kvm_check_extension(kvm_state, 
KVM_CAP_VCPU_EVENTS);
 #endif
 
+    kvm_state->debugregs = 0;
+#ifdef KVM_CAP_DEBUGREGS
+    kvm_state->debugregs = kvm_check_extension(kvm_state, KVM_CAP_DEBUGREGS);
+#endif
+
     kvm_init_ap();
     if (kvm_irqchip) {
         if (!qemu_kvm_has_gsi_routing()) {
diff --git a/qemu-kvm.h b/qemu-kvm.h
index f5db9e6..0cbc6f7 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -970,6 +970,7 @@ struct KVMState {
     int migration_log;
     int vcpu_events;
     int robust_singlestep;
+    int debugregs;
 #ifdef KVM_CAP_SET_GUEST_DEBUG
     QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
 #endif
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 2316d8f..eaac9a6 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -884,7 +884,6 @@ static int kvm_guest_debug_workarounds(CPUState *env)
     return ret;
 }
 
-#ifdef KVM_UPSTREAM
 static int kvm_put_debugregs(CPUState *env)
 {
 #ifdef KVM_CAP_DEBUGREGS
@@ -932,6 +931,7 @@ static int kvm_get_debugregs(CPUState *env)
     return 0;
 }
 
+#ifdef KVM_UPSTREAM
 int kvm_arch_put_registers(CPUState *env, int level)
 {
     int ret;
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to