From d6d0e494bb6feea91677eb05077532881602ffd3 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 24 Aug 2018 12:52:36 -0700 Subject: [PATCH] nvme: add quirk for Intel SSDs without vendor-specific log pages QEMU emulated NVMe SSDs report themselves with an Intel vendor ID, but don't support the Intel vendor-specific log pages. So add a quirk to avoid confusing error messages. Signed-off-by: Jim Harris Change-Id: Ic41476801ede94d43acb9972217ea7420ca53679 Reviewed-on: https://review.gerrithub.io/423422 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Xiaodong Liu Reviewed-by: Ben Walker --- lib/nvme/nvme_ctrlr.c | 2 +- lib/nvme/nvme_internal.h | 7 +++++++ lib/nvme/nvme_quirks.c | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 3386dc494a..09f1ac8bc9 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -403,7 +403,7 @@ nvme_ctrlr_set_supported_log_pages(struct spdk_nvme_ctrlr *ctrlr) if (ctrlr->cdata.lpa.celp) { ctrlr->log_page_supported[SPDK_NVME_LOG_COMMAND_EFFECTS_LOG] = true; } - if (ctrlr->cdata.vid == SPDK_PCI_VID_INTEL) { + if (ctrlr->cdata.vid == SPDK_PCI_VID_INTEL && !(ctrlr->quirks & NVME_INTEL_QUIRK_NO_LOG_PAGES)) { nvme_ctrlr_set_intel_support_log_pages(ctrlr); } } diff --git a/lib/nvme/nvme_internal.h b/lib/nvme/nvme_internal.h index aca8d716d7..5dfa772de0 100644 --- a/lib/nvme/nvme_internal.h +++ b/lib/nvme/nvme_internal.h @@ -107,6 +107,13 @@ extern pid_t g_spdk_nvme_pid; */ #define NVME_QUIRK_OCSSD 0x80 +/* + * The controller has an Intel vendor ID but does not support Intel vendor-specific + * log pages. This is primarily for QEMU emulated SSDs which report an Intel vendor + * ID but do not support these log pages. + */ +#define NVME_INTEL_QUIRK_NO_LOG_PAGES 0x100 + #define NVME_MAX_ASYNC_EVENTS (8) #define NVME_MIN_TIMEOUT_PERIOD (5) diff --git a/lib/nvme/nvme_quirks.c b/lib/nvme/nvme_quirks.c index 73dc76442c..9a213b12da 100644 --- a/lib/nvme/nvme_quirks.c +++ b/lib/nvme/nvme_quirks.c @@ -76,7 +76,8 @@ static const struct nvme_quirk nvme_quirks[] = { NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC }, { {SPDK_PCI_VID_INTEL, 0x5845, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID}, - NVME_QUIRK_IDENTIFY_CNS + NVME_QUIRK_IDENTIFY_CNS | + NVME_INTEL_QUIRK_NO_LOG_PAGES }, { {SPDK_PCI_VID_CNEXLABS, 0x1f1f, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID}, NVME_QUIRK_IDENTIFY_CNS |