Commit fd980feb authored by Colin Percival's avatar Colin Percival
Browse files

Detect CPU type before asking VMWare for TSC freq

This allows us to set tsc_is_invariant and select appropriately
fenced versions of RDTSC based on the CPU type.

Reviewed by:	markj
Sponsored by:	https://www.patreon.com/cperciva
parent a727d953
......@@ -134,7 +134,6 @@ tsc_freq_vmware(void)
if (regs[1] != UINT_MAX)
tsc_freq = regs[0] | ((uint64_t)regs[1] << 32);
}
tsc_is_invariant = 1;
tsc_early_calib_exact = 1;
}
......@@ -268,11 +267,6 @@ probe_tsc_freq(void)
tsc_perf_stat = 1;
}
if (vm_guest == VM_GUEST_VMWARE) {
tsc_freq_vmware();
return;
}
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:
case CPU_VENDOR_HYGON:
......@@ -311,6 +305,11 @@ probe_tsc_freq(void)
break;
}
if (vm_guest == VM_GUEST_VMWARE) {
tsc_freq_vmware();
return;
}
if (tsc_freq_cpuid(&tsc_freq)) {
/*
* If possible, use the value obtained from CPUID as the initial
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment