All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Quirk for Samsung PM1733 controllers
@ 2020-06-15 23:12 christopher.walker
  2020-06-15 23:19 ` Chaitanya Kulkarni
  2020-06-15 23:42 ` Keith Busch
  0 siblings, 2 replies; 6+ messages in thread
From: christopher.walker @ 2020-06-15 23:12 UTC (permalink / raw)
  Cc: sagi, linux-nvme, axboe, christopher.walker, kbusch, hch

From: Christopher Walker <christopher.walker@gmail.com>

Accommodate the drive-ready times of Samsung 1733 controllers, which
range from 2s for the 2TB model up to 4s for the 16TB model.

Signed-off-by: Christopher Walker <christopher.walker@gmail.com>
---
 drivers/nvme/host/core.c |  3 +++
 drivers/nvme/host/nvme.h | 16 ++++++++++++++++
 drivers/nvme/host/pci.c  |  2 ++
 3 files changed, 21 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c2c5bc4..9a5ebbe 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2234,6 +2234,9 @@ int nvme_disable_ctrl(struct nvme_ctrl *ctrl)
 	if (ctrl->quirks & NVME_QUIRK_DELAY_BEFORE_CHK_RDY)
 		msleep(NVME_QUIRK_DELAY_AMOUNT);
 
+	if (ctrl->quirks & NVME_QUIRK_LONG_DELAY_BEFORE_CHK_RDY)
+		msleep(NVME_QUIRK_LONG_DELAY_AMOUNT);
+
 	return nvme_wait_ready(ctrl, ctrl->cap, false);
 }
 EXPORT_SYMBOL_GPL(nvme_disable_ctrl);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index c0f4226..8174032 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -129,6 +129,12 @@ enum nvme_quirks {
 	 * Don't change the value of the temperature threshold feature
 	 */
 	NVME_QUIRK_NO_TEMP_THRESH_CHANGE	= (1 << 14),
+
+	/*
+	 * Samsung 1733 controllers need a longer delay before checking device
+	 * readiness
+	 */
+	NVME_QUIRK_LONG_DELAY_BEFORE_CHK_RDY	= (1 << 15),
 };
 
 /*
@@ -173,6 +179,16 @@ static inline u16 nvme_req_qid(struct request *req)
  */
 #define NVME_QUIRK_DELAY_AMOUNT		2300
 
+/* Samsung 1733 drives have long drive ready times.  From the spec:
+ * 15.36TB: 4s
+ *  7.68TB: 3s
+ *  3.84TB: 2s
+ *  1.92TB: 2s
+ * The delay below accommodates the 15.36TB drive at the expense of the
+ * smaller drives.
+ */
+#define NVME_QUIRK_LONG_DELAY_AMOUNT	4300
+
 enum nvme_ctrl_state {
 	NVME_CTRL_NEW,
 	NVME_CTRL_LIVE,
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index e2bacd3..7ef4867 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3109,6 +3109,8 @@ static void nvme_error_resume(struct pci_dev *pdev)
 		.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
 	{ PCI_DEVICE(0x144d, 0xa822),   /* Samsung PM1725a */
 		.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
+	{ PCI_DEVICE(0x144d, 0xa824),   /* Samsung PM1733 */
+		.driver_data = NVME_QUIRK_LONG_DELAY_BEFORE_CHK_RDY, },
 	{ PCI_DEVICE(0x1d1d, 0x1f1f),	/* LighNVM qemu device */
 		.driver_data = NVME_QUIRK_LIGHTNVM, },
 	{ PCI_DEVICE(0x1d1d, 0x2807),	/* CNEX WL */
-- 
1.8.3.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-16  6:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-15 23:12 [PATCH] nvme: Quirk for Samsung PM1733 controllers christopher.walker
2020-06-15 23:19 ` Chaitanya Kulkarni
2020-06-15 23:42 ` Keith Busch
2020-06-16  0:19   ` Chris Walker
     [not found]   ` <CAFD1iUqfki3O9HibUiy4hiYYwp-MEN+3ZogYfe8MUgdd2YZEqA@mail.gmail.com>
2020-06-16  0:23     ` Keith Busch
2020-06-16  6:53       ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.