KVM: SVM: implement enhanced INVLPG intercept
authorAndre Przywara <andre.przywara@amd.com>
Tue, 21 Dec 2010 10:12:06 +0000 (11:12 +0100)
committerAvi Kivity <avi@redhat.com>
Wed, 12 Jan 2011 09:31:05 +0000 (11:31 +0200)
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>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/svm.c

index d84f6a7c2bc5882ccfe216d726ad2a4d3f6060d9..a04c01e324b4f17480922581019aa603432f5a1a 100644 (file)
@@ -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)