- Add bhyve NVMe device emulation.

The initial work on bhyve NVMe device emulation was done by the GSoC student
Shunsuke Mie and was heavily modified in performan, functionality and
guest support by Leon Dang.

bhyve:
	-s <n>,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z

	accepted devpath:
		/dev/blockdev
		/path/to/image
		ram=size_in_MiB

Tested with guest OS: FreeBSD Head, Linux Fedora fc27, Ubuntu 18.04,
                      OpenSuse 15.0, Windows Server 2016 Datacenter.
Tested with all accepted device paths: Real nvme, zdev and also with ram.
Tested on: AMD Ryzen Threadripper 1950X 16-Core Processor and
           Intel(R) Xeon(R) CPU E5-2609 v2 @ 2.50GHz.

Tests at: https://people.freebsd.org/~araujo/bhyve_nvme/nvme.txt

Submitted by:	Shunsuke Mie <sux2mfgj_gmail.com>,
		Leon Dang <leon_digitalmsx.com>
Reviewed by:	chuck (early version), grehan
Relnotes:	Yes
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D14022
This commit is contained in:
Marcelo Araujo 2018-07-05 03:33:58 +00:00
parent 3d07f89450
commit c066c68c57
4 changed files with 1879 additions and 2 deletions

View File

@ -41,6 +41,7 @@ SRCS= \
pci_hostbridge.c \
pci_irq.c \
pci_lpc.c \
pci_nvme.c \
pci_passthru.c \
pci_virtio_block.c \
pci_virtio_console.c \

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd Jun 11, 2018
.Dd Jul 05, 2018
.Dt BHYVE 8
.Os
.Sh NAME
@ -241,6 +241,8 @@ The LPC bridge emulation can only be configured on bus 0.
Raw framebuffer device attached to VNC server.
.It Li xhci
eXtensible Host Controller Interface (xHCI) USB controller.
.It Li nvme
NVM Express (NVMe) controller.
.El
.It Op Ar conf
This optional parameter describes the backend for device emulations.
@ -433,6 +435,27 @@ xHCI USB devices:
A USB tablet device which provides precise cursor synchronization
when using VNC.
.El
.Pp
NVMe devices:
.Bl -tag -width 10n
.It Li devpath
Accepted device paths are:
.Ar /dev/blockdev
or
.Ar /path/to/image
or
.Ar ram=size_in_MiB .
.It Li maxq
Max number of queues.
.It Li qsz
Max elements in each queue.
.It Li ioslots
Max number of concurrent I/O requests.
.It Li sectsz
Sector size (defaults to blockif sector size).
.It Li ser
Serial number with maximum 20 characters.
.El
.El
.It Fl S
Wire guest memory.

View File

@ -44,12 +44,12 @@
#define BLOCKIF_IOV_MAX 33 /* not practical to be IOV_MAX */
struct blockif_req {
struct iovec br_iov[BLOCKIF_IOV_MAX];
int br_iovcnt;
off_t br_offset;
ssize_t br_resid;
void (*br_callback)(struct blockif_req *req, int err);
void *br_param;
struct iovec br_iov[BLOCKIF_IOV_MAX];
};
struct blockif_ctxt;

1853
usr.sbin/bhyve/pci_nvme.c Normal file

File diff suppressed because it is too large Load Diff