|
@@ -6040,11 +6040,27 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
|
|
|
set_debugreg(vcpu->arch.eff_db[1], 1);
|
|
|
set_debugreg(vcpu->arch.eff_db[2], 2);
|
|
|
set_debugreg(vcpu->arch.eff_db[3], 3);
|
|
|
+ set_debugreg(vcpu->arch.dr6, 6);
|
|
|
}
|
|
|
|
|
|
trace_kvm_entry(vcpu->vcpu_id);
|
|
|
kvm_x86_ops->run(vcpu);
|
|
|
|
|
|
+ /*
|
|
|
+ * Do this here before restoring debug registers on the host. And
|
|
|
+ * since we do this before handling the vmexit, a DR access vmexit
|
|
|
+ * can (a) read the correct value of the debug registers, (b) set
|
|
|
+ * KVM_DEBUGREG_WONT_EXIT again.
|
|
|
+ */
|
|
|
+ if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)) {
|
|
|
+ int i;
|
|
|
+
|
|
|
+ WARN_ON(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
|
|
|
+ kvm_x86_ops->sync_dirty_debug_regs(vcpu);
|
|
|
+ for (i = 0; i < KVM_NR_DB_REGS; i++)
|
|
|
+ vcpu->arch.eff_db[i] = vcpu->arch.db[i];
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* If the guest has used debug registers, at least dr7
|
|
|
* will be disabled while returning to the host.
|