Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2011 04:03:11 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r221942 - in projects/bhyve: lib lib/libvmmapi share/mk usr.sbin usr.sbin/bhyve usr.sbin/vmmctl
Message-ID:  <201105150403.p4F43BfO025281@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Sun May 15 04:03:11 2011
New Revision: 221942
URL: http://svn.freebsd.org/changeset/base/221942

Log:
  First cut to port bhyve, vmmctl, and libvmmapi to HEAD.

Added:
  projects/bhyve/lib/libvmmapi/
     - copied from r221828, projects/bhyve_ref/lib/libvmmapi/
  projects/bhyve/usr.sbin/bhyve/
     - copied from r221828, projects/bhyve_ref/usr.sbin/bhyve/
  projects/bhyve/usr.sbin/vmmctl/
     - copied from r221828, projects/bhyve_ref/usr.sbin/vmmctl/
Modified:
  projects/bhyve/lib/Makefile
  projects/bhyve/lib/libvmmapi/Makefile
  projects/bhyve/lib/libvmmapi/mptable.c
  projects/bhyve/lib/libvmmapi/vmmapi.c
  projects/bhyve/share/mk/bsd.libnames.mk
  projects/bhyve/usr.sbin/Makefile.amd64
  projects/bhyve/usr.sbin/bhyve/Makefile
  projects/bhyve/usr.sbin/bhyve/dbgport.c
  projects/bhyve/usr.sbin/bhyve/fbsdrun.c
  projects/bhyve/usr.sbin/bhyve/inout.h
  projects/bhyve/usr.sbin/bhyve/pci_emul.c
  projects/bhyve/usr.sbin/bhyve/xmsr.c
  projects/bhyve/usr.sbin/vmmctl/Makefile
  projects/bhyve/usr.sbin/vmmctl/vmmctl.c

Modified: projects/bhyve/lib/Makefile
==============================================================================
--- projects/bhyve/lib/Makefile	Sun May 15 02:21:39 2011	(r221941)
+++ projects/bhyve/lib/Makefile	Sun May 15 04:03:11 2011	(r221942)
@@ -110,6 +110,7 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	${_libusbhid} \
 	${_libusb} \
 	${_libvgl} \
+	${_libvmmapi} \
 	libwrap \
 	liby \
 	libz \
@@ -197,6 +198,7 @@ _libsmb=	libsmb
 .if ${MK_NCP} != "no"
 _libncp=	libncp
 .endif
+_libvmmapi=	libvmmapi
 .endif
 
 .if ${MACHINE_CPUARCH} == "powerpc"

Modified: projects/bhyve/lib/libvmmapi/Makefile
==============================================================================
--- projects/bhyve_ref/lib/libvmmapi/Makefile	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/lib/libvmmapi/Makefile	Sun May 15 04:03:11 2011	(r221942)
@@ -4,6 +4,8 @@ LIB=	vmmapi
 SRCS=	vmmapi.c vmmapi_freebsd.c mptable.c
 INCS=	vmmapi.h
 
+WARNS?=	2
+
 CFLAGS+= -I${.CURDIR}
 
 .include <bsd.lib.mk>

Modified: projects/bhyve/lib/libvmmapi/mptable.c
==============================================================================
--- projects/bhyve_ref/lib/libvmmapi/mptable.c	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/lib/libvmmapi/mptable.c	Sun May 15 04:03:11 2011	(r221942)
@@ -118,6 +118,7 @@ mp_build_bus_entries(struct mpe_bus *mpe
 
 }
 
+#ifdef notyet
 static void
 mp_build_ioapic_entries(struct mpe_ioapic *mpei)
 {
@@ -280,6 +281,7 @@ mptable_dump(struct mp_floating_pointer 
 
 	}
 }
