/* Checks if hypervisor supports x2apic without VT-D interrupt remapping. */ static bool __init vmware_legacy_x2apic_available(void) { uint32_t eax, ebx, ecx, edx; VMWARE_PORT(GETVCPU_INFO, eax, ebx, ecx, edx); return (eax & (1 << VMWARE_PORT_CMD_VCPU_RESERVED)) == 0 && (eax & (1 << VMWARE_PORT_CMD_LEGACY_X2APIC)) != 0; }
static void __init vmware_platform_setup(void) { uint32_t eax, ebx, ecx, edx; uint64_t lpj, tsc_khz; VMWARE_PORT(GETHZ, eax, ebx, ecx, edx); if (ebx != UINT_MAX) { lpj = tsc_khz = eax | (((uint64_t)ebx) << 32); do_div(tsc_khz, 1000); WARN_ON(tsc_khz >> 32); pr_info("TSC freq read from hypervisor : %lu.%03lu MHz\n", (unsigned long) tsc_khz / 1000, (unsigned long) tsc_khz % 1000); if (!preset_lpj) { do_div(lpj, HZ); preset_lpj = lpj; } vmware_tsc_khz = tsc_khz; x86_platform.calibrate_tsc = vmware_get_tsc_khz; x86_platform.calibrate_cpu = vmware_get_tsc_khz; #ifdef CONFIG_X86_LOCAL_APIC /* Skip lapic calibration since we know the bus frequency. */ lapic_timer_frequency = ecx / HZ; pr_info("Host bus clock speed read from hypervisor : %u Hz\n", ecx); #endif } else {
static void __init vmware_platform_setup(void) { uint32_t eax, ebx, ecx, edx; VMWARE_PORT(GETHZ, eax, ebx, ecx, edx); if (ebx != UINT_MAX) x86_platform.calibrate_tsc = vmware_get_tsc_khz; else printk(KERN_WARNING "Failed to get TSC freq from the hypervisor\n"); }
static unsigned long __vmware_get_tsc_khz(void) { uint64_t tsc_hz; uint32_t eax, ebx, ecx, edx; VMWARE_PORT(GETHZ, eax, ebx, ecx, edx); if (ebx == UINT_MAX) return 0; tsc_hz = eax | (((uint64_t)ebx) << 32); do_div(tsc_hz, 1000); BUG_ON(tsc_hz >> 32); return tsc_hz; }
static void __init vmware_platform_setup(void) { uint32_t eax, ebx, ecx, edx; VMWARE_PORT(GETHZ, eax, ebx, ecx, edx); if (ebx != UINT_MAX) x86_platform.calibrate_tsc = vmware_get_tsc_khz; else printk(KERN_WARNING "Failed to get TSC freq from the hypervisor\n"); /* NMI watchdog uses perfctrs, but they are not present. */ nmi_watchdog = NMI_NONE; }
static unsigned long vmware_get_tsc_khz(void) { uint64_t tsc_hz, lpj; uint32_t eax, ebx, ecx, edx; VMWARE_PORT(GETHZ, eax, ebx, ecx, edx); tsc_hz = eax | (((uint64_t)ebx) << 32); do_div(tsc_hz, 1000); BUG_ON(tsc_hz >> 32); printk(KERN_INFO "TSC freq read from hypervisor : %lu.%03lu MHz\n", (unsigned long) tsc_hz / 1000, (unsigned long) tsc_hz % 1000); if (!preset_lpj) { lpj = ((u64)tsc_hz * 1000); do_div(lpj, HZ); preset_lpj = lpj; } return tsc_hz; }
static inline int __vmware_platform(void) { uint32_t eax, ebx, ecx, edx; VMWARE_PORT(GETVERSION, eax, ebx, ecx, edx); return eax != (uint32_t)-1 && ebx == VMWARE_HYPERVISOR_MAGIC; }
static inline int vmware_enable_lazy_timer_emulation(void) { uint32_t eax, ebx, ecx, edx; VMWARE_PORT(LAZYTIMEREMULATION, eax, ebx, ecx, edx); return ebx == VMWARE_HYPERVISOR_MAGIC; }