summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorBryan Steele <brynet@cvs.openbsd.org>2018-09-20 14:33:00 +0000
committerBryan Steele <brynet@cvs.openbsd.org>2018-09-20 14:33:00 +0000
commit0872b1ee869baf2b3cf63dee005b7cbb9fc92e7e (patch)
tree04684703fbbf325bd7c3af06e000bd4d3407c243 /sys/arch/amd64
parent7bd5f33b39a54be9e058b13da81443d072f50f72 (diff)
vmm(4): Clear the guest MWAITX/MONITORX extended CPUID feature bit,
like we already do for MWAIT/MONITOR. Also match Intel here by not exposing the SVM capability to AMD guests. Allows Linux guests to boot in vmd(8) on Ryzen CPUs. ok mlarkin@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/vmm.c4
-rw-r--r--sys/arch/amd64/include/vmmvar.h7
2 files changed, 6 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 34c5651a021..266a5333e56 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.219 2018/08/21 19:04:38 deraadt Exp $ */
+/* $OpenBSD: vmm.c,v 1.220 2018/09/20 14:32:59 brynet Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -6146,7 +6146,7 @@ vmm_handle_cpuid(struct vcpu *vcpu)
case 0x80000001: /* Extended function info */
*rax = curcpu()->ci_efeature_eax;
*rbx = 0; /* Reserved */
- *rcx = curcpu()->ci_efeature_ecx;
+ *rcx = curcpu()->ci_efeature_ecx & VMM_ECPUIDECX_MASK;
*rdx = curcpu()->ci_feature_eflags & VMM_FEAT_EFLAGS_MASK;
break;
case 0x80000002: /* Brand string */
diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h
index fcbbb987cd6..812e660f5f2 100644
--- a/sys/arch/amd64/include/vmmvar.h
+++ b/sys/arch/amd64/include/vmmvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmmvar.h,v 1.58 2018/08/21 19:04:40 deraadt Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.59 2018/09/20 14:32:59 brynet Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -548,8 +548,8 @@ struct vm_rwregs_params {
/*
* clone host capabilities minus:
* debug store (CPUIDECX_DTES64, CPUIDECX_DSCPL, CPUID_DS)
- * monitor/mwait (CPUIDECX_MWAIT)
- * vmx (CPUIDECX_VMX)
+ * monitor/mwait (CPUIDECX_MWAIT, CPUIDECX_MWAITX)
+ * vmx/svm (CPUIDECX_VMX, CPUIDECX_SVM)
* smx (CPUIDECX_SMX)
* speedstep (CPUIDECX_EST)
* thermal (CPUIDECX_TM2, CPUID_ACPI, CPUID_TM)
@@ -573,6 +573,7 @@ struct vm_rwregs_params {
CPUIDECX_DSCPL | CPUIDECX_SMX | CPUIDECX_CNXTID | \
CPUIDECX_SDBG | CPUIDECX_XTPR | CPUIDECX_PCID | \
CPUIDECX_DCA | CPUIDECX_X2APIC | CPUIDECX_DEADLINE)
+#define VMM_ECPUIDECX_MASK ~(CPUIDECX_SVM | CPUIDECX_MWAITX)
#define VMM_CPUIDEDX_MASK ~(CPUID_ACPI | CPUID_TM | \
CPUID_HTT | CPUID_DS | CPUID_APIC | \
CPUID_PSN | CPUID_SS | CPUID_PBE | \