summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-11-13 07:39:05 +0000
committerneel <neel@FreeBSD.org>2012-11-13 07:39:05 +0000
commit1a164db277254c1198a5923050a4e403737937c3 (patch)
tree96b9ec5962272d9c843abffb6d4db9b66e04efd3 /sys/amd64
parentf146c1921cfde17a6716187a95a05c21f5e46b94 (diff)
parenta841c9341b2afeabcf32a11c8bd91bbe3346177a (diff)
downloadFreeBSD-src-1a164db277254c1198a5923050a4e403737937c3.zip
FreeBSD-src-1a164db277254c1198a5923050a4e403737937c3.tar.gz
IFC @ r242940
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/identcpu.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c
index 465316a..2517498 100644
--- a/sys/amd64/amd64/identcpu.c
+++ b/sys/amd64/amd64/identcpu.c
@@ -481,7 +481,7 @@ SYSINIT(hook_tsc_freq, SI_SUB_CONFIGURE, SI_ORDER_ANY, hook_tsc_freq, NULL);
void
identify_cpu(void)
{
- u_int regs[4];
+ u_int regs[4], cpu_stdext_disable;
do_cpuid(0, regs);
cpu_high = regs[0];
@@ -516,6 +516,20 @@ identify_cpu(void)
if (cpu_high >= 7) {
cpuid_count(7, 0, regs);
cpu_stdext_feature = regs[1];
+
+ /*
+ * Some hypervisors fail to filter out unsupported
+ * extended features. For now, disable the
+ * extensions, activation of which requires setting a
+ * bit in CR4, and which VM monitors do not support.
+ */
+ if (cpu_feature2 & CPUID2_HV) {
+ cpu_stdext_disable = CPUID_STDEXT_FSGSBASE |
+ CPUID_STDEXT_SMEP;
+ } else
+ cpu_stdext_disable = 0;
+ TUNABLE_INT_FETCH("hw.cpu_stdext_disable", &cpu_stdext_disable);
+ cpu_stdext_feature &= ~cpu_stdext_disable;
}
if (cpu_vendor_id == CPU_VENDOR_INTEL ||
OpenPOWER on IntegriCloud