Commit 7c784dfb authored by Jim Harris's avatar Jim Harris
Browse files

nvme: add MSI-X vector count quirk for Micron SSDs



At least some models of Micron SSDs only allocate MSI-X vector count
equal to the number of IO queues - this does not account for the
admin queue. This results in driver initialization failure for the
Micron SSDs when interrupt mode is enabled, since we base the requested
count on the number of IO queues plus one.

So add a quirk to lower the number of supported IO queues by one. Its
not clear how many Micron SSD models out there have this problem, so
we will just apply it to all of them.

Fixes issue #3645.

Signed-off-by: default avatarJim Harris <jim.harris@nvidia.com>
Change-Id: Ibf986c46de156755101aa8f512d290a713666493
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/25809


Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarChangpeng Liu <changpeliu@tencent.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
parent d539bb1e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ extern "C" {
#define SPDK_PCI_VID_NUTANIX		0x4e58
#define SPDK_PCI_VID_HUAWEI		0x19e5
#define SPDK_PCI_VID_MICROSOFT		0x1414
#define SPDK_PCI_VID_MICRON		0x1344

#define SPDK_PCI_CLASS_ANY_ID		0xffffff
/**
+7 −0
Original line number Diff line number Diff line
@@ -2974,6 +2974,13 @@ nvme_ctrlr_set_num_queues_done(void *arg, const struct spdk_nvme_cpl *cpl)
		ctrlr->opts.num_io_queues = spdk_min(min_allocated, ctrlr->opts.num_io_queues);

		if (ctrlr->opts.enable_interrupts) {
			if (ctrlr->quirks & NVME_QUIRK_MSIX_VECTOR_COUNT) {
				/* This controller does not allocate enough vectors for
				 * each IO queue plus the admin queue. So decrement the number
				 * of IO queues we will allow by one.
				 */
				ctrlr->opts.num_io_queues--;
			}
			ctrlr->opts.num_io_queues = spdk_min(MAX_IO_QUEUES_WITH_INTERRUPTS,
							     ctrlr->opts.num_io_queues);
			if (nvme_transport_ctrlr_enable_interrupts(ctrlr) < 0) {
+6 −0
Original line number Diff line number Diff line
@@ -150,6 +150,12 @@ extern struct spdk_nvme_transport_opts g_spdk_nvme_transport_opts;
 */
#define NVME_QUIRK_MINIMUM_ADMIN_QUEUE_SIZE 0x20000

/*
 * Some Micron SSD models do not allocate an extra MSI-X vector for the admin
 * queue.
 */
#define NVME_QUIRK_MSIX_VECTOR_COUNT 0x40000

#define NVME_MAX_ASYNC_EVENTS	(8)

#define NVME_MAX_ADMIN_TIMEOUT_IN_SECS	(30)
+3 −0
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ static const struct nvme_quirk nvme_quirks[] = {
	{	{SPDK_PCI_CLASS_NVME, SPDK_PCI_VID_MICROSOFT, 0xb111, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
		NVME_QUIRK_MINIMUM_ADMIN_QUEUE_SIZE
	},
	{	{SPDK_PCI_CLASS_NVME, SPDK_PCI_VID_MICRON, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
		NVME_QUIRK_MSIX_VECTOR_COUNT
	},
	{	{0x000000, 0x0000, 0x0000, 0x0000, 0x0000}, 0}
};