Re: [PATCH v2 5/6] KVM: SVM: Inject MCEs when restricted injection is active
From: Lai Jiangshan
Date: Sun Sep 22 2024 - 18:02:10 EST
Hello
On Tue, Sep 10, 2024 at 2:06 PM Melody Wang <huibo.wang@xxxxxxx> wrote:
> @@ -5153,7 +5160,7 @@ void sev_snp_cancel_injection(struct kvm_vcpu *vcpu)
>
> /*
> * KVM only injects a single event each time (prepare_hv_injection),
> - * so when events.nmi is true, the vector will be zero
> + * so when events.nmi is true, the mce and vector will be zero
> */
This comment seems ambiguous, and in the following code,
events.nmi/mce/vector appears to be able to be true simultaneously,
rather than being mutually exclusive.
> if (hvdb->events.vector)
> svm->vmcb->control.event_inj |= hvdb->events.vector |
> @@ -5162,6 +5169,9 @@ void sev_snp_cancel_injection(struct kvm_vcpu *vcpu)
> if (hvdb->events.nmi)
> svm->vmcb->control.event_inj |= SVM_EVTINJ_TYPE_NMI;
>
> + if (hvdb->events.mce)
> + svm->vmcb->control.event_inj |= MC_VECTOR | SVM_EVTINJ_TYPE_EXEPT;