Re: [PATCH v2 8/9] KVM: x86: lapic does not have to process INIT if it is blocked

From: Paolo Bonzini
Date: Wed Aug 17 2022 - 11:33:36 EST


On 8/17/22 16:11, Maxim Levitsky wrote:

While reviwing this, I noticed that we have this code:


static bool svm_apic_init_signal_blocked(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);

/*
* TODO: Last condition latch INIT signals on vCPU when
* vCPU is in guest-mode and vmcb12 defines intercept on INIT.
* To properly emulate the INIT intercept,
* svm_check_nested_events() should call nested_svm_vmexit()
* if an INIT signal is pending.
*/
return !gif_set(svm) ||
(vmcb_is_intercept(&svm->vmcb->control, INTERCEPT_INIT));
}

Is this workaround still needed? svm_check_nested_events does check
the apic's INIT/SIPI status.

Currently the '.apic_init_signal_blocked' is called from
kvm_vcpu_latch_init which itself is currently called from
kvm_vcpu_latch_init which happens after we would vmexit if INIT is
intercepted by nested hypervisor.
No, it shouldn't be needed anymore.

Paolo