Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: SVM: implement enhanced INVLPG intercept

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>

authored by

Andre Przywara and committed by
Avi Kivity
df4f3108 cae3797a

+6 -1
+6 -1
arch/x86/kvm/svm.c
··· 2652 2652 2653 2653 static int invlpg_interception(struct vcpu_svm *svm) 2654 2654 { 2655 - return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE; 2655 + if (!static_cpu_has(X86_FEATURE_DECODEASSISTS)) 2656 + return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE; 2657 + 2658 + kvm_mmu_invlpg(&svm->vcpu, svm->vmcb->control.exit_info_1); 2659 + skip_emulated_instruction(&svm->vcpu); 2660 + return 1; 2656 2661 } 2657 2662 2658 2663 static int emulate_on_interception(struct vcpu_svm *svm)