From patchwork Wed Oct 7 14:31:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 52284 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 n97EnQTi022521 for ; Wed, 7 Oct 2009 14:49:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759419AbZJGOdB (ORCPT ); Wed, 7 Oct 2009 10:33:01 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759414AbZJGOc7 (ORCPT ); Wed, 7 Oct 2009 10:32:59 -0400 Received: from va3ehsobe001.messaging.microsoft.com ([216.32.180.11]:45640 "EHLO VA3EHSOBE001.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759415AbZJGOc4 (ORCPT ); Wed, 7 Oct 2009 10:32:56 -0400 Received: from mail112-va3-R.bigfish.com (10.7.14.240) by VA3EHSOBE001.bigfish.com (10.7.40.21) with Microsoft SMTP Server id 8.1.340.0; Wed, 7 Oct 2009 14:32:11 +0000 Received: from mail112-va3 (localhost.localdomain [127.0.0.1]) by mail112-va3-R.bigfish.com (Postfix) with ESMTP id C071815104F4; Wed, 7 Oct 2009 14:32:10 +0000 (UTC) X-SpamScore: 8 X-BigFish: VPS8(zza4b1ozz1202hzzz32i6bh63h) X-Spam-TCS-SCL: 2:0 X-FB-SS: 5, Received: by mail112-va3 (MessageSwitch) id 1254925912222224_12249; Wed, 7 Oct 2009 14:31:52 +0000 (UCT) Received: from VA3EHSMHS028.bigfish.com (unknown [10.7.14.238]) by mail112-va3.bigfish.com (Postfix) with ESMTP id 2EB8AEB0051; Wed, 7 Oct 2009 14:31:52 +0000 (UTC) Received: from ausb3extmailp02.amd.com (163.181.251.22) by VA3EHSMHS028.bigfish.com (10.7.99.38) with Microsoft SMTP Server (TLS) id 14.0.482.32; Wed, 7 Oct 2009 14:31:48 +0000 Received: from ausb3twp01.amd.com (ausb3twp01.amd.com [163.181.250.37]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n97EViIv011333; Wed, 7 Oct 2009 09:31:47 -0500 X-WSS-ID: 0KR5F0S-01-FE9-02 X-M-MSG: Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.0) with ESMTP id 2A97610284BD; Wed, 7 Oct 2009 09:31:40 -0500 (CDT) Received: from sausexmb2.amd.com ([163.181.3.157]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 Oct 2009 09:31:43 -0500 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by sausexmb2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 Oct 2009 09:31:43 -0500 Received: from seurexmb1.amd.com ([165.204.9.130]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 Oct 2009 16:31:35 +0200 Received: from lemmy.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 Oct 2009 16:31:34 +0200 Received: by lemmy.amd.com (Postfix, from userid 41430) id 026CFC9B77; Wed, 7 Oct 2009 16:31:35 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Graf , Joerg Roedel Subject: [PATCH 01/10] KVM: SVM: Notify nested hypervisor of lost event injections Date: Wed, 7 Oct 2009 16:31:19 +0200 Message-ID: <1254925888-13743-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1254925888-13743-1-git-send-email-joerg.roedel@amd.com> References: <1254925888-13743-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 07 Oct 2009 14:31:35.0061 (UTC) FILETIME=[DF308C50:01CA475A] MIME-Version: 1.0 X-Reverse-DNS: ausb3extmailp02.amd.com 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..b6ce1a9 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 case 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;