Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2017 04:02:14 +0000 (UTC)
From:      Marcelo Araujo <araujo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319678 - in head/sys: kern sys x86/x86
Message-ID:  <201706080402.v5842E46067943@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: araujo
Date: Thu Jun  8 04:02:14 2017
New Revision: 319678
URL: https://svnweb.freebsd.org/changeset/base/319678

Log:
  Allow sysctl kern.vm_guest to return bhyve when running under bhyve.
  
  Submitted by:	Sean Fagan <sef@ixsystems.com>
  Reviewed by:	grehan
  MFH:		4 weeks.
  Sponsored by:	iXsystems, Inc.
  Differential Revision:	https://reviews.freebsd.org/D11090

Modified:
  head/sys/kern/subr_param.c
  head/sys/sys/systm.h
  head/sys/x86/x86/identcpu.c

Modified: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c	Thu Jun  8 03:51:17 2017	(r319677)
+++ head/sys/kern/subr_param.c	Thu Jun  8 04:02:14 2017	(r319678)
@@ -149,6 +149,7 @@ static const char *const vm_guest_sysctl_names[] = {
 	"hv",
 	"vmware",
 	"kvm",
+	"bhyve",
 	NULL
 };
 CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST);

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Thu Jun  8 03:51:17 2017	(r319677)
+++ head/sys/sys/systm.h	Thu Jun  8 04:02:14 2017	(r319678)
@@ -76,7 +76,7 @@ extern int vm_guest;		/* Running as virtual machine gu
  * Keep in sync with vm_guest_sysctl_names[].
  */
 enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV,
-		VM_GUEST_VMWARE, VM_GUEST_KVM, VM_LAST };
+		VM_GUEST_VMWARE, VM_GUEST_KVM, VM_GUEST_BHYVE, VM_LAST };
 
 #if defined(WITNESS) || defined(INVARIANT_SUPPORT)
 void	kassert_panic(const char *fmt, ...)  __printflike(1, 2);

Modified: head/sys/x86/x86/identcpu.c
==============================================================================
--- head/sys/x86/x86/identcpu.c	Thu Jun  8 03:51:17 2017	(r319677)
+++ head/sys/x86/x86/identcpu.c	Thu Jun  8 04:02:14 2017	(r319678)
@@ -1282,6 +1282,8 @@ identify_hypervisor(void)
 				vm_guest = VM_GUEST_HV;
 			else if (strcmp(hv_vendor, "KVMKVMKVM") == 0)
 				vm_guest = VM_GUEST_KVM;
+			else if (strcmp(hv_vendor, "bhyve bhyve") == 0)
+				vm_guest = VM_GUEST_BHYVE;
 		}
 		return;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706080402.v5842E46067943>