Bug 224476 - [patch] bhyve: emulate MSR_EXTFEATURES
Summary: [patch] bhyve: emulate MSR_EXTFEATURES
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: Marcelo Araujo
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-12-20 09:25 UTC by Keita Uchida
Modified: 2019-07-12 22:32 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Keita Uchida 2017-12-20 09:25:02 UTC
When I try to boot a vm on AMD FX Series, it hangs. 
The reason probably is that the VM cannot read the register (MSR_EXTFEATURES).


Index: sys/amd64/vmm/amd/svm_msr.c
===================================================================
--- sys/amd64/vmm/amd/svm_msr.c	(revision 327021)
+++ sys/amd64/vmm/amd/svm_msr.c	(working copy)
@@ -125,6 +125,9 @@
 	case MSR_AMDK8_IPM:
 		*result = 0;
 		break;
+	case MSR_EXTFEATURES:
+		*result = 0;
+		break;
 	default:
 		error = EINVAL;
 		break;
@@ -161,6 +164,8 @@
 		 * Ignore writes to microcode update register.
 		 */
 		break;
+	case MSR_EXTFEATURES:
+		break;
 	default:
 		error = EINVAL;
 		break;
Comment 1 commit-hook freebsd_committer freebsd_triage 2018-10-30 10:03:04 UTC
A commit references this bug:

Author: araujo
Date: Tue Oct 30 10:02:24 UTC 2018
New revision: 339911
URL: https://svnweb.freebsd.org/changeset/base/339911

Log:
  Emulate machine check related MSR_EXTFEATURES to allow guest OSes to
  boot on AMD FX Series.

  PR:		224476
  Submitted by:	Keita Uchida <m@jgz.jp>
  Reviewed by:	rgrimes
  Sponsored by:	iXsystems Inc.
  Differential Revision:	https://reviews.freebsd.org/D17713

Changes:
  head/sys/amd64/vmm/amd/svm_msr.c
Comment 2 Marcelo Araujo freebsd_committer freebsd_triage 2018-10-30 10:03:37 UTC
Thanks for the patch!
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-07-12 22:32:08 UTC
A commit references this bug:

Author: jhb
Date: Fri Jul 12 22:31:15 UTC 2019
New revision: 349958
URL: https://svnweb.freebsd.org/changeset/base/349958

Log:
  MFC 339911,339936,343075,343166,348592: Various AMD CPU-specific fixes.

  339911:
  Emulate machine check related MSR_EXTFEATURES to allow guest OSes to
  boot on AMD FX Series.

  339936:
  Merge cases with upper block.
  This is a cosmetic change only to simplify code.

  343075:
  vmm(4): Take steps towards multicore bhyve AMD support

  vmm's CPUID emulation presented Intel topology information to the guest, but
  disabled AMD topology information and in some cases passed through garbage.
  I.e., CPUID leaves 0x8000_001[de] were passed through to the guest, but
  guest CPUs can migrate between host threads, so the information presented
  was not consistent.  This could easily be observed with 'cpucontrol -i 0xfoo
  /dev/cpuctl0'.

  Slightly improve this situation by enabling the AMD topology feature flag
  and presenting at least the CPUID fields used by FreeBSD itself to probe
  topology on more modern AMD64 hardware (Family 15h+).  Older stuff is
  probably less interesting.  I have not been able to empirically confirm it
  is sufficient, but it should not regress anything either.

  343166:
  vmm(4): Mask Spectre feature bits on AMD hosts

  For parity with Intel hosts, which already mask out the CPUID feature
  bits that indicate the presence of the SPEC_CTRL MSR, do the same on
  AMD.

  Eventually we may want to have a better support story for guests, but
  for now, limit the damage of incorrectly indicating an MSR we do not yet
  support.

  Eventually, we may want a generic CPUID override system for
  administrators, or for minimum supported feature set in heterogenous
  environments with failover.  That is a much larger scope effort than
  this bug fix.

  348592:
  Emulate the AMD MSR_LS_CFG MSR used for various Ryzen errata.

  Writes are ignored and reads always return zero.

  PR:		224476, 235010

Changes:
_U  stable/11/
  stable/11/sys/amd64/vmm/amd/svm_msr.c
  stable/11/sys/amd64/vmm/x86.c
  stable/11/sys/amd64/vmm/x86.h
  stable/11/sys/x86/x86/mp_x86.c
  stable/11/usr.sbin/bhyve/xmsr.c
_U  stable/12/
  stable/12/sys/amd64/vmm/amd/svm_msr.c
  stable/12/sys/amd64/vmm/x86.c
  stable/12/sys/amd64/vmm/x86.h
  stable/12/sys/x86/x86/mp_x86.c
  stable/12/usr.sbin/bhyve/xmsr.c