Received: by 10.213.65.68 with SMTP id h4csp387195imn; Tue, 27 Mar 2018 00:45:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELtl6EtJ9yGCcmkUkPW7WcUi/tpDRmb+HDaY+QX8Kh8IMYxTX6vWP/ayZz7A5jsr0d/tzTp/ X-Received: by 10.98.59.4 with SMTP id i4mr35892324pfa.26.1522136705378; Tue, 27 Mar 2018 00:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522136705; cv=none; d=google.com; s=arc-20160816; b=JDj44cCc/63xYbGzG/L3F92jOt/yXhmhfyrpY6nBKpb33d1PW74ikZOpGWQ4RGnWtR NJyYL7aibIRKtvtEJMWmSojt+Wz4IQobfAOBWJ3ttBEOIgMyXGI6Zm1g7PrZstNUirJm KeNd5pLJYIwB69ogi3XXRxhrkBIdFXcQd0U6J12Q7xXRdd/+YDblhJBtsqxsr0ivdaZs AwkZlLhbO8lPmDQeINvmYHBwIZQw0q1nZw7nOe8GBxQ5CNZfcRVdEM+shEy8w71Bxz7m 4SZNJpmGFAY8lWw0E2oAX1CbI8ysNUEb/3LkdyMfOezKud8VmZ+WvMWpo0N4pG4pI7eC qqrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:subject:cc:to:from:date:message-id :mime-version:dkim-signature:arc-authentication-results; bh=iY3AaY5Hlvq4HCpVmuUerab3yCKEof8crNnbTWw1c68=; b=APZZstzfJ8NTj7JSOnwwGd3l1uOoKoYevdcoiJv/b2712kiuExruT9dBprAOerxulL 0hWULUtv3F7eIc1FaqiwTSoGfj0bBJeBJORAoayEkARCv689p/k1pBuFtSH0Yyd6A4X2 W3Thr9BUStQjWKYFlYUaY/LJ0f/SrpkzP0K0eXNVpcDxI880s2kHh8hRXke0fVI/wfPw WKo5T9xq0o9P9liZNKKrGpIAN1E6RKyZ4428eW9BeKnmkbdNErcBhCBSvrGUc/ssUMEP LwKiVuTB3WEf2TGPES6X/so4ITb7E8lTdsegncgEBlzjWTqSxXW+D23jLGk+HOWqhiS4 ViIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=kQpqjqAZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6si459006pgq.260.2018.03.27.00.44.51; Tue, 27 Mar 2018 00:45:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=kQpqjqAZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751211AbeC0Hnw (ORCPT + 99 others); Tue, 27 Mar 2018 03:43:52 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:58552 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbeC0Hnu (ORCPT ); Tue, 27 Mar 2018 03:43:50 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2R7HSUp048125; Tue, 27 Mar 2018 07:43:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : to : cc : subject : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=iY3AaY5Hlvq4HCpVmuUerab3yCKEof8crNnbTWw1c68=; b=kQpqjqAZ4P2QfY01rR2TIjdBA2Y8gnwLeIbtUaKi9lhNsPGEdcbw1vjdR4ynpJqDI88v I//AbvVidZo/K9wB9ONRFTM4VqknNNwGbI6Ds3c14/zeKFRlEyaoPeJ2bZwsrdvP2dUQ 9GOGDkVBP5rA5nwwTpazRP5YTSXUzxoh5sTisdIlfDjEduiRNUQRNyLAgaKahPISdVfi nd+tuPBlAYW+HRMJr5XAr4wVREvvCdnsvyZ20XAk3XB/hGgGTCtf7ze5xMI09+IWNW06 eSHgJ5e1bEPXhfF6K+WSdJG/xxz2ZnWmMAU3DQcyMO/LJ77sDWXDPsFzoRkUR1OfbLl1 cw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2gyheh038q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Mar 2018 07:43:28 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2R7hSeL016898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Mar 2018 07:43:28 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2R7hRv1003010; Tue, 27 Mar 2018 07:43:27 GMT MIME-Version: 1.0 Message-ID: <9f084c44-d394-473f-906d-f11036dc48d9@default> Date: Tue, 27 Mar 2018 00:43:27 -0700 (PDT) From: Liran Alon To: Cc: , , , , Subject: Re: [PATCH 1/2] KVM: VMX: Introduce handle_ud() X-Mailer: Zimbra on Oracle Beehive Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8844 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803270073 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- kernellwp@gmail.com wrote: > From: Wanpeng Li >=20 > Introduce handle_ud() to handle invalid opcode, this function will be >=20 > used by later patches. >=20 > 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) > =09return 1; > } > =20 > +static int handle_ud(struct kvm_vcpu *vcpu) > +{ > +=09enum emulation_result er; > + > +=09er =3D emulate_instruction(vcpu, EMULTYPE_TRAP_UD); > +=09if (er =3D=3D EMULATE_USER_EXIT) > +=09=09return 0; > +=09if (er !=3D EMULATE_DONE) > +=09=09kvm_queue_exception(vcpu, UD_VECTOR); > +=09return 1; > +} > + > static int handle_exception(struct kvm_vcpu *vcpu) > { > =09struct vcpu_vmx *vmx =3D to_vmx(vcpu); > @@ -6233,14 +6245,8 @@ static int handle_exception(struct kvm_vcpu > *vcpu) > =09if (is_nmi(intr_info)) > =09=09return 1; /* already handled by vmx_vcpu_run() */ > =20 > -=09if (is_invalid_opcode(intr_info)) { > -=09=09er =3D emulate_instruction(vcpu, EMULTYPE_TRAP_UD); > -=09=09if (er =3D=3D EMULATE_USER_EXIT) > -=09=09=09return 0; > -=09=09if (er !=3D EMULATE_DONE) > -=09=09=09kvm_queue_exception(vcpu, UD_VECTOR); > -=09=09return 1; > -=09} > +=09if (is_invalid_opcode(intr_info)) > +=09=09return handle_ud(vcpu); > =20 > =09error_code =3D 0; > =09if (intr_info & INTR_INFO_DELIVER_CODE_MASK) > --=20 > 2.7.4 Reviewed-By: Liran Alon