Skip to content

Commit 25b69a4

Browse files
vittyvkgregkh
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 982f8f1 commit 25b69a4

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
@@ -321,8 +321,16 @@ void kvm_apic_set_version(struct kvm_vcpu *vcpu)
321321
if (!lapic_in_kernel(vcpu))
322322
return;
323323

324+
/*
325+
* KVM emulates 82093AA datasheet (with in-kernel IOAPIC implementation)
326+
* which doesn't have EOI register; Some buggy OSes (e.g. Windows with
327+
* Hyper-V role) disable EOI broadcast in lapic not checking for IOAPIC
328+
* version first and level-triggered interrupts never get EOIed in
329+
* IOAPIC.
330+
*/
324331
feat = kvm_find_cpuid_entry(apic->vcpu, 0x1, 0);
325-
if (feat && (feat->ecx & (1 << (X86_FEATURE_X2APIC & 31))))
332+
if (feat && (feat->ecx & (1 << (X86_FEATURE_X2APIC & 31))) &&
333+
!ioapic_in_kernel(vcpu->kvm))
326334
v |= APIC_LVR_DIRECTED_EOI;
327335
kvm_lapic_set_reg(apic, APIC_LVR, v);
328336
}

0 commit comments

Comments
 (0)