Commit 13f8cf15 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

nvme: add NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC



The VirtualBox emulated NVMe device will intermittently
hang on the first read/write command after an I/O
qpair has been allocated.  The frequency of the hang
diminishes if a delay is added after allocating the I/O
qpair - until it disappears completely with a 100us delay.
So add a quirk to insert this delay.

Note - the 100us delay was tested by running
the hello_world example app 50000 times.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I237e31b1b8a1a1e28262851ae0a21cd7345f0f1a
parent 2ba94738
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ extern "C" {
#define SPDK_PCI_ANY_ID			0xffff
#define SPDK_PCI_VID_INTEL		0x8086
#define SPDK_PCI_VID_MEMBLAZE		0x1c5f
#define SPDK_PCI_VID_VIRTUALBOX		0x80ee

/**
 * PCI class code for NVMe devices.
+4 −0
Original line number Diff line number Diff line
@@ -192,6 +192,10 @@ spdk_nvme_ctrlr_alloc_io_qpair(struct spdk_nvme_ctrlr *ctrlr,

	nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);

	if (ctrlr->quirks & NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC) {
		spdk_delay_us(100);
	}

	return qpair;
}

+6 −0
Original line number Diff line number Diff line
@@ -89,6 +89,12 @@
 */
#define NVME_INTEL_QUIRK_STRIPING 0x8

/*
 * The controller needs a delay after allocating an I/O queue pair
 * before it is ready to accept I/O commands.
 */
#define NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC 0x10

#define NVME_MAX_ASYNC_EVENTS	(8)

#define NVME_MIN_TIMEOUT_PERIOD		(5)
+3 −0
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ static const struct nvme_quirk nvme_quirks[] = {
	{	{SPDK_PCI_VID_MEMBLAZE, 0x0540, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
		NVME_QUIRK_DELAY_BEFORE_CHK_RDY
	},
	{	{SPDK_PCI_VID_VIRTUALBOX, 0x4e56, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
		NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC
	},
	{	{0x0000, 0x0000, 0x0000, 0x0000}, 0}
};