From: brynet Date: Thu, 20 Sep 2018 14:32:59 +0000 (+0000) Subject: vmm(4): Clear the guest MWAITX/MONITORX extended CPUID feature bit, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=927beb9ef36d476c345f2bc76ff4380453aa6c03;p=openbsd 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@ --- 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 * @@ -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 * @@ -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 | \