Skip to content

Commit cb7be08

Browse files
Guilherme G. Piccoligregkh
authored andcommitted
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> [mauricfo: backport to v4.4.70 without nvme quirk handling & nvme_ctrl] Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> Tested-by: Narasimhan Vaidyanathan <vnarasimhan@in.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bddc802 commit cb7be08

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

drivers/nvme/host/pci.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,12 +1639,7 @@ static int nvme_disable_ctrl(struct nvme_dev *dev, u64 cap)
16391639
dev->ctrl_config &= ~NVME_CC_ENABLE;
16401640
writel(dev->ctrl_config, &dev->bar->cc);
16411641

1642-
/* Checking for dev->tagset is a trick to avoid sleeping on module
1643-
* load, since we only need the quirk on reset_controller. Notice
1644-
* that the HGST device needs this delay only in firmware activation
1645-
* procedure; unfortunately we have no (easy) way to verify this.
1646-
*/
1647-
if (pdev->vendor == 0x1c58 && pdev->device == 0x0003 && dev->tagset)
1642+
if (pdev->vendor == 0x1c58 && pdev->device == 0x0003)
16481643
msleep(NVME_QUIRK_DELAY_AMOUNT);
16491644

16501645
return nvme_wait_ready(dev, cap, false);

0 commit comments

Comments
 (0)