From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: [PATCH] KVM: SVM: Cleanup NMI singlestep Date: Sun, 18 Oct 2009 13:24:54 +0200 Message-ID: <4ADAFB06.3040004@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA74311790E6AD35BA689566D" Cc: kvm-devel To: Avi Kivity , Marcelo Tosatti Return-path: Received: from fmmailgate03.web.de ([217.72.192.234]:46226 "EHLO fmmailgate03.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752777AbZJRL3E (ORCPT ); Sun, 18 Oct 2009 07:29:04 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA74311790E6AD35BA689566D Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Push the NMI-related singlestep variable into vcpu_svm. It's dealing with an AMD-specific deficit, nothing generic for x86. Signed-off-by: Jan Kiszka --- arch/x86/include/asm/kvm_host.h | 1 - arch/x86/kvm/svm.c | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_h= ost.h index c6094f1..097a492 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 { unsigned int time_offset; struct page *time_page; =20 - bool singlestep; /* guest is single stepped by KVM */ bool nmi_pending; bool nmi_injected; =20 diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 170b2d9..ffa6ad2 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -107,6 +107,8 @@ struct vcpu_svm { u32 *msrpm; =20 struct nested_state nested; + + bool nmi_singlestep; }; =20 /* enable NPT for AMD64 and X86 with PAE */ @@ -1050,7 +1052,7 @@ static void update_db_intercept(struct kvm_vcpu *vc= pu) svm->vmcb->control.intercept_exceptions &=3D ~((1 << DB_VECTOR) | (1 << BP_VECTOR)); =20 - if (vcpu->arch.singlestep) + if (svm->nmi_singlestep) svm->vmcb->control.intercept_exceptions |=3D (1 << DB_VECTOR); =20 if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) { @@ -1195,13 +1197,13 @@ static int db_interception(struct vcpu_svm *svm) =20 if (!(svm->vcpu.guest_debug & (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) && - !svm->vcpu.arch.singlestep) { + !svm->nmi_singlestep) { kvm_queue_exception(&svm->vcpu, DB_VECTOR); return 1; } =20 - if (svm->vcpu.arch.singlestep) { - svm->vcpu.arch.singlestep =3D false; + if (svm->nmi_singlestep) { + svm->nmi_singlestep =3D false; if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP)) svm->vmcb->save.rflags &=3D ~(X86_EFLAGS_TF | X86_EFLAGS_RF); @@ -2543,7 +2545,7 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu= ) /* Something prevents NMI from been injected. Single step over possible problem (IRET or exception injection or interrupt shadow) */ - vcpu->arch.singlestep =3D true; + svm->nmi_singlestep =3D true; svm->vmcb->save.rflags |=3D (X86_EFLAGS_TF | X86_EFLAGS_RF); update_db_intercept(vcpu); } --------------enigA74311790E6AD35BA689566D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkra+wYACgkQitSsb3rl5xSUNQCcDltc5i1P9EadKJBjeqen3H88 B68An2BAp9r7cnKS9pXV6kidrLACV/y7 =Us6b -----END PGP SIGNATURE----- --------------enigA74311790E6AD35BA689566D--