Skip to content

Commit b21ea15

Browse files
vittyvkZhengShunQian
authored andcommitted
KVM: lapic: stop advertising DIRECTED_EOI when in-kernel IOAPIC is in use
[ Upstream commit 0bcc3fb ] Devices which use level-triggered interrupts under Windows 2016 with Hyper-V role enabled don't work: Windows disables EOI broadcast in SPIV unconditionally. Our in-kernel IOAPIC implementation emulates an old IOAPIC version which has no EOI register so EOI never happens. The issue was discovered and discussed a while ago: https://www.spinics.net/lists/kvm/msg148098.html While this is a guest OS bug (it should check that IOAPIC has the required capabilities before disabling EOI broadcast) we can workaround it in KVM: advertising DIRECTED_EOI with in-kernel IOAPIC makes little sense anyway. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: Radim Krčmář <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2d3c381 commit b21ea15

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

arch/x86/kvm/lapic.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,16 @@ void kvm_apic_set_version(struct kvm_vcpu *vcpu)
288288
if (!kvm_vcpu_has_lapic(vcpu))
289289
return;
290290

291+
/*
292+
* KVM emulates 82093AA datasheet (with in-kernel IOAPIC implementation)
293+
* which doesn't have EOI register; Some buggy OSes (e.g. Windows with
294+
* Hyper-V role) disable EOI broadcast in lapic not checking for IOAPIC
295+
* version first and level-triggered interrupts never get EOIed in
296+
* IOAPIC.
297+
*/
291298
feat = kvm_find_cpuid_entry(apic->vcpu, 0x1, 0);
292-
if (feat && (feat->ecx & (1 << (X86_FEATURE_X2APIC & 31))))
299+
if (feat && (feat->ecx & (1 << (X86_FEATURE_X2APIC & 31))) &&
300+
!ioapic_in_kernel(vcpu->kvm))
293301
v |= APIC_LVR_DIRECTED_EOI;
294302
apic_set_reg(apic, APIC_LVR, v);
295303
}

0 commit comments

Comments
 (0)