Messages in this thread |  | | Date | Tue, 28 Apr 2026 10:58:45 -0700 | | Subject | Re: [PATCH v4 3/7] KVM: SVM: Inject #HV when Restricted Injection is active | | From | Melody Wang <> |
| |
Hi Joerg,
On 4/28/26 4:12 AM, Joerg Rodel wrote: > On Fri, Apr 24, 2026 at 05:42:07PM +0000, Melody Wang wrote: >> +void sev_snp_cancel_injection(struct kvm_vcpu *vcpu) >> +{ >> + struct vcpu_svm *svm = to_svm(vcpu); >> + struct kvm_host_map hvdb_map; >> + struct hvdb *hvdb; >> + >> + if (!sev_snp_is_rinj_active(vcpu)) >> + return; >> + >> + if (!svm->vmcb->control.event_inj) >> + return; >> + >> + if (WARN_ONCE((svm->vmcb->control.event_inj & SVM_EVTINJ_VEC_MASK) != HV_VECTOR, >> + "Restricted Injection enabled, %u vector not supported\n", >> + svm->vmcb->control.event_inj & SVM_EVTINJ_VEC_MASK)) >> + return; >> + >> + /* >> + * Copy the information in the doorbell page into the event injection >> + * fields to complete the cancellation flow. >> + */ >> + hvdb = map_hvdb(vcpu, &hvdb_map); >> + if (!hvdb) >> + return; >> + >> + if (!hvdb->events.pending_events) { >> + /* No pending events, then event_inj field should be 0 */ >> + WARN_ON_ONCE(svm->vmcb->control.event_inj); >> + goto out; >> + } >> + >> + /* Copy info back into event_inj field (replaces #HV) */ >> + svm->vmcb->control.event_inj = SVM_EVTINJ_VALID; >> + >> + if (hvdb->events.vector) >> + svm->vmcb->control.event_inj |= hvdb->events.vector | >> + SVM_EVTINJ_TYPE_INTR; >> + >> + hvdb->events.pending_events = 0; > > Does this also need to clear no_further_signal?
Yes, the no_further_signal is a bit in pending_events so it is getting cleared already. :)
Thanks, Melody > > -Joerg
-- Thanks, Melody
|  |