diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2012-09-20 23:42:55 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-09-23 09:00:07 -0400 |
commit | c863901075a42d50678616d8ee4b96ef13080498 (patch) | |
tree | 947ffa1bd109f15b9cb483c8257fb028d0ed7df3 /arch/x86/kvm/vmx.c | |
parent | 7a84428af7ca6a847f058c9ff244a18a2664fd1b (diff) |
KVM: x86: Fix guest debug across vcpu INIT reset
If we reset a vcpu on INIT, we so far overwrote dr7 as provided by
KVM_SET_GUEST_DEBUG, and we also cleared switch_db_regs unconditionally.
Fix this by saving the dr7 used for guest debugging and calculating the
effective register value as well as switch_db_regs on any potential
change. This will change to focus of the set_guest_debug vendor op to
update_dp_bp_intercept.
Found while trying to stop on start_secondary.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 30bcb953afee..5d46c905e06f 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2288,16 +2288,6 @@ static void vmx_cache_reg(struct kvm_vcpu *vcpu, enum kvm_reg reg) | |||
2288 | } | 2288 | } |
2289 | } | 2289 | } |
2290 | 2290 | ||
2291 | static void set_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) | ||
2292 | { | ||
2293 | if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) | ||
2294 | vmcs_writel(GUEST_DR7, dbg->arch.debugreg[7]); | ||
2295 | else | ||
2296 | vmcs_writel(GUEST_DR7, vcpu->arch.dr7); | ||
2297 | |||
2298 | update_exception_bitmap(vcpu); | ||
2299 | } | ||
2300 | |||
2301 | static __init int cpu_has_kvm_support(void) | 2291 | static __init int cpu_has_kvm_support(void) |
2302 | { | 2292 | { |
2303 | return cpu_has_vmx(); | 2293 | return cpu_has_vmx(); |
@@ -3960,8 +3950,6 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
3960 | kvm_rip_write(vcpu, 0); | 3950 | kvm_rip_write(vcpu, 0); |
3961 | kvm_register_write(vcpu, VCPU_REGS_RSP, 0); | 3951 | kvm_register_write(vcpu, VCPU_REGS_RSP, 0); |
3962 | 3952 | ||
3963 | vmcs_writel(GUEST_DR7, 0x400); | ||
3964 | |||
3965 | vmcs_writel(GUEST_GDTR_BASE, 0); | 3953 | vmcs_writel(GUEST_GDTR_BASE, 0); |
3966 | vmcs_write32(GUEST_GDTR_LIMIT, 0xffff); | 3954 | vmcs_write32(GUEST_GDTR_LIMIT, 0xffff); |
3967 | 3955 | ||
@@ -7237,7 +7225,7 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
7237 | .vcpu_load = vmx_vcpu_load, | 7225 | .vcpu_load = vmx_vcpu_load, |
7238 | .vcpu_put = vmx_vcpu_put, | 7226 | .vcpu_put = vmx_vcpu_put, |
7239 | 7227 | ||
7240 | .set_guest_debug = set_guest_debug, | 7228 | .update_db_bp_intercept = update_exception_bitmap, |
7241 | .get_msr = vmx_get_msr, | 7229 | .get_msr = vmx_get_msr, |
7242 | .set_msr = vmx_set_msr, | 7230 | .set_msr = vmx_set_msr, |
7243 | .get_segment_base = vmx_get_segment_base, | 7231 | .get_segment_base = vmx_get_segment_base, |