FreeBSD/src dab3834 (r349958)sys/amd64/vmm x86.c x86.h, sys/amd64/vmm/amd svm_msr.c

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
DeltaFile
+119-36sys/amd64/vmm/x86.c
+3-2sys/amd64/vmm/amd/svm_msr.c
+2-0sys/amd64/vmm/x86.h
+2-0usr.sbin/bhyve/xmsr.c
+1-0sys/x86/x86/mp_x86.c
+127-385 files

UnifiedSplitRaw

FreeBSD/src 86b9bb7 (r349958)sys/amd64/vmm x86.c x86.h, sys/amd64/vmm/amd svm_msr.c

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
DeltaFile
+119-36sys/amd64/vmm/x86.c
+3-2sys/amd64/vmm/amd/svm_msr.c
+2-0sys/amd64/vmm/x86.h
+2-0usr.sbin/bhyve/xmsr.c
+1-0sys/x86/x86/mp_x86.c
+127-385 files

UnifiedSplitRaw