From patchwork Wed Jul 13 15:32:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 972662 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 p6DFZY2U017127 for ; Wed, 13 Jul 2011 15:35:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755605Ab1GMPfI (ORCPT ); Wed, 13 Jul 2011 11:35:08 -0400 Received: from tx2ehsobe004.messaging.microsoft.com ([65.55.88.14]:35940 "EHLO TX2EHSOBE008.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755341Ab1GMPfH (ORCPT ); Wed, 13 Jul 2011 11:35:07 -0400 Received: from mail40-tx2-R.bigfish.com (10.9.14.252) by TX2EHSOBE008.bigfish.com (10.9.40.28) with Microsoft SMTP Server id 14.1.225.22; Wed, 13 Jul 2011 15:35:06 +0000 Received: from mail40-tx2 (localhost.localdomain [127.0.0.1]) by mail40-tx2-R.bigfish.com (Postfix) with ESMTP id 2B5911BF0502; Wed, 13 Jul 2011 15:35:06 +0000 (UTC) X-SpamScore: 1 X-BigFish: VPS1(zzzz1202hzz8275bhz32i668h839h62h) 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 mail40-tx2 (localhost.localdomain [127.0.0.1]) by mail40-tx2 (MessageSwitch) id 1310571262853796_16499; Wed, 13 Jul 2011 15:34:22 +0000 (UTC) Received: from TX2EHSMHS012.bigfish.com (unknown [10.9.14.253]) by mail40-tx2.bigfish.com (Postfix) with ESMTP id 4E1F715D01E2; Wed, 13 Jul 2011 15:33:13 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by TX2EHSMHS012.bigfish.com (10.9.99.112) with Microsoft SMTP Server id 14.1.225.22; Wed, 13 Jul 2011 15:33:13 +0000 X-WSS-ID: 0LOA37A-01-0C1-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 2092E10281C1; Wed, 13 Jul 2011 10:33:10 -0500 (CDT) Received: from SAUSEXDAG04.amd.com (163.181.55.4) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.106.1; Wed, 13 Jul 2011 10:34:10 -0500 Received: from storexhtp01.amd.com (172.24.4.3) by sausexdag04.amd.com (163.181.55.4) with Microsoft SMTP Server (TLS) id 14.1.289.1; Wed, 13 Jul 2011 08:33:12 -0700 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp01.amd.com (172.24.4.3) 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 DD32549C5EA; Wed, 13 Jul 2011 16:33:10 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id C0964100205; Wed, 13 Jul 2011 17:33:10 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: , , Joerg Roedel Subject: [PATCH 2/7] KVM: SVM: Use host_vmcb_pa for vmload and vmsave Date: Wed, 13 Jul 2011 17:32:20 +0200 Message-ID: <1310571145-28930-3-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:35:34 +0000 (UTC) This saves copying over the vmload/vmsave switched part from the host to the guest vmcb later. Signed-off-by: Joerg Roedel --- arch/x86/kvm/svm.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 3d5990f..dc703ac 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -3704,9 +3704,13 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) /* Enter guest mode */ "push %%"R"ax \n\t" - "mov %c[vmcb](%[svm]), %%"R"ax \n\t" + "mov %c[host_vmcb](%[svm]), %%"R"ax \n\t" __ex(SVM_VMLOAD) "\n\t" + "mov (%%"R"sp), %%"R"ax\n\t" + "mov %c[vmcb](%[svm]), %%"R"ax \n\t" __ex(SVM_VMRUN) "\n\t" + "mov (%%"R"sp), %%"R"ax\n\t" + "mov %c[host_vmcb](%[svm]), %%"R"ax \n\t" __ex(SVM_VMSAVE) "\n\t" "pop %%"R"ax \n\t" @@ -3731,6 +3735,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) : : [svm]"a"(svm), [vmcb]"i"(offsetof(struct vcpu_svm, vmcb_pa)), + [host_vmcb]"i"(offsetof(struct vcpu_svm, host_vmcb_pa)), [rbx]"i"(offsetof(struct vcpu_svm, vcpu.arch.regs[VCPU_REGS_RBX])), [rcx]"i"(offsetof(struct vcpu_svm, vcpu.arch.regs[VCPU_REGS_RCX])), [rdx]"i"(offsetof(struct vcpu_svm, vcpu.arch.regs[VCPU_REGS_RDX])),