From: Tom Lendacky Date: Thu, 10 Dec 2020 17:09:44 +0000 (-0600) Subject: KVM: SVM: Do not allow instruction emulation under SEV-ES X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=bc624d9f1bbbfd6ae7057437cd3fcfef17066399;p=linux.git KVM: SVM: Do not allow instruction emulation under SEV-ES When a guest is running as an SEV-ES guest, it is not possible to emulate instructions. Add support to prevent instruction emulation. Signed-off-by: Tom Lendacky Message-Id: Signed-off-by: Paolo Bonzini --- diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index bec427acab208..cade703d6edbe 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -4157,6 +4157,12 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int i bool smep, smap, is_user; unsigned long cr4; + /* + * When the guest is an SEV-ES guest, emulation is not possible. + */ + if (sev_es_guest(vcpu->kvm)) + return false; + /* * Detect and workaround Errata 1096 Fam_17h_00_0Fh. *