[PATCH 3/4] KVM: x86: correctly merge pending and injected exception

2021-04-01 Thread Maxim Levitsky
Allow the pending and the injected exceptions to co-exist when they are raised. Add 'kvm_deliver_pending_exception' function which 'merges' the pending and injected exception or delivers a VM exit with both for a case when the L1 intercepts the pending exception. The later is done by vendor code

Re: [PATCH 3/4] KVM: x86: correctly merge pending and injected exception

2021-04-01 Thread Paolo Bonzini
On 01/04/21 16:38, Maxim Levitsky wrote: +static int kvm_do_deliver_pending_exception(struct kvm_vcpu *vcpu) +{ + int class1, class2, ret; + + /* try to deliver current pending exception as VM exit */ + if (is_guest_mode(vcpu)) { + ret = kvm_x86_ops.nested_ops->del

Re: [PATCH 3/4] KVM: x86: correctly merge pending and injected exception

2021-04-01 Thread Sean Christopherson
On Thu, Apr 01, 2021, Paolo Bonzini wrote: > On 01/04/21 16:38, Maxim Levitsky wrote: > > +static int kvm_do_deliver_pending_exception(struct kvm_vcpu *vcpu) > > +{ > > + int class1, class2, ret; > > + > > + /* try to deliver current pending exception as VM exit */ > > + if (is_guest_mode(vcp