Page MenuHomeFreeBSD

bhyve: implement rdmsr for MSR_IA32_FEATURE_CONTROL
ClosedPublic

Authored by c.koehne_beckhoff.com on Apr 9 2021, 5:42 AM.

Details

Summary

Windows guest crashes on boot. It's caused by rdmsr to MSR_IA32_FEATURE_CONTROL. Windows checks this MSR to determine enabled VMX features. Bhyve hasn't implement it yet. For that reason, bhyve injects a GP which causes Windows to crash.
This patch returns MSR_IA32_FEATURE_CONTROL with Lock Bit set and VMX disabled to tell Windows that VMX isn't available.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

c.koehne_beckhoff.com edited the summary of this revision. (Show Details)
c.koehne_beckhoff.com retitled this revision from bhyve: fix crash of rdmsr from windows guests to bhyve: implement rdmsr for MSR_IA32_FEATURE_CONTROL.Apr 9 2021, 5:45 AM
jlduran_gmail.com added inline comments.
usr.sbin/bhyve/xmsr.c
132

I guess machine/specialreg.h already defines IA32_FEATURE_CONTROL_LOCK?

  • Use IA32_FEATURE_CONTROL_LOCK define

This looks ok to me with the tweaked comment. Does this permit Windows guests to boot without -w?

usr.sbin/bhyve/xmsr.c
128–130

I'm able to boot a Windows guest without -w by applying this patch.

grehan added a subscriber: grehan.

Looks fine, and preserves #GP on writes.

This revision is now accepted and ready to land.Apr 13 2021, 7:51 AM

Do you have this already staged as a git commit in a tree Peter or I could pull from?