From 1177d38ce1d34d8cf23c6fd1b4320467771d2ee0 Mon Sep 17 00:00:00 2001 From: "Stephen J. Kiernan" Date: Tue, 21 May 2019 13:29:53 +0000 Subject: The older detection methods (smbios.bios.vendor and smbios.system.product) are able to determine some virtual machines, but the vm_guest variable was still only being set to VM_GUEST_VM. Since we do know what some of them specifically are, we can set vm_guest appropriately. Also, if we see the CPUID has the HV flag, but we were unable to find a definitive vendor in the Hypervisor CPUID Information Leaf, fall back to the older detection methods, as they may be able to determine a specific HV type. Add VM_GUEST_PARALLELS value to VM_GUEST for Parallels. Approved by: cem Differential Revision: https://reviews.freebsd.org/D20305 --- sys/kern/subr_param.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'sys/kern/subr_param.c') diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index 6cb8e5d48d2b..92d1066da383 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -146,15 +146,16 @@ SYSCTL_PROC(_kern, OID_AUTO, vm_guest, CTLFLAG_RD | CTLTYPE_STRING, * corresponding enum VM_GUEST members. */ static const char *const vm_guest_sysctl_names[] = { - "none", - "generic", - "xen", - "hv", - "vmware", - "kvm", - "bhyve", - "vbox", - NULL + [VM_GUEST_NO] = "none", + [VM_GUEST_VM] = "generic", + [VM_GUEST_XEN] = "xen", + [VM_GUEST_HV] = "hv", + [VM_GUEST_VMWARE] = "vmware", + [VM_GUEST_KVM] = "kvm", + [VM_GUEST_BHYVE] = "bhyve", + [VM_GUEST_VBOX] = "vbox", + [VM_GUEST_PARALLELS] = "parallels", + [VM_LAST] = NULL }; CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST); -- cgit v1.2.3