+#endif
 
 int
 vm_build_mptable(struct vmctx *ctx, vm_paddr_t gpa, int len, int ncpu,

Modified: projects/bhyve/lib/libvmmapi/vmmapi.c
==============================================================================
--- projects/bhyve_ref/lib/libvmmapi/vmmapi.c	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/lib/libvmmapi/vmmapi.c	Sun May 15 04:03:11 2011	(r221942)
@@ -478,8 +478,6 @@ vm_get_stats(struct vmctx *ctx, int vcpu
 const char *
 vm_get_stat_desc(struct vmctx *ctx, int index)
 {
-	int error;
-
 	static struct vm_stat_desc statdesc;
 
 	statdesc.index = index;

Modified: projects/bhyve/share/mk/bsd.libnames.mk
==============================================================================
--- projects/bhyve/share/mk/bsd.libnames.mk	Sun May 15 02:21:39 2011	(r221941)
+++ projects/bhyve/share/mk/bsd.libnames.mk	Sun May 15 04:03:11 2011	(r221942)
@@ -160,6 +160,7 @@ LIBULOG?=	${DESTDIR}${LIBDIR}/libulog.a
 LIBUTIL?=	${DESTDIR}${LIBDIR}/libutil.a
 LIBUUTIL?=	${DESTDIR}${LIBDIR}/libuutil.a
 LIBVGL?=	${DESTDIR}${LIBDIR}/libvgl.a
+LIBVMMAPI?=	${DESTDIR}${LIBDIR}/libvmmapi.a
 LIBWRAP?=	${DESTDIR}${LIBDIR}/libwrap.a
 LIBXPG4?=	${DESTDIR}${LIBDIR}/libxpg4.a
 LIBY?=		${DESTDIR}${LIBDIR}/liby.a

Modified: projects/bhyve/usr.sbin/Makefile.amd64
==============================================================================
--- projects/bhyve/usr.sbin/Makefile.amd64	Sun May 15 02:21:39 2011	(r221941)
+++ projects/bhyve/usr.sbin/Makefile.amd64	Sun May 15 04:03:11 2011	(r221942)
@@ -10,6 +10,7 @@ SUBDIR+=	acpi
 SUBDIR+=	apm
 .endif
 SUBDIR+=	asf
+SUBDIR+=	bhyve
 SUBDIR+=	boot0cfg
 .if ${MK_TOOLCHAIN} != "no"
 SUBDIR+=	btxld
@@ -30,4 +31,5 @@ SUBDIR+=	spkrtest
 .if ${MK_SYSINSTALL} != "no"
 SUBDIR+=	sade
 .endif
+SUBDIR+=	vmmctl
 SUBDIR+=	zzz

Modified: projects/bhyve/usr.sbin/bhyve/Makefile
==============================================================================
--- projects/bhyve_ref/usr.sbin/bhyve/Makefile	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/usr.sbin/bhyve/Makefile	Sun May 15 04:03:11 2011	(r221942)
@@ -13,6 +13,8 @@ NO_MAN=
 DPADD=	${LIBVMMAPI} ${LIBMD} ${LIBPTHREAD}
 LDADD=	-lvmmapi -lmd -lpthread
 
+WARNS?=	2
+
 CFLAGS+= -I${.CURDIR}/../../sys
 
 .include <bsd.prog.mk>

Modified: projects/bhyve/usr.sbin/bhyve/dbgport.c
==============================================================================
--- projects/bhyve_ref/usr.sbin/bhyve/dbgport.c	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/usr.sbin/bhyve/dbgport.c	Sun May 15 04:03:11 2011	(r221942)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include <errno.h>
 
 #include "inout.h"
+#include "dbgport.h"
 
 #define	BVM_DBG_PORT	0x224
 

Modified: projects/bhyve/usr.sbin/bhyve/fbsdrun.c
==============================================================================
--- projects/bhyve_ref/usr.sbin/bhyve/fbsdrun.c	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/usr.sbin/bhyve/fbsdrun.c	Sun May 15 04:03:11 2011	(r221942)
@@ -185,7 +185,7 @@ fbsdrun_muxed(void)
 	return (guest_vcpu_mux);
 }
 
-void *
+static void *
 fbsdrun_start_thread(void *param)
 {
 	int vcpu;
@@ -240,20 +240,20 @@ fbsdrun_get_next_cpu(int curcpu)
 	return ((curcpu + 1) % foundcpus);
 }
 
-int
+static int
 vmexit_catch_reset(void)
 {
         stats.io_reset++;
         return (VMEXIT_RESET);
 }
 
-int
+static int
 vmexit_catch_inout(void)
 {
 	return (VMEXIT_ABORT);
 }
 
-int
+static int
 vmexit_handle_notify(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu,
 		     uint32_t eax)
 {

Modified: projects/bhyve/usr.sbin/bhyve/inout.h
==============================================================================
--- projects/bhyve_ref/usr.sbin/bhyve/inout.h	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/usr.sbin/bhyve/inout.h	Sun May 15 04:03:11 2011	(r221942)
@@ -52,7 +52,8 @@ struct inout_port {
 		#name,							\
 		(port),							\
 		(flags),						\
-		(handler)						\
+		(handler),						\
+		0							\
 	};								\
 	DATA_SET(inout_port_set, __CONCAT(__inout_port, __LINE__))
 	

Modified: projects/bhyve/usr.sbin/bhyve/pci_emul.c
==============================================================================
--- projects/bhyve_ref/usr.sbin/bhyve/pci_emul.c	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/usr.sbin/bhyve/pci_emul.c	Sun May 15 04:03:11 2011	(r221942)
@@ -887,7 +887,7 @@ struct pci_emul_dsoftc {
 
 #define	PCI_EMUL_MSGS	4
 
-int
+static int
 pci_emul_dinit(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
 {
 	int error;
@@ -911,7 +911,7 @@ pci_emul_dinit(struct vmctx *ctx, struct
 	return (0);
 }
 
-void
+static void
 pci_emul_diow(struct pci_devinst *pi, int baridx, int offset, int size,
 	      uint32_t value)
 {
@@ -943,7 +943,7 @@ pci_emul_diow(struct pci_devinst *pi, in
 	}
 }
 
-uint32_t
+static uint32_t
 pci_emul_dior(struct pci_devinst *pi, int baridx, int offset, int size)
 {
 	struct pci_emul_dsoftc *sc = pi->pi_arg;

Modified: projects/bhyve/usr.sbin/bhyve/xmsr.c
==============================================================================
--- projects/bhyve_ref/usr.sbin/bhyve/xmsr.c	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/usr.sbin/bhyve/xmsr.c	Sun May 15 04:03:11 2011	(r221942)
@@ -30,7 +30,7 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
-#include <machine/apicreg.h>
+#include <x86/apicreg.h>
 
 #include <assert.h>
 #include <stdio.h>

Modified: projects/bhyve/usr.sbin/vmmctl/Makefile
==============================================================================
--- projects/bhyve_ref/usr.sbin/vmmctl/Makefile	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/usr.sbin/vmmctl/Makefile	Sun May 15 04:03:11 2011	(r221942)
@@ -10,6 +10,8 @@ NO_MAN=
 DPADD=	${LIBVMMAPI}
 LDADD=	-lvmmapi
 
+WARNS?=	3
+
 CFLAGS+= -I${.CURDIR}/../../sys/amd64/vmm
 
 .include <bsd.prog.mk>

Modified: projects/bhyve/usr.sbin/vmmctl/vmmctl.c
==============================================================================
--- projects/bhyve_ref/usr.sbin/vmmctl/vmmctl.c	Fri May 13 04:54:01 2011	(r221828)
+++ projects/bhyve/usr.sbin/vmmctl/vmmctl.c	Sun May 15 04:03:11 2011	(r221942)
@@ -382,7 +382,7 @@ main(int argc, char *argv[])
 	vm_paddr_t hpa;
 	size_t len;
 	struct vm_exit vmexit;
-	uint64_t ctl, eptp, bm, tsc_off, addr, u64;
+	uint64_t ctl, eptp, bm, addr, u64;
 	struct vmctx *ctx;
 
 	uint64_t cr0, cr3, cr4, dr7, rsp, rip, rflags, efer, pat;
@@ -1128,21 +1128,21 @@ main(int argc, char *argv[])
 	if (!error && get_pinbased_ctls) {
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_PIN_BASED_CTLS, &ctl);
 		if (error == 0)
-			printf("pinbased_ctls[%d]\t0x%08x\n", vcpu, ctl);
+			printf("pinbased_ctls[%d]\t0x%08lx\n", vcpu, ctl);
 	}
 
 	if (!error && get_procbased_ctls) {
 		error = vm_get_vmcs_field(ctx, vcpu,
 					  VMCS_PRI_PROC_BASED_CTLS, &ctl);
 		if (error == 0)
-			printf("procbased_ctls[%d]\t0x%08x\n", vcpu, ctl);
+			printf("procbased_ctls[%d]\t0x%08lx\n", vcpu, ctl);
 	}
 
 	if (!error && get_procbased_ctls2) {
 		error = vm_get_vmcs_field(ctx, vcpu,
 					  VMCS_SEC_PROC_BASED_CTLS, &ctl);
 		if (error == 0)
-			printf("procbased_ctls2[%d]\t0x%08x\n", vcpu, ctl);
+			printf("procbased_ctls2[%d]\t0x%08lx\n", vcpu, ctl);
 	}
 
 	if (!error && get_vmcs_gla) {
@@ -1162,7 +1162,7 @@ main(int argc, char *argv[])
 	if (!error && get_vmcs_entry_interruption_info) {
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_ENTRY_INTR_INFO,&u64);
 		if (error == 0) {
-			printf("entry_interruption_info[%d]\t0x%08x\n",
+			printf("entry_interruption_info[%d]\t0x%08lx\n",
 				vcpu, u64);
 		}
 	}
@@ -1177,30 +1177,30 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_EXCEPTION_BITMAP,
 					  &bm);
 		if (error == 0)
-			printf("exception_bitmap[%d]\t0x%08x\n", vcpu, bm);
+			printf("exception_bitmap[%d]\t0x%08lx\n", vcpu, bm);
 	}
 
 	if (!error && get_io_bitmap) {
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_IO_BITMAP_A, &bm);
 		if (error == 0)
-			printf("io_bitmap_a[%d]\t0x%08x\n", vcpu, bm);
+			printf("io_bitmap_a[%d]\t0x%08lx\n", vcpu, bm);
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_IO_BITMAP_B, &bm);
 		if (error == 0)
-			printf("io_bitmap_b[%d]\t0x%08x\n", vcpu, bm);
+			printf("io_bitmap_b[%d]\t0x%08lx\n", vcpu, bm);
 	}
 
 	if (!error && get_tsc_offset) {
 		uint64_t tscoff;
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_TSC_OFFSET, &tscoff);
 		if (error == 0)
-			printf("tsc_offset[%d]\t0x%016lx\n", tscoff);
+			printf("tsc_offset[%d]\t0x%016lx\n", vcpu, tscoff);
 	}
 
 	if (!error && get_cr0_mask) {
 		uint64_t cr0mask;
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_CR0_MASK, &cr0mask);
 		if (error == 0)
-			printf("cr0_mask[%d]\t\t0x%016lx\n", cr0mask);
+			printf("cr0_mask[%d]\t\t0x%016lx\n", vcpu, cr0mask);
 	}
 
 	if (!error && get_cr0_shadow) {
@@ -1208,14 +1208,14 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_CR0_SHADOW,
 					  &cr0shadow);
 		if (error == 0)
-			printf("cr0_shadow[%d]\t\t0x%016lx\n", cr0shadow);
+			printf("cr0_shadow[%d]\t\t0x%016lx\n", vcpu, cr0shadow);
 	}
 
 	if (!error && get_cr4_mask) {
 		uint64_t cr4mask;
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_CR4_MASK, &cr4mask);
 		if (error == 0)
