x86: gate smbios hypervisor identification behind vm_guest

cpuid detection may have picked up a more specific guest type already,
and a follow-up check of smbios vendor/product may erroneously blow
away the previously detected type.

This reportedly fixes the boot under Hyper-V, which advertises an
smbios.system.product of "Virtual Machine."

PR:		270239
Reviewed by:	imp, kib (both earlier version, same concept)
Fixes:	2fee875629 ("abstract out the vm detection via smbios..")
Differential Revision:	https://reviews.freebsd.org/D39140
This commit is contained in:
Kyle Evans 2023-03-16 14:26:28 -05:00
parent 896516e54a
commit f7a884cb01

View file

@ -69,6 +69,14 @@ identify_hypervisor_smbios(void)
char *p;
int i;
/*
* Some platforms, e.g., amd64, have other ways of detecting what kind
* of hypervisor we may be running under. Make sure we don't clobber a
* more specific vm_guest that's been previously detected.
*/
if (vm_guest != VM_GUEST_NO && vm_guest != VM_GUEST_VM)
return;
/*
* XXX: Some of these entries may not be needed since they were
* added to FreeBSD before the checks above.