public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@amd.com>
To: <avi@redhat.com>, <mtosatti@redhat.com>
Cc: <kvm@vger.kernel.org>, Andre Przywara <andre.przywara@amd.com>
Subject: [PATCH 7/8] kvm/svm: implement enhanced INVLPG intercept
Date: Tue, 21 Dec 2010 11:12:06 +0100	[thread overview]
Message-ID: <1292926327-19319-8-git-send-email-andre.przywara@amd.com> (raw)
In-Reply-To: <1292926327-19319-1-git-send-email-andre.przywara@amd.com>

When the DecodeAssist feature is available, the linear address
is provided in the VMCB on INVLPG intercepts. Use it directly to
avoid any decoding and emulation.
This is only useful for shadow paging, though.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
---
 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 eb662da..7871702 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2652,7 +2652,12 @@ static int iret_interception(struct vcpu_svm *svm)
 
 static int invlpg_interception(struct vcpu_svm *svm)
 {
-	return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE;
+	if (!static_cpu_has(X86_FEATURE_DECODEASSISTS))
+		return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE;
+
+	kvm_mmu_invlpg(&svm->vcpu, svm->vmcb->control.exit_info_1);
+	skip_emulated_instruction(&svm->vcpu);
+	return 1;
 }
 
 static int emulate_on_interception(struct vcpu_svm *svm)
-- 
1.6.4



  parent reply	other threads:[~2010-12-21 10:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21 10:11 [PATCH -v3 0/8] kvm/svm: implement new DecodeAssist features Andre Przywara
2010-12-21 10:12 ` [PATCH 1/8] kvm: fix CR8 handling Andre Przywara
2010-12-21 10:12 ` [PATCH 2/8] kvm: move complete_insn_gp() into x86.c Andre Przywara
2010-12-21 10:12 ` [PATCH 3/8] kvm: cleanup emulate_instruction Andre Przywara
2010-12-21 10:12 ` [PATCH 4/8] kvm/svm: add new SVM feature bit names Andre Przywara
2010-12-21 10:12 ` [PATCH 5/8] kvm/svm: enhance MOV CR intercept handler Andre Przywara
2010-12-21 13:43   ` Avi Kivity
2010-12-21 10:12 ` [PATCH 6/8] kvm/svm: enhance mov DR " Andre Przywara
2010-12-21 10:12 ` Andre Przywara [this message]
2010-12-21 10:12 ` [PATCH 8/8] kvm/svm: copy instruction bytes from VMCB Andre Przywara
2010-12-21 13:41 ` [PATCH -v3 0/8] kvm/svm: implement new DecodeAssist features Avi Kivity
2010-12-23 12:47 ` Marcelo Tosatti

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=1292926327-19319-8-git-send-email-andre.przywara@amd.com \
    --to=andre.przywara@amd.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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