mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 03:12:27 +00:00
As mentioned in the KVM documentation, TSC_DEADLINE_TIMER feature needs some special checks to validate that it is supported as the cpuid will always report it as disabled. We need to use the KVM_CHECK_EXTENSION ioctl to request the value of KVM_CAP_TSC_DEADLINE_TIMER. In case it is supported through the local APIC emulation provided by the CREATE_IRQCHIP in KVM, we have to set manually this feature by patching the cpuid. Here quoted from the KVM documentation: ``` The TSC deadline timer feature (CPUID leaf 1, ecx[24]) is always returned as false, since the feature depends on KVM_CREATE_IRQCHIP for local APIC support. Instead it is reported via ioctl(KVM_CHECK_EXTENSION, KVM_CAP_TSC_DEADLINE_TIMER) if that returns true and you use KVM_CREATE_IRQCHIP, or if you emulate the feature in userspace, then you can enable the feature for KVM_SET_CPUID2. ``` This patch implements the behavior described above, and this allows the VMM to remove the emulated Programmable Interval Timer (PIT) when the TSC_DEADLINE_TIMER feature can be enabled. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>