-			printf("cr4_mask[%d]\t\t0x%016lx\n", cr4mask);
+			printf("cr4_mask[%d]\t\t0x%016lx\n", vcpu, cr4mask);
 	}
 
 	if (!error && get_cr4_shadow) {
@@ -1223,7 +1223,7 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_CR4_SHADOW,
 					  &cr4shadow);
 		if (error == 0)
-			printf("cr4_shadow[%d]\t\t0x%016lx\n", cr4shadow);
+			printf("cr4_shadow[%d]\t\t0x%016lx\n", vcpu, cr4shadow);
 	}
 	
 	if (!error && get_cr3_targets) {
@@ -1231,7 +1231,7 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_CR3_TARGET_COUNT,
 					  &target_count);
 		if (error == 0) {
-			printf("cr3_target_count[%d]\t0x%08x\n",
+			printf("cr3_target_count[%d]\t0x%08lx\n",
 				vcpu, target_count);
 		}
 
@@ -1281,7 +1281,7 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_TPR_THRESHOLD,
 					  &threshold);
 		if (error == 0)
-			printf("tpr_threshold[%d]\t0x%08x\n", vcpu, threshold);
+			printf("tpr_threshold[%d]\t0x%08lx\n", vcpu, threshold);
 	}
 
 	if (!error && get_msr_bitmap_address) {
@@ -1300,21 +1300,21 @@ main(int argc, char *argv[])
 		uint64_t vpid;
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_VPID, &vpid);
 		if (error == 0)
