All of lore.kernel.org
 help / color / mirror / Atom feed
From: christopher.walker@gmail.com
Cc: sagi@grimberg.me, linux-nvme@lists.infradead.org, axboe@fb.com,
	christopher.walker@gmail.com, kbusch@kernel.org, hch@lst.de
Subject: [PATCH] nvme: Quirk for Samsung PM1733 controllers
Date: Mon, 15 Jun 2020 17:12:22 -0600	[thread overview]
Message-ID: <1592262742-103431-1-git-send-email-christopher.walker@gmail.com> (raw)

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

             reply	other threads:[~2020-06-15 23:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 23:12 christopher.walker [this message]
2020-06-15 23:19 ` [PATCH] nvme: Quirk for Samsung PM1733 controllers 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1592262742-103431-1-git-send-email-christopher.walker@gmail.com \
    --to=christopher.walker@gmail.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.