提交 88f0a990 编写于 作者: C Christoph Hellwig 提交者: Yang Yingliang

nvme: add a Identify Namespace Identification Descriptor list quirk

mainline inclusion
from mainline-v5.8~19
commit 5bedd3af
category: bugfix
bugzilla: NA
CVE: NA
Link: https://gitee.com/openeuler/kernel/issues/I4JFBE?from=project-issue

-------------------------------------------------

Add a quirk for a device that does not
support the Identify Namespace Identification Descriptor list despite
claiming 1.3 compliance.

Fixes: ea43d970 ("nvme: fix identify error status silent ignore")
Reported-by: NIngo Brunberg <ingo_brunberg@web.de>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Tested-by: NIngo Brunberg <ingo_brunberg@web.de>
Reviewed-by: NSagi Grimberg <sagi@grimberg.me>

conflicts:
drivers/nvme/host/core.c
drivers/nvme/host/pci.c
[adjust context]
Signed-off-by: Nchengjike <chengjike.cheng@huawei.com>
Reviewed-by: NAo Sun <sunao.sun@huawei.com>
Reviewed-by: NZhenwei Yang <yangzhenwei@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 72438fc4
...@@ -987,6 +987,9 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid, ...@@ -987,6 +987,9 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid,
int pos; int pos;
int len; int len;
if (ctrl->quirks & NVME_QUIRK_NO_NS_DESC_LIST)
return 0;
c.identify.opcode = nvme_admin_identify; c.identify.opcode = nvme_admin_identify;
c.identify.nsid = cpu_to_le32(nsid); c.identify.nsid = cpu_to_le32(nsid);
c.identify.cns = NVME_ID_CNS_NS_DESC_LIST; c.identify.cns = NVME_ID_CNS_NS_DESC_LIST;
...@@ -1000,18 +1003,6 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid, ...@@ -1000,18 +1003,6 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid,
if (status) { if (status) {
dev_warn(ctrl->device, dev_warn(ctrl->device,
"Identify Descriptors failed (%d)\n", status); "Identify Descriptors failed (%d)\n", status);
/*
* Don't treat non-retryable errors as fatal, as we potentially
* already have a NGUID or EUI-64. If we failed with DNR set,
* we want to silently ignore the error as we can still
* identify the device, but if the status has DNR set, we want
* to propagate the error back specifically for the disk
* revalidation flow to make sure we don't abandon the
* device just because of a temporal retry-able error (such
* as path of transport errors).
*/
if (status > 0 && (status & NVME_SC_DNR))
status = 0;
goto free_data; goto free_data;
} }
......
...@@ -90,6 +90,13 @@ enum nvme_quirks { ...@@ -90,6 +90,13 @@ enum nvme_quirks {
* Set MEDIUM priority on SQ creation * Set MEDIUM priority on SQ creation
*/ */
NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7), NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7),
/*
* The controller doesn't handle the Identify Namespace
* Identification Descriptor list subcommand despite claiming
* NVMe 1.3 compliance.
*/
NVME_QUIRK_NO_NS_DESC_LIST = (1 << 15),
}; };
/* /*
......
...@@ -2724,6 +2724,8 @@ static const struct pci_device_id nvme_id_table[] = { ...@@ -2724,6 +2724,8 @@ static const struct pci_device_id nvme_id_table[] = {
NVME_QUIRK_MEDIUM_PRIO_SQ }, NVME_QUIRK_MEDIUM_PRIO_SQ },
{ PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
.driver_data = NVME_QUIRK_IDENTIFY_CNS, }, .driver_data = NVME_QUIRK_IDENTIFY_CNS, },
{ PCI_DEVICE(0x126f, 0x2263), /* Silicon Motion unidentified */
.driver_data = NVME_QUIRK_NO_NS_DESC_LIST, },
{ PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */ { PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
{ PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册