-			printf("vpid[%d]\t\t0x%04x\n", vcpu, vpid);
+			printf("vpid[%d]\t\t0x%04lx\n", vcpu, vpid);
 	}
 	
 	if (!error && get_ple_window) {
 		uint64_t window;
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_PLE_WINDOW, &window);
 		if (error == 0)
-			printf("ple_window[%d]\t\t0x%08x\n", vcpu, window);
+			printf("ple_window[%d]\t\t0x%08lx\n", vcpu, window);
 	}
 
 	if (!error && get_ple_gap) {
 		uint64_t gap;
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_PLE_GAP, &gap);
 		if (error == 0)
-			printf("ple_gap[%d]\t\t0x%08x\n", vcpu, gap);
+			printf("ple_gap[%d]\t\t0x%08lx\n", vcpu, gap);
 	}
 
 	if (!error && get_inst_err) {
@@ -1322,7 +1322,7 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_INSTRUCTION_ERROR,
 					  &insterr);
 		if (error == 0) {
-			printf("instruction_error[%d]\t0x%08x\n",
+			printf("instruction_error[%d]\t0x%08lx\n",
 				vcpu, insterr);
 		}
 	}
@@ -1330,13 +1330,13 @@ main(int argc, char *argv[])
 	if (!error && get_exit_ctls) {
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_EXIT_CTLS, &ctl);
 		if (error == 0)
