From patchwork Thu Oct 8 10:03:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 52484 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 n98A6E61026091 for ; Thu, 8 Oct 2009 10:06:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757491AbZJHKF4 (ORCPT ); Thu, 8 Oct 2009 06:05:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757073AbZJHKF4 (ORCPT ); Thu, 8 Oct 2009 06:05:56 -0400 Received: from tx2ehsobe004.messaging.microsoft.com ([65.55.88.14]:3211 "EHLO TX2EHSOBE008.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932205AbZJHKFO (ORCPT ); Thu, 8 Oct 2009 06:05:14 -0400 Received: from mail93-tx2-R.bigfish.com (10.9.14.239) by TX2EHSOBE008.bigfish.com (10.9.40.28) with Microsoft SMTP Server id 8.1.340.0; Thu, 8 Oct 2009 10:04:38 +0000 Received: from mail93-tx2 (localhost.localdomain [127.0.0.1]) by mail93-tx2-R.bigfish.com (Postfix) with ESMTP id D49BE18E018B; Thu, 8 Oct 2009 10:04:37 +0000 (UTC) X-SpamScore: 10 X-BigFish: VPS10(zza4b1ozz1202hzzz32i6bh43j63h) X-Spam-TCS-SCL: 2:0 X-FB-SS: 5, Received: by mail93-tx2 (MessageSwitch) id 1254996267783207_22035; Thu, 8 Oct 2009 10:04:27 +0000 (UCT) Received: from TX2EHSMHS031.bigfish.com (unknown [10.9.14.249]) by mail93-tx2.bigfish.com (Postfix) with ESMTP id E2573978079; Thu, 8 Oct 2009 10:04:26 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by TX2EHSMHS031.bigfish.com (10.9.99.131) with Microsoft SMTP Server (TLS) id 14.0.482.32; Thu, 8 Oct 2009 10:04:24 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n98A4D7U031312; Thu, 8 Oct 2009 05:04:17 -0500 X-WSS-ID: 0KR6XB1-02-14H-02 X-M-MSG: Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.0) with ESMTP id 2EC02C84F7; Thu, 8 Oct 2009 05:04:12 -0500 (CDT) Received: from sausexmb1.amd.com ([163.181.3.156]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 8 Oct 2009 05:04:16 -0500 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 8 Oct 2009 05:04:16 -0500 Received: from seurexmb1.amd.com ([165.204.9.130]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 8 Oct 2009 12:03:24 +0200 Received: from lemmy.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 8 Oct 2009 12:03:23 +0200 Received: by lemmy.amd.com (Postfix, from userid 41430) id 5AFE9C9A71; Thu, 8 Oct 2009 12:03:23 +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: Thu, 8 Oct 2009 12:03:11 +0200 Message-ID: <1254996199-17667-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1254996199-17667-1-git-send-email-joerg.roedel@amd.com> References: <1254996199-17667-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 08 Oct 2009 10:03:23.0509 (UTC) FILETIME=[924A5250:01CA47FE] 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;