aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Grehan <grehan@FreeBSD.org>2020-05-18 07:06:35 +0000
committerPeter Grehan <grehan@FreeBSD.org>2020-05-18 07:06:35 +0000
commitb3ba39776441fc8097776c665a508bd992d81449 (patch)
tree7ebe936b15c356b747f52936f79a73a35934b101
parentc056b412992d519104c7da1c83a59e552cbc31ca (diff)
downloadsrc-b3ba39776441fc8097776c665a508bd992d81449.tar.gz
src-b3ba39776441fc8097776c665a508bd992d81449.zip
MFS r361132
Hide host CPUID 0x15 TSC/Crystal ratio/freq info from guest Approved by: re (kib), bz (mentor)
Notes
Notes: svn path=/releng/11.4/; revision=361151
-rw-r--r--sys/amd64/vmm/x86.c12
-rw-r--r--sys/amd64/vmm/x86.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index 860e6b33ca33..2f09afd6bf44 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -554,6 +554,18 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id,
}
break;
+ case CPUID_0000_0015:
+ /*
+ * Don't report CPU TSC/Crystal ratio and clock
+ * values since guests may use these to derive the
+ * local APIC frequency..
+ */
+ regs[0] = 0;
+ regs[1] = 0;
+ regs[2] = 0;
+ regs[3] = 0;
+ break;
+
case 0x40000000:
regs[0] = CPUID_VM_HIGH;
bcopy(bhyve_id, &regs[1], 4);
diff --git a/sys/amd64/vmm/x86.h b/sys/amd64/vmm/x86.h
index 618189c80b35..a0d3b2085ec3 100644
--- a/sys/amd64/vmm/x86.h
+++ b/sys/amd64/vmm/x86.h
@@ -39,6 +39,7 @@
#define CPUID_0000_000A (0xA)
#define CPUID_0000_000B (0xB)
#define CPUID_0000_000D (0xD)
+#define CPUID_0000_0015 (0x15)
#define CPUID_8000_0000 (0x80000000)
#define CPUID_8000_0001 (0x80000001)
#define CPUID_8000_0002 (0x80000002)