Skip to content

Commit 4bb05f3

Browse files
tlendackybonzini
authored andcommitted
KVM: SVM: Add a dedicated INVD intercept routine
The INVD instruction intercept performs emulation. Emulation can't be done on an SEV guest because the guest memory is encrypted. Provide a dedicated intercept routine for the INVD intercept. And since the instruction is emulated as a NOP, just skip it instead. Fixes: 1654efc ("KVM: SVM: Add KVM_SEV_INIT command") Signed-off-by: Tom Lendacky <[email protected]> Message-Id: <a0b9a19ffa7fef86a3cc700c7ea01cb2731e04e5.1600972918.git.thomas.lendacky@amd.com> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 8d214c4 commit 4bb05f3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,12 @@ static int iret_interception(struct vcpu_svm *svm)
21832183
return 1;
21842184
}
21852185

2186+
static int invd_interception(struct vcpu_svm *svm)
2187+
{
2188+
/* Treat an INVD instruction as a NOP and just skip it. */
2189+
return kvm_skip_emulated_instruction(&svm->vcpu);
2190+
}
2191+
21862192
static int invlpg_interception(struct vcpu_svm *svm)
21872193
{
21882194
if (!static_cpu_has(X86_FEATURE_DECODEASSISTS))
@@ -2774,7 +2780,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = {
27742780
[SVM_EXIT_RDPMC] = rdpmc_interception,
27752781
[SVM_EXIT_CPUID] = cpuid_interception,
27762782
[SVM_EXIT_IRET] = iret_interception,
2777-
[SVM_EXIT_INVD] = emulate_on_interception,
2783+
[SVM_EXIT_INVD] = invd_interception,
27782784
[SVM_EXIT_PAUSE] = pause_interception,
27792785
[SVM_EXIT_HLT] = halt_interception,
27802786
[SVM_EXIT_INVLPG] = invlpg_interception,

0 commit comments

Comments
 (0)