]>
Commit | Line | Data |
---|---|---|
eac43d9e GKH |
1 | From b5a10c5f7532b7473776da87e67f8301bbc32693 Mon Sep 17 00:00:00 2001 |
2 | From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com> | |
3 | Date: Wed, 28 Dec 2016 22:13:15 -0200 | |
4 | Subject: nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too | |
5 | ||
6 | From: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> | |
7 | ||
8 | commit b5a10c5f7532b7473776da87e67f8301bbc32693 upstream. | |
9 | ||
10 | Commit 54adc01055b7 ("nvme/quirk: Add a delay before checking for adapter | |
11 | readiness") introduced a quirk to adapters that cannot read the bit | |
12 | NVME_CSTS_RDY right after register NVME_REG_CC is set; these adapters | |
13 | need a delay or else the action of reading the bit NVME_CSTS_RDY could | |
14 | somehow corrupt adapter's registers state and it never recovers. | |
15 | ||
16 | When this quirk was added, we checked ctrl->tagset in order to avoid | |
17 | quirking in probe time, supposing we would never require such delay | |
18 | during probe. Well, it was too optimistic; we in fact need this quirk | |
19 | at probe time in some cases, like after a kexec. | |
20 | ||
21 | In some experiments, after abnormal shutdown of machine (aka power cord | |
22 | unplug), we booted into our bootloader in Power, which is a Linux kernel, | |
23 | and kexec'ed into another distro. If this kexec is too quick, we end up | |
24 | reaching the probe of NVMe adapter in that distro when adapter is in | |
25 | bad state (not fully initialized on our bootloader). What happens next | |
26 | is that nvme_wait_ready() is unable to complete, except if the quirk is | |
27 | enabled. | |
28 | ||
29 | So, this patch removes the original ctrl->tagset verification in order | |
30 | to enable the quirk even on probe time. | |
31 | ||
32 | Fixes: 54adc01055b7 ("nvme/quirk: Add a delay before checking for adapter readiness") | |
33 | Reported-by: Andrew Byrne <byrneadw@ie.ibm.com> | |
34 | Reported-by: Jaime A. H. Gomez <jahgomez@mx1.ibm.com> | |
35 | Reported-by: Zachary D. Myers <zdmyers@us.ibm.com> | |
36 | Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> | |
37 | Acked-by: Jeffrey Lien <Jeff.Lien@wdc.com> | |
38 | Signed-off-by: Christoph Hellwig <hch@lst.de> | |
39 | [mauricfo: backport to v4.4.70 without nvme quirk handling & nvme_ctrl] | |
40 | Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> | |
41 | Tested-by: Narasimhan Vaidyanathan <vnarasimhan@in.ibm.com> | |
42 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
43 | --- | |
44 | drivers/nvme/host/pci.c | 7 +------ | |
45 | 1 file changed, 1 insertion(+), 6 deletions(-) | |
46 | ||
47 | --- a/drivers/nvme/host/pci.c | |
48 | +++ b/drivers/nvme/host/pci.c | |
49 | @@ -1639,12 +1639,7 @@ static int nvme_disable_ctrl(struct nvme | |
50 | dev->ctrl_config &= ~NVME_CC_ENABLE; | |
51 | writel(dev->ctrl_config, &dev->bar->cc); | |
52 | ||
53 | - /* Checking for dev->tagset is a trick to avoid sleeping on module | |
54 | - * load, since we only need the quirk on reset_controller. Notice | |
55 | - * that the HGST device needs this delay only in firmware activation | |
56 | - * procedure; unfortunately we have no (easy) way to verify this. | |
57 | - */ | |
58 | - if (pdev->vendor == 0x1c58 && pdev->device == 0x0003 && dev->tagset) | |
59 | + if (pdev->vendor == 0x1c58 && pdev->device == 0x0003) | |
60 | msleep(NVME_QUIRK_DELAY_AMOUNT); | |
61 | ||
62 | return nvme_wait_ready(dev, cap, false); |