[BUG] nvme-pci: NVMe probe fails with ENODEV
Christoph Hellwig
hch at lst.de
Thu Mar 9 07:12:18 PST 2023
On Thu, Mar 09, 2023 at 07:31:07PM +0530, Rajat Khandelwal wrote:
> Hi,
> I am seeking some help regarding an issue I encounter sporadically
> with Samsung Portable TBT SSD X5.
>
> Right from the thunderbolt discovery to the PCIe enumeration, everything
> is fine, until 'NVME_REG_CSTS' is tried to be read in 'nvme_reset_work'.
> Precisely, 'readl(dev->bar + NVME_REG_CSTS)' fails.
>
> I handle type-C, thunderbolt and USB4 on Chrome platforms, and currently
> we are working on Intel Raptorlake systems.
> This issue has been witnessed from ADL time-frame and now is seen
> on RPL as well. I would really like to get to the bottom of the problem
> and close the issue.
>
> I have tried 5.10 and 6.1.15 kernels.
So we have a quirk for a device called Samsung X5 in core.c, which is a
bit of an unusual match. Can you check that it gets applied for the
device that you are testing?
Also if it gets applied, can you test this patch?
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c2730b116dc680..7eb980105ce6c1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2264,6 +2264,9 @@ static int nvme_wait_ready(struct nvme_ctrl *ctrl, u32 mask, u32 val,
u32 csts;
int ret;
+ if (ctrl->quirks & NVME_QUIRK_DELAY_BEFORE_CHK_RDY)
+ msleep(NVME_QUIRK_DELAY_AMOUNT);
+
while ((ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CSTS, &csts)) == 0) {
if (csts == ~0)
return -ENODEV;
@@ -2303,8 +2306,6 @@ int nvme_disable_ctrl(struct nvme_ctrl *ctrl, bool shutdown)
NVME_CSTS_SHST_CMPLT,
ctrl->shutdown_timeout, "shutdown");
}
- if (ctrl->quirks & NVME_QUIRK_DELAY_BEFORE_CHK_RDY)
- msleep(NVME_QUIRK_DELAY_AMOUNT);
return nvme_wait_ready(ctrl, NVME_CSTS_RDY, 0,
(NVME_CAP_TIMEOUT(ctrl->cap) + 1) / 2, "reset");
}
More information about the Linux-nvme
mailing list