[PATCH v3 1/3] KVM: VMX: Update EOI bitmaps even if APICv is (temporarily) inhibited

From: Sean Christopherson

Date: Tue Oct 27 2026 - 18:32:06 EST


As KVM does with IRTEs for device posted interrupts, update the EOI bitmaps
if APICv *can* be enabled for the vCPU, not just if APICv is *currently*
enabled and active. I.e. keep the bitmaps up-to-date at all times so that
KVM doesn't need to refresh the bitmaps if APICv is unhibited in the future.

In the worst case scenario, failure to update the EOI bitmaps means KVM
could miss an EOI and effectively break level-triggered IRQs, e.g. if a GSI
routing change occurred while APICv was inhibitied.

Reported-by: Sashiko Bot <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/sashiko-outbox-180887@xxxxxxxxxx
Fixes: d62caabb41f3 ("kvm/x86: per-vcpu apicv deactivation support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/vmx/vmx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index b341af4c6057..d8e66d67138f 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7079,7 +7079,7 @@ int vmx_sync_pir_to_irr(struct kvm_vcpu *vcpu)

void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
{
- if (!kvm_vcpu_apicv_active(vcpu))
+ if (!lapic_in_kernel(vcpu) || !enable_apicv)
return;

vmcs_write64(EOI_EXIT_BITMAP0, eoi_exit_bitmap[0]);
--
2.56.0.307.g5fe7bd680c-goog