static inline void __cpuinit detect_hypervisor_vendor(struct cpuinfo_x86 *c) { if (vmware_platform()) { c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE; } else if (kvm_para_available()) { c->x86_hyper_vendor = X86_HYPER_VENDOR_KVM; } else { c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE; } }
unsigned long vmware_get_tsc_khz(void) { unsigned long vm_tsc_khz; BUG_ON(!vmware_platform()); /* Enable "lazy" timer emulation. Rather than holding * back virtual time when timer interrupt delivery falls * behind and attempting to "catch up", in lazy mode, * missed periodic interrupts are skipped and virtual * time always reflects real time. */ vm_tsc_khz = __vmware_get_tsc_khz(); #ifdef CONFIG_X86_64 { extern int timekeeping_use_tsc; if (vm_tsc_khz && timekeeping_use_tsc >= 0) { if (vmware_enable_lazy_timer_emulation()) { timekeeping_use_tsc = 1; /* * Disable softlockups if using TSC based * timekeeping, as this may have false * positives when running under hypervisors. */ nosoftlockup = 1; } else { printk(KERN_WARNING "time.c: failed to enable lazy timer " "emulation. Disabling tsc based " "timekeeping\n"); timekeeping_use_tsc = 0; } } } #else if (vm_tsc_khz) { if (!vmware_enable_lazy_timer_emulation()) printk(KERN_WARNING "time.c: failed to enable lazy timer " "emulation. Disabling tsc based " "timekeeping\n"); } #endif return vm_tsc_khz; }
unsigned long vmware_get_tsc_khz(void) { BUG_ON(!vmware_platform()); return __vmware_get_tsc_khz(); }