Sean Christopherson <sean.j.christopherson@xxxxxxxxx> writes: > The "no #UD on fail" is used only in the VMWare case, and for the VMWare > scenario it really means "#GP instead of #UD on fail". Remove the flag > in preparation for moving all fault injection into the emulation flow > itself, which in turn will allow eliminating EMULATE_DONE and company. > > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > --- > arch/x86/include/asm/kvm_host.h | 1 - > arch/x86/kvm/svm.c | 3 +-- > arch/x86/kvm/vmx/vmx.c | 3 +-- > arch/x86/kvm/x86.c | 2 +- > 4 files changed, 3 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 44a5ce57a905..dd6bd9ed0839 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1318,7 +1318,6 @@ enum emulation_result { > #define EMULTYPE_TRAP_UD (1 << 1) > #define EMULTYPE_SKIP (1 << 2) > #define EMULTYPE_ALLOW_RETRY (1 << 3) > -#define EMULTYPE_NO_UD_ON_FAIL (1 << 4) > #define EMULTYPE_VMWARE (1 << 5) > int kvm_emulate_instruction(struct kvm_vcpu *vcpu, int emulation_type); > int kvm_emulate_instruction_from_buffer(struct kvm_vcpu *vcpu, > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index 1f220a85514f..5a42f9c70014 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -2772,8 +2772,7 @@ static int gp_interception(struct vcpu_svm *svm) > > WARN_ON_ONCE(!enable_vmware_backdoor); > > - er = kvm_emulate_instruction(vcpu, > - EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL); > + er = kvm_emulate_instruction(vcpu, EMULTYPE_VMWARE); > if (er == EMULATE_USER_EXIT) > return 0; > else if (er != EMULATE_DONE) > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 18286e5b5983..6ecf773825e2 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -4509,8 +4509,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) > > if (!vmx->rmode.vm86_active && is_gp_fault(intr_info)) { > WARN_ON_ONCE(!enable_vmware_backdoor); > - er = kvm_emulate_instruction(vcpu, > - EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL); > + er = kvm_emulate_instruction(vcpu, EMULTYPE_VMWARE); > if (er == EMULATE_USER_EXIT) > return 0; > else if (er != EMULATE_DONE) > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index fe847f8eb947..e0f0e14d8fac 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -6210,7 +6210,7 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu, int emulation_type) > ++vcpu->stat.insn_emulation_fail; > trace_kvm_emulate_insn_failed(vcpu); > > - if (emulation_type & EMULTYPE_NO_UD_ON_FAIL) > + if (emulation_type & EMULTYPE_VMWARE) > return EMULATE_FAIL; > > kvm_queue_exception(vcpu, UD_VECTOR); Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> -- Vitaly