aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2023-03-16 19:26:28 +0000
committerKyle Evans <kevans@FreeBSD.org>2023-03-17 05:54:32 +0000
commitf7a884cb017f6618ae872f8d52e80a147daf3f59 (patch)
tree1671f2b815b58e2914937ed4842245f39dc382f4
parent896516e54a8c39c1c8be3ad918f38fbf196b57ed (diff)
downloadsrc-f7a884cb017f6618ae872f8d52e80a147daf3f59.tar.gz
src-f7a884cb017f6618ae872f8d52e80a147daf3f59.zip
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: 2fee87562948 ("abstract out the vm detection via smbios..") Differential Revision: https://reviews.freebsd.org/D39140
-rw-r--r--sys/dev/smbios/smbios_subr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/smbios/smbios_subr.c b/sys/dev/smbios/smbios_subr.c
index c28bf0e4983f..4e30751cd716 100644
--- a/sys/dev/smbios/smbios_subr.c
+++ b/sys/dev/smbios/smbios_subr.c
@@ -70,6 +70,14 @@ identify_hypervisor_smbios(void)
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.
*/