From: Joerg Roedel <joerg.roedel@amd.com>
To: Avi Kivity <avi@redhat.com>
Cc: Alexander Graf <agraf@suse.de>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 14/21] kvm/svm: clean up nested vmrun path
Date: Fri, 7 Aug 2009 11:49:41 +0200 [thread overview]
Message-ID: <1249638588-10982-15-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1249638588-10982-1-git-send-email-joerg.roedel@amd.com>
This patch removes the usage of nested_svm_do from the vmrun emulation
path.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kvm/svm.c | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index c2ca953..c1e3f46 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1730,25 +1730,35 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
return 0;
}
-static int nested_svm_vmrun_msrpm(struct vcpu_svm *svm, void *arg1,
- void *arg2, void *opaque)
+static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
{
+ u32 *nested_msrpm;
int i;
- u32 *nested_msrpm = (u32*)arg1;
+
+ nested_msrpm = nested_svm_map(svm, svm->nested.vmcb_msrpm, KM_USER0);
+ if (!nested_msrpm)
+ return false;
+
for (i=0; i< PAGE_SIZE * (1 << MSRPM_ALLOC_ORDER) / 4; i++)
svm->nested.msrpm[i] = svm->msrpm[i] | nested_msrpm[i];
+
svm->vmcb->control.msrpm_base_pa = __pa(svm->nested.msrpm);
- return 0;
+ nested_svm_unmap(nested_msrpm, KM_USER0);
+
+ return true;
}
-static int nested_svm_vmrun(struct vcpu_svm *svm, void *arg1,
- void *arg2, void *opaque)
+static bool nested_svm_vmrun(struct vcpu_svm *svm)
{
- struct vmcb *nested_vmcb = (struct vmcb *)arg1;
+ struct vmcb *nested_vmcb;
struct vmcb *hsave = svm->nested.hsave;
struct vmcb *vmcb = svm->vmcb;
+ nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, KM_USER0);
+ if (!nested_vmcb)
+ return false;
+
/* nested_vmcb is our indicator if nested SVM is activated */
svm->nested.vmcb = svm->vmcb->save.rax;
@@ -1864,9 +1874,11 @@ static int nested_svm_vmrun(struct vcpu_svm *svm, void *arg1,
svm->vmcb->control.event_inj = nested_vmcb->control.event_inj;
svm->vmcb->control.event_inj_err = nested_vmcb->control.event_inj_err;
+ nested_svm_unmap(nested_vmcb, KM_USER0);
+
enable_gif(svm);
- return 0;
+ return true;
}
static void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb)
@@ -1934,12 +1946,10 @@ static int vmrun_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
skip_emulated_instruction(&svm->vcpu);
- if (nested_svm_do(svm, svm->vmcb->save.rax, 0,
- NULL, nested_svm_vmrun))
+ if (!nested_svm_vmrun(svm))
return 1;
- if (nested_svm_do(svm, svm->nested.vmcb_msrpm, 0,
- NULL, nested_svm_vmrun_msrpm))
+ if (!nested_svm_vmrun_msrpm(svm))
return 1;
return 1;
--
1.6.3.3
next prev parent reply other threads:[~2009-08-07 9:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-07 9:49 [PATCH 0/21] Nested SVM cleanups v2 Joerg Roedel
2009-08-07 9:49 ` [PATCH 01/21] kvm/svm: add helper functions for global interrupt flag Joerg Roedel
2009-08-07 9:49 ` [PATCH 02/21] kvm/svm: optimize nested #vmexit Joerg Roedel
2009-08-07 9:49 ` [PATCH 03/21] kvm/svm: optimize nested vmrun Joerg Roedel
2009-08-07 9:49 ` [PATCH 04/21] kvm/svm: copy only necessary parts of the control area on vmrun/vmexit Joerg Roedel
2009-08-07 9:49 ` [PATCH 05/21] kvm/svm: complete interrupts after handling nested exits Joerg Roedel
2009-08-07 9:49 ` [PATCH 06/21] kvm/svm: move nested svm state into seperate struct Joerg Roedel
2009-08-07 9:49 ` [PATCH 07/21] kvm/svm: cache nested intercepts Joerg Roedel
2009-08-07 9:49 ` [PATCH 08/21] kvm/svm: consolidate nested_svm_exit_handled Joerg Roedel
2009-08-07 9:49 ` [PATCH 09/21] kvm/svm: do nested vmexit in nested_svm_exit_handled Joerg Roedel
2009-08-07 9:49 ` [PATCH 10/21] kvm/svm: simplify nested_svm_check_exception Joerg Roedel
2009-08-07 9:49 ` [PATCH 11/21] kvm/svm: get rid of nested_svm_vmexit_real Joerg Roedel
2009-08-07 9:49 ` [PATCH 12/21] kvm/svm: clean up nested_svm_exit_handled_msr Joerg Roedel
2009-08-07 9:49 ` [PATCH 13/21] kvm/svm: clean up nestec vmload/vmsave paths Joerg Roedel
2009-08-07 9:49 ` Joerg Roedel [this message]
2009-08-07 9:49 ` [PATCH 15/21] kvm/svm: remove nested_svm_do and helper functions Joerg Roedel
2009-08-07 9:49 ` [PATCH 16/21] kvm/svm: handle errors in vmrun emulation path appropriatly Joerg Roedel
2009-08-07 9:49 ` [PATCH 17/21] kvm/svm: move special nested exit handling to separate function Joerg Roedel
2009-08-07 9:49 ` [PATCH 18/21] kvm/svm: remove unnecessary is_nested check from svm_cpu_run Joerg Roedel
2009-08-07 9:49 ` [PATCH 19/21] kvm/svm: move nested_svm_intr main logic out of if-clause Joerg Roedel
2009-08-07 9:49 ` [PATCH 20/21] kvm/svm: check for nested VINTR flag in svm_interrupt_allowed Joerg Roedel
2009-08-07 9:49 ` [PATCH 21/21] kvm/svm: enable nested svm by default Joerg Roedel
2009-08-09 9:41 ` [PATCH 0/21] Nested SVM cleanups v2 Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1249638588-10982-15-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®