summaryrefslogtreecommitdiffstats
path: root/sys/amd64/vmm
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2014-10-17 03:04:38 +0000
committerneel <neel@FreeBSD.org>2014-10-17 03:04:38 +0000
commitb194fc5a2b8dd89544329e2aaa9569f23c24b990 (patch)
tree114478797f2adac781c8ea176c9929af8edd737b /sys/amd64/vmm
parent7108d4bd756dc60f02abfc957c668af4820022cc (diff)
downloadFreeBSD-src-b194fc5a2b8dd89544329e2aaa9569f23c24b990.zip
FreeBSD-src-b194fc5a2b8dd89544329e2aaa9569f23c24b990.tar.gz
Hide extended PerfCtr MSRs on AMD processors by clearing bits 23, 24 and 28 in
CPUID.80000001H:ECX. Handle accesses to PerfCtrX and PerfEvtSelX MSRs by ignoring writes and returning 0 on reads. This further reduces the number of unimplemented MSRs hit by a Linux guest during boot.
Diffstat (limited to 'sys/amd64/vmm')
-rw-r--r--sys/amd64/vmm/x86.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index 9140805..3c5ca19 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -159,6 +159,14 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id,
regs[2] &= ~(AMDID2_SVM | AMDID2_TOPOLOGY);
/*
+ * Don't advertise extended performance counter MSRs
+ * to the guest.
+ */
+ regs[2] &= ~AMDID2_PCXC;
+ regs[2] &= ~AMDID2_PNXC;
+ regs[2] &= ~AMDID2_PTSCEL2I;
+
+ /*
* Hide rdtscp/ia32_tsc_aux until we know how
* to deal with them.
*/
OpenPOWER on IntegriCloud