-			printf("exit_ctls[%d]\t\t0x%08x\n", vcpu, ctl);
+			printf("exit_ctls[%d]\t\t0x%08lx\n", vcpu, ctl);
 	}
 
 	if (!error && get_entry_ctls) {
 		error = vm_get_vmcs_field(ctx, vcpu, VMCS_ENTRY_CTLS, &ctl);
 		if (error == 0)
-			printf("entry_ctls[%d]\t\t0x%08x\n", vcpu, ctl);
+			printf("entry_ctls[%d]\t\t0x%08lx\n", vcpu, ctl);
 	}
 
 	if (!error && get_host_pat) {
@@ -1385,7 +1385,7 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu,
 					  VMCS_GUEST_IA32_SYSENTER_CS, &cs);
 		if (error == 0)
-			printf("guest_sysenter_cs[%d]\t0x%08x\n", vcpu, cs);
+			printf("guest_sysenter_cs[%d]\t0x%08lx\n", vcpu, cs);
 
 		error = vm_get_vmcs_field(ctx, vcpu,
 					  VMCS_GUEST_IA32_SYSENTER_ESP, &rsp);
@@ -1421,7 +1421,7 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu,
 					  VMCS_EXIT_INTERRUPTION_INFO, &u64);
 		if (error == 0) {
-			printf("vmcs_exit_interruption_info[%d]\t0x%08x\n",
+			printf("vmcs_exit_interruption_info[%d]\t0x%08lx\n",
 				vcpu, u64);
 		}
 	}
@@ -1430,7 +1430,7 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu,
 					  VMCS_EXIT_INTERRUPTION_ERROR, &u64);
 		if (error == 0) {
-			printf("vmcs_exit_interruption_error[%d]\t0x%08x\n",
+			printf("vmcs_exit_interruption_error[%d]\t0x%08lx\n",
 				vcpu, u64);
 		}
 	}
@@ -1439,7 +1439,7 @@ main(int argc, char *argv[])
 		error = vm_get_vmcs_field(ctx, vcpu,
 					  VMCS_GUEST_INTERRUPTIBILITY, &u64);
 		if (error == 0) {
-			printf("vmcs_guest_interruptibility[%d]\t0x%08x\n",
+			printf("vmcs_guest_interruptibility[%d]\t0x%08lx\n",
 				vcpu, u64);
 		}
 	}



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