Function set_lapic_and_restore_irr

Source
fn set_lapic_and_restore_irr(
    vm: &KvmVm,
    vcpu: &KvmVcpu,
    state: &LapicState,
) -> Result<()>
Expand description

Restores the Local APIC state and re-signals any pending IRR interrupt vectors via MSI.

On Intel hosts with APICv enabled running older Linux kernels (v4.11 through 6.5.11), KVM_SET_LAPIC clears the hardware Posted Interrupt Request (PIR) descriptor. Re-signaling pending IRR vectors via MSI ensures they are properly populated in both the LAPIC IRR and the hardware PIR descriptor so they are delivered upon guest resume. This function is idempotent on newer kernels. The already set interrupts get set again, which is an idempotent function.