summaryrefslogtreecommitdiffstats
path: root/sys/amd64/vmm/x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/amd64/vmm/x86.c')
-rw-r--r--sys/amd64/vmm/x86.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index 13eaaad..fa2eabc 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/cpuset.h>
+#include <machine/clock.h>
#include <machine/cpufunc.h>
#include <machine/md_var.h>
#include <machine/specialreg.h>
@@ -89,11 +90,27 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id,
case CPUID_8000_0003:
case CPUID_8000_0004:
case CPUID_8000_0006:
- case CPUID_8000_0007:
case CPUID_8000_0008:
cpuid_count(*eax, *ecx, regs);
break;
+ case CPUID_8000_0007:
+ cpuid_count(*eax, *ecx, regs);
+ /*
+ * If the host TSCs are not synchronized across
+ * physical cpus then we cannot advertise an
+ * invariant tsc to a vcpu.
+ *
+ * XXX This still falls short because the vcpu
+ * can observe the TSC moving backwards as it
+ * migrates across physical cpus. But at least
+ * it should discourage the guest from using the
+ * TSC to keep track of time.
+ */
+ if (!smp_tsc)
+ regs[3] &= ~AMDPM_TSC_INVARIANT;
+ break;
+
case CPUID_0000_0001:
do_cpuid(1, regs);
OpenPOWER on IntegriCloud