From patchwork Fri Oct 9 14:08:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 52720 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n99EGmvG017028 for ; Fri, 9 Oct 2009 14:16:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760915AbZJIOJb (ORCPT ); Fri, 9 Oct 2009 10:09:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760908AbZJIOJb (ORCPT ); Fri, 9 Oct 2009 10:09:31 -0400 Received: from va3ehsobe004.messaging.microsoft.com ([216.32.180.14]:39405 "EHLO VA3EHSOBE004.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1760902AbZJIOJ3 (ORCPT ); Fri, 9 Oct 2009 10:09:29 -0400 Received: from mail130-va3-R.bigfish.com (10.7.14.235) by VA3EHSOBE004.bigfish.com (10.7.40.24) with Microsoft SMTP Server id 8.1.340.0; Fri, 9 Oct 2009 14:08:53 +0000 Received: from mail130-va3 (localhost.localdomain [127.0.0.1]) by mail130-va3-R.bigfish.com (Postfix) with ESMTP id A516324070A; Fri, 9 Oct 2009 14:08:52 +0000 (UTC) X-SpamScore: 10 X-BigFish: VPS10(zza4b1ozz1202hzzz32i2a8h6bh43j62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, Received: by mail130-va3 (MessageSwitch) id 125509733121222_13772; Fri, 9 Oct 2009 14:08:51 +0000 (UCT) Received: from VA3EHSMHS032.bigfish.com (unknown [10.7.14.247]) by mail130-va3.bigfish.com (Postfix) with ESMTP id 958681B7804E; Fri, 9 Oct 2009 14:08:50 +0000 (UTC) Received: from svlb1extmailp02.amd.com (139.95.251.11) by VA3EHSMHS032.bigfish.com (10.7.99.42) with Microsoft SMTP Server (TLS) id 14.0.482.32; Fri, 9 Oct 2009 14:08:46 +0000 Received: from svlb1twp01.amd.com ([139.95.250.34]) by svlb1extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n99E8bvY018817; Fri, 9 Oct 2009 07:08:40 -0700 X-WSS-ID: 0KR93AE-03-0N8-02 X-M-MSG: Received: from SSVLEXBH1.amd.com (ssvlexbh1.amd.com [139.95.53.182]) by svlb1twp01.amd.com (Tumbleweed MailGate 3.7.0) with ESMTP id 2386419A014E; Fri, 9 Oct 2009 07:08:38 -0700 (PDT) Received: from ssvlexmb2.amd.com ([139.95.53.7]) by SSVLEXBH1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 07:08:41 -0700 Received: from SF36EXMB1.amd.com ([172.19.4.24]) by ssvlexmb2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 07:08:41 -0700 Received: from seurexmb1.amd.com ([165.204.9.130]) by SF36EXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 16:08:37 +0200 Received: from lemmy.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 16:08:36 +0200 Received: by lemmy.amd.com (Postfix, from userid 41430) id F1CECC9A75; Fri, 9 Oct 2009 16:08:35 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: Alexander Graf , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 1/9] KVM: SVM: Notify nested hypervisor of lost event injections Date: Fri, 9 Oct 2009 16:08:25 +0200 Message-ID: <1255097313-23267-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1255097313-23267-1-git-send-email-joerg.roedel@amd.com> References: <1255097313-23267-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 09 Oct 2009 14:08:36.0325 (UTC) FILETIME=[FE39A150:01CA48E9] MIME-Version: 1.0 X-Reverse-DNS: unknown Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 279a2ae..e372854 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1615,6 +1615,22 @@ static int nested_svm_vmexit(struct vcpu_svm *svm) nested_vmcb->control.exit_info_2 = vmcb->control.exit_info_2; nested_vmcb->control.exit_int_info = vmcb->control.exit_int_info; nested_vmcb->control.exit_int_info_err = vmcb->control.exit_int_info_err; + + /* + * If we emulate a VMRUN/#VMEXIT in the same host #vmexit cycle we have + * to make sure that we do not lose injected events. So check event_inj + * here and copy it to exit_int_info if it is valid. + * Exit_int_info and event_inj can't be both valid because the case + * below only happens on a VMRUN instruction intercept which has + * no valid exit_int_info set. + */ + if (vmcb->control.event_inj & SVM_EVTINJ_VALID) { + struct vmcb_control_area *nc = &nested_vmcb->control; + + nc->exit_int_info = vmcb->control.event_inj; + nc->exit_int_info_err = vmcb->control.event_inj_err; + } + nested_vmcb->control.tlb_ctl = 0; nested_vmcb->control.event_inj = 0; nested_vmcb->control.event_inj_err = 0;