summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'usr')
-rw-r--r--usr/src/Makefile.master2
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c3
-rw-r--r--usr/src/compat/bhyve/sys/ktr.h27
-rw-r--r--usr/src/compat/bhyve/sys/malloc.h49
-rw-r--r--usr/src/lib/libipadm/common/ipadm_ndpd.c7
-rw-r--r--usr/src/tools/Makefile1
-rw-r--r--usr/src/tools/Makefile.targ8
-rw-r--r--usr/src/tools/Makefile.tools5
-rw-r--r--usr/src/tools/sgs/ld/Makefile7
-rw-r--r--usr/src/tools/sgs/libconv/Makefile1
-rw-r--r--usr/src/tools/sgs/libelf/Makefile11
-rw-r--r--usr/src/tools/sgs/libld/Makefile13
-rw-r--r--usr/src/tools/sgs/liblddbg/Makefile11
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_server.c45
-rw-r--r--usr/src/uts/common/inet/ip.h3
-rw-r--r--usr/src/uts/common/smbsrv/smb_ktypes.h3
-rw-r--r--usr/src/uts/intel/io/vmm/amd/svm.c47
-rw-r--r--usr/src/uts/intel/io/vmm/intel/vmx.c67
-rw-r--r--usr/src/uts/intel/io/vmm/intel/vtd.c15
-rw-r--r--usr/src/uts/intel/io/vmm/io/iommu.h5
-rw-r--r--usr/src/uts/intel/io/vmm/io/ppt.c3
-rw-r--r--usr/src/uts/intel/io/vmm/io/vatpic.c46
-rw-r--r--usr/src/uts/intel/io/vmm/io/vatpit.c13
-rw-r--r--usr/src/uts/intel/io/vmm/io/vhpet.c36
-rw-r--r--usr/src/uts/intel/io/vmm/io/vioapic.c34
-rw-r--r--usr/src/uts/intel/io/vmm/io/vlapic.c33
-rw-r--r--usr/src/uts/intel/io/vmm/io/vlapic_priv.h40
-rw-r--r--usr/src/uts/intel/io/vmm/io/vpmtmr.c8
-rw-r--r--usr/src/uts/intel/io/vmm/io/vrtc.c64
-rw-r--r--usr/src/uts/intel/io/vmm/sys/vmm_kernel.h6
-rw-r--r--usr/src/uts/intel/io/vmm/vmm.c44
-rw-r--r--usr/src/uts/intel/io/vmm/vmm_gpt.c1
-rw-r--r--usr/src/uts/intel/io/vmm/vmm_instruction_emul.c1
-rw-r--r--usr/src/uts/intel/io/vmm/vmm_ktr.h72
-rw-r--r--usr/src/uts/intel/io/vmm/vmm_lapic.c8
-rw-r--r--usr/src/uts/intel/io/vmm/vmm_sol_dev.c2
-rw-r--r--usr/src/uts/intel/io/vmm/vmm_sol_glue.c147
-rw-r--r--usr/src/uts/intel/io/vmm/vmm_stat.c10
-rw-r--r--usr/src/uts/intel/io/vmm/vmm_vm.c1
-rw-r--r--usr/src/uts/intel/io/vmm/x86.c3
40 files changed, 241 insertions, 661 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index 9a926c7fbf..47672f66ad 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -939,7 +939,7 @@ CW= $(ONBLD_TOOLS)/bin/$(MACH)/cw
BUILD_CC= $(CW) $(CW_LINKER) $(CW_CC_COMPILERS) --
BUILD_CCC= $(CW) -C $(CW_LINKER) $(CW_CCC_COMPILERS) --
BUILD_CPP= /usr/lib/cpp
-BUILD_LD= $(ONBLD_TOOLS)/bin/$(MACH)/ld
+BUILD_LD= $(ONBLD_TOOLS)/bin/$(MACH64)/ld
$(MACH)_CC= $(BUILD_CC)
$(MACH)_CCC= $(BUILD_CCC)
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c
index 2bae04288e..9660e67d06 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c
@@ -19,6 +19,7 @@
* CDDL HEADER END
*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2022 Oxide Computer Company
*/
#include "defs.h"
@@ -2418,7 +2419,7 @@ ndpd_delete_addrs(const char *ifname)
}
if (IN6_IS_ADDR_UNSPECIFIED(&pi->pi_token)) {
logmsg(LOG_ERR, "token does not exist for %s", ifname);
- return (EINVAL);
+ return (ENOENT);
}
if (ifsock < 0) {
diff --git a/usr/src/compat/bhyve/sys/ktr.h b/usr/src/compat/bhyve/sys/ktr.h
deleted file mode 100644
index 96c499ef18..0000000000
--- a/usr/src/compat/bhyve/sys/ktr.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file and its contents are supplied under the terms of the
- * Common Development and Distribution License ("CDDL"), version 1.0.
- * You may only use this file in accordance with the terms of version
- * 1.0 of the CDDL.
- *
- * A full copy of the text of the CDDL should have accompanied this
- * source. A copy of the CDDL is also available via the Internet at
- * http://www.illumos.org/license/CDDL.
- */
-
-/*
- * Copyright 2013 Pluribus Networks Inc.
- */
-
-#ifndef _COMPAT_FREEBSD_SYS_KTR_H_
-#define _COMPAT_FREEBSD_SYS_KTR_H_
-
-#define CTR0(m, format)
-#define CTR1(m, format, p1)
-#define CTR2(m, format, p1, p2)
-#define CTR3(m, format, p1, p2, p3)
-#define CTR4(m, format, p1, p2, p3, p4)
-#define CTR5(m, format, p1, p2, p3, p4, p5)
-#define CTR6(m, d, p1, p2, p3, p4, p5, p6)
-
-#endif /* _COMPAT_FREEBSD_SYS_KTR_H_ */
diff --git a/usr/src/compat/bhyve/sys/malloc.h b/usr/src/compat/bhyve/sys/malloc.h
deleted file mode 100644
index 341d57b807..0000000000
--- a/usr/src/compat/bhyve/sys/malloc.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file and its contents are supplied under the terms of the
- * Common Development and Distribution License ("CDDL"), version 1.0.
- * You may only use this file in accordance with the terms of version
- * 1.0 of the CDDL.
- *
- * A full copy of the text of the CDDL should have accompanied this
- * source. A copy of the CDDL is also available via the Internet at
- * http://www.illumos.org/license/CDDL.
- */
-
-/*
- * Copyright 2013 Pluribus Networks Inc.
- */
-
-#ifndef _COMPAT_FREEBSD_SYS_MALLOC_H_
-#define _COMPAT_FREEBSD_SYS_MALLOC_H_
-
-/*
- * flags to malloc.
- */
-#define M_NOWAIT 0x0001 /* do not block */
-#define M_WAITOK 0x0002 /* ok to block */
-#define M_ZERO 0x0100 /* bzero the allocation */
-
-struct malloc_type {
- const char *ks_shortdesc; /* Printable type name. */
-};
-
-#ifdef _KERNEL
-#define MALLOC_DEFINE(type, shortdesc, longdesc) \
- struct malloc_type type[1] = { \
- { shortdesc } \
- }
-
-#define MALLOC_DECLARE(type) \
- extern struct malloc_type type[1]
-
-void free(void *addr, struct malloc_type *type);
-void *malloc(unsigned long size, struct malloc_type *type, int flags);
-void *old_malloc(unsigned long size, struct malloc_type *type , int flags);
-void *contigmalloc(unsigned long, struct malloc_type *, int, vm_paddr_t,
- vm_paddr_t, unsigned long, vm_paddr_t);
-void contigfree(void *, unsigned long, struct malloc_type *);
-
-
-#endif /* _KERNEL */
-
-#endif /* _COMPAT_FREEBSD_SYS_MALLOC_H_ */
diff --git a/usr/src/lib/libipadm/common/ipadm_ndpd.c b/usr/src/lib/libipadm/common/ipadm_ndpd.c
index 29ea8ccf51..95e6df2d0a 100644
--- a/usr/src/lib/libipadm/common/ipadm_ndpd.c
+++ b/usr/src/lib/libipadm/common/ipadm_ndpd.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
+ * Copyright 2022 Oxide Computer Company
*/
/*
@@ -129,8 +130,12 @@ i_ipadm_delete_ipv6addrs(ipadm_handle_t iph, ipadm_addrobj_t ipaddr)
*/
status = i_ipadm_send_ndpd_cmd(ipaddr->ipadm_ifname, ipaddr,
IPADM_DELETE_ADDRS);
- if (status == IPADM_NDPD_NOT_RUNNING)
+
+ /* if the entry is not found, or ndpd is not running, just carry on */
+ if (status == IPADM_NDPD_NOT_RUNNING || status == IPADM_ENXIO ||
+ status == IPADM_NOTFOUND)
status = IPADM_SUCCESS;
+
if (status == IPADM_SUCCESS)
status = i_ipadm_delete_addr(iph, ipaddr);
diff --git a/usr/src/tools/Makefile b/usr/src/tools/Makefile
index 63f9b38709..5524ad71bd 100644
--- a/usr/src/tools/Makefile
+++ b/usr/src/tools/Makefile
@@ -109,6 +109,7 @@ ROOTDIRS= \
$(ROOTONBLD) \
$(ROOTONBLD)/bin \
$(ROOTONBLD)/bin/$(MACH) \
+ $(ROOTONBLD)/bin/$(MACH64) \
$(ROOTONBLD)/lib \
$(ROOTONBLD)/lib/$(MACH) \
$(ROOTONBLD)/lib/$(MACH)/64 \
diff --git a/usr/src/tools/Makefile.targ b/usr/src/tools/Makefile.targ
index b496f5d5fd..62ea62bfb0 100644
--- a/usr/src/tools/Makefile.targ
+++ b/usr/src/tools/Makefile.targ
@@ -19,8 +19,6 @@
# CDDL HEADER END
#
#
-#ident "%Z%%M% %I% %E% SMI"
-#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -28,9 +26,3 @@
clobber: clean
-$(RM) $(PROG) $(CLOBBERFILES)
-
-lint_PROG:
- $(LINT.c) $(PROG).c
-
-lint_SRCS:
- $(LINT.c) $(SRCS)
diff --git a/usr/src/tools/Makefile.tools b/usr/src/tools/Makefile.tools
index 315a10b6c6..6bc8e66c14 100644
--- a/usr/src/tools/Makefile.tools
+++ b/usr/src/tools/Makefile.tools
@@ -34,6 +34,7 @@ ROOTOPT= $(TOOLS_PROTO)/opt
ROOTONBLD= $(ROOTOPT)/onbld
ROOTONBLDBIN= $(ROOTONBLD)/bin
ROOTONBLDBINMACH= $(ROOTONBLD)/bin/$(MACH)
+ROOTONBLDBINMACH64= $(ROOTONBLD)/bin/$(MACH64)
ROOTONBLDETC= $(ROOTONBLD)/etc
ROOTONBLDLIB= $(ROOTONBLD)/lib
ROOTONBLDLIBMACH= $(ROOTONBLD)/lib/$(MACH)
@@ -78,6 +79,7 @@ CW_LINKER=
ROOTONBLDPROG= $(PROG:%=$(ROOTONBLDBIN)/%)
ROOTONBLDSCRIPTS= $(SCRIPTS:%=$(ROOTONBLDBIN)/%)
ROOTONBLDMACHPROG= $(PROG:%=$(ROOTONBLDBINMACH)/%)
+ROOTONBLDMACH64PROG= $(PROG:%=$(ROOTONBLDBINMACH64)/%)
ROOTONBLDSHFILES= $(SHFILES:%=$(ROOTONBLDBIN)/%)
ROOTONBLDMAKEFILES= $(MAKEFILES:%=$(ROOTONBLDBIN)/%)
ROOTONBLDMACHSHFILES= $(SHFILES:%=$(ROOTONBLDBINMACH)/%)
@@ -106,6 +108,9 @@ $(ROOTONBLDBIN)/%: %
$(ROOTONBLDBINMACH)/%: %
$(INS.file)
+$(ROOTONBLDBINMACH64)/%: %
+ $(INS.file)
+
$(ROOTONBLDETC)/%: %
$(INS.file)
diff --git a/usr/src/tools/sgs/ld/Makefile b/usr/src/tools/sgs/ld/Makefile
index 05ce16f7a6..f8c54774da 100644
--- a/usr/src/tools/sgs/ld/Makefile
+++ b/usr/src/tools/sgs/ld/Makefile
@@ -25,16 +25,17 @@
include ../Makefile.com
include ../../Makefile.tools
include $(SGSHOME)/ld/Makefile.com
+include $(SRC)/Makefile.master.64
-LDLIBS = -lumem -L../libconv -L$(ROOTONBLDLIBMACH) -lld -lelf -lconv
+LDLIBS = -lumem -L../libconv -L$(ROOTONBLDLIBMACH64) -lld -lelf -lconv
NATIVE_LIBS += libc.so libumem.so
CPPFLAGS = $(NATIVE_CPPFLAGS)
CFLAGS = $(NATIVE_CFLAGS)
MAPFILES = $(SRCDIR)/common/mapfile-intf
-RPATH = '-R$$ORIGIN/../../lib/$(MACH)'
+RPATH = '-R$$ORIGIN/../../lib/$(MACH)/64'
CW_LINKER =
-install: $(ROOTONBLDMACHPROG)
+install: $(ROOTONBLDMACH64PROG)
.KEEP_STATE:
diff --git a/usr/src/tools/sgs/libconv/Makefile b/usr/src/tools/sgs/libconv/Makefile
index a4423c8304..626221f74e 100644
--- a/usr/src/tools/sgs/libconv/Makefile
+++ b/usr/src/tools/sgs/libconv/Makefile
@@ -27,6 +27,7 @@
include ../Makefile.com
include $(SGSHOME)/libconv/Makefile.com
+include $(SRC)/Makefile.master.64
CPPFLAGS = $(NATIVE_CPPFLAGS) -I$(SRC)/lib/libc/inc -I$(ELFCAP) \
-I$(SRC)/common/sgsrtcid \
diff --git a/usr/src/tools/sgs/libelf/Makefile b/usr/src/tools/sgs/libelf/Makefile
index 7fc734dc99..bb397296f6 100644
--- a/usr/src/tools/sgs/libelf/Makefile
+++ b/usr/src/tools/sgs/libelf/Makefile
@@ -26,6 +26,7 @@
include ../Makefile.com
include ../../Makefile.tools
include $(SGSHOME)/libelf/Makefile.com
+include $(SRC)/Makefile.master.64
CONVLIBDIR = -L../libconv
CPPFLAGS = $(NATIVE_CPPFLAGS)
@@ -40,14 +41,14 @@ MAPFILES=
.KEEP_STATE:
-install: all $(ROOTONBLDLIBMACH)/$(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+install: all $(ROOTONBLDLIBMACH64)/$(DYNLIB) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
-$(ROOTONBLDLIBMACH)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH)
+$(ROOTONBLDLIBMACH64)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH64)
$(BUILD.SO)
$(POST_PROCESS_SO)
-$(ROOTONBLDLIBMACH)/$(LIBLINKS): $(ROOTONBLDLIBMACH)/$(DYNLIB)
- @$(RM) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
- $(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+$(ROOTONBLDLIBMACH64)/$(LIBLINKS): $(ROOTONBLDLIBMACH64)/$(DYNLIB)
+ @$(RM) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
+ $(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
include $(SGSHOME)/libelf/Makefile.targ
diff --git a/usr/src/tools/sgs/libld/Makefile b/usr/src/tools/sgs/libld/Makefile
index 956a85c482..72c3adf4f1 100644
--- a/usr/src/tools/sgs/libld/Makefile
+++ b/usr/src/tools/sgs/libld/Makefile
@@ -28,6 +28,7 @@
include ../Makefile.com
include ../../Makefile.tools
include $(SGSHOME)/libld/Makefile.com
+include $(SRC)/Makefile.master.64
.KEEP_STATE:
@@ -43,7 +44,7 @@ CW_LINKER =
CPPFLAGS = $(NATIVE_CPPFLAGS) -DUSE_LIBLD_MALLOC -I$(SRC)/lib/libc/inc \
-I$(SRC)/uts/common/krtld -I$(SRC)/uts/sparc \
-I$(SRC)/uts/common
-LDLIBS += -L../libconv -lconv -L$(ROOTONBLDLIBMACH) -llddbg -lelf -lc
+LDLIBS += -L../libconv -lconv -L$(ROOTONBLDLIBMACH64) -llddbg -lelf -lc
NATIVE_LIBS += libc.so
DYNFLAGS += $(VERSREF) '-R$$ORIGIN'
@@ -51,14 +52,14 @@ CFLAGS = $(NATIVE_CFLAGS)
all: $(DYNLIB) $(LIBLINKS)
-install: all $(ROOTONBLDLIBMACH)/$(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+install: all $(ROOTONBLDLIBMACH64)/$(DYNLIB) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
-$(ROOTONBLDLIBMACH)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH)
+$(ROOTONBLDLIBMACH64)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH64)
$(BUILD.SO)
$(POST_PROCESS_SO)
-$(ROOTONBLDLIBMACH)/$(LIBLINKS): $(ROOTONBLDLIBMACH)/$(DYNLIB)
- @$(RM) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
- $(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+$(ROOTONBLDLIBMACH64)/$(LIBLINKS): $(ROOTONBLDLIBMACH64)/$(DYNLIB)
+ @$(RM) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
+ $(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
include $(SGSHOME)/libld/Makefile.targ
diff --git a/usr/src/tools/sgs/liblddbg/Makefile b/usr/src/tools/sgs/liblddbg/Makefile
index 968af30d3e..5a7818e852 100644
--- a/usr/src/tools/sgs/liblddbg/Makefile
+++ b/usr/src/tools/sgs/liblddbg/Makefile
@@ -27,6 +27,7 @@
include ../Makefile.com
include ../../Makefile.tools
include $(SGSHOME)/liblddbg/Makefile.com
+include $(SRC)/Makefile.master.64
.KEEP_STATE:
@@ -42,14 +43,14 @@ MAPFILES =
all: $(DYNLIB) $(LIBLINKS)
-install: all $(ROOTONBLDLIBMACH)/$(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+install: all $(ROOTONBLDLIBMACH64)/$(DYNLIB) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
-$(ROOTONBLDLIBMACH)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH)
+$(ROOTONBLDLIBMACH64)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH64)
$(BUILD.SO)
$(POST_PROCESS_SO)
-$(ROOTONBLDLIBMACH)/$(LIBLINKS): $(ROOTONBLDLIBMACH)/$(DYNLIB)
- @$(RM) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
- $(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+$(ROOTONBLDLIBMACH64)/$(LIBLINKS): $(ROOTONBLDLIBMACH64)/$(DYNLIB)
+ @$(RM) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
+ $(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH64)/$(LIBLINKS)
include $(SGSHOME)/liblddbg/Makefile.targ
diff --git a/usr/src/uts/common/fs/smbsrv/smb_server.c b/usr/src/uts/common/fs/smbsrv/smb_server.c
index 3b69a5699b..5988f121eb 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_server.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_server.c
@@ -22,7 +22,7 @@
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017 by Delphix. All rights reserved.
* Copyright 2019 Nexenta by DDN, Inc. All rights reserved.
- * Copyright 2020 RackTop Systems, Inc.
+ * Copyright 2022 RackTop Systems, Inc.
*/
/*
@@ -2478,15 +2478,17 @@ smb_spool_add_doc(smb_tree_t *tree, smb_kspooldoc_t *sp)
static void
smb_server_create_session(smb_listener_daemon_t *ld, ksocket_t s_so)
{
+ smb_server_t *sv = ld->ld_sv;
smb_session_t *session;
- taskqid_t tqid;
smb_llist_t *sl;
- smb_server_t *sv = ld->ld_sv;
+ taskqid_t tqid;
+ clock_t now;
session = smb_session_create(s_so, ld->ld_port, sv,
ld->ld_family);
if (session == NULL) {
+ /* This should be rare (create sleeps) */
smb_soshutdown(s_so);
smb_sodestroy(s_so);
cmn_err(CE_WARN, "SMB Session: alloc failed");
@@ -2495,6 +2497,17 @@ smb_server_create_session(smb_listener_daemon_t *ld, ksocket_t s_so)
sl = &sv->sv_session_list;
smb_llist_enter(sl, RW_WRITER);
+ if (smb_llist_get_count(sl) >= sv->sv_cfg.skc_maxconnections) {
+ /*
+ * New session not in sv_session_list, so we can just
+ * delete it directly.
+ */
+ smb_llist_exit(sl);
+ DTRACE_PROBE1(maxconn, smb_session_t *, session);
+ smb_soshutdown(session->sock);
+ smb_session_delete(session);
+ goto logmaxconn;
+ }
smb_llist_insert_tail(sl, session);
smb_llist_exit(sl);
@@ -2505,13 +2518,33 @@ smb_server_create_session(smb_listener_daemon_t *ld, ksocket_t s_so)
tqid = taskq_dispatch(sv->sv_receiver_pool,
smb_server_receiver, session, TQ_NOQUEUE | TQ_SLEEP);
if (tqid == TASKQID_INVALID) {
+ /*
+ * We never entered smb_server_receiver()
+ * so need to do it's return cleanup
+ */
+ DTRACE_PROBE1(maxconn, smb_session_t *, session);
smb_session_disconnect(session);
+ smb_session_logoff(session);
smb_server_destroy_session(session);
- cmn_err(CE_WARN, "SMB Session: taskq_dispatch failed");
- return;
+ goto logmaxconn;
}
- /* handy for debugging */
+
+ /* Success */
session->s_receiver_tqid = tqid;
+ return;
+
+logmaxconn:
+ /*
+ * If we hit max_connections, log something so an admin
+ * can find out why new connections are failing, but
+ * log this no more than once a minute.
+ */
+ now = ddi_get_lbolt();
+ if (now > ld->ld_quiet) {
+ ld->ld_quiet = now + SEC_TO_TICK(60);
+ cmn_err(CE_WARN, "SMB can't create session: "
+ "Would exceed max_connections.");
+ }
}
static void
diff --git a/usr/src/uts/common/inet/ip.h b/usr/src/uts/common/inet/ip.h
index 7687fdd29e..ebf2574363 100644
--- a/usr/src/uts/common/inet/ip.h
+++ b/usr/src/uts/common/inet/ip.h
@@ -25,6 +25,7 @@
* Copyright 2017 Nexenta Systems, Inc.
* Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2019, Joyent, Inc.
+ * Copyright 2022 Oxide Computer Company
*/
#ifndef _INET_IP_H
@@ -2015,7 +2016,7 @@ enum { IF_CMD = 1, LIF_CMD, ARP_CMD, XARP_CMD, MSFILT_CMD, MISC_CMD };
#define IPI_DONTCARE 0 /* For ioctl encoded values that don't matter */
/* Flag values in ipi_flags */
-#define IPI_PRIV 0x1 /* Root only command */
+#define IPI_PRIV 0x1 /* Command requires PRIV_SYS_IP_CONFIG */
#define IPI_MODOK 0x2 /* Permitted on mod instance of IP */
#define IPI_WR 0x4 /* Need to grab writer access */
#define IPI_GET_CMD 0x8 /* branch to mi_copyout on success */
diff --git a/usr/src/uts/common/smbsrv/smb_ktypes.h b/usr/src/uts/common/smbsrv/smb_ktypes.h
index 1b596dbb9f..9d63d4c4b4 100644
--- a/usr/src/uts/common/smbsrv/smb_ktypes.h
+++ b/usr/src/uts/common/smbsrv/smb_ktypes.h
@@ -20,8 +20,8 @@
*/
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2020 RackTop Systems, Inc.
* Copyright 2020 Tintri by DDN, Inc. All rights reserved.
+ * Copyright 2022 RackTop Systems, Inc.
*/
/*
@@ -2063,6 +2063,7 @@ typedef struct {
int ld_family;
struct sockaddr_in ld_sin;
struct sockaddr_in6 ld_sin6;
+ clock_t ld_quiet;
} smb_listener_daemon_t;
#define SMB_SSETUP_CMD "authentication"
diff --git a/usr/src/uts/intel/io/vmm/amd/svm.c b/usr/src/uts/intel/io/vmm/amd/svm.c
index 993e759fc6..b699d57991 100644
--- a/usr/src/uts/intel/io/vmm/amd/svm.c
+++ b/usr/src/uts/intel/io/vmm/amd/svm.c
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/pcpu.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
@@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$");
#include "vmm_lapic.h"
#include "vmm_stat.h"
-#include "vmm_ktr.h"
#include "vmm_ioport.h"
#include "vatpic.h"
#include "vlapic.h"
@@ -113,9 +112,6 @@ static uint32_t vmcb_clean = VMCB_CACHE_DEFAULT;
SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_RDTUN, &vmcb_clean,
0, NULL);
-static MALLOC_DEFINE(M_SVM, "svm", "svm");
-static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic");
-
/* SVM features advertised by CPUID.8000000AH:EDX */
static uint32_t svm_feature = ~0U; /* AMD SVM features. */
@@ -275,8 +271,6 @@ svm_set_intercept(struct svm_softc *sc, int vcpu, int idx, uint32_t bitmask,
if (ctrl->intercept[idx] != oldval) {
svm_set_dirty(sc, vcpu, VMCB_CACHE_I);
- VCPU_CTR3(sc->vm, vcpu, "intercept[%d] modified "
- "from %x to %x", idx, oldval, ctrl->intercept[idx]);
}
}
@@ -430,16 +424,13 @@ svm_vminit(struct vm *vm)
int i;
uint16_t maxcpus;
- svm_sc = malloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO);
- if (((uintptr_t)svm_sc & PAGE_MASK) != 0)
- panic("malloc of svm_softc not aligned on page boundary");
+ svm_sc = kmem_zalloc(sizeof (*svm_sc), KM_SLEEP);
+ VERIFY3U(((uintptr_t)svm_sc & PAGE_MASK), ==, 0);
- svm_sc->msr_bitmap = contigmalloc(SVM_MSR_BITMAP_SIZE, M_SVM,
- M_WAITOK, 0, ~(vm_paddr_t)0, PAGE_SIZE, 0);
+ svm_sc->msr_bitmap = vmm_contig_alloc(SVM_MSR_BITMAP_SIZE);
if (svm_sc->msr_bitmap == NULL)
panic("contigmalloc of SVM MSR bitmap failed");
- svm_sc->iopm_bitmap = contigmalloc(SVM_IO_BITMAP_SIZE, M_SVM,
- M_WAITOK, 0, ~(vm_paddr_t)0, PAGE_SIZE, 0);
+ svm_sc->iopm_bitmap = vmm_contig_alloc(SVM_IO_BITMAP_SIZE);
if (svm_sc->iopm_bitmap == NULL)
panic("contigmalloc of SVM IO bitmap failed");
@@ -945,8 +936,6 @@ svm_save_exitintinfo(struct svm_softc *svm_sc, int vcpu)
* If a #VMEXIT happened during event delivery then record the event
* that was being delivered.
*/
- VCPU_CTR2(svm_sc->vm, vcpu, "SVM:Pending INTINFO(0x%lx), vector=%d.\n",
- intinfo, VMCB_EXITINTINFO_VECTOR(intinfo));
vmm_stat_incr(svm_sc->vm, vcpu, VCPU_EXITINTINFO, 1);
/*
* Relies on match between VMCB exitintinfo format and bhyve-generic
@@ -992,7 +981,6 @@ svm_enable_intr_window_exiting(struct svm_softc *sc, int vcpu)
VERIFY((ctrl->eventinj & VMCB_EVENTINJ_VALID) != 0 ||
(state->rflags & PSL_I) == 0 || ctrl->intr_shadow);
- VCPU_CTR0(sc->vm, vcpu, "Enable intr window exiting");
ctrl->v_irq |= V_IRQ;
ctrl->v_intr_prio |= V_IGN_TPR;
ctrl->v_intr_vector = 0;
@@ -1013,7 +1001,6 @@ svm_disable_intr_window_exiting(struct svm_softc *sc, int vcpu)
return;
}
- VCPU_CTR0(sc->vm, vcpu, "Disable intr window exiting");
ctrl->v_irq &= ~V_IRQ;
ctrl->v_intr_vector = 0;
svm_set_dirty(sc, vcpu, VMCB_CACHE_TPR);
@@ -1038,7 +1025,6 @@ svm_clear_nmi_blocking(struct svm_softc *sc, int vcpu)
struct vmcb_ctrl *ctrl;
KASSERT(svm_nmi_blocked(sc, vcpu), ("vNMI already unblocked"));
- VCPU_CTR0(sc->vm, vcpu, "vNMI blocking cleared");
/*
* When the IRET intercept is cleared the vcpu will attempt to execute
* the "iret" when it runs next. However, it is possible to inject
@@ -1498,23 +1484,15 @@ svm_vmexit(struct svm_softc *svm_sc, int vcpu, struct vm_exit *vmexit)
case VMCB_EXIT_NPF:
/* EXITINFO2 contains the faulting guest physical address */
if (info1 & VMCB_NPF_INFO1_RSV) {
- VCPU_CTR2(svm_sc->vm, vcpu, "nested page fault with "
- "reserved bits set: info1(%lx) info2(%lx)",
- info1, info2);
+ /* nested fault with reserved bits set */
} else if (vm_mem_allocated(svm_sc->vm, vcpu, info2)) {
vmexit->exitcode = VM_EXITCODE_PAGING;
vmexit->u.paging.gpa = info2;
vmexit->u.paging.fault_type = npf_fault_type(info1);
vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_NESTED_FAULT, 1);
- VCPU_CTR3(svm_sc->vm, vcpu, "nested page fault "
- "on gpa %lx/%lx at rip %lx",
- info2, info1, state->rip);
} else if (svm_npf_emul_fault(info1)) {
svm_handle_mmio_emul(svm_sc, vcpu, vmexit, info2);
vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_MMIO_EMUL, 1);
- VCPU_CTR3(svm_sc->vm, vcpu, "mmio_emul fault "
- "for gpa %lx/%lx at rip %lx",
- info2, info1, state->rip);
}
break;
case VMCB_EXIT_MONITOR:
@@ -2015,11 +1993,9 @@ svm_vmrun(void *arg, int vcpu, uint64_t rip)
ctrl->vmcb_clean = vmcb_clean & ~vcpustate->dirty;
vcpustate->dirty = 0;
- VCPU_CTR1(vm, vcpu, "vmcb clean %x", ctrl->vmcb_clean);
/* Launch Virtual Machine. */
vcpu_ustate_change(vm, vcpu, VU_RUN);
- VCPU_CTR1(vm, vcpu, "Resume execution at %lx", state->rip);
svm_dr_enter_guest(gctx);
svm_launch(vmcb_pa, gctx, get_pcpu());
svm_dr_leave_guest(gctx);
@@ -2053,9 +2029,9 @@ svm_vmcleanup(void *arg)
{
struct svm_softc *sc = arg;
- contigfree(sc->iopm_bitmap, SVM_IO_BITMAP_SIZE, M_SVM);
- contigfree(sc->msr_bitmap, SVM_MSR_BITMAP_SIZE, M_SVM);
- free(sc, M_SVM);
+ vmm_contig_free(sc->iopm_bitmap, SVM_IO_BITMAP_SIZE);
+ vmm_contig_free(sc->msr_bitmap, SVM_MSR_BITMAP_SIZE);
+ kmem_free(sc, sizeof (*sc));
}
static uint64_t *
@@ -2418,8 +2394,7 @@ svm_vlapic_init(void *arg, int vcpuid)
struct vlapic *vlapic;
svm_sc = arg;
- vlapic = malloc(sizeof (struct vlapic), M_SVM_VLAPIC,
- M_WAITOK | M_ZERO);
+ vlapic = kmem_zalloc(sizeof (struct vlapic), KM_SLEEP);
vlapic->vm = svm_sc->vm;
vlapic->vcpuid = vcpuid;
vlapic->apic_page = (struct LAPIC *)&svm_sc->apic_page[vcpuid];
@@ -2433,7 +2408,7 @@ static void
svm_vlapic_cleanup(void *arg, struct vlapic *vlapic)
{
vlapic_cleanup(vlapic);
- free(vlapic, M_SVM_VLAPIC);
+ kmem_free(vlapic, sizeof (struct vlapic));
}
static void
diff --git a/usr/src/uts/intel/io/vmm/intel/vmx.c b/usr/src/uts/intel/io/vmm/intel/vmx.c
index 58d1c8361e..360cec1056 100644
--- a/usr/src/uts/intel/io/vmm/intel/vmx.c
+++ b/usr/src/uts/intel/io/vmm/intel/vmx.c
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/pcpu.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
@@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$");
#include "vmm_lapic.h"
#include "vmm_host.h"
#include "vmm_ioport.h"
-#include "vmm_ktr.h"
#include "vmm_stat.h"
#include "vatpic.h"
#include "vlapic.h"
@@ -163,9 +162,6 @@ __FBSDID("$FreeBSD$");
#define HANDLED 1
#define UNHANDLED 0
-static MALLOC_DEFINE(M_VMX, "vmx", "vmx");
-static MALLOC_DEFINE(M_VLAPIC, "vlapic", "vlapic");
-
SYSCTL_DECL(_hw_vmm);
SYSCTL_NODE(_hw_vmm, OID_AUTO, vmx, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
NULL);
@@ -695,13 +691,10 @@ vmx_vminit(struct vm *vm)
uint32_t proc_ctls, proc2_ctls, pin_ctls;
uint64_t apic_access_pa = UINT64_MAX;
- vmx = malloc(sizeof (struct vmx), M_VMX, M_WAITOK | M_ZERO);
- if ((uintptr_t)vmx & PAGE_MASK) {
- panic("malloc of struct vmx not aligned on %d byte boundary",
- PAGE_SIZE);
- }
- vmx->vm = vm;
+ vmx = kmem_zalloc(sizeof (struct vmx), KM_SLEEP);
+ VERIFY3U((uintptr_t)vmx & PAGE_MASK, ==, 0);
+ vmx->vm = vm;
vmx->eptp = vmspace_table_root(vm_get_vmspace(vm));
/*
@@ -1053,23 +1046,22 @@ CTASSERT((PROCBASED_CTLS_ONE_SETTING & PROCBASED_INT_WINDOW_EXITING) != 0);
static __inline void
vmx_set_int_window_exiting(struct vmx *vmx, int vcpu)
{
-
if ((vmx->cap[vcpu].proc_ctls & PROCBASED_INT_WINDOW_EXITING) == 0) {
+ /* Enable interrupt window exiting */
vmx->cap[vcpu].proc_ctls |= PROCBASED_INT_WINDOW_EXITING;
vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls);
- VCPU_CTR0(vmx->vm, vcpu, "Enabling interrupt window exiting");
}
}
static __inline void
vmx_clear_int_window_exiting(struct vmx *vmx, int vcpu)
{
-
KASSERT((vmx->cap[vcpu].proc_ctls & PROCBASED_INT_WINDOW_EXITING) != 0,
("intr_window_exiting not set: %x", vmx->cap[vcpu].proc_ctls));
+
+ /* Disable interrupt window exiting */
vmx->cap[vcpu].proc_ctls &= ~PROCBASED_INT_WINDOW_EXITING;
vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls);
- VCPU_CTR0(vmx->vm, vcpu, "Disabling interrupt window exiting");
}
static __inline bool
@@ -1341,10 +1333,6 @@ vmx_inject_vlapic(struct vmx *vmx, int vcpu, struct vlapic *vlapic)
*/
if (status_new > status_old) {
vmcs_write(VMCS_GUEST_INTR_STATUS, status_new);
- VCPU_CTR2(vlapic->vm, vlapic->vcpuid,
- "vmx_inject_interrupts: guest_intr_status "
- "changed from 0x%04x to 0x%04x",
- status_old, status_new);
}
/*
@@ -1433,7 +1421,6 @@ vmx_restore_nmi_blocking(struct vmx *vmx, int vcpuid)
{
uint32_t gi;
- VCPU_CTR0(vmx->vm, vcpuid, "Restore Virtual-NMI blocking");
gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY);
gi |= VMCS_INTERRUPTIBILITY_NMI_BLOCKING;
vmcs_write(VMCS_GUEST_INTERRUPTIBILITY, gi);
@@ -1444,7 +1431,6 @@ vmx_clear_nmi_blocking(struct vmx *vmx, int vcpuid)
{
uint32_t gi;
- VCPU_CTR0(vmx->vm, vcpuid, "Clear Virtual-NMI blocking");
gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY);
gi &= ~VMCS_INTERRUPTIBILITY_NMI_BLOCKING;
vmcs_write(VMCS_GUEST_INTERRUPTIBILITY, gi);
@@ -2182,7 +2168,6 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
* as most VM-exit fields are not populated as usual.
*/
if (reason == EXIT_REASON_MCE_DURING_ENTRY) {
- VCPU_CTR0(vmx->vm, vcpu, "Handling MCE during VM-entry");
vmm_call_trap(T_MCE);
return (1);
}
@@ -2276,10 +2261,6 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
}
vmexit->exitcode = VM_EXITCODE_TASK_SWITCH;
SDT_PROBE4(vmm, vmx, exit, taskswitch, vmx, vcpu, vmexit, ts);
- VCPU_CTR4(vmx->vm, vcpu, "task switch reason %d, tss 0x%04x, "
- "%s errcode 0x%016lx", ts->reason, ts->tsssel,
- ts->ext ? "external" : "internal",
- ((uint64_t)ts->errcode << 32) | ts->errcode_valid);
break;
case EXIT_REASON_CR_ACCESS:
vmm_stat_incr(vmx->vm, vcpu, VMEXIT_CR_ACCESS, 1);
@@ -2407,7 +2388,6 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
* the machine check back into the guest.
*/
if (intr_vec == IDT_MC) {
- VCPU_CTR0(vmx->vm, vcpu, "Vectoring to MCE handler");
vmm_call_trap(T_MCE);
return (1);
}
@@ -2444,8 +2424,6 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
errcode_valid = 1;
errcode = vmcs_read(VMCS_EXIT_INTR_ERRCODE);
}
- VCPU_CTR2(vmx->vm, vcpu, "Reflecting exception %d/%x into "
- "the guest", intr_vec, errcode);
SDT_PROBE5(vmm, vmx, exit, exception,
vmx, vcpu, vmexit, intr_vec, errcode);
error = vm_inject_exception(vmx->vm, vcpu, intr_vec,
@@ -2924,9 +2902,6 @@ vmx_run(void *arg, int vcpu, uint64_t rip)
vmexit->exitcode);
}
- VCPU_CTR1(vm, vcpu, "returning from vmx_run: exitcode %d",
- vmexit->exitcode);
-
vmcs_clear(vmcs_pa);
vmx_msr_guest_exit(vmx, vcpu);
@@ -2956,7 +2931,7 @@ vmx_vmcleanup(void *arg)
for (i = 0; i < maxcpus; i++)
vpid_free(vmx->state[i].vpid);
- free(vmx, M_VMX);
+ kmem_free(vmx, sizeof (*vmx));
}
static uint64_t *
@@ -3020,7 +2995,7 @@ vmx_getreg(void *arg, int vcpu, int reg, uint64_t *retval)
running = vcpu_is_running(vmx->vm, vcpu, &hostcpu);
if (running && hostcpu != curcpu)
- panic("vmx_getreg: %s%d is running", vm_name(vmx->vm), vcpu);
+ panic("vmx_getreg: %d is running", vcpu);
/* VMCS access not required for ctx reads */
if ((regp = vmxctx_regptr(&vmx->ctx[vcpu], reg)) != NULL) {
@@ -3076,7 +3051,7 @@ vmx_setreg(void *arg, int vcpu, int reg, uint64_t val)
running = vcpu_is_running(vmx->vm, vcpu, &hostcpu);
if (running && hostcpu != curcpu)
- panic("vmx_setreg: %s%d is running", vm_name(vmx->vm), vcpu);
+ panic("vmx_setreg: %d is running", vcpu);
/* VMCS access not required for ctx writes */
if ((regp = vmxctx_regptr(&vmx->ctx[vcpu], reg)) != NULL) {
@@ -3182,7 +3157,7 @@ vmx_getdesc(void *arg, int vcpu, int seg, struct seg_desc *desc)
running = vcpu_is_running(vmx->vm, vcpu, &hostcpu);
if (running && hostcpu != curcpu)
- panic("vmx_getdesc: %s%d is running", vm_name(vmx->vm), vcpu);
+ panic("vmx_getdesc: %d is running", vcpu);
if (!running) {
vmcs_load(vmx->vmcs_pa[vcpu]);
@@ -3212,7 +3187,7 @@ vmx_setdesc(void *arg, int vcpu, int seg, const struct seg_desc *desc)
running = vcpu_is_running(vmx->vm, vcpu, &hostcpu);
if (running && hostcpu != curcpu)
- panic("vmx_setdesc: %s%d is running", vm_name(vmx->vm), vcpu);
+ panic("vmx_setdesc: %d is running", vcpu);
if (!running) {
vmcs_load(vmx->vmcs_pa[vcpu]);
@@ -3647,22 +3622,19 @@ vmx_tpr_shadow_exit(struct vlapic *vlapic)
static struct vlapic *
vmx_vlapic_init(void *arg, int vcpuid)
{
- struct vmx *vmx;
- struct vlapic *vlapic;
+ struct vmx *vmx = arg;
struct vlapic_vtx *vlapic_vtx;
+ struct vlapic *vlapic;
- vmx = arg;
+ vlapic_vtx = kmem_zalloc(sizeof (struct vlapic_vtx), KM_SLEEP);
+ vlapic_vtx->pir_desc = &vmx->pir_desc[vcpuid];
+ vlapic_vtx->vmx = vmx;
- vlapic = malloc(sizeof (struct vlapic_vtx), M_VLAPIC,
- M_WAITOK | M_ZERO);
+ vlapic = &vlapic_vtx->vlapic;
vlapic->vm = vmx->vm;
vlapic->vcpuid = vcpuid;
vlapic->apic_page = (struct LAPIC *)&vmx->apic_page[vcpuid];
- vlapic_vtx = (struct vlapic_vtx *)vlapic;
- vlapic_vtx->pir_desc = &vmx->pir_desc[vcpuid];
- vlapic_vtx->vmx = vmx;
-
if (vmx_cap_en(vmx, VMX_CAP_TPR_SHADOW)) {
vlapic->ops.enable_x2apic_mode = vmx_enable_x2apic_mode_ts;
}
@@ -3685,9 +3657,8 @@ vmx_vlapic_init(void *arg, int vcpuid)
static void
vmx_vlapic_cleanup(void *arg, struct vlapic *vlapic)
{
-
vlapic_cleanup(vlapic);
- free(vlapic, M_VLAPIC);
+ kmem_free(vlapic, sizeof (struct vlapic_vtx));
}
static void
diff --git a/usr/src/uts/intel/io/vmm/intel/vtd.c b/usr/src/uts/intel/io/vmm/intel/vtd.c
index d32143aa07..6f5e6626c8 100644
--- a/usr/src/uts/intel/io/vmm/intel/vtd.c
+++ b/usr/src/uts/intel/io/vmm/intel/vtd.c
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <dev/pci/pcireg.h>
@@ -131,8 +131,6 @@ static dev_info_t *vtddips[DRHD_MAX_UNITS];
static uint64_t root_table[PAGE_SIZE / sizeof (uint64_t)] __aligned(4096);
static uint64_t ctx_tables[256][PAGE_SIZE / sizeof (uint64_t)] __aligned(4096);
-static MALLOC_DEFINE(M_VTD, "vtd", "vtd");
-
static int
vtd_max_domains(struct vtdmap *vtdmap)
{
@@ -666,7 +664,7 @@ vtd_update_mapping(void *arg, vm_paddr_t gpa, vm_paddr_t hpa, uint64_t len,
* to it from the current page table.
*/
if (ptp[ptpindex] == 0) {
- void *nlp = malloc(PAGE_SIZE, M_VTD, M_WAITOK | M_ZERO);
+ void *nlp = vmm_ptp_alloc();
ptp[ptpindex] = vtophys(nlp)| VTD_PTE_RD | VTD_PTE_WR;
}
@@ -779,12 +777,12 @@ vtd_create_domain(vm_paddr_t maxaddr)
tmp, agaw);
}
- dom = malloc(sizeof (struct domain), M_VTD, M_ZERO | M_WAITOK);
+ dom = kmem_zalloc(sizeof (struct domain), KM_SLEEP);
dom->pt_levels = pt_levels;
dom->addrwidth = addrwidth;
dom->id = domain_id();
dom->maxaddr = maxaddr;
- dom->ptp = malloc(PAGE_SIZE, M_VTD, M_ZERO | M_WAITOK);
+ dom->ptp = vmm_ptp_alloc();
if ((uintptr_t)dom->ptp & PAGE_MASK)
panic("vtd_create_domain: ptp (%p) not page aligned", dom->ptp);
@@ -846,8 +844,7 @@ vtd_free_ptp(uint64_t *ptp, int level)
}
}
- bzero(ptp, PAGE_SIZE);
- free(ptp, M_VTD);
+ vmm_ptp_free(ptp);
}
static void
@@ -859,7 +856,7 @@ vtd_destroy_domain(void *arg)
SLIST_REMOVE(&domhead, dom, domain, next);
vtd_free_ptp(dom->ptp, dom->pt_levels);
- free(dom, M_VTD);
+ kmem_free(dom, sizeof (*dom));
}
const struct iommu_ops iommu_ops_intel = {
diff --git a/usr/src/uts/intel/io/vmm/io/iommu.h b/usr/src/uts/intel/io/vmm/io/iommu.h
index a5e9448b4e..0d1c4b1ee2 100644
--- a/usr/src/uts/intel/io/vmm/io/iommu.h
+++ b/usr/src/uts/intel/io/vmm/io/iommu.h
@@ -73,4 +73,9 @@ void iommu_remove_mapping(void *dom, vm_paddr_t gpa, size_t len);
void iommu_add_device(void *dom, uint16_t rid);
void iommu_remove_device(void *dom, uint16_t rid);
void iommu_invalidate_tlb(void *domain);
+
+/* Glue functions used by iommu provider(s) */
+void *vmm_ptp_alloc(void);
+void vmm_ptp_free(void *);
+
#endif
diff --git a/usr/src/uts/intel/io/vmm/io/ppt.c b/usr/src/uts/intel/io/vmm/io/ppt.c
index 75a29fa17a..3492603d38 100644
--- a/usr/src/uts/intel/io/vmm/io/ppt.c
+++ b/usr/src/uts/intel/io/vmm/io/ppt.c
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/pciio.h>
@@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysmacros.h>
#include "vmm_lapic.h"
-#include "vmm_ktr.h"
#include "iommu.h"
#include "ppt.h"
diff --git a/usr/src/uts/intel/io/vmm/io/vatpic.c b/usr/src/uts/intel/io/vmm/io/vatpic.c
index 43e332d70d..2b4dc81b12 100644
--- a/usr/src/uts/intel/io/vmm/io/vatpic.c
+++ b/usr/src/uts/intel/io/vmm/io/vatpic.c
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/systm.h>
@@ -54,13 +54,10 @@ __FBSDID("$FreeBSD$");
#include <machine/vmm.h>
-#include "vmm_ktr.h"
#include "vmm_lapic.h"
#include "vioapic.h"
#include "vatpic.h"
-static MALLOC_DEFINE(M_VATPIC, "atpic", "bhyve virtual atpic (8259)");
-
#define VATPIC_LOCK(vatpic) mutex_enter(&((vatpic)->lock))
#define VATPIC_UNLOCK(vatpic) mutex_exit(&((vatpic)->lock))
#define VATPIC_LOCKED(vatpic) MUTEX_HELD(&((vatpic)->lock))
@@ -115,21 +112,6 @@ struct vatpic {
struct atpic_stats stats;
};
-#define VATPIC_CTR0(vatpic, fmt) \
- VM_CTR0((vatpic)->vm, fmt)
-
-#define VATPIC_CTR1(vatpic, fmt, a1) \
- VM_CTR1((vatpic)->vm, fmt, a1)
-
-#define VATPIC_CTR2(vatpic, fmt, a1, a2) \
- VM_CTR2((vatpic)->vm, fmt, a1, a2)
-
-#define VATPIC_CTR3(vatpic, fmt, a1, a2, a3) \
- VM_CTR3((vatpic)->vm, fmt, a1, a2, a3)
-
-#define VATPIC_CTR4(vatpic, fmt, a1, a2, a3, a4) \
- VM_CTR4((vatpic)->vm, fmt, a1, a2, a3, a4)
-
/*
* Loop over all the pins in priority order from highest to lowest.
*/
@@ -235,10 +217,6 @@ vatpic_notify_intr(struct vatpic *vatpic)
atpic = &vatpic->atpic[1];
if (!atpic->intr_raised &&
(pin = vatpic_get_highest_irrpin(atpic)) != -1) {
- VATPIC_CTR4(vatpic, "atpic slave notify pin = %d "
- "(imr 0x%x irr 0x%x isr 0x%x)", pin,
- atpic->reg_imr, atpic->reg_irr, atpic->reg_isr);
-
/*
* Cascade the request from the slave to the master.
*/
@@ -247,9 +225,7 @@ vatpic_notify_intr(struct vatpic *vatpic)
(void) vatpic_set_pinstate(vatpic, 2, false);
}
} else {
- VATPIC_CTR3(vatpic, "atpic slave no eligible interrupts "
- "(imr 0x%x irr 0x%x isr 0x%x)",
- atpic->reg_imr, atpic->reg_irr, atpic->reg_isr);
+ /* No eligible interrupts on slave chip */
}
/*
@@ -258,10 +234,6 @@ vatpic_notify_intr(struct vatpic *vatpic)
atpic = &vatpic->atpic[0];
if (!atpic->intr_raised &&
(pin = vatpic_get_highest_irrpin(atpic)) != -1) {
- VATPIC_CTR4(vatpic, "atpic master notify pin = %d "
- "(imr 0x%x irr 0x%x isr 0x%x)", pin,
- atpic->reg_imr, atpic->reg_irr, atpic->reg_isr);
-
/*
* From Section 3.6.2, "Interrupt Modes", in the
* MPtable Specification, Version 1.4
@@ -292,9 +264,7 @@ vatpic_notify_intr(struct vatpic *vatpic)
(void) vioapic_pulse_irq(vatpic->vm, 0);
vatpic->stats.as_interrupts++;
} else {
- VATPIC_CTR3(vatpic, "atpic master no eligible interrupts "
- "(imr 0x%x irr 0x%x isr 0x%x)",
- atpic->reg_imr, atpic->reg_irr, atpic->reg_isr);
+ /* No eligible interrupts on master chip */
}
}
@@ -312,12 +282,12 @@ vatpic_icw1(struct vatpic *vatpic, struct atpic *atpic, uint8_t val)
atpic->special_mask_mode = false;
if ((val & ICW1_SNGL) != 0) {
- VATPIC_CTR0(vatpic, "vatpic cascade mode required");
+ /* Cascade mode reqired */
return (-1);
}
if ((val & ICW1_IC4) == 0) {
- VATPIC_CTR0(vatpic, "vatpic icw4 required");
+ /* ICW4 reqired */
return (-1);
}
@@ -347,7 +317,7 @@ static int
vatpic_icw4(struct vatpic *vatpic, struct atpic *atpic, uint8_t val)
{
if ((val & ICW4_8086) == 0) {
- VATPIC_CTR0(vatpic, "vatpic microprocessor mode required");
+ /* Microprocessor mode required */
return (-1);
}
@@ -809,7 +779,7 @@ vatpic_init(struct vm *vm)
{
struct vatpic *vatpic;
- vatpic = malloc(sizeof (struct vatpic), M_VATPIC, M_WAITOK | M_ZERO);
+ vatpic = kmem_zalloc(sizeof (struct vatpic), KM_SLEEP);
vatpic->vm = vm;
mutex_init(&vatpic->lock, NULL, MUTEX_ADAPTIVE, NULL);
@@ -821,5 +791,5 @@ void
vatpic_cleanup(struct vatpic *vatpic)
{
mutex_destroy(&vatpic->lock);
- free(vatpic, M_VATPIC);
+ kmem_free(vatpic, sizeof (*vatpic));
}
diff --git a/usr/src/uts/intel/io/vmm/io/vatpit.c b/usr/src/uts/intel/io/vmm/io/vatpit.c
index 3d66932a3a..9bf6c01ff4 100644
--- a/usr/src/uts/intel/io/vmm/io/vatpit.c
+++ b/usr/src/uts/intel/io/vmm/io/vatpit.c
@@ -34,19 +34,16 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <machine/vmm.h>
-#include "vmm_ktr.h"
#include "vatpic.h"
#include "vioapic.h"
#include "vatpit.h"
-static MALLOC_DEFINE(M_VATPIT, "atpit", "bhyve virtual atpit (8254)");
-
#define VATPIT_LOCK(vatpit) mutex_enter(&((vatpit)->lock))
#define VATPIT_UNLOCK(vatpit) mutex_exit(&((vatpit)->lock))
@@ -147,8 +144,6 @@ vatpit_callout_handler(void *a)
c = &vatpit->channel[arg->channel_num];
callout = &c->callout;
- VM_CTR1(vatpit->vm, "atpit t%d fired", arg->channel_num);
-
VATPIT_LOCK(vatpit);
if (callout_pending(callout)) /* callout was reset */
@@ -348,7 +343,7 @@ vatpit_handler(void *arg, bool in, uint16_t port, uint8_t bytes, uint32_t *eax)
if (port == TIMER_MODE) {
if (in) {
- VM_CTR0(vatpit->vm, "vatpit attempt to read mode");
+ /* Mode is write-only */
return (-1);
}
@@ -450,7 +445,7 @@ vatpit_init(struct vm *vm)
struct vatpit_callout_arg *arg;
int i;
- vatpit = malloc(sizeof (struct vatpit), M_VATPIT, M_WAITOK | M_ZERO);
+ vatpit = kmem_zalloc(sizeof (struct vatpit), KM_SLEEP);
vatpit->vm = vm;
mutex_init(&vatpit->lock, NULL, MUTEX_ADAPTIVE, NULL);
@@ -474,7 +469,7 @@ vatpit_cleanup(struct vatpit *vatpit)
callout_drain(&vatpit->channel[i].callout);
mutex_destroy(&vatpit->lock);
- free(vatpit, M_VATPIT);
+ kmem_free(vatpit, sizeof (*vatpit));
}
void
diff --git a/usr/src/uts/intel/io/vmm/io/vhpet.c b/usr/src/uts/intel/io/vmm/io/vhpet.c
index 423280a32e..cab4f54458 100644
--- a/usr/src/uts/intel/io/vmm/io/vhpet.c
+++ b/usr/src/uts/intel/io/vmm/io/vhpet.c
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/mutex.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/systm.h>
#include <dev/acpica/acpi_hpet.h>
@@ -52,9 +52,6 @@ __FBSDID("$FreeBSD$");
#include "vioapic.h"
#include "vhpet.h"
-#include "vmm_ktr.h"
-
-static MALLOC_DEFINE(M_VHPET, "vhpet", "bhyve virtual hpet");
#define HPET_FREQ 16777216 /* 16.7 (2^24) Mhz */
#define FS_PER_S 1000000000000000ul
@@ -224,7 +221,6 @@ vhpet_timer_interrupt(struct vhpet *vhpet, int n)
* If a level triggered interrupt is already asserted then just return.
*/
if ((vhpet->isr & (1 << n)) != 0) {
- VM_CTR1(vhpet->vm, "hpet t%d intr is already asserted", n);
return;
}
@@ -236,7 +232,7 @@ vhpet_timer_interrupt(struct vhpet *vhpet, int n)
pin = vhpet_timer_ioapic_pin(vhpet, n);
if (pin == 0) {
- VM_CTR1(vhpet->vm, "hpet t%d intr is not routed to ioapic", n);
+ /* Interrupt is not routed to IOAPIC */
return;
}
@@ -289,8 +285,6 @@ vhpet_handler(void *a)
n = arg->timer_num;
callout = &vhpet->timer[n].callout;
- VM_CTR1(vhpet->vm, "hpet t%d fired", n);
-
VHPET_LOCK(vhpet);
if (callout_pending(callout)) /* callout was reset */
@@ -314,8 +308,6 @@ done:
static void
vhpet_stop_timer(struct vhpet *vhpet, int n, hrtime_t now)
{
-
- VM_CTR1(vhpet->vm, "hpet t%d stopped", n);
callout_stop(&vhpet->timer[n].callout);
/*
@@ -326,8 +318,6 @@ vhpet_stop_timer(struct vhpet *vhpet, int n, hrtime_t now)
* the next interrupt has to wait for the counter to wrap around.
*/
if (vhpet->timer[n].callout_expire < now) {
- VM_CTR1(vhpet->vm, "hpet t%d interrupt triggered after "
- "stopping timer", n);
vhpet_timer_interrupt(vhpet, n);
}
}
@@ -415,7 +405,6 @@ vhpet_timer_update_config(struct vhpet *vhpet, int n, uint64_t data,
return;
vhpet->timer[n].cap_config = newval;
- VM_CTR2(vhpet->vm, "hpet t%d cap_config set to 0x%016x", n, newval);
/*
* Validate the interrupt routing in the HPET_TCNF_INT_ROUTE field.
@@ -425,8 +414,7 @@ vhpet_timer_update_config(struct vhpet *vhpet, int n, uint64_t data,
allowed_irqs = vhpet->timer[n].cap_config >> 32;
new_pin = vhpet_timer_ioapic_pin(vhpet, n);
if (new_pin != 0 && (allowed_irqs & (1 << new_pin)) == 0) {
- VM_CTR3(vhpet->vm, "hpet t%d configured invalid irq %d, "
- "allowed_irqs 0x%08x", n, new_pin, allowed_irqs);
+ /* Invalid IRQ configured */
new_pin = 0;
vhpet->timer[n].cap_config &= ~HPET_TCNF_INT_ROUTE;
}
@@ -458,8 +446,6 @@ vhpet_timer_update_config(struct vhpet *vhpet, int n, uint64_t data,
clear_isr = false;
if (clear_isr) {
- VM_CTR1(vhpet->vm, "hpet t%d isr cleared due to "
- "configuration change", n);
(void) vioapic_deassert_irq(vhpet->vm, old_pin);
vhpet->isr &= ~(1 << n);
}
@@ -496,15 +482,12 @@ vhpet_mmio_write(struct vm *vm, int vcpuid, uint64_t gpa, uint64_t val,
}
break;
default:
- VM_CTR2(vhpet->vm, "hpet invalid mmio write: "
- "offset 0x%08x, size %d", offset, size);
+ /* Invalid MMIO write */
goto done;
}
/* Access to the HPET should be naturally aligned to its width */
if (offset & (size - 1)) {
- VM_CTR2(vhpet->vm, "hpet invalid mmio write: "
- "offset 0x%08x, size %d", offset, size);
goto done;
}
@@ -528,10 +511,8 @@ vhpet_mmio_write(struct vm *vm, int vcpuid, uint64_t gpa, uint64_t val,
if ((oldval ^ vhpet->config) & HPET_CNF_ENABLE) {
if (vhpet_counter_enabled(vhpet)) {
vhpet_start_counting(vhpet);
- VM_CTR0(vhpet->vm, "hpet enabled");
} else {
vhpet_stop_counting(vhpet, counter, now);
- VM_CTR0(vhpet->vm, "hpet disabled");
}
}
goto done;
@@ -541,7 +522,6 @@ vhpet_mmio_write(struct vm *vm, int vcpuid, uint64_t gpa, uint64_t val,
isr_clear_mask = vhpet->isr & data;
for (i = 0; i < VHPET_NUM_TIMERS; i++) {
if ((isr_clear_mask & (1 << i)) != 0) {
- VM_CTR1(vhpet->vm, "hpet t%d isr cleared", i);
vhpet_timer_clear_isr(vhpet, i);
}
}
@@ -630,16 +610,12 @@ vhpet_mmio_read(struct vm *vm, int vcpuid, uint64_t gpa, uint64_t *rval,
/* Accesses to the HPET should be 4 or 8 bytes wide */
if (size != 4 && size != 8) {
- VM_CTR2(vhpet->vm, "hpet invalid mmio read: "
- "offset 0x%08x, size %d", offset, size);
data = 0;
goto done;
}
/* Access to the HPET should be naturally aligned to its width */
if (offset & (size - 1)) {
- VM_CTR2(vhpet->vm, "hpet invalid mmio read: "
- "offset 0x%08x, size %d", offset, size);
data = 0;
goto done;
}
@@ -705,7 +681,7 @@ vhpet_init(struct vm *vm)
uint64_t allowed_irqs;
struct vhpet_callout_arg *arg;
- vhpet = malloc(sizeof (struct vhpet), M_VHPET, M_WAITOK | M_ZERO);
+ vhpet = kmem_zalloc(sizeof (struct vhpet), KM_SLEEP);
vhpet->vm = vm;
mutex_init(&vhpet->lock, NULL, MUTEX_ADAPTIVE, NULL);
@@ -745,7 +721,7 @@ vhpet_cleanup(struct vhpet *vhpet)
callout_drain(&vhpet->timer[i].callout);
mutex_destroy(&vhpet->lock);
- free(vhpet, M_VHPET);
+ kmem_free(vhpet, sizeof (*vhpet));
}
int
diff --git a/usr/src/uts/intel/io/vmm/io/vioapic.c b/usr/src/uts/intel/io/vmm/io/vioapic.c
index 90dedb9ac1..8222fd33e3 100644
--- a/usr/src/uts/intel/io/vmm/io/vioapic.c
+++ b/usr/src/uts/intel/io/vmm/io/vioapic.c
@@ -51,13 +51,12 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/cpuset.h>
#include <x86/apicreg.h>
#include <machine/vmm.h>
-#include "vmm_ktr.h"
#include "vmm_lapic.h"
#include "vlapic.h"
#include "vioapic.h"
@@ -96,19 +95,6 @@ struct vioapic {
#define VIOAPIC_UNLOCK(vioapic) mutex_exit(&((vioapic)->lock))
#define VIOAPIC_LOCKED(vioapic) MUTEX_HELD(&((vioapic)->lock))
-static MALLOC_DEFINE(M_VIOAPIC, "vioapic", "bhyve virtual ioapic");
-
-#define VIOAPIC_CTR1(vioapic, fmt, a1) \
- VM_CTR1((vioapic)->vm, fmt, a1)
-
-#define VIOAPIC_CTR2(vioapic, fmt, a1, a2) \
- VM_CTR2((vioapic)->vm, fmt, a1, a2)
-
-#define VIOAPIC_CTR3(vioapic, fmt, a1, a2, a3) \
- VM_CTR3((vioapic)->vm, fmt, a1, a2, a3)
-
-#define VIOAPIC_CTR4(vioapic, fmt, a1, a2, a3, a4) \
- VM_CTR4((vioapic)->vm, fmt, a1, a2, a3, a4)
static void
vioapic_send_intr(struct vioapic *vioapic, int pin)
@@ -124,7 +110,7 @@ vioapic_send_intr(struct vioapic *vioapic, int pin)
high = vioapic->rtbl[pin].reg >> 32;
if ((low & IOART_INTMASK) == IOART_INTMSET) {
- VIOAPIC_CTR1(vioapic, "ioapic pin%d: masked", pin);
+ /* Pin is masked */
return;
}
@@ -133,8 +119,7 @@ vioapic_send_intr(struct vioapic *vioapic, int pin)
level = low & IOART_TRGRLVL ? true : false;
if (level) {
if ((low & IOART_REM_IRR) != 0) {
- VIOAPIC_CTR1(vioapic, "ioapic pin%d: irr pending",
- pin);
+ /* IRR already pending */
return;
}
vioapic->rtbl[pin].reg |= IOART_REM_IRR;
@@ -331,9 +316,6 @@ vioapic_write(struct vioapic *vioapic, int vcpuid, uint32_t addr, uint32_t data)
(vioapic->rtbl[pin].reg & IOART_REM_IRR) != 0)
vioapic->rtbl[pin].reg &= ~IOART_REM_IRR;
- VIOAPIC_CTR2(vioapic, "ioapic pin%d: redir table entry %#lx",
- pin, vioapic->rtbl[pin].reg);
-
/*
* Generate an interrupt if the following conditions are met:
* - pin trigger mode is level
@@ -341,8 +323,6 @@ vioapic_write(struct vioapic *vioapic, int vcpuid, uint32_t addr, uint32_t data)
*/
if ((vioapic->rtbl[pin].reg & IOART_TRGRMOD) == IOART_TRGRLVL &&
(vioapic->rtbl[pin].acnt > 0)) {
- VIOAPIC_CTR2(vioapic, "ioapic pin%d: asserted at rtbl "
- "write, acnt %d", pin, vioapic->rtbl[pin].acnt);
vioapic_send_intr(vioapic, pin);
}
}
@@ -420,7 +400,6 @@ vioapic_process_eoi(struct vm *vm, int vcpuid, int vector)
("vioapic_process_eoi: invalid vector %d", vector));
vioapic = vm_ioapic(vm);
- VIOAPIC_CTR1(vioapic, "ioapic processing eoi for vector %d", vector);
/*
* XXX keep track of the pins associated with this vector instead
@@ -434,8 +413,7 @@ vioapic_process_eoi(struct vm *vm, int vcpuid, int vector)
continue;
vioapic->rtbl[pin].reg &= ~IOART_REM_IRR;
if (vioapic->rtbl[pin].acnt > 0) {
- VIOAPIC_CTR2(vioapic, "ioapic pin%d: asserted at eoi, "
- "acnt %d", pin, vioapic->rtbl[pin].acnt);
+ /* Pin asserted at EOI */
vioapic_send_intr(vioapic, pin);
}
}
@@ -448,7 +426,7 @@ vioapic_init(struct vm *vm)
int i;
struct vioapic *vioapic;
- vioapic = malloc(sizeof (struct vioapic), M_VIOAPIC, M_WAITOK | M_ZERO);
+ vioapic = kmem_zalloc(sizeof (struct vioapic), KM_SLEEP);
vioapic->vm = vm;
mutex_init(&vioapic->lock, NULL, MUTEX_ADAPTIVE, NULL);
@@ -464,7 +442,7 @@ void
vioapic_cleanup(struct vioapic *vioapic)
{
mutex_destroy(&vioapic->lock);
- free(vioapic, M_VIOAPIC);
+ kmem_free(vioapic, sizeof (*vioapic));
}
int
diff --git a/usr/src/uts/intel/io/vmm/io/vlapic.c b/usr/src/uts/intel/io/vmm/io/vlapic.c
index ef7a876c0c..50964a9c4c 100644
--- a/usr/src/uts/intel/io/vmm/io/vlapic.c
+++ b/usr/src/uts/intel/io/vmm/io/vlapic.c
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/cpuset.h>
@@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$");
#include <sys/vmm_kernel.h>
#include "vmm_lapic.h"
-#include "vmm_ktr.h"
#include "vmm_stat.h"
#include "vlapic.h"
@@ -163,8 +162,7 @@ vlapic_dfr_write_handler(struct vlapic *vlapic)
lapic = vlapic->apic_page;
if (vlapic_x2mode(vlapic)) {
- VM_CTR1(vlapic->vm, "ignoring write to DFR in x2apic mode: %#x",
- lapic->dfr);
+ /* Ignore write to DFR in x2APIC mode */
lapic->dfr = 0;
return;
}
@@ -182,12 +180,10 @@ vlapic_ldr_write_handler(struct vlapic *vlapic)
/* LDR is read-only in x2apic mode */
if (vlapic_x2mode(vlapic)) {
- VLAPIC_CTR1(vlapic, "ignoring write to LDR in x2apic mode: %#x",
- lapic->ldr);
+ /* Ignore write to LDR in x2APIC mode */
lapic->ldr = x2apic_ldr(vlapic);
} else {
lapic->ldr &= ~APIC_LDR_RESERVED;
- VLAPIC_CTR1(vlapic, "vlapic LDR set to %#x", lapic->ldr);
}
}
@@ -263,8 +259,6 @@ vlapic_get_ccr(struct vlapic *vlapic)
}
KASSERT(ccr <= lapic->icr_timer, ("vlapic_get_ccr: invalid ccr %x, "
"icr_timer is %x", ccr, lapic->icr_timer));
- VLAPIC_CTR2(vlapic, "vlapic ccr_timer = %#x, icr_timer = %#x",
- ccr, lapic->icr_timer);
VLAPIC_TIMER_UNLOCK(vlapic);
return (ccr);
}
@@ -279,8 +273,6 @@ vlapic_dcr_write_handler(struct vlapic *vlapic)
VLAPIC_TIMER_LOCK(vlapic);
divisor = vlapic_timer_divisor(lapic->dcr_timer);
- VLAPIC_CTR2(vlapic, "vlapic dcr_timer=%#x, divisor=%d",
- lapic->dcr_timer, divisor);
/*
* Update the timer frequency and the timer period.
@@ -574,7 +566,6 @@ vlapic_update_ppr(struct vlapic *vlapic)
}
vlapic->apic_page->ppr = ppr;
- VLAPIC_CTR1(vlapic, "vlapic_update_ppr 0x%02x", ppr);
}
/*
@@ -598,7 +589,6 @@ vlapic_raise_ppr(struct vlapic *vlapic, int vec)
#endif /* __ISRVEC_DEBUG */
lapic->ppr = ppr;
- VLAPIC_CTR1(vlapic, "vlapic_update_ppr 0x%02x", ppr);
}
void
@@ -627,9 +617,6 @@ vlapic_process_eoi(struct vlapic *vlapic)
vector = i * 32 + bitpos;
isrptr[idx] &= ~(1 << bitpos);
- VCPU_CTR1(vlapic->vm, vlapic->vcpuid, "EOI vector %d",
- vector);
- VLAPIC_CTR_ISR(vlapic, "vlapic_process_eoi");
#ifdef __ISRVEC_DEBUG
vlapic_isrstk_eoi(vlapic, vector);
#endif
@@ -641,7 +628,6 @@ vlapic_process_eoi(struct vlapic *vlapic)
return;
}
}
- VCPU_CTR0(vlapic->vm, vlapic->vcpuid, "Gratuitous EOI");
vmm_stat_incr(vlapic->vm, vlapic->vcpuid, VLAPIC_GRATUITOUS_EOI, 1);
}
@@ -690,7 +676,6 @@ vlapic_fire_timer(struct vlapic *vlapic)
ASSERT(VLAPIC_TIMER_LOCKED(vlapic));
if (vlapic_fire_lvt(vlapic, APIC_LVT_TIMER)) {
- VLAPIC_CTR0(vlapic, "vlapic timer fired");
vmm_stat_incr(vlapic->vm, vlapic->vcpuid, VLAPIC_INTR_TIMER, 1);
}
}
@@ -908,8 +893,6 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys,
* Guest has configured a bad logical
* model for this vcpu - skip it.
*/
- VLAPIC_CTR1(vlapic, "vlapic has bad logical "
- "model %x - cannot deliver interrupt", dfr);
continue;
}
@@ -931,8 +914,6 @@ vlapic_set_tpr(struct vlapic *vlapic, uint8_t val)
struct LAPIC *lapic = vlapic->apic_page;
if (lapic->tpr != val) {
- VCPU_CTR2(vlapic->vm, vlapic->vcpuid, "vlapic TPR changed "
- "from %#x to %#x", lapic->tpr, val);
lapic->tpr = val;
vlapic_update_ppr(vlapic);
}
@@ -1067,7 +1048,6 @@ vlapic_self_ipi_handler(struct vlapic *vlapic, uint32_t val)
(void) lapic_intr_edge(vlapic->vm, vlapic->vcpuid, vec);
vmm_stat_incr(vlapic->vm, vlapic->vcpuid, VLAPIC_IPI_SEND, 1);
vmm_stat_incr(vlapic->vm, vlapic->vcpuid, VLAPIC_IPI_RECV, 1);
- VLAPIC_CTR1(vlapic, "vlapic self-ipi %d", vec);
}
int
@@ -1090,7 +1070,6 @@ vlapic_pending_intr(struct vlapic *vlapic, int *vecptr)
if (bitpos != 0) {
vector = i * 32 + (bitpos - 1);
if (PRIO(vector) > PRIO(lapic->ppr)) {
- VLAPIC_CTR1(vlapic, "pending intr %d", vector);
if (vecptr != NULL)
*vecptr = vector;
return (1);
@@ -1121,11 +1100,9 @@ vlapic_intr_accepted(struct vlapic *vlapic, int vector)
irrptr = &lapic->irr0;
atomic_clear_int(&irrptr[idx], 1 << (vector % 32));
- VLAPIC_CTR_IRR(vlapic, "vlapic_intr_accepted");
isrptr = &lapic->isr0;
isrptr[idx] |= 1 << (vector % 32);
- VLAPIC_CTR_ISR(vlapic, "vlapic_intr_accepted");
/*
* The only way a fresh vector could be accepted into ISR is if it was
@@ -1158,7 +1135,6 @@ vlapic_svr_write_handler(struct vlapic *vlapic)
* The apic is now disabled so stop the apic timer
* and mask all the LVT entries.
*/
- VLAPIC_CTR0(vlapic, "vlapic is software-disabled");
VLAPIC_TIMER_LOCK(vlapic);
callout_stop(&vlapic->callout);
VLAPIC_TIMER_UNLOCK(vlapic);
@@ -1168,7 +1144,6 @@ vlapic_svr_write_handler(struct vlapic *vlapic)
* The apic is now enabled so restart the apic timer
* if it is configured in periodic mode.
*/
- VLAPIC_CTR0(vlapic, "vlapic is software-enabled");
if (vlapic_periodic_timer(vlapic))
vlapic_icrtmr_write_handler(vlapic);
}
@@ -1704,7 +1679,7 @@ vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys,
if (delmode != IOART_DELFIXED &&
delmode != IOART_DELLOPRI &&
delmode != IOART_DELEXINT) {
- VM_CTR1(vm, "vlapic intr invalid delmode %#x", delmode);
+ /* Invalid delivery mode */
return;
}
lowprio = (delmode == IOART_DELLOPRI);
diff --git a/usr/src/uts/intel/io/vmm/io/vlapic_priv.h b/usr/src/uts/intel/io/vmm/io/vlapic_priv.h
index 7b12b60f51..abe1271fcc 100644
--- a/usr/src/uts/intel/io/vmm/io/vlapic_priv.h
+++ b/usr/src/uts/intel/io/vmm/io/vlapic_priv.h
@@ -97,46 +97,6 @@
#define APIC_OFFSET_TIMER_DCR 0x3E0 /* Timer's Divide Configuration */
#define APIC_OFFSET_SELF_IPI 0x3F0 /* Self IPI register */
-#define VLAPIC_CTR0(vlapic, format) \
- VCPU_CTR0((vlapic)->vm, (vlapic)->vcpuid, format)
-
-#define VLAPIC_CTR1(vlapic, format, p1) \
- VCPU_CTR1((vlapic)->vm, (vlapic)->vcpuid, format, p1)
-
-#define VLAPIC_CTR2(vlapic, format, p1, p2) \
- VCPU_CTR2((vlapic)->vm, (vlapic)->vcpuid, format, p1, p2)
-
-#define VLAPIC_CTR3(vlapic, format, p1, p2, p3) \
- VCPU_CTR3((vlapic)->vm, (vlapic)->vcpuid, format, p1, p2, p3)
-
-#define VLAPIC_CTR_IRR(vlapic, msg) \
-do { \
- uint32_t *irrptr = &(vlapic)->apic_page->irr0; \
- irrptr[0] = irrptr[0]; /* silence compiler */ \
- VLAPIC_CTR1((vlapic), msg " irr0 0x%08x", irrptr[0 << 2]); \
- VLAPIC_CTR1((vlapic), msg " irr1 0x%08x", irrptr[1 << 2]); \
- VLAPIC_CTR1((vlapic), msg " irr2 0x%08x", irrptr[2 << 2]); \
- VLAPIC_CTR1((vlapic), msg " irr3 0x%08x", irrptr[3 << 2]); \
- VLAPIC_CTR1((vlapic), msg " irr4 0x%08x", irrptr[4 << 2]); \
- VLAPIC_CTR1((vlapic), msg " irr5 0x%08x", irrptr[5 << 2]); \
- VLAPIC_CTR1((vlapic), msg " irr6 0x%08x", irrptr[6 << 2]); \
- VLAPIC_CTR1((vlapic), msg " irr7 0x%08x", irrptr[7 << 2]); \
-} while (0)
-
-#define VLAPIC_CTR_ISR(vlapic, msg) \
-do { \
- uint32_t *isrptr = &(vlapic)->apic_page->isr0; \
- isrptr[0] = isrptr[0]; /* silence compiler */ \
- VLAPIC_CTR1((vlapic), msg " isr0 0x%08x", isrptr[0 << 2]); \
- VLAPIC_CTR1((vlapic), msg " isr1 0x%08x", isrptr[1 << 2]); \
- VLAPIC_CTR1((vlapic), msg " isr2 0x%08x", isrptr[2 << 2]); \
- VLAPIC_CTR1((vlapic), msg " isr3 0x%08x", isrptr[3 << 2]); \
- VLAPIC_CTR1((vlapic), msg " isr4 0x%08x", isrptr[4 << 2]); \
- VLAPIC_CTR1((vlapic), msg " isr5 0x%08x", isrptr[5 << 2]); \
- VLAPIC_CTR1((vlapic), msg " isr6 0x%08x", isrptr[6 << 2]); \
- VLAPIC_CTR1((vlapic), msg " isr7 0x%08x", isrptr[7 << 2]); \
-} while (0)
-
/*
* 16 priority levels with at most one vector injected per level.
*/
diff --git a/usr/src/uts/intel/io/vmm/io/vpmtmr.c b/usr/src/uts/intel/io/vmm/io/vpmtmr.c
index 9a7d7d4253..930aa2d237 100644
--- a/usr/src/uts/intel/io/vmm/io/vpmtmr.c
+++ b/usr/src/uts/intel/io/vmm/io/vpmtmr.c
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/systm.h>
#include <machine/vmm.h>
@@ -67,14 +67,12 @@ struct vpmtmr {
hrtime_t base_time;
};
-static MALLOC_DEFINE(M_VPMTMR, "vpmtmr", "bhyve virtual acpi timer");
-
struct vpmtmr *
vpmtmr_init(struct vm *vm)
{
struct vpmtmr *vpmtmr;
- vpmtmr = malloc(sizeof (struct vpmtmr), M_VPMTMR, M_WAITOK | M_ZERO);
+ vpmtmr = kmem_zalloc(sizeof (struct vpmtmr), KM_SLEEP);
vpmtmr->vm = vm;
vpmtmr->base_time = gethrtime();
@@ -111,7 +109,7 @@ vpmtmr_cleanup(struct vpmtmr *vpmtmr)
err = vpmtmr_detach_ioport(vpmtmr);
VERIFY3P(err, ==, 0);
- free(vpmtmr, M_VPMTMR);
+ kmem_free(vpmtmr, sizeof (*vpmtmr));
}
int
diff --git a/usr/src/uts/intel/io/vmm/io/vrtc.c b/usr/src/uts/intel/io/vmm/io/vrtc.c
index e01fabfa68..4c74cd7922 100644
--- a/usr/src/uts/intel/io/vmm/io/vrtc.c
+++ b/usr/src/uts/intel/io/vmm/io/vrtc.c
@@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/queue.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/clock.h>
#include <sys/sysctl.h>
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
#include <isa/rtc.h>
-#include "vmm_ktr.h"
#include "vatpic.h"
#include "vioapic.h"
#include "vrtc.h"
@@ -106,8 +105,6 @@ struct vrtc {
static void vrtc_callout_handler(void *arg);
static void vrtc_set_reg_c(struct vrtc *vrtc, uint8_t newval);
-static MALLOC_DEFINE(M_VRTC, "vrtc", "bhyve virtual rtc");
-
SYSCTL_DECL(_hw_vmm);
SYSCTL_NODE(_hw_vmm, OID_AUTO, vrtc, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
NULL);
@@ -403,8 +400,6 @@ vrtc_time_update(struct vrtc *vrtc, time_t newtime, hrtime_t newbase)
alarm_hour = rtc->alarm_hour;
oldtime = vrtc->base_rtctime;
- VM_CTR2(vrtc->vm, "Updating RTC secs from %lx to %lx",
- oldtime, newtime);
vrtc->base_uptime = newbase;
@@ -425,7 +420,6 @@ vrtc_time_update(struct vrtc *vrtc, time_t newtime, hrtime_t newbase)
* Return an error if RTC updates are halted by the guest.
*/
if (rtc_halted(vrtc)) {
- VM_CTR0(vrtc->vm, "RTC update halted by guest");
return (EBUSY);
}
@@ -514,12 +508,10 @@ vrtc_callout_reset(struct vrtc *vrtc, hrtime_t freqhrt)
if (freqhrt == 0) {
if (callout_active(&vrtc->callout)) {
- VM_CTR0(vrtc->vm, "RTC callout stopped");
callout_stop(&vrtc->callout);
}
return;
}
- VM_CTR1(vrtc->vm, "RTC callout frequency %d hz", NANOSEC / freqhrt);
callout_reset_hrtime(&vrtc->callout, freqhrt, vrtc_callout_handler,
vrtc, 0);
}
@@ -531,7 +523,6 @@ vrtc_callout_handler(void *arg)
time_t rtctime;
int error;
- VM_CTR0(vrtc->vm, "vrtc callout fired");
VRTC_LOCK(vrtc);
if (callout_pending(&vrtc->callout)) /* callout was reset */
@@ -580,7 +571,6 @@ vrtc_set_reg_c(struct vrtc *vrtc, uint8_t newval)
{
struct rtcdev *rtc;
int oldirqf, newirqf;
- uint8_t oldval, changed;
ASSERT(VRTC_LOCKED(vrtc));
@@ -596,20 +586,14 @@ vrtc_set_reg_c(struct vrtc *vrtc, uint8_t newval)
newirqf = 0;
}
- oldval = rtc->reg_c;
rtc->reg_c = newirqf | newval;
- changed = oldval ^ rtc->reg_c;
- if (changed) {
- VM_CTR2(vrtc->vm, "RTC reg_c changed from %x to %x",
- oldval, rtc->reg_c);
- }
if (!oldirqf && newirqf) {
- VM_CTR1(vrtc->vm, "RTC irq %d asserted", RTC_IRQ);
+ /* IRQ asserted */
(void) vatpic_pulse_irq(vrtc->vm, RTC_IRQ);
(void) vioapic_pulse_irq(vrtc->vm, RTC_IRQ);
} else if (oldirqf && !newirqf) {
- VM_CTR1(vrtc->vm, "RTC irq %d deasserted", RTC_IRQ);
+ /* IRQ de-asserted */
}
}
@@ -630,10 +614,6 @@ vrtc_set_reg_b(struct vrtc *vrtc, uint8_t newval)
rtc->reg_b = newval;
changed = oldval ^ newval;
- if (changed) {
- VM_CTR2(vrtc->vm, "RTC reg_b changed from %x to %x",
- oldval, newval);
- }
if (changed & RTCSB_HALT) {
hrtime_t basetime;
@@ -695,7 +675,7 @@ static void
vrtc_set_reg_a(struct vrtc *vrtc, uint8_t newval)
{
hrtime_t oldfreq, newfreq;
- uint8_t oldval, changed;
+ uint8_t oldval;
ASSERT(VRTC_LOCKED(vrtc));
@@ -704,8 +684,7 @@ vrtc_set_reg_a(struct vrtc *vrtc, uint8_t newval)
oldfreq = vrtc_freq(vrtc);
if (divider_enabled(oldval) && !divider_enabled(newval)) {
- VM_CTR2(vrtc->vm, "RTC divider held in reset at %lx/%lx",
- vrtc->base_rtctime, vrtc->base_uptime);
+ /* RTC divider held in reset */
} else if (!divider_enabled(oldval) && divider_enabled(newval)) {
/*
* If the dividers are coming out of reset then update
@@ -714,18 +693,11 @@ vrtc_set_reg_a(struct vrtc *vrtc, uint8_t newval)
* while the dividers were disabled.
*/
vrtc->base_uptime = gethrtime();
- VM_CTR2(vrtc->vm, "RTC divider out of reset at %lx/%lx",
- vrtc->base_rtctime, vrtc->base_uptime);
} else {
/* NOTHING */
}
vrtc->rtcdev.reg_a = newval;
- changed = oldval ^ newval;
- if (changed) {
- VM_CTR2(vrtc->vm, "RTC reg_a changed from %x to %x",
- oldval, newval);
- }
/*
* Side effect of changes to rate select and divider enable bits.
@@ -748,13 +720,6 @@ vrtc_set_time(struct vm *vm, time_t secs)
error = vrtc_time_update(vrtc, secs, gethrtime());
VRTC_UNLOCK(vrtc);
- if (error) {
- VM_CTR2(vrtc->vm, "Error %d setting RTC time to %lx", error,
- secs);
- } else {
- VM_CTR1(vrtc->vm, "RTC time set to %lx", secs);
- }
-
return (error);
}
@@ -785,15 +750,13 @@ vrtc_nvram_write(struct vm *vm, int offset, uint8_t value)
*/
if (offset < offsetof(struct rtcdev, nvram[0]) ||
offset == RTC_CENTURY || offset >= sizeof (struct rtcdev)) {
- VM_CTR1(vrtc->vm, "RTC nvram write to invalid offset %d",
- offset);
+ /* NVRAM write to invalid offset */
return (EINVAL);
}
VRTC_LOCK(vrtc);
ptr = (uint8_t *)(&vrtc->rtcdev);
ptr[offset] = value;
- VM_CTR2(vrtc->vm, "RTC nvram write %x to offset %x", value, offset);
VRTC_UNLOCK(vrtc);
return (0);
@@ -897,25 +860,19 @@ vrtc_data_handler(void *arg, bool in, uint16_t port, uint8_t bytes,
} else {
*val = *((uint8_t *)rtc + offset);
}
- VM_CTR2(vm, "Read value %x from RTC offset %x",
- *val, offset);
} else {
switch (offset) {
case 10:
- VM_CTR1(vm, "RTC reg_a set to %x", *val);
vrtc_set_reg_a(vrtc, *val);
break;
case 11:
- VM_CTR1(vm, "RTC reg_b set to %x", *val);
error = vrtc_set_reg_b(vrtc, *val);
break;
case 12:
- VM_CTR1(vm, "RTC reg_c set to %x (ignored)",
- *val);
+ /* Ignored write to reg_c */
break;
case 13:
- VM_CTR1(vm, "RTC reg_d set to %x (ignored)",
- *val);
+ /* Ignored write to reg_d */
break;
case 0:
/*
@@ -924,7 +881,6 @@ vrtc_data_handler(void *arg, bool in, uint16_t port, uint8_t bytes,
*val &= 0x7f;
/* FALLTHRU */
default:
- VM_CTR2(vm, "RTC offset %x set to %x", offset, *val);
*((uint8_t *)rtc + offset) = *val;
break;
}
@@ -969,7 +925,7 @@ vrtc_init(struct vm *vm)
time_t curtime;
int error;
- vrtc = malloc(sizeof (struct vrtc), M_VRTC, M_WAITOK | M_ZERO);
+ vrtc = kmem_zalloc(sizeof (struct vrtc), KM_SLEEP);
vrtc->vm = vm;
mutex_init(&vrtc->lock, NULL, MUTEX_ADAPTIVE, NULL);
callout_init(&vrtc->callout, 1);
@@ -1004,7 +960,7 @@ vrtc_cleanup(struct vrtc *vrtc)
{
callout_drain(&vrtc->callout);
mutex_destroy(&vrtc->lock);
- free(vrtc, M_VRTC);
+ kmem_free(vrtc, sizeof (*vrtc));
}
void
diff --git a/usr/src/uts/intel/io/vmm/sys/vmm_kernel.h b/usr/src/uts/intel/io/vmm/sys/vmm_kernel.h
index ed6fe1c814..29e90e3a1e 100644
--- a/usr/src/uts/intel/io/vmm/sys/vmm_kernel.h
+++ b/usr/src/uts/intel/io/vmm/sys/vmm_kernel.h
@@ -111,10 +111,9 @@ struct vmm_ops {
extern struct vmm_ops vmm_ops_intel;
extern struct vmm_ops vmm_ops_amd;
-int vm_create(const char *name, uint64_t flags, struct vm **retvm);
+int vm_create(uint64_t flags, struct vm **retvm);
void vm_destroy(struct vm *vm);
int vm_reinit(struct vm *vm, uint64_t);
-const char *vm_name(struct vm *vm);
uint16_t vm_get_maxcpus(struct vm *vm);
void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores,
uint16_t *threads, uint16_t *maxcpus);
@@ -378,6 +377,9 @@ typedef enum vm_msr_result {
void vmm_sol_glue_init(void);
void vmm_sol_glue_cleanup(void);
+void *vmm_contig_alloc(size_t);
+void vmm_contig_free(void *, size_t);
+
int vmm_mod_load(void);
int vmm_mod_unload(void);
diff --git a/usr/src/uts/intel/io/vmm/vmm.c b/usr/src/uts/intel/io/vmm/vmm.c
index db87dfbbf4..800ae4d8ee 100644
--- a/usr/src/uts/intel/io/vmm/vmm.c
+++ b/usr/src/uts/intel/io/vmm/vmm.c
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/sysctl.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/pcpu.h>
#include <sys/mutex.h>
#include <sys/proc.h>
@@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$");
#include <sys/vmm_gpt.h>
#include "vmm_ioport.h"
-#include "vmm_ktr.h"
#include "vmm_host.h"
#include "vmm_util.h"
#include "vatpic.h"
@@ -206,7 +205,6 @@ struct vm {
struct mem_map mem_maps[VM_MAX_MEMMAPS]; /* (i) guest address space */
struct mem_seg mem_segs[VM_MAX_MEMSEGS]; /* (o) guest memory regions */
struct vmspace *vmspace; /* (o) guest's address space */
- char name[VM_MAX_NAMELEN]; /* (o) virtual machine name */
struct vcpu vcpu[VM_MAXCPU]; /* (i) guest vcpus */
/* The following describe the vm cpu topology */
uint16_t sockets; /* (o) num of sockets */
@@ -274,8 +272,6 @@ static vmm_pte_ops_t *pte_ops = NULL;
SDT_PROVIDER_DEFINE(vmm);
-static MALLOC_DEFINE(M_VM, "vm", "vm");
-
SYSCTL_NODE(_hw, OID_AUTO, vmm, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
NULL);
@@ -522,7 +518,7 @@ uint_t threads_per_core = 1;
bool gpt_track_dirty = false;
int
-vm_create(const char *name, uint64_t flags, struct vm **retvm)
+vm_create(uint64_t flags, struct vm **retvm)
{
struct vm *vm;
struct vmspace *vmspace;
@@ -534,15 +530,11 @@ vm_create(const char *name, uint64_t flags, struct vm **retvm)
if (!vmm_initialized)
return (ENXIO);
- /* Name validation has already occurred */
- VERIFY3U(strnlen(name, VM_MAX_NAMELEN), <, VM_MAX_NAMELEN);
-
vmspace = vmspace_alloc(VM_MAXUSER_ADDRESS, pte_ops, gpt_track_dirty);
if (vmspace == NULL)
return (ENOMEM);
- vm = malloc(sizeof (struct vm), M_VM, M_WAITOK | M_ZERO);
- (void) strlcpy(vm->name, name, sizeof (vm->name));
+ vm = kmem_zalloc(sizeof (struct vm), KM_SLEEP);
vm->vmspace = vmspace;
vm->mem_transient = (flags & VCF_RESERVOIR_MEM) == 0;
@@ -663,7 +655,7 @@ void
vm_destroy(struct vm *vm)
{
vm_cleanup(vm, true);
- free(vm, M_VM);
+ kmem_free(vm, sizeof (*vm));
}
int
@@ -705,12 +697,6 @@ vm_reinit(struct vm *vm, uint64_t flags)
return (0);
}
-const char *
-vm_name(struct vm *vm)
-{
- return (vm->name);
-}
-
int
vm_map_mmio(struct vm *vm, vm_paddr_t gpa, size_t len, vm_paddr_t hpa)
{
@@ -1127,7 +1113,6 @@ vm_set_register(struct vm *vm, int vcpuid, int reg, uint64_t val)
return (error);
/* Set 'nextrip' to match the value of %rip */
- VCPU_CTR1(vm, vcpuid, "Setting nextrip to %lx", val);
vcpu = &vm->vcpu[vcpuid];
vcpu->nextrip = val;
return (0);
@@ -1340,8 +1325,6 @@ vcpu_set_state_locked(struct vm *vm, int vcpuid, enum vcpu_state newstate,
while (vcpu->state != VCPU_IDLE) {
vcpu->reqidle = 1;
vcpu_notify_event_locked(vcpu, VCPU_NOTIFY_EXIT);
- VCPU_CTR1(vm, vcpuid, "vcpu state change from %s to "
- "idle requested", vcpu_state2str(vcpu->state));
cv_wait(&vcpu->state_cv, &vcpu->lock);
}
} else {
@@ -1380,9 +1363,6 @@ vcpu_set_state_locked(struct vm *vm, int vcpuid, enum vcpu_state newstate,
if (error)
return (EBUSY);
- VCPU_CTR2(vm, vcpuid, "vcpu state changed from %s to %s",
- vcpu_state2str(vcpu->state), vcpu_state2str(newstate));
-
vcpu->state = newstate;
if (newstate == VCPU_RUNNING)
vcpu->hostcpu = curcpu;
@@ -1511,9 +1491,6 @@ vm_handle_paging(struct vm *vm, int vcpuid)
rv = vmc_fault(vmc, vme->u.paging.gpa, ftype);
- VCPU_CTR3(vm, vcpuid, "vm_handle_paging rv = %d, gpa = %lx, "
- "ftype = %d", rv, vme->u.paging.gpa, ftype);
-
if (rv != 0)
return (EFAULT);
return (0);
@@ -1576,9 +1553,6 @@ vm_handle_mmio_emul(struct vm *vm, int vcpuid)
inst_addr = vme->rip + vme->u.mmio_emul.cs_base;
cs_d = vme->u.mmio_emul.cs_d;
- VCPU_CTR1(vm, vcpuid, "inst_emul fault accessing gpa %lx",
- vme->u.mmio_emul.gpa);
-
/* Fetch the faulting instruction */
if (vie_needs_fetch(vie)) {
error = vie_fetch_instruction(vie, vm, vcpuid, inst_addr,
@@ -1597,8 +1571,6 @@ vm_handle_mmio_emul(struct vm *vm, int vcpuid)
}
if (vie_decode_instruction(vie, vm, vcpuid, cs_d) != 0) {
- VCPU_CTR1(vm, vcpuid, "Error decoding instruction at %lx",
- inst_addr);
/* Dump (unrecognized) instruction bytes in userspace */
vie_fallback_exitinfo(vie, vme);
return (-1);
@@ -1765,7 +1737,6 @@ vm_handle_suspend(struct vm *vm, int vcpuid)
int rc;
if (CPU_CMP(&vm->suspended_cpus, &vm->active_cpus) == 0) {
- VCPU_CTR0(vm, vcpuid, "All vcpus suspended");
break;
}
@@ -2435,8 +2406,6 @@ exit:
vmm_savectx(&vcpu->vtc);
kpreempt_enable();
- VCPU_CTR2(vm, vcpuid, "retu %d/%d", error, vme->exitcode);
-
vcpu_ustate_change(vm, vcpuid, VU_EMU_USER);
return (error);
}
@@ -2464,8 +2433,6 @@ vm_restart_instruction(void *arg, int vcpuid)
* instruction to be restarted.
*/
vcpu->exitinfo.inst_length = 0;
- VCPU_CTR1(vm, vcpuid, "restarting instruction at %lx by "
- "setting inst_length to zero", vcpu->exitinfo.rip);
} else if (state == VCPU_FROZEN) {
/*
* When a vcpu is "frozen" it is outside the critical section
@@ -2475,8 +2442,6 @@ vm_restart_instruction(void *arg, int vcpuid)
*/
error = vm_get_register(vm, vcpuid, VM_REG_GUEST_RIP, &rip);
KASSERT(!error, ("%s: error %d getting rip", __func__, error));
- VCPU_CTR2(vm, vcpuid, "restarting instruction by updating "
- "nextrip from %lx to %lx", vcpu->nextrip, rip);
vcpu->nextrip = rip;
} else {
panic("%s: invalid state %d", __func__, state);
@@ -3125,7 +3090,6 @@ vm_activate_cpu(struct vm *vm, int vcpuid)
return (EBUSY);
}
- VCPU_CTR0(vm, vcpuid, "activated");
CPU_SET_ATOMIC(vcpuid, &vm->active_cpus);
/*
diff --git a/usr/src/uts/intel/io/vmm/vmm_gpt.c b/usr/src/uts/intel/io/vmm/vmm_gpt.c
index 586b994d56..a542dba055 100644
--- a/usr/src/uts/intel/io/vmm/vmm_gpt.c
+++ b/usr/src/uts/intel/io/vmm/vmm_gpt.c
@@ -15,7 +15,6 @@
*/
#include <sys/types.h>
-#include <sys/malloc.h>
#include <sys/atomic.h>
#include <sys/kmem.h>
#include <sys/sysmacros.h>
diff --git a/usr/src/uts/intel/io/vmm/vmm_instruction_emul.c b/usr/src/uts/intel/io/vmm/vmm_instruction_emul.c
index a71fa63cc4..6f2380d170 100644
--- a/usr/src/uts/intel/io/vmm/vmm_instruction_emul.c
+++ b/usr/src/uts/intel/io/vmm/vmm_instruction_emul.c
@@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$");
#include <x86/specialreg.h>
#include "vmm_ioport.h"
-#include "vmm_ktr.h"
enum vie_status {
VIES_INIT = (1U << 0),
diff --git a/usr/src/uts/intel/io/vmm/vmm_ktr.h b/usr/src/uts/intel/io/vmm/vmm_ktr.h
deleted file mode 100644
index 2e706ffc57..0000000000
--- a/usr/src/uts/intel/io/vmm/vmm_ktr.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2011 NetApp, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _VMM_KTR_H_
-#define _VMM_KTR_H_
-
-#include <sys/ktr.h>
-#include <sys/pcpu.h>
-
-#ifndef KTR_VMM
-#define KTR_VMM KTR_GEN
-#endif
-
-#define VCPU_CTR0(vm, vcpuid, format) \
- CTR2(KTR_VMM, "vm %s[%d]: " format, vm_name((vm)), (vcpuid))
-
-#define VCPU_CTR1(vm, vcpuid, format, p1) \
- CTR3(KTR_VMM, "vm %s[%d]: " format, vm_name((vm)), (vcpuid), (p1))
-
-#define VCPU_CTR2(vm, vcpuid, format, p1, p2) \
- CTR4(KTR_VMM, "vm %s[%d]: " format, vm_name((vm)), (vcpuid), (p1), (p2))
-
-#define VCPU_CTR3(vm, vcpuid, format, p1, p2, p3) \
- CTR5(KTR_VMM, "vm %s[%d]: " format, vm_name((vm)), (vcpuid), \
- (p1), (p2), (p3))
-
-#define VCPU_CTR4(vm, vcpuid, format, p1, p2, p3, p4) \
- CTR6(KTR_VMM, "vm %s[%d]: " format, vm_name((vm)), (vcpuid), \
- (p1), (p2), (p3), (p4))
-
-#define VM_CTR0(vm, format) \
- CTR1(KTR_VMM, "vm %s: " format, vm_name((vm)))
-
-#define VM_CTR1(vm, format, p1) \
- CTR2(KTR_VMM, "vm %s: " format, vm_name((vm)), (p1))
-
-#define VM_CTR2(vm, format, p1, p2) \
- CTR3(KTR_VMM, "vm %s: " format, vm_name((vm)), (p1), (p2))
-
-#define VM_CTR3(vm, format, p1, p2, p3) \
- CTR4(KTR_VMM, "vm %s: " format, vm_name((vm)), (p1), (p2), (p3))
-
-#define VM_CTR4(vm, format, p1, p2, p3, p4) \
- CTR5(KTR_VMM, "vm %s: " format, vm_name((vm)), (p1), (p2), (p3), (p4))
-#endif
diff --git a/usr/src/uts/intel/io/vmm/vmm_lapic.c b/usr/src/uts/intel/io/vmm/vmm_lapic.c
index 8ef1c851d0..bf97e18d2c 100644
--- a/usr/src/uts/intel/io/vmm/vmm_lapic.c
+++ b/usr/src/uts/intel/io/vmm/vmm_lapic.c
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
#include <x86/apicreg.h>
#include <machine/vmm.h>
-#include "vmm_ktr.h"
#include "vmm_lapic.h"
#include "vlapic.h"
@@ -120,10 +119,8 @@ lapic_intr_msi(struct vm *vm, uint64_t addr, uint64_t msg)
uint32_t dest;
bool phys;
- VM_CTR2(vm, "lapic MSI addr: %#lx msg: %#lx", addr, msg);
-
if ((addr & MSI_X86_ADDR_MASK) != MSI_X86_ADDR_BASE) {
- VM_CTR1(vm, "lapic MSI invalid addr %#lx", addr);
+ /* Invalid MSI address */
return (-1);
}
@@ -143,9 +140,6 @@ lapic_intr_msi(struct vm *vm, uint64_t addr, uint64_t msg)
delmode = msg & APIC_DELMODE_MASK;
vec = msg & 0xff;
- VM_CTR3(vm, "lapic MSI %s dest %#x, vec %d",
- phys ? "physical" : "logical", dest, vec);
-
vlapic_deliver_intr(vm, LAPIC_TRIG_EDGE, dest, phys, delmode, vec);
return (0);
}
diff --git a/usr/src/uts/intel/io/vmm/vmm_sol_dev.c b/usr/src/uts/intel/io/vmm/vmm_sol_dev.c
index c8fd8b9aa4..bf57cba26f 100644
--- a/usr/src/uts/intel/io/vmm/vmm_sol_dev.c
+++ b/usr/src/uts/intel/io/vmm/vmm_sol_dev.c
@@ -1665,7 +1665,7 @@ vmmdev_do_vm_create(const struct vm_create_req *req, cred_t *cr)
goto fail;
}
- error = vm_create(req->name, req->flags, &sc->vmm_vm);
+ error = vm_create(req->flags, &sc->vmm_vm);
if (error == 0) {
/* Complete VM intialization and report success. */
(void) strlcpy(sc->vmm_name, name, sizeof (sc->vmm_name));
diff --git a/usr/src/uts/intel/io/vmm/vmm_sol_glue.c b/usr/src/uts/intel/io/vmm/vmm_sol_glue.c
index 81c3ea0ea9..6e3173581f 100644
--- a/usr/src/uts/intel/io/vmm/vmm_sol_glue.c
+++ b/usr/src/uts/intel/io/vmm/vmm_sol_glue.c
@@ -44,7 +44,7 @@
#include <sys/archsystm.h>
#include <sys/cpuset.h>
#include <sys/fp.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/queue.h>
#include <sys/spl.h>
#include <sys/systm.h>
@@ -146,138 +146,117 @@ cpusetobj_ffs(const cpuset_t *set)
return (small + 1);
}
-struct kmem_item {
- void *addr;
- size_t size;
+struct vmm_ptp_item {
+ void *vpi_vaddr;
};
-static kmutex_t kmem_items_lock;
+static kmutex_t vmm_ptp_lock;
-static mod_hash_t *vmm_alloc_hash;
-uint_t vmm_alloc_hash_nchains = 16381;
-uint_t vmm_alloc_hash_size = PAGESIZE;
+static mod_hash_t *vmm_ptp_hash;
+uint_t vmm_ptp_hash_nchains = 16381;
+uint_t vmm_ptp_hash_size = PAGESIZE;
static void
-vmm_alloc_hash_valdtor(mod_hash_val_t val)
+vmm_ptp_hash_valdtor(mod_hash_val_t val)
{
- struct kmem_item *i = (struct kmem_item *)val;
+ struct vmm_ptp_item *i = (struct vmm_ptp_item *)val;
- kmem_free(i->addr, i->size);
- kmem_free(i, sizeof (struct kmem_item));
+ kmem_free(i->vpi_vaddr, PAGE_SIZE);
+ kmem_free(i, sizeof (*i));
}
static void
-vmm_alloc_init(void)
+vmm_ptp_init(void)
{
- vmm_alloc_hash = mod_hash_create_ptrhash("vmm_alloc_hash",
- vmm_alloc_hash_nchains, vmm_alloc_hash_valdtor,
- vmm_alloc_hash_size);
+ vmm_ptp_hash = mod_hash_create_ptrhash("vmm_ptp_hash",
+ vmm_ptp_hash_nchains, vmm_ptp_hash_valdtor, vmm_ptp_hash_size);
- VERIFY(vmm_alloc_hash != NULL);
+ VERIFY(vmm_ptp_hash != NULL);
}
static uint_t
-vmm_alloc_check(mod_hash_key_t key, mod_hash_val_t *val, void *unused)
+vmm_ptp_check(mod_hash_key_t key, mod_hash_val_t *val, void *unused)
{
- struct kmem_item *i = (struct kmem_item *)val;
+ struct vmm_ptp_item *i = (struct vmm_ptp_item *)val;
- cmn_err(CE_PANIC, "!vmm_alloc_check: hash not empty: %p, %lu", i->addr,
- i->size);
+ cmn_err(CE_PANIC, "!vmm_ptp_check: hash not empty: %p", i->vpi_vaddr);
return (MH_WALK_TERMINATE);
}
static void
-vmm_alloc_cleanup(void)
+vmm_ptp_cleanup(void)
{
- mod_hash_walk(vmm_alloc_hash, vmm_alloc_check, NULL);
- mod_hash_destroy_ptrhash(vmm_alloc_hash);
+ mod_hash_walk(vmm_ptp_hash, vmm_ptp_check, NULL);
+ mod_hash_destroy_ptrhash(vmm_ptp_hash);
}
+/*
+ * The logic in VT-d uses both kernel-virtual and direct-mapped addresses when
+ * freeing PTP pages. Until the consuming code is improved to better track the
+ * pages it allocates, we keep the kernel-virtual addresses to those pages in a
+ * hash table for when they are freed.
+ */
void *
-malloc(unsigned long size, struct malloc_type *mtp, int flags)
+vmm_ptp_alloc(void)
{
- void *p;
- struct kmem_item *i;
- int kmem_flag = KM_SLEEP;
+ void *p;
+ struct vmm_ptp_item *i;
- if (flags & M_NOWAIT)
- kmem_flag = KM_NOSLEEP;
-
- if (flags & M_ZERO) {
- p = kmem_zalloc(size, kmem_flag);
- } else {
- p = kmem_alloc(size, kmem_flag);
- }
+ p = kmem_zalloc(PAGE_SIZE, KM_SLEEP);
+ i = kmem_alloc(sizeof (struct vmm_ptp_item), KM_SLEEP);
+ i->vpi_vaddr = p;
- if (p == NULL)
- return (NULL);
-
- i = kmem_zalloc(sizeof (struct kmem_item), kmem_flag);
-
- if (i == NULL) {
- kmem_free(p, size);
- return (NULL);
- }
-
- mutex_enter(&kmem_items_lock);
- i->addr = p;
- i->size = size;
-
- VERIFY(mod_hash_insert(vmm_alloc_hash,
+ mutex_enter(&vmm_ptp_lock);
+ VERIFY(mod_hash_insert(vmm_ptp_hash,
(mod_hash_key_t)PHYS_TO_DMAP(vtophys(p)), (mod_hash_val_t)i) == 0);
-
- mutex_exit(&kmem_items_lock);
+ mutex_exit(&vmm_ptp_lock);
return (p);
}
void
-free(void *addr, struct malloc_type *mtp)
+vmm_ptp_free(void *addr)
{
- mutex_enter(&kmem_items_lock);
- VERIFY(mod_hash_destroy(vmm_alloc_hash,
+ mutex_enter(&vmm_ptp_lock);
+ VERIFY(mod_hash_destroy(vmm_ptp_hash,
(mod_hash_key_t)PHYS_TO_DMAP(vtophys(addr))) == 0);
- mutex_exit(&kmem_items_lock);
+ mutex_exit(&vmm_ptp_lock);
}
+/* Reach into i86pc/os/ddi_impl.c for these */
extern void *contig_alloc(size_t, ddi_dma_attr_t *, uintptr_t, int);
extern void contig_free(void *, size_t);
void *
-contigmalloc(unsigned long size, struct malloc_type *type, int flags,
- vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
- vm_paddr_t boundary)
+vmm_contig_alloc(size_t size)
{
ddi_dma_attr_t attr = {
/* Using fastboot_dma_attr as a guide... */
- DMA_ATTR_V0,
- low, /* dma_attr_addr_lo */
- high, /* dma_attr_addr_hi */
- 0x00000000FFFFFFFFULL, /* dma_attr_count_max */
- alignment, /* dma_attr_align */
- 1, /* dma_attr_burstsize */
- 1, /* dma_attr_minxfer */
- 0x00000000FFFFFFFFULL, /* dma_attr_maxxfer */
- 0x00000000FFFFFFFFULL, /* dma_attr_seg: any */
- 1, /* dma_attr_sgllen */
- alignment, /* dma_attr_granular */
- 0, /* dma_attr_flags */
+ .dma_attr_version = DMA_ATTR_V0,
+ .dma_attr_addr_lo = 0,
+ .dma_attr_addr_hi = ~0UL,
+ .dma_attr_count_max = 0x00000000FFFFFFFFULL,
+ .dma_attr_align = PAGE_SIZE,
+ .dma_attr_burstsizes = 1,
+ .dma_attr_minxfer = 1,
+ .dma_attr_maxxfer = 0x00000000FFFFFFFFULL,
+ .dma_attr_seg = 0x00000000FFFFFFFFULL, /* any */
+ .dma_attr_sgllen = 1,
+ .dma_attr_granular = PAGE_SIZE,
+ .dma_attr_flags = 0,
};
- int cansleep = (flags & M_WAITOK);
- void *result;
+ void *res;
- ASSERT(alignment == PAGESIZE);
-
- result = contig_alloc((size_t)size, &attr, alignment, cansleep);
-
- if (result != NULL && (flags & M_ZERO) != 0) {
- bzero(result, size);
+ res = contig_alloc(size, &attr, PAGE_SIZE, 1);
+ if (res != NULL) {
+ bzero(res, size);
}
- return (result);
+
+ return (res);
}
void
-contigfree(void *addr, unsigned long size, struct malloc_type *type)
+vmm_contig_free(void *addr, size_t size)
{
contig_free(addr, size);
}
@@ -429,14 +408,14 @@ vmm_cpuid_init(void)
void
vmm_sol_glue_init(void)
{
- vmm_alloc_init();
+ vmm_ptp_init();
vmm_cpuid_init();
}
void
vmm_sol_glue_cleanup(void)
{
- vmm_alloc_cleanup();
+ vmm_ptp_cleanup();
}
diff --git a/usr/src/uts/intel/io/vmm/vmm_stat.c b/usr/src/uts/intel/io/vmm/vmm_stat.c
index 1d8644f48d..1a8128d330 100644
--- a/usr/src/uts/intel/io/vmm/vmm_stat.c
+++ b/usr/src/uts/intel/io/vmm/vmm_stat.c
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <machine/vmm.h>
#include "vmm_util.h"
@@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$");
static int vst_num_elems, vst_num_types;
static struct vmm_stat_type *vsttab[MAX_VMM_STAT_ELEMS];
-static MALLOC_DEFINE(M_VMM_STAT, "vmm stat", "vmm stat");
-
#define vst_size ((size_t)vst_num_elems * sizeof (uint64_t))
void
@@ -122,21 +120,19 @@ vmm_stat_copy(struct vm *vm, int vcpu, int index, int count, int *num_stats,
void *
vmm_stat_alloc(void)
{
-
- return (malloc(vst_size, M_VMM_STAT, M_WAITOK));
+ return (kmem_alloc(vst_size, KM_SLEEP));
}
void
vmm_stat_init(void *vp)
{
-
bzero(vp, vst_size);
}
void
vmm_stat_free(void *vp)
{
- free(vp, M_VMM_STAT);
+ kmem_free(vp, vst_size);
}
int
diff --git a/usr/src/uts/intel/io/vmm/vmm_vm.c b/usr/src/uts/intel/io/vmm/vmm_vm.c
index 6e75e6bf87..42d963a53c 100644
--- a/usr/src/uts/intel/io/vmm/vmm_vm.c
+++ b/usr/src/uts/intel/io/vmm/vmm_vm.c
@@ -26,7 +26,6 @@
#include <sys/sysmacros.h>
#include <sys/machsystm.h>
#include <sys/vmsystm.h>
-#include <sys/malloc.h>
#include <sys/x86_archext.h>
#include <vm/as.h>
#include <vm/hat_i86.h>
diff --git a/usr/src/uts/intel/io/vmm/x86.c b/usr/src/uts/intel/io/vmm/x86.c
index 187c89afd0..de48ba1d48 100644
--- a/usr/src/uts/intel/io/vmm/x86.c
+++ b/usr/src/uts/intel/io/vmm/x86.c
@@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$");
#include <machine/vmm.h>
#include "vmm_host.h"
-#include "vmm_ktr.h"
#include "vmm_util.h"
#include "x86.h"
@@ -110,8 +109,6 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, uint64_t *rax, uint64_t *rbx,
func = (uint32_t)*rax;
param = (uint32_t)*rcx;
- VCPU_CTR2(vm, vcpu_id, "cpuid %#x,%#x", func, param);
-
/*
* Requests for invalid CPUID levels should map to the highest
* available level instead.