summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2022-03-02 13:39:44 -0500
committerDan McDonald <danmcd@joyent.com>2022-03-02 13:39:44 -0500
commit80e685ca4539785ad0b647ce5cef5d5f8b79ed6f (patch)
tree3e0d2a7c85a715c761565d79b810a29618e21454
parent143ed836ba84ee6f57ce416b8693ff0d12cef081 (diff)
parent3d0662810ae7f231943be2eb0bf9cd8b25496ddb (diff)
downloadillumos-joyent-80e685ca4539785ad0b647ce5cef5d5f8b79ed6f.tar.gz
[illumos-gate merge]
commit 3d0662810ae7f231943be2eb0bf9cd8b25496ddb 14511 bhyve needs devmem access for all segments commit d2b76ef70a19a09ea9aab5aaeb614dc7c9d195ed 14534 diff could support -q commit 63cdc4a2836cf93078a5dd140d42583170a04953 14529 nvmeadm should ignore requests to attach/detach ignored namespaces commit 1767024ccd62fe7212679d959527eb445767d01a 14528 nvme should return ENOTSUP for ioctls not supported by the hardware commit 2c4fdd8fb33adc5c98677c7d5c87687c405be868 14544 bhyve(1M) uses -A in EXAMPLES but doesn't otherwise document it
-rw-r--r--usr/src/cmd/bhyve/bhyverun.c15
-rw-r--r--usr/src/cmd/diff/Makefile1
-rw-r--r--usr/src/cmd/diff/diff.c27
-rw-r--r--usr/src/cmd/diff/diff.h10
-rw-r--r--usr/src/cmd/nvmeadm/nvmeadm.c30
-rw-r--r--usr/src/cmd/nvmeadm/nvmeadm.h3
-rw-r--r--usr/src/cmd/nvmeadm/nvmeadm_dev.c18
-rw-r--r--usr/src/man/man1/diff.1850
-rw-r--r--usr/src/man/man1m/bhyve.1m12
-rw-r--r--usr/src/man/man1m/nvmeadm.1m6
-rw-r--r--usr/src/man/man4/bhyve_config.48
-rw-r--r--usr/src/pkg/manifests/system-bhyve-tests.p5m1
-rw-r--r--usr/src/test/bhyve-tests/runfiles/default.run8
-rw-r--r--usr/src/test/bhyve-tests/tests/vmm/Makefile1
-rw-r--r--usr/src/test/bhyve-tests/tests/vmm/mem_devmem.c160
-rw-r--r--usr/src/uts/common/io/nvme/nvme.c33
-rw-r--r--usr/src/uts/common/sys/nvme.h3
-rw-r--r--usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c58
18 files changed, 748 insertions, 496 deletions
diff --git a/usr/src/cmd/bhyve/bhyverun.c b/usr/src/cmd/bhyve/bhyverun.c
index 3b80c9c144..a6819efb97 100644
--- a/usr/src/cmd/bhyve/bhyverun.c
+++ b/usr/src/cmd/bhyve/bhyverun.c
@@ -40,6 +40,7 @@
* Copyright 2015 Pluribus Networks Inc.
* Copyright 2018 Joyent, Inc.
* Copyright 2021 Oxide Computer Company
+ * Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
*/
#include <sys/cdefs.h>
@@ -240,18 +241,18 @@ usage(int code)
#ifdef __FreeBSD__
"Usage: %s [-AaCDeHhPSuWwxY]\n"
#else
- "Usage: %s [-AaCDdeHhPSuWwxY]\n"
+ "Usage: %s [-aCDdeHhPSuWwxY]\n"
#endif
" %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n"
#ifdef __FreeBSD__
" %*s [-G port] [-k config_file] [-l lpc] [-m mem] [-o var=value]\n"
" %*s [-p vcpu:hostcpu] [-r file] [-s pci] [-U uuid] vmname\n"
+ " -A: create ACPI tables\n"
#else
" %*s [-k <config_file>] [-l <lpc>] [-m mem] [-o <var>=<value>]\n"
" %*s [-s <pci>] [-U uuid] vmname\n"
#endif
- " -A: create ACPI tables\n"
" -a: local apic is in xAPIC mode (deprecated)\n"
" -C: include guest memory in core file\n"
" -c: number of cpus and/or topology specification\n"
@@ -1455,7 +1456,17 @@ main(int argc, char *argv[])
set_config_bool("x86.x2apic", false);
break;
case 'A':
+#ifdef __FreeBSD__
+ /*
+ * This option is ignored on illumos since the
+ * generated ACPI tables are not used; the bootroms
+ * have their own. The option is retained for backwards
+ * compatibility but does nothing. Note that the
+ * acpi_tables configuration is still accepted via
+ * -o if somebody really wants to generate these tables.
+ */
set_config_bool("acpi_tables", true);
+#endif
break;
case 'D':
set_config_bool("destroy_on_poweroff", true);
diff --git a/usr/src/cmd/diff/Makefile b/usr/src/cmd/diff/Makefile
index 02f8655486..a3d6ac51aa 100644
--- a/usr/src/cmd/diff/Makefile
+++ b/usr/src/cmd/diff/Makefile
@@ -31,7 +31,6 @@ LIBDIFFH= diffh
include ../Makefile.cmd
CERRWARN += -_gcc=-Wno-parentheses
-CERRWARN += -_gcc=-Wno-address
#
# for messaging catalog
diff --git a/usr/src/cmd/diff/diff.c b/usr/src/cmd/diff/diff.c
index 5a2ae27492..16a3f3b06d 100644
--- a/usr/src/cmd/diff/diff.c
+++ b/usr/src/cmd/diff/diff.c
@@ -38,6 +38,10 @@
*/
/*
+ * Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
+ */
+
+/*
* diff - differential file comparison
*
* Uses an algorithm which finds
@@ -232,7 +236,7 @@ main(int argc, char **argv)
diffargv = argv;
whichtemp = 0;
- while ((flag = getopt(argc, argv, "bitwcuefhnlrsC:D:S:U:")) != EOF) {
+ while ((flag = getopt(argc, argv, "bitwcuefhnlqrsC:D:S:U:")) != EOF) {
switch (flag) {
case 'D':
opt = D_IFDEF;
@@ -294,6 +298,10 @@ main(int argc, char **argv)
opt = D_NREVERSE;
break;
+ case 'q':
+ qflag = 1;
+ break;
+
case 'r':
rflag = 1;
break;
@@ -462,6 +470,13 @@ notsame:
(void) fclose(input[1]);
done();
}
+ if (qflag) {
+ (void) printf(gettext("Files %s and %s differ\n"),
+ file1, file2);
+ (void) fclose(input[0]);
+ (void) fclose(input[1]);
+ done();
+ }
prepare(0, file1);
prepare(1, file2);
prune();
@@ -1796,7 +1811,7 @@ useless(char *cp)
if (cp[1] == '.' && cp[2] == '\0')
return (1); /* directory ".." */
}
- if (start && strcmp(start, cp) > 0)
+ if (strcmp(start, cp) > 0)
return (1);
return (0);
}
@@ -2041,11 +2056,11 @@ static void
usage(void)
{
(void) fprintf(stderr, gettext(
- "usage: diff [-bitw] [-c | -e | -f | -h | -n | -u] file1 "
+ "usage: diff [-biqtw] [-c | -e | -f | -h | -n | -u] file1 "
"file2\n"
- " diff [-bitw] [-C number | -U number] file1 file2\n"
- " diff [-bitw] [-D string] file1 file2\n"
- " diff [-bitw] [-c | -e | -f | -h | -n | -u] [-l] [-r] "
+ " diff [-biqtw] [-C number | -U number] file1 file2\n"
+ " diff [-biqtw] [-D string] file1 file2\n"
+ " diff [-biqtw] [-c | -e | -f | -h | -n | -u] [-l] [-r] "
"[-s] [-S name] directory1 directory2\n"));
status = 2;
done();
diff --git a/usr/src/cmd/diff/diff.h b/usr/src/cmd/diff/diff.h
index 3bc71686ec..420e7726a5 100644
--- a/usr/src/cmd/diff/diff.h
+++ b/usr/src/cmd/diff/diff.h
@@ -25,7 +25,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
@@ -37,12 +37,13 @@
* contributors.
*/
+/*
+ * Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
+ */
+
#ifndef _DIFF_H
#define _DIFF_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -123,6 +124,7 @@ int bflag = 0;
int tflag = 0;
int wflag = 0;
int iflag = 0;
+int qflag = 0;
int rflag = 0;
int lflag = 0;
int sflag = 0;
diff --git a/usr/src/cmd/nvmeadm/nvmeadm.c b/usr/src/cmd/nvmeadm/nvmeadm.c
index b592a2bd25..d288ac1865 100644
--- a/usr/src/cmd/nvmeadm/nvmeadm.c
+++ b/usr/src/cmd/nvmeadm/nvmeadm.c
@@ -293,6 +293,7 @@ main(int argc, char **argv)
}
npa.npa_cmd = cmd;
+ npa.npa_interactive = B_TRUE;
optind++;
@@ -533,8 +534,12 @@ nvme_process(di_node_t node, di_minor_t minor, void *arg)
if (npa->npa_idns == NULL)
goto out;
- if (npa->npa_isns)
- npa->npa_dsk = nvme_dskname(npa);
+ if (npa->npa_isns) {
+ npa->npa_ignored = nvme_is_ignored_ns(fd);
+ if (!npa->npa_ignored)
+ npa->npa_dsk = nvme_dskname(npa);
+ }
+
exitcode += npa->npa_cmd->c_func(fd, npa);
@@ -1247,12 +1252,21 @@ do_attach_detach(int fd, const nvme_process_arg_t *npa)
nvme_walk(&ns_npa, npa->npa_node);
return (exitcode);
- } else {
- if ((c_name[0] == 'd' ? nvme_detach : nvme_attach)(fd)
- == B_FALSE) {
- warn("%s failed", c_name);
- return (-1);
- }
+ }
+
+ /*
+ * Unless the user interactively requested a particular namespace to be
+ * attached or detached, don't even try to attach or detach namespaces
+ * that are ignored by the driver, thereby avoiding printing pointless
+ * error messages.
+ */
+ if (!npa->npa_interactive && npa->npa_ignored)
+ return (0);
+
+ if ((c_name[0] == 'd' ? nvme_detach : nvme_attach)(fd)
+ == B_FALSE) {
+ warn("%s failed", c_name);
+ return (-1);
}
return (0);
diff --git a/usr/src/cmd/nvmeadm/nvmeadm.h b/usr/src/cmd/nvmeadm/nvmeadm.h
index 6b620f8fab..e06cd93189 100644
--- a/usr/src/cmd/nvmeadm/nvmeadm.h
+++ b/usr/src/cmd/nvmeadm/nvmeadm.h
@@ -42,6 +42,8 @@ struct nvme_process_arg {
char *npa_nsid;
int npa_found;
boolean_t npa_isns;
+ boolean_t npa_ignored;
+ boolean_t npa_interactive;
const nvmeadm_cmd_t *npa_cmd;
di_node_t npa_node;
di_minor_t npa_minor;
@@ -114,6 +116,7 @@ extern boolean_t nvme_detach(int);
extern boolean_t nvme_attach(int);
extern boolean_t nvme_firmware_load(int, void *, size_t, offset_t, uint16_t *);
extern boolean_t nvme_firmware_commit(int, int, int, uint16_t *);
+extern boolean_t nvme_is_ignored_ns(int);
/*
* ofmt related
diff --git a/usr/src/cmd/nvmeadm/nvmeadm_dev.c b/usr/src/cmd/nvmeadm/nvmeadm_dev.c
index 1617de5da9..6c837d0d8c 100644
--- a/usr/src/cmd/nvmeadm/nvmeadm_dev.c
+++ b/usr/src/cmd/nvmeadm/nvmeadm_dev.c
@@ -222,6 +222,24 @@ nvme_firmware_commit(int fd, int slot, int action, uint16_t *sc)
return (rv);
}
+boolean_t
+nvme_is_ignored_ns(int fd)
+{
+ boolean_t ret;
+ uint64_t res = 0;
+
+ /*
+ * The ioctl shouldn't fail. If it does, we treat it the same as if the
+ * namespace was ignored.
+ */
+ ret = nvme_ioctl(fd, NVME_IOC_IS_IGNORED_NS, NULL, NULL, 0, &res);
+
+ if (ret)
+ ret = (res == 0) ? B_FALSE : B_TRUE;
+
+ return (ret);
+}
+
int
nvme_open(di_minor_t minor)
{
diff --git a/usr/src/man/man1/diff.1 b/usr/src/man/man1/diff.1
index b3f54b09cb..5078d84803 100644
--- a/usr/src/man/man1/diff.1
+++ b/usr/src/man/man1/diff.1
@@ -43,455 +43,437 @@
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
.\"
-.TH DIFF 1 "Sep 22, 2004"
-.SH NAME
-diff \- compare two files
-.SH SYNOPSIS
-.LP
-.nf
-\fBdiff\fR [\fB-bitw\fR] [\fB-c\fR | \fB-e\fR | \fB-f\fR | \fB-h\fR | \fB-n\fR | \fB-u\fR] \fIfile1\fR \fIfile2\fR
-.fi
-
-.LP
-.nf
-\fBdiff\fR [\fB-bitw\fR] [\fB-C\fR \fInumber\fR | \fB-U\fR \fInumber\fR] \fIfile1\fR \fIfile2\fR
-.fi
-
-.LP
-.nf
-\fBdiff\fR [\fB-bitw\fR] [\fB-D\fR \fIstring\fR] \fIfile1\fR \fIfile2\fR
-.fi
-
-.LP
-.nf
-\fBdiff\fR [\fB-bitw\fR] [\fB-c\fR | \fB-e\fR | \fB-f\fR | \fB-h\fR | \fB-n\fR | \fB-u\fR] [\fB-l\fR] [\fB-r\fR] [\fB-s\fR]
- [\fB-S\fR \fIname\fR] \fIdirectory1\fR \fIdirectory2\fR
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBdiff\fR utility will compare the contents of \fIfile1\fR and \fIfile2\fR
-and write to standard output a list of changes necessary to convert \fIfile1\fR
-into \fIfile2\fR. This list should be minimal. Except in rare circumstances,
-\fBdiff\fR finds a smallest sufficient set of file differences. No output will
-be produced if the files are identical.
-.sp
-.LP
+.Dd February 23, 2022
+.Dt DIFF 1
+.Os
+.Sh NAME
+.Nm diff
+.Nd compare two files
+.Sh SYNOPSIS
+.Nm
+.Op Fl biqtw
+.Op Fl c | e | f | h | n | u
+.Ar file1
+.Ar file2
+.Nm
+.Op Fl biqtw
+.Op Fl C Ar number | Fl U Ar number
+.Ar file1
+.Ar file2
+.Nm
+.Op Fl biqtw
+.Op Fl D Ar string
+.Ar file1
+.Ar file2
+.Nm
+.Op Fl biqtw
+.Op Fl c | e | f | h | n | u
+.Op Fl l
+.Op Fl r
+.Op Fl s
+.Op Fl S Ar name
+.Ar directory1
+.Ar directory2
+.Sh DESCRIPTION
+The
+.Nm
+utility will compare the contents of
+.Ar file1
+and
+.Ar file2
+and write to standard output a list of changes necessary to convert
+.Ar file1
+into
+.Ar file2 .
+This list should be minimal.
+Except in rare circumstances,
+.Nm
+finds a smallest sufficient set of file differences.
+No output will be produced if the files are identical.
+.Pp
The normal output contains lines of these forms:
-.sp
-.in +2
-.nf
-\fIn1\fR \fBa\fR \fIn3,n4\fR
-\fIn1,n2\fR \fBd\fR \fIn3\fR
-\fIn1,n2\fR \fBc\fR \fIn3,n4\fR
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-where \fIn1\fR and \fIn2\fR represent lines \fIfile1\fR and \fIn3\fR and
-\fIn4\fR represent lines in \fIfile2\fR These lines resemble \fBed\fR(1)
-commands to convert \fIfile1\fR to \fIfile2\fR. By exchanging \fBa\fR for
-\fBd\fR and reading backward, \fIfile2\fR can be converted to \fIfile1\fR. As
-in \fBed\fR, identical pairs, where \fIn1\fR=\fIn2\fR or \fIn3\fR=\fIn4\fR, are
-abbreviated as a single number.
-.sp
-.LP
+.Pp
+.Bl -item -offset indent -compact
+.Sm off
+.It
+.Ar n1 Sy a Ar n3 , n4
+.It
+.Ar n1 , n2 Sy d Ar n3
+.It
+.Ar n1 , n2 Sy c Ar n3 , n4
+.Sm on
+.El
+.Pp
+where
+.Ar n1
+and
+.Ar n2
+represent lines in
+.Ar file1
+and
+.Ar n3
+and
+.Ar n4
+represent lines in
+.Ar file2
+These lines resemble
+.Xr ed 1
+commands to convert
+.Ar file1
+to
+.Ar file2 .
+By exchanging
+.Sy a
+for
+.Sy d
+and reading backwards,
+.Ar file2
+can be converted to
+.Ar file1 .
+As in
+.Xr ed 1 ,
+identical pairs, where
+.Ar n1 Ns = Ns Ar n2
+or
+.Ar n3 Ns = Ns Ar n4
+are abbreviated as a single number.
+.Pp
Following each of these lines come all the lines that are affected in the first
-file flagged by `\|\fB<\fR\|', then all the lines that are affected in the
-second file flagged by `\|\fB>\fR\|'.
-.SH OPTIONS
-.sp
-.LP
+file flagged by
+.Sq < ,
+then all the lines that are affected in the second file flagged by
+.Sq > .
+.Sh OPTIONS
The following options are supported:
-.sp
-.ne 2
-.na
-\fB\fB-b\fR \fR
-.ad
-.RS 7n
-Ignores trailing blanks (spaces and tabs) and treats other strings of blanks as
-equivalent.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-i\fR \fR
-.ad
-.RS 7n
-Ignores the case of letters. For example, `\fBA\fR' will compare equal to
-`\fBa\fR'.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-t\fR \fR
-.ad
-.RS 7n
-Expands TAB characters in output lines. Normal or \fB-c\fR output adds
-character(s) to the front of each line that may adversely affect the
-indentation of the original source lines and make the output lines difficult to
-interpret. This option will preserve the original source's indentation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-w\fR \fR
-.ad
-.RS 7n
-Ignores all blanks (SPACE and TAB characters) and treats all other strings of
-blanks as equivalent. For example, `\fBif ( a =\|= b )\fR' will compare equal
-to `\fBif(a=\|=b)\fR'.
-.RE
-
-.sp
-.LP
+.Bl -tag -width Ds
+.It Fl b
+Ignores trailing blanks
+.Pq spaces and tabs
+and treats other strings of blanks as equivalent.
+.It Fl i
+Ignores the case of letters.
+For example, `
+.Sq A
+will compare equal to
+.Sq a .
+.It Fl q
+report only when files differ
+.It Fl t
+Expands TAB characters in output lines.
+Normal or
+.Fl c
+output adds character(s) to the front of each line that may adversely affect
+the indentation of the original source lines and make the output lines
+difficult to interpret.
+This option will preserve the original source's indentation.
+.It Fl w
+Ignores all blanks
+.Pq SPACE and TAB characters
+and treats all other strings of blanks as equivalent.
+For example,
+.Ql if ( a == b )
+will compare equal to
+.Ql if (a==b) .
+.El
+.Pp
The following options are mutually exclusive:
-.sp
-.ne 2
-.na
-\fB\fB-c\fR \fR
-.ad
-.RS 14n
-Produces a listing of differences with three lines of context. With this
-option, output format is modified slightly. That is, output begins with
-identification of the files involved and their creation dates, then each change
-is separated by a line with a dozen \fB*\fR's. The lines removed from
-\fIfile1\fR are marked with '\(em'. The lines added to \fIfile2\fR are
-marked '\|+\|'. Lines that are changed from one file to the other are marked in both
-files with '\|!\|'.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-C\fR \fInumber\fR \fR
-.ad
-.RS 14n
-Produces a listing of differences identical to that produced by \fB-c\fR with
-\fInumber\fR lines of context.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-D\fR \fIstring\fR \fR
-.ad
-.RS 14n
-Creates a merged version of \fIfile1\fR and \fIfile2\fR with C preprocessor
-controls included so that a compilation of the result without defining
-\fIstring\fR is equivalent to compiling \fIfile1\fR, while defining
-\fIstring\fR will yield \fIfile2\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-e\fR \fR
-.ad
-.RS 14n
-Produces a script of only \fBa\fR, \fBc\fR, and \fBd\fR commands for the editor
-\fBed\fR, which will recreate \fIfile2\fR from \fIfile1\fR. In connection with
-the \fB-e\fR option, the following shell program may help maintain multiple
-versions of a file. Only an ancestral file ($1) and a chain of
-version-to-version \fBed\fR scripts ($2,$3,...) made by \fBdiff\fR need be on
-hand. A ``latest version'' appears on the standard output.
-.sp
-.in +2
-.nf
-(shift; cat $*; echo a\'1,$p') | ed \(mi $1
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-f\fR \fR
-.ad
-.RS 13n
-Produces a similar script, not useful with \fBed\fR, in the opposite order.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-h\fR \fR
-.ad
-.RS 13n
-Does a fast, half-hearted job. It works only when changed stretches are short
-and well separated, but does work on files of unlimited length. Options
-\fB-c\fR, \fB-C\fR, \fB-D\fR, \fB-e\fR, \fB-f\fR, and \fB-n\fR are unavailable
-with \fB-h\fR. \fBdiff\fR does not descend into directories with this option.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-n\fR \fR
-.ad
-.RS 13n
-Produces a script similar to \fB-e\fR, but in the opposite order and with a
-count of changed lines on each insert or delete command.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-u\fR\fR
-.ad
-.RS 13n
-Produces a listing of differences with three lines of context. The output is
-similar to that of the \fB-c\fR option, except that the context is "unified".
-Removed and changed lines in \fIfile1\fR are marked by a '\fB-\fR' while lines
-added or changed in \fIfile2\fR are marked by a '\fB+\fR'. Both versions of
-changed lines appear in the output, while added, removed, and context lines
-appear only once. The identification of \fIfile1\fR and \fIfile2\fR is
-different, with "\fB\(mi\(mi\(mi\fR" and "\fB+++\fR" being printed where
-"\fB***\fR" and "\fB\(mi\(mi\(mi\fR" would appear with the \fB-c\fR option.
+.Bl -tag -width Ds
+.It Fl c
+Produces a listing of differences with three lines of context.
+With this option, output format is modified slightly.
+That is, output begins with identification of the files involved and their
+creation dates, then each change is separated by a line with a dozen
+asterisks
+.Pq \&* .
+The lines removed from
+.Ar file1
+are marked with
+.Sq -- .
+The lines added to
+.Ar file2
+are marked
+.Sq \&+ .
+Lines that are changed from one file to the other are marked in both files with
+.Sq \&! .
+.It Fl C Ar number
+Produces a listing of differences identical to that produced by
+.Fl c
+with
+.Ar number
+lines of context.
+.It Fl D Ar string
+Creates a merged version of
+.Ar file1
+and
+.Ar file2
+with C preprocessor controls included so that a compilation of the result
+without defining
+.Ar string
+is equivalent to compiling
+.Ar file1 ,
+while defining
+.Ar string
+will yield
+.Ar file2 .
+.It Fl e
+Produces a script of only
+.Sy a ,
+.Sy c ,
+and
+.Sy d
+commands for the editor
+.Xr ed 1 ,
+which will recreate
+.Ar file2
+from
+.Ar file1 .
+In connection with the
+.Fl e
+option, the following shell program may help maintain multiple versions of a
+file.
+Only an ancestral file
+.Pq $1
+and a chain of version-to-version
+.Sy ed
+scripts
+.Pq $2,$3,...
+made by
+.Nm
+need be on hand.
+A
+.Dq latest version
+appears on the standard output.
+.Pp
+.Dl (shift; cat $*; echo a'1,$p') | ed - $1
+.It Fl f
+Produces a similar script, not useful with
+.Xr ed 1 ,
+in the opposite order.
+.It Fl h
+Does a fast, half-hearted job.
+It works only when changed stretches are short and well separated, but does
+work on files of unlimited length.
+Options
+.Fl c ,
+.Fl C ,
+.Fl D ,
+.Fl e ,
+.Fl f ,
+and
+.Fl n
+are unavailable with
+.Fl h .
+.Nm
+does not descend into directories with this option.
+.It Fl n
+Produces a script similar to
+.Fl e ,
+but in the opposite order and with a count of changed lines on each insert or
+delete command.
+.It Fl u
+Produces a listing of differences with three lines of context.
+The output is similar to that of the
+.Fl c
+option, except that the context is
+.Dq unified .
+Removed and changed lines in
+.Ar file1
+are marked by a
+.Sq \&-
+while lines added or changed in
+.Ar file2
+are marked by a
+.Sq \&+ .
+Both versions of changed lines appear in the output, while added, removed, and
+context lines appear only once.
+The identification of
+.Ar file1
+and
+.Ar file2
+is different, with
+.Dq ---
+and
+.Dq +++
+being printed where
+.Dq ***
+and
+.Dq ---
+would appear with the
+.Fl c
+option.
Each change is separated by a line of the form
-.sp
-.in +2
-.nf
-\fB@@ -\fIn1\fR,\fIn2\fR +\fIn3\fR,\fIn4\fR @@\fR
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-U\fR \fInumber\fR\fR
-.ad
-.RS 13n
-Produces a listing of differences identical to that produced by \fB-u\fR with
-\fInumber\fR lines of context.
-.RE
-
-.sp
-.LP
+.Pp
+.D1 Cm @@ Cm \&- Ns Ar n1 , Ns Ar n2 Cm + Ns Ar n3 , Ns Ar n4 Cm @@
+.It Fl U Ar number
+Produces a listing of differences identical to that produced by
+.Fl u
+with
+.Ar number
+lines of context.
+.El
+.Pp
The following options are used for comparing directories:
-.sp
-.ne 2
-.na
-\fB\fB-l\fR \fR
-.ad
-.RS 12n
-Produces output in long format. Before the \fBdiff\fR, each text file is piped
-through \fBpr\fR(1) to paginate it. Other differences are remembered and
-summarized after all text file differences are reported.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-r\fR \fR
-.ad
-.RS 12n
-Applies \fBdiff\fR recursively to common subdirectories encountered.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-s\fR \fR
-.ad
-.RS 12n
-Reports files that are identical. These identical files would not otherwise be
-mentioned.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-S\fR \fIname\fR \fR
-.ad
-.RS 12n
-Starts a directory \fBdiff\fR in the middle, beginning with the file
-\fIname\fR.
-.RE
-
-.SH OPERANDS
-.sp
-.LP
+.Bl -tag -width Ds
+.It Fl l
+Produces output in long format.
+Before the
+.Nm ,
+each text file is piped through
+.Xr pr 1
+to paginate it.
+Other differences are remembered and summarized after all text file differences
+are reported.
+.It Fl r
+Applies
+.Nm
+recursively to common subdirectories encountered.
+.It Fl s
+Reports files that are identical.
+These identical files would not otherwise be mentioned.
+.It Fl S Ar name
+Starts a directory
+.Nm
+in the middle, beginning with the file
+.Ar name .
+.El
+.Sh OPERANDS
The following operands are supported:
-.sp
-.ne 2
-.na
-\fB\fIfile1\fR \fR
-.ad
-.br
-.na
-\fB\fIfile2\fR\fR
-.ad
-.RS 15n
-A path name of a file or directory to be compared. If either \fIfile1\fR or
-\fIfile2\fR is \fB\(mi\fR, the standard input will be used in its place.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIdirectory1\fR \fR
-.ad
-.br
-.na
-\fB\fIdirectory2\fR\fR
-.ad
-.RS 15n
+.Pp
+.Bl -tag -offset Ds -width directory1 -compact
+.It Ar file1
+.It Ar file2
+A path name of a file or directory to be compared.
+If either
+.Ar file1
+or
+.Ar file2
+is
+.Sq \&- ,
+the standard input will be used in its place.
+.Pp
+.It Ar directory1
+.It Ar directory2
A path name of a directory to be compared.
-.RE
-
-.sp
-.LP
-If only one of \fIfile1\fR and \fIfile2\fR is a directory, \fBdiff\fR will be
-applied to the non-directory file and the file contained in the directory file
-with a filename that is the same as the last component of the non-directory
-file.
-.SH USAGE
-.sp
-.LP
-See \fBlargefile\fR(5) for the description of the behavior of \fBdiff\fR when
-encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
-.SH EXAMPLES
-.LP
-\fBExample 1 \fRTypical output of the diff command
-.sp
-.LP
-In the following command, \fBdir1\fR is a directory containing a directory
-named \fBx\fR, \fBdir2\fR is a directory containing a directory named \fBx\fR,
-\fBdir1/x\fR and \fBdir2/x\fR both contain files named \fBdate.out\fR, and
-\fBdir2/x\fR contains a file named \fBy\fR:
-
-.sp
-.in +2
-.nf
-example% \fBdiff -r dir1 dir2\fR
+.El
+.Pp
+If only one of
+.Ar file1
+and
+.Ar file2
+is a directory,
+.Nm
+will be applied to the non-directory file and the file contained in the
+directory file with a filename that is the same as the last component of the
+non-directory file.
+.Sh USAGE
+See
+.Xr largefile 5
+for the description of the behavior of
+.Nm
+when encountering files greater than or equal to 2 Gbyte
+.Pq 2^31 bytes .
+.Sh FILES
+.Bl -tag -width Ds
+.It Pa /tmp/d?????
+temporary file used for comparison
+.It Pa /usr/lib/diffh
+executable file for
+.Fl h
+option
+.El
+.Sh EXIT STATUS
+The following exit values are returned:
+.Bl -tag -width Ds
+.It 0
+No differences were found.
+.It 1
+Differences were found.
+.It >1
+An error occurred.
+.El
+.Sh EXAMPLES
+.Sy Example 1 No Typical output of the diff command
+.Pp
+In the following command,
+.Ar dir1
+is a directory containing a directory named
+.Pa x ,
+.Ar dir2
+is a directory containing a directory named
+.Pa x ,
+.Pa dir1/x
+and
+.Pa dir2/x
+both contain files named
+.Pa date.out ,
+and
+.Pa dir2/x
+contains a file named
+.Pa y :
+.Bd -literal -offset 4n
+example% diff -r dir1 dir2
Common subdirectories: dir1/x and dir2/x
-
Only in dir2/x: y
-
diff -r dir1/x/date.out dir2/x/date.out
-
1c1
-
< Mon Jul 2 13:12:16 PDT 1990
-
---
-
> Tue Jun 19 21:41:39 PDT 1990
-.fi
-.in -2
-.sp
-
-.SH ENVIRONMENT VARIABLES
-.sp
-.LP
-See \fBenviron\fR(5) for descriptions of the following environment variables
-that affect the execution of \fBdiff\fR: \fBLANG\fR, \fBLC_ALL\fR,
-\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_TIME\fR, and \fBNLSPATH\fR.
-.sp
-.ne 2
-.na
-\fB\fBTZ\fR \fR
-.ad
-.RS 7n
+.Ed
+.Sh ENVIRONMENT VARIABLES
+See
+.Xr environ 5
+for descriptions of the following environment variables that affect the
+execution of
+.Nm :
+.Ev LANG ,
+.Ev LC_ALL ,
+.Ev LC_CTYPE ,
+.Ev LC_MESSAGES ,
+.Ev LC_TIME ,
+and
+.Ev NLSPATH .
+.Bl -tag -width Ds
+.It Ev TZ
Determines the locale for affecting the timezone used for calculating file
-timestamps written with the \fB-C\fR and \fB-c\fR options.
-.RE
-
-.SH EXIT STATUS
-.sp
-.LP
-The following exit values are returned:
-.sp
-.ne 2
-.na
-\fB\fB0\fR \fR
-.ad
-.RS 7n
-No differences were found.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB1\fR \fR
-.ad
-.RS 7n
-Differences were found.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB>1\fR \fR
-.ad
-.RS 7n
-An error occurred.
-.RE
-
-.SH FILES
-.sp
-.ne 2
-.na
-\fB\fB/tmp/d?????\fR \fR
-.ad
-.RS 19n
-temporary file used for comparison
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB/usr/lib/diffh\fR \fR
-.ad
-.RS 19n
-executable file for \fB-h\fR option
-.RE
-
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-CSI Enabled
-_
-Interface Stability Standard
-.TE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBbdiff\fR(1), \fBcmp\fR(1), \fBcomm\fR(1), \fBdircmp\fR(1), \fBed\fR(1),
-\fBpr\fR(1), \fBsdiff\fR(1), \fBattributes\fR(5), \fBenviron\fR(5),
-\fBlargefile\fR(5), \fBstandards\fR(5)
-.SH NOTES
-.sp
-.LP
-Editing scripts produced under the \fB-e\fR or \fB-f\fR options are naive about
-creating lines consisting of a single period (\fB\&.\fR).
-.sp
-.LP
+timestamps written with the
+.Fl C
+and
+.Fl c
+options.
+.El
+.Sh INTERFACE STABILITY
+The command line interface of
+.Nm
+is
+.Sy Committed .
+The output of
+.Nm
+is
+.Sy Committed .
+.Sh SEE ALSO
+.Xr bdiff 1 ,
+.Xr cmp 1 ,
+.Xr comm 1 ,
+.Xr dircmp 1 ,
+.Xr ed 1 ,
+.Xr pr 1 ,
+.Xr sdiff 1 ,
+.Xr attributes 5 ,
+.Xr environ 5 ,
+.Xr largefile 5 ,
+.Xr standards 5
+.Sh NOTES
+Editing scripts produced under the
+.Fl e
+or
+.Fl f
+options are na\(:ive about creating lines consisting of a single dot
+.Sq \&. .
+.Pp
Missing NEWLINE at end of file indicates that the last line of the file in
-question did not have a NEWLINE. If the lines are different, they will be
-flagged and output, although the output will seem to indicate they are the
-same.
+question did not have a NEWLINE.
+If the lines are different, they will be flagged and output, although the
+output will seem to indicate they are the same.
diff --git a/usr/src/man/man1m/bhyve.1m b/usr/src/man/man1m/bhyve.1m
index dfb4bc965b..689c34fdb3 100644
--- a/usr/src/man/man1m/bhyve.1m
+++ b/usr/src/man/man1m/bhyve.1m
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" Portions Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
+.\" Portions Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
.\"
-.Dd November 18, 2021
+.Dd February 26, 2022
.Dt BHYVE 1M
.Os
.Sh NAME
@@ -772,7 +772,7 @@ block device backed by the
filesystem image, and a serial port for the console:
.Bd -literal -offset indent
bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \e
- -l com1,stdio -A -H -P -m 1G vm1
+ -l com1,stdio -H -P -m 1G vm1
.Ed
.Pp
Run a 24GB single-CPU virtual machine with three network ports.
@@ -780,7 +780,7 @@ Run a 24GB single-CPU virtual machine with three network ports.
bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net-viona,vmvnic0 \e
-s 2:1,virtio-net-viona,vmvnic1 -s 2:2,virtio-net-viona,vmvnic2 \e
-s 3,virtio-blk,/my/image -l com1,stdio \e
- -A -H -P -m 24G bigvm
+ -H -P -m 24G bigvm
.Ed
.Pp
Run an 8GB virtual machine with 2 quad core CPUs, 2 NVMe disks and one other
@@ -795,7 +795,7 @@ bhyve -c sockets=2,cores=4,threads=2 \e
-s 2:0,ahci,cd:/images/install.iso \e
-s 3,virtio-net-viona,vnic=vmvnic0 \e
-l com1,socket,/tmp/vm.com1,wait \e
- -A -H -P -m 8G
+ -H -P -m 8G
.Ed
.Pp
Run a UEFI virtual machine with a display resolution of 800 by 600 pixels
@@ -806,7 +806,7 @@ bhyve -c 2 -m 4G -w -H \e
-s 3,ahci-cd,/path/to/uefi-OS-install.iso \e
-s 4,nvme,/dev/zvol/rdsk/tank/hdd0 \e
-s 5,virtio-net-viona,vnic=vnmic0 \e
- -s 29,fbuf,rfb=0.0.0.0:5900,w=800,h=600,wait \e
+ -s 29,fbuf,vga=off,rfb=0.0.0.0:5900,w=800,h=600,wait \e
-s 30,xhci,tablet \e
-s 31,lpc -l com1,stdio \e
-l bootrom,/usr/share/bhyve/firmware/BHYVE_UEFI.fd \e
diff --git a/usr/src/man/man1m/nvmeadm.1m b/usr/src/man/man1m/nvmeadm.1m
index 0ec278936e..422e6f0048 100644
--- a/usr/src/man/man1m/nvmeadm.1m
+++ b/usr/src/man/man1m/nvmeadm.1m
@@ -390,6 +390,9 @@ currently opened.
The detached state will not persist across reboots or reloads of the
.Xr nvme 7D
driver.
+.Pp
+It is not an error to detach a namespace that is already detached, any such
+request will be silently ignored.
.It Xo
.Nm
.Cm attach
@@ -403,6 +406,9 @@ previous
.Nm
.Cm detach
command.
+.Pp
+It is not an error to attach a namespace that is already attached, any such
+request will be silently ignored.
.It Xo
.Nm
.Cm list-firmware
diff --git a/usr/src/man/man4/bhyve_config.4 b/usr/src/man/man4/bhyve_config.4
index 963139050c..94572b7ace 100644
--- a/usr/src/man/man4/bhyve_config.4
+++ b/usr/src/man/man4/bhyve_config.4
@@ -23,9 +23,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" Portions Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
+.\" Portions Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
.\"
-.Dd September 25, 2021
+.Dd February 26, 2022
.Dt BHYVE_CONFIG 4
.Os
.Sh NAME
@@ -123,7 +123,9 @@ If no suffix is given, the value is assumed to be in mebibytes.
.It Va memory.wired Ta bool Ta false Ta
Wire guest memory.
.It Va acpi_tables Ta bool Ta false Ta
-Generate ACPI tables.
+Generate ACPI tables; these tables are
+.Em not
+used on illumos.
.It Va destroy_on_poweroff Ta bool Ta false Ta
Destroy the VM on guest-initiated power-off.
.It Va gdb.address Ta string Ta localhost Ta
diff --git a/usr/src/pkg/manifests/system-bhyve-tests.p5m b/usr/src/pkg/manifests/system-bhyve-tests.p5m
index 823ed69a60..d0d31a0190 100644
--- a/usr/src/pkg/manifests/system-bhyve-tests.p5m
+++ b/usr/src/pkg/manifests/system-bhyve-tests.p5m
@@ -39,6 +39,7 @@ file path=opt/bhyve-tests/tests/mevent/vnode_file mode=0555
file path=opt/bhyve-tests/tests/mevent/vnode_zvol mode=0555
dir path=opt/bhyve-tests/tests/vmm
file path=opt/bhyve-tests/tests/vmm/fpu_getset mode=0555
+file path=opt/bhyve-tests/tests/vmm/mem_devmem mode=0555
file path=opt/bhyve-tests/tests/vmm/mem_partial mode=0555
file path=opt/bhyve-tests/tests/vmm/mem_seg_map mode=0555
license lic_CDDL license=lic_CDDL
diff --git a/usr/src/test/bhyve-tests/runfiles/default.run b/usr/src/test/bhyve-tests/runfiles/default.run
index 3055f3e2d8..0aae1bcb46 100644
--- a/usr/src/test/bhyve-tests/runfiles/default.run
+++ b/usr/src/test/bhyve-tests/runfiles/default.run
@@ -20,7 +20,13 @@ post =
outputdir = /var/tmp/test_results
[/opt/bhyve-tests/tests/vmm]
-tests = ['mem_partial', 'mem_seg_map', 'fpu_getset']
+user = root
+tests = [
+ 'fpu_getset',
+ 'mem_devmem',
+ 'mem_partial',
+ 'mem_seg_map'
+ ]
# Tests of userspace mevent system, built from cmd/bhyve
[/opt/bhyve-tests/tests/mevent]
diff --git a/usr/src/test/bhyve-tests/tests/vmm/Makefile b/usr/src/test/bhyve-tests/tests/vmm/Makefile
index 30d06a0f6b..97cf709ca3 100644
--- a/usr/src/test/bhyve-tests/tests/vmm/Makefile
+++ b/usr/src/test/bhyve-tests/tests/vmm/Makefile
@@ -17,6 +17,7 @@ include $(SRC)/test/Makefile.com
PROG = mem_partial \
mem_seg_map \
+ mem_devmem \
fpu_getset
COMMON_OBJS = common.o
diff --git a/usr/src/test/bhyve-tests/tests/vmm/mem_devmem.c b/usr/src/test/bhyve-tests/tests/vmm/mem_devmem.c
new file mode 100644
index 0000000000..5742739f39
--- /dev/null
+++ b/usr/src/test/bhyve-tests/tests/vmm/mem_devmem.c
@@ -0,0 +1,160 @@
+/*
+ * 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 2022 Oxide Computer Company
+ */
+
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stropts.h>
+#include <strings.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <libgen.h>
+
+#include <sys/vmm.h>
+#include <sys/vmm_dev.h>
+#include <sys/mman.h>
+#include <vmmapi.h>
+
+#include "common.h"
+
+enum test_segs {
+ SEG_LOWMEM = 0,
+ SEG_BOOTROM = 1,
+};
+#define PAGE_CNT 2
+#define PAGE_SZ 4096
+#define SEG_SZ (PAGE_CNT * PAGE_SZ)
+#define WHOLE_SZ (SEG_SZ * 2)
+
+#define TESTVAL_LOWMEM 0x1000ffff
+#define TESTVAL_BOOTROM 0x2000eeee
+
+int
+main(int argc, char *argv[])
+{
+ struct vmctx *ctx;
+ int res, fd;
+ const char *suite_name = basename(argv[0]);
+
+ ctx = create_test_vm(suite_name);
+ if (ctx == NULL) {
+ perror("could open test VM");
+ return (1);
+ }
+ fd = vm_get_device_fd(ctx);
+
+ res = alloc_memseg(ctx, SEG_LOWMEM, SEG_SZ, "");
+ if (res != 0) {
+ perror("could not alloc lowmem seg");
+ goto bail;
+ }
+ res = alloc_memseg(ctx, SEG_BOOTROM, SEG_SZ, "bootrom");
+ if (res != 0) {
+ perror("could not alloc bootrom seg");
+ goto bail;
+ }
+
+ res = vm_mmap_memseg(ctx, 0, SEG_LOWMEM, 0, SEG_SZ, PROT_ALL);
+ if (res != 0) {
+ perror("could not map lowmem into vmspace");
+ goto bail;
+ }
+ res = vm_mmap_memseg(ctx, SEG_SZ, SEG_BOOTROM, 0, SEG_SZ, PROT_READ);
+ if (res != 0) {
+ perror("could not map bootrom into vmspace");
+ goto bail;
+ }
+
+ void *guest_mem;
+ guest_mem = mmap(NULL, WHOLE_SZ, PROT_READ, MAP_SHARED, fd, 0);
+ if (guest_mem == MAP_FAILED) {
+ perror("could not mmap guest-physical memory");
+ goto bail;
+ }
+
+ void *direct_lowmem, *direct_bootrom;
+ off_t seg_obj_off;
+
+ res = vm_get_devmem_offset(ctx, SEG_LOWMEM, &seg_obj_off);
+ if (res != 0) {
+ perror("could not find mapping offset for lowmem seg");
+ goto bail;
+ }
+ direct_lowmem = mmap(NULL, SEG_SZ, PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, seg_obj_off);
+ if (direct_lowmem == MAP_FAILED) {
+ perror("could not mmap lowmem directly");
+ goto bail;
+ }
+
+ res = vm_get_devmem_offset(ctx, SEG_BOOTROM, &seg_obj_off);
+ if (res != 0) {
+ perror("could not find mapping offset for lowmem seg");
+ goto bail;
+ }
+ direct_bootrom = mmap(NULL, SEG_SZ, PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, seg_obj_off);
+ if (direct_bootrom == MAP_FAILED) {
+ perror("could not mmap bootrom directly");
+ goto bail;
+ }
+
+ uint32_t *datap;
+
+ datap = direct_lowmem;
+ *datap = TESTVAL_LOWMEM;
+ datap = direct_bootrom;
+ *datap = TESTVAL_BOOTROM;
+
+ /* check that data written though direct access is as expected */
+ datap = guest_mem;
+ if (*datap != TESTVAL_LOWMEM) {
+ (void) fprintf(stderr, "unexpected data in lowmem %x != %x\n",
+ *datap, TESTVAL_LOWMEM);
+ goto bail;
+ }
+ datap = (guest_mem + SEG_SZ);
+ if (*datap != TESTVAL_BOOTROM) {
+ (void) fprintf(stderr, "unexpected data in bootrom %x != %x\n",
+ *datap, TESTVAL_BOOTROM);
+ goto bail;
+ }
+
+ /* unmap access mappings */
+ res = munmap(guest_mem, WHOLE_SZ);
+ if (res != 0) {
+ perror("could not munmap vmspace");
+ goto bail;
+ }
+ res = munmap(direct_lowmem, SEG_SZ);
+ if (res != 0) {
+ perror("could not munmap lowmem object");
+ goto bail;
+ }
+ res = munmap(direct_bootrom, SEG_SZ);
+ if (res != 0) {
+ perror("could not munmap bootrom object");
+ goto bail;
+ }
+
+ /* mission accomplished */
+ vm_destroy(ctx);
+ (void) printf("%s\tPASS\n", suite_name);
+ return (0);
+
+bail:
+ vm_destroy(ctx);
+ return (1);
+}
diff --git a/usr/src/uts/common/io/nvme/nvme.c b/usr/src/uts/common/io/nvme/nvme.c
index 77117adda0..a8a9d0b843 100644
--- a/usr/src/uts/common/io/nvme/nvme.c
+++ b/usr/src/uts/common/io/nvme/nvme.c
@@ -4662,7 +4662,7 @@ nvme_ioctl_get_features(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc,
return (EINVAL);
}
} else if (res != 0) {
- return (EINVAL);
+ return (ENOTSUP);
}
break;
@@ -4777,7 +4777,7 @@ nvme_ioctl_format(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc, int mode,
* Check whether the FORMAT NVM command is supported.
*/
if (nvme->n_idctl->id_oacs.oa_format == 0)
- return (EINVAL);
+ return (ENOTSUP);
/*
* Don't allow format or secure erase of individual namespace if that
@@ -4908,6 +4908,9 @@ nvme_ioctl_firmware_download(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc,
if ((mode & FWRITE) == 0 || secpolicy_sys_config(cred_p, B_FALSE) != 0)
return (EPERM);
+ if (nvme->n_idctl->id_oacs.oa_firmware == 0)
+ return (ENOTSUP);
+
if (nsid != 0)
return (EINVAL);
@@ -4989,6 +4992,9 @@ nvme_ioctl_firmware_commit(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc,
if ((mode & FWRITE) == 0 || secpolicy_sys_config(cred_p, B_FALSE) != 0)
return (EPERM);
+ if (nvme->n_idctl->id_oacs.oa_firmware == 0)
+ return (ENOTSUP);
+
if (nsid != 0)
return (EINVAL);
@@ -5266,6 +5272,26 @@ out:
}
static int
+nvme_ioctl_is_ignored_ns(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc, int mode,
+ cred_t *cred_p)
+{
+ _NOTE(ARGUNUSED(cred_p));
+
+ if ((mode & FREAD) == 0)
+ return (EPERM);
+
+ if (nsid == 0)
+ return (EINVAL);
+
+ if (nvme->n_ns[nsid - 1].ns_ignore)
+ nioc->n_arg = 1;
+ else
+ nioc->n_arg = 0;
+
+ return (0);
+}
+
+static int
nvme_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *cred_p,
int *rval_p)
{
@@ -5292,7 +5318,8 @@ nvme_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *cred_p,
nvme_ioctl_attach,
nvme_ioctl_firmware_download,
nvme_ioctl_firmware_commit,
- nvme_ioctl_passthru
+ nvme_ioctl_passthru,
+ nvme_ioctl_is_ignored_ns
};
if (nvme == NULL)
diff --git a/usr/src/uts/common/sys/nvme.h b/usr/src/uts/common/sys/nvme.h
index 83d29d0b8d..bca3102270 100644
--- a/usr/src/uts/common/sys/nvme.h
+++ b/usr/src/uts/common/sys/nvme.h
@@ -54,7 +54,8 @@ extern "C" {
#define NVME_IOC_FIRMWARE_DOWNLOAD (NVME_IOC | 11)
#define NVME_IOC_FIRMWARE_COMMIT (NVME_IOC | 12)
#define NVME_IOC_PASSTHRU (NVME_IOC | 13)
-#define NVME_IOC_MAX NVME_IOC_PASSTHRU
+#define NVME_IOC_IS_IGNORED_NS (NVME_IOC | 14)
+#define NVME_IOC_MAX NVME_IOC_IS_IGNORED_NS
#define IS_NVME_IOC(x) ((x) > NVME_IOC && (x) <= NVME_IOC_MAX)
#define NVME_IOC_CMD(x) ((x) & 0xff)
diff --git a/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c b/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c
index 4ef2e5f583..24dd851831 100644
--- a/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c
+++ b/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c
@@ -115,6 +115,33 @@ static int vmm_kstat_alloc(vmm_softc_t *, minor_t, const cred_t *);
static void vmm_kstat_init(vmm_softc_t *);
static void vmm_kstat_fini(vmm_softc_t *);
+/*
+ * The 'devmem' hack:
+ *
+ * On native FreeBSD, bhyve consumers are allowed to create 'devmem' segments
+ * in the vm which appear with their own name related to the vm under /dev.
+ * Since this would be a hassle from an sdev perspective and would require a
+ * new cdev interface (or complicate the existing one), we choose to implement
+ * this in a different manner. Direct access to the underlying vm memory
+ * segments is exposed by placing them in a range of offsets beyond the normal
+ * guest memory space. Userspace can query the appropriate offset to mmap()
+ * for a given segment-id with the VM_DEVMEM_GETOFFSET ioctl.
+ */
+
+static vmm_devmem_entry_t *
+vmmdev_devmem_find(vmm_softc_t *sc, int segid)
+{
+ vmm_devmem_entry_t *ent = NULL;
+ list_t *dl = &sc->vmm_devmem_list;
+
+ for (ent = list_head(dl); ent != NULL; ent = list_next(dl, ent)) {
+ if (ent->vde_segid == segid) {
+ return (ent);
+ }
+ }
+ return (NULL);
+}
+
static int
vmmdev_get_memseg(vmm_softc_t *sc, struct vm_memseg *mseg)
{
@@ -128,13 +155,8 @@ vmmdev_get_memseg(vmm_softc_t *sc, struct vm_memseg *mseg)
if (!sysmem) {
vmm_devmem_entry_t *de;
- list_t *dl = &sc->vmm_devmem_list;
- for (de = list_head(dl); de != NULL; de = list_next(dl, de)) {
- if (de->vde_segid == mseg->segid) {
- break;
- }
- }
+ de = vmmdev_devmem_find(sc, mseg->segid);
if (de != NULL) {
(void) strlcpy(mseg->name, de->vde_name,
sizeof (mseg->name));
@@ -146,19 +168,6 @@ vmmdev_get_memseg(vmm_softc_t *sc, struct vm_memseg *mseg)
return (error);
}
-/*
- * The 'devmem' hack:
- *
- * On native FreeBSD, bhyve consumers are allowed to create 'devmem' segments
- * in the vm which appear with their own name related to the vm under /dev.
- * Since this would be a hassle from an sdev perspective and would require a
- * new cdev interface (or complicate the existing one), we choose to implement
- * this in a different manner. When 'devmem' mappings are created, an
- * identifying off_t is communicated back out to userspace. That off_t,
- * residing above the normal guest memory space, can be used to mmap the
- * 'devmem' mapping from the already-open vm device.
- */
-
static int
vmmdev_devmem_create(vmm_softc_t *sc, struct vm_memseg *mseg, const char *name)
{
@@ -239,7 +248,7 @@ vmmdev_alloc_memseg(vmm_softc_t *sc, struct vm_memseg *mseg)
}
error = vm_alloc_memseg(sc->vmm_vm, mseg->segid, mseg->len, sysmem);
- if (error == 0 && VM_MEMSEG_NAME(mseg)) {
+ if (error == 0) {
/*
* Rather than create a whole fresh device from which userspace
* can mmap this segment, instead make it available at an
@@ -1442,19 +1451,14 @@ vmmdev_do_ioctl(vmm_softc_t *sc, int cmd, intptr_t arg, int md,
}
case VM_DEVMEM_GETOFFSET: {
struct vm_devmem_offset vdo;
- list_t *dl = &sc->vmm_devmem_list;
- vmm_devmem_entry_t *de = NULL;
+ vmm_devmem_entry_t *de;
if (ddi_copyin(datap, &vdo, sizeof (vdo), md) != 0) {
error = EFAULT;
break;
}
- for (de = list_head(dl); de != NULL; de = list_next(dl, de)) {
- if (de->vde_segid == vdo.segid) {
- break;
- }
- }
+ de = vmmdev_devmem_find(sc, vdo.segid);
if (de != NULL) {
vdo.offset = de->vde_off;
if (ddi_copyout(&vdo, datap, sizeof (vdo), md) != 0) {