From patchwork Wed Jul 13 15:32:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 972612 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6DFRZ3u016052 for ; Wed, 13 Jul 2011 15:34:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755597Ab1GMPdT (ORCPT ); Wed, 13 Jul 2011 11:33:19 -0400 Received: from tx2ehsobe001.messaging.microsoft.com ([65.55.88.11]:55350 "EHLO TX2EHSOBE001.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755394Ab1GMPdQ (ORCPT ); Wed, 13 Jul 2011 11:33:16 -0400 Received: from mail52-tx2-R.bigfish.com (10.9.14.251) by TX2EHSOBE001.bigfish.com (10.9.40.21) with Microsoft SMTP Server id 14.1.225.22; Wed, 13 Jul 2011 15:33:16 +0000 Received: from mail52-tx2 (localhost.localdomain [127.0.0.1]) by mail52-tx2-R.bigfish.com (Postfix) with ESMTP id DDDDB1051C; Wed, 13 Jul 2011 15:33:15 +0000 (UTC) X-SpamScore: 1 X-BigFish: VPS1(zzzz1202hzz8275dhz32i668h839h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: CIP:163.181.249.108; KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI Received: from mail52-tx2 (localhost.localdomain [127.0.0.1]) by mail52-tx2 (MessageSwitch) id 1310571195715742_13911; Wed, 13 Jul 2011 15:33:15 +0000 (UTC) Received: from TX2EHSMHS045.bigfish.com (unknown [10.9.14.251]) by mail52-tx2.bigfish.com (Postfix) with ESMTP id 9A7EB184804C; Wed, 13 Jul 2011 15:33:15 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by TX2EHSMHS045.bigfish.com (10.9.99.145) with Microsoft SMTP Server id 14.1.225.22; Wed, 13 Jul 2011 15:33:15 +0000 X-WSS-ID: 0LOA37B-01-0C5-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Axway MailGate 3.8.1) with ESMTP id 2EFB210281B2; Wed, 13 Jul 2011 10:33:10 -0500 (CDT) Received: from sausexhtp01.amd.com (163.181.3.165) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.106.1; Wed, 13 Jul 2011 10:34:11 -0500 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 13 Jul 2011 10:33:12 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Wed, 13 Jul 2011 11:33:11 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id C2AB549C5E9; Wed, 13 Jul 2011 16:33:10 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id AF68F10002D; Wed, 13 Jul 2011 17:33:10 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: , , Joerg Roedel Subject: [PATCH 1/7] KVM: SVM: Keep seperate pointer to host-vmcb Date: Wed, 13 Jul 2011 17:32:19 +0200 Message-ID: <1310571145-28930-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1310571145-28930-1-git-send-email-joerg.roedel@amd.com> References: <1310571145-28930-1-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 13 Jul 2011 15:34:37 +0000 (UTC) From: Joerg Roedel This patch introduces a new pointer which always points to the VMCB used for running the L1 guest. Signed-off-by: Joerg Roedel --- arch/x86/kvm/svm.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 475d1c9..3d5990f 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -113,7 +113,9 @@ static u32 msrpm_offsets[MSRPM_OFFSETS] __read_mostly; struct vcpu_svm { struct kvm_vcpu vcpu; struct vmcb *vmcb; + struct vmcb *host_vmcb; unsigned long vmcb_pa; + unsigned long host_vmcb_pa; struct svm_cpu_data *svm_data; uint64_t asid_generation; uint64_t sysenter_esp; @@ -1171,9 +1173,11 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) svm->nested.msrpm = page_address(nested_msrpm_pages); svm_vcpu_init_msrpm(svm->nested.msrpm); - svm->vmcb = page_address(page); + svm->host_vmcb = page_address(page); + svm->vmcb = svm->host_vmcb; clear_page(svm->vmcb); svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; + svm->host_vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; svm->asid_generation = 0; init_vmcb(svm); kvm_write_tsc(&svm->vcpu, 0);