aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/kvm_host.h1
-rw-r--r--arch/x86/kvm/svm.c12
2 files changed, 7 insertions, 6 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 2536fbd85b3a..4d994ad5051a 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -354,7 +354,6 @@ struct kvm_vcpu_arch {
354 unsigned int time_offset; 354 unsigned int time_offset;
355 struct page *time_page; 355 struct page *time_page;
356 356
357 bool singlestep; /* guest is single stepped by KVM */
358 bool nmi_pending; 357 bool nmi_pending;
359 bool nmi_injected; 358 bool nmi_injected;
360 359
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 170b2d9c6909..ffa6ad216b71 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -107,6 +107,8 @@ struct vcpu_svm {
107 u32 *msrpm; 107 u32 *msrpm;
108 108
109 struct nested_state nested; 109 struct nested_state nested;
110
111 bool nmi_singlestep;
110}; 112};
111 113
112/* enable NPT for AMD64 and X86 with PAE */ 114/* enable NPT for AMD64 and X86 with PAE */
@@ -1050,7 +1052,7 @@ static void update_db_intercept(struct kvm_vcpu *vcpu)
1050 svm->vmcb->control.intercept_exceptions &= 1052 svm->vmcb->control.intercept_exceptions &=
1051 ~((1 << DB_VECTOR) | (1 << BP_VECTOR)); 1053 ~((1 << DB_VECTOR) | (1 << BP_VECTOR));
1052 1054
1053 if (vcpu->arch.singlestep) 1055 if (svm->nmi_singlestep)
1054 svm->vmcb->control.intercept_exceptions |= (1 << DB_VECTOR); 1056 svm->vmcb->control.intercept_exceptions |= (1 << DB_VECTOR);
1055 1057
1056 if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) { 1058 if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) {
@@ -1195,13 +1197,13 @@ static int db_interception(struct vcpu_svm *svm)
1195 1197
1196 if (!(svm->vcpu.guest_debug & 1198 if (!(svm->vcpu.guest_debug &
1197 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) && 1199 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) &&
1198 !svm->vcpu.arch.singlestep) { 1200 !svm->nmi_singlestep) {
1199 kvm_queue_exception(&svm->vcpu, DB_VECTOR); 1201 kvm_queue_exception(&svm->vcpu, DB_VECTOR);
1200 return 1; 1202 return 1;
1201 } 1203 }
1202 1204
1203 if (svm->vcpu.arch.singlestep) { 1205 if (svm->nmi_singlestep) {
1204 svm->vcpu.arch.singlestep = false; 1206 svm->nmi_singlestep = false;
1205 if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP)) 1207 if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP))
1206 svm->vmcb->save.rflags &= 1208 svm->vmcb->save.rflags &=
1207 ~(X86_EFLAGS_TF | X86_EFLAGS_RF); 1209 ~(X86_EFLAGS_TF | X86_EFLAGS_RF);
@@ -2543,7 +2545,7 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)
2543 /* Something prevents NMI from been injected. Single step over 2545 /* Something prevents NMI from been injected. Single step over
2544 possible problem (IRET or exception injection or interrupt 2546 possible problem (IRET or exception injection or interrupt
2545 shadow) */ 2547 shadow) */
2546 vcpu->arch.singlestep = true; 2548 svm->nmi_singlestep = true;
2547 svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF); 2549 svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF);
2548 update_db_intercept(vcpu); 2550 update_db_intercept(vcpu);
2549} 2551}