aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>2016-12-28 19:13:15 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-19 14:18:05 -0500
commit0aefd99f37f315a67dcb6487ce371f32dd1422a7 (patch)
treef946ba240e0cd217d52c9c6dc0a79b3914ee0a88
parent9bae3c370a9ecc658d6a807efa007fdec915d0ed (diff)
nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too
commit b5a10c5f7532b7473776da87e67f8301bbc32693 upstream. Commit 54adc01055b7 ("nvme/quirk: Add a delay before checking for adapter readiness") introduced a quirk to adapters that cannot read the bit NVME_CSTS_RDY right after register NVME_REG_CC is set; these adapters need a delay or else the action of reading the bit NVME_CSTS_RDY could somehow corrupt adapter's registers state and it never recovers. When this quirk was added, we checked ctrl->tagset in order to avoid quirking in probe time, supposing we would never require such delay during probe. Well, it was too optimistic; we in fact need this quirk at probe time in some cases, like after a kexec. In some experiments, after abnormal shutdown of machine (aka power cord unplug), we booted into our bootloader in Power, which is a Linux kernel, and kexec'ed into another distro. If this kexec is too quick, we end up reaching the probe of NVMe adapter in that distro when adapter is in bad state (not fully initialized on our bootloader). What happens next is that nvme_wait_ready() is unable to complete, except if the quirk is enabled. So, this patch removes the original ctrl->tagset verification in order to enable the quirk even on probe time. Fixes: 54adc01055b7 ("nvme/quirk: Add a delay before checking for adapter readiness") Reported-by: Andrew Byrne <byrneadw@ie.ibm.com> Reported-by: Jaime A. H. Gomez <jahgomez@mx1.ibm.com> Reported-by: Zachary D. Myers <zdmyers@us.ibm.com> Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Acked-by: Jeffrey Lien <Jeff.Lien@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/nvme/host/core.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 79e679d12f3b..da10b484bd25 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1122,12 +1122,7 @@ int nvme_disable_ctrl(struct nvme_ctrl *ctrl, u64 cap)
1122 if (ret) 1122 if (ret)
1123 return ret; 1123 return ret;
1124 1124
1125 /* Checking for ctrl->tagset is a trick to avoid sleeping on module 1125 if (ctrl->quirks & NVME_QUIRK_DELAY_BEFORE_CHK_RDY)
1126 * load, since we only need the quirk on reset_controller. Notice
1127 * that the HGST device needs this delay only in firmware activation
1128 * procedure; unfortunately we have no (easy) way to verify this.
1129 */
1130 if ((ctrl->quirks & NVME_QUIRK_DELAY_BEFORE_CHK_RDY) && ctrl->tagset)
1131 msleep(NVME_QUIRK_DELAY_AMOUNT); 1126 msleep(NVME_QUIRK_DELAY_AMOUNT);
1132 1127
1133 return nvme_wait_ready(ctrl, cap, false); 1128 return nvme_wait_ready(ctrl, cap, false);