From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 1/2] KVM: VMX: Introduce handle_ud() Date: Tue, 27 Mar 2018 00:38:41 -0400 Message-ID: <20180327043841.GA16974@char.us.oracle.com> References: <1522116735-4861-1-git-send-email-wanpengli@tencent.com> <1522116735-4861-2-git-send-email-wanpengli@tencent.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Andrew Cooper To: Wanpeng Li Return-path: Content-Disposition: inline In-Reply-To: <1522116735-4861-2-git-send-email-wanpengli@tencent.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Mon, Mar 26, 2018 at 07:12:14PM -0700, Wanpeng Li wrote: > From: Wanpeng Li >=20 > Introduce handle_ud() to handle invalid opcode, this function will be=20 > used by later patches. >=20 Reviewed-by: Konrad Rzeszutek Wilk Thank you! > Cc: Paolo Bonzini > Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 > Cc: Andrew Cooper > Signed-off-by: Wanpeng Li > --- > arch/x86/kvm/vmx.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) >=20 > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 9bc05f5..0f99833 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -6215,6 +6215,18 @@ static int handle_machine_check(struct kvm_vcpu = *vcpu) > return 1; > } > =20 > +static int handle_ud(struct kvm_vcpu *vcpu) > +{ > + enum emulation_result er; > + > + er =3D emulate_instruction(vcpu, EMULTYPE_TRAP_UD); > + if (er =3D=3D EMULATE_USER_EXIT) > + return 0; > + if (er !=3D EMULATE_DONE) > + kvm_queue_exception(vcpu, UD_VECTOR); > + return 1; > +} > + > static int handle_exception(struct kvm_vcpu *vcpu) > { > struct vcpu_vmx *vmx =3D to_vmx(vcpu); > @@ -6233,14 +6245,8 @@ static int handle_exception(struct kvm_vcpu *vcp= u) > if (is_nmi(intr_info)) > return 1; /* already handled by vmx_vcpu_run() */ > =20 > - if (is_invalid_opcode(intr_info)) { > - er =3D emulate_instruction(vcpu, EMULTYPE_TRAP_UD); > - if (er =3D=3D EMULATE_USER_EXIT) > - return 0; > - if (er !=3D EMULATE_DONE) > - kvm_queue_exception(vcpu, UD_VECTOR); > - return 1; > - } > + if (is_invalid_opcode(intr_info)) > + return handle_ud(vcpu); > =20 > error_code =3D 0; > if (intr_info & INTR_INFO_DELIVER_CODE_MASK) > --=20 > 2.7.4 >=20