From 3da443021fdbd2141faf7651fb8433c80d316d7f Mon Sep 17 00:00:00 2001 From: Peter Grehan Date: Thu, 16 Mar 2017 03:21:42 +0000 Subject: [PATCH] Hide the AMD MONITORX/MWAITX capability. Otherwise, recent Linux guests will use these instructions, resulting in #UD exceptions since bhyve doesn't implement MONITOR/MWAIT exits. This fixes boot-time hangs in recent Linux guests on Ryzen CPUs (and probably Bulldozer aka AMD FX as well). Reviewed by: kib MFC after: 1 week --- sys/amd64/vmm/x86.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c index 525e1d9b912f..61d99d502ac2 100644 --- a/sys/amd64/vmm/x86.c +++ b/sys/amd64/vmm/x86.c @@ -176,6 +176,9 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, /* Don't advertise the OS visible workaround feature */ regs[2] &= ~AMDID2_OSVW; + /* Hide mwaitx/monitorx capability from the guest */ + regs[2] &= ~AMDID2_MWAITX; + /* * Hide rdtscp/ia32_tsc_aux until we know how * to deal with them.