Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626949

[PATCH 3/5] nvme: Add nvme_core.force_apst to ignore the NO_APST quirk

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 3/5] nvme: Add nvme_core.force_apst to ignore the NO_APST quirk
Date 2017-04-20 05:10 +0200
Message-ID <tyaDM-3Au-19@gated-at.bofh.it> (permalink)
References <tyaDL-3Au-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


We're probably going to be stuck quirking APST off on an over-broad
range of devices for 4.11.  Let's make it easy to override the quirk
for testing.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 drivers/nvme/host/core.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 52b4e52b85a2..b422996f88ed 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -62,6 +62,10 @@ module_param(default_ps_max_latency_us, ulong, 0644);
 MODULE_PARM_DESC(default_ps_max_latency_us,
 		 "max power saving latency for new devices; use PM QOS to change per device");
 
+static bool force_apst;
+module_param(force_apst, bool, 0644);
+MODULE_PARM_DESC(force_apst, "allow APST for newly enumerated devices even if quirked off");
+
 static LIST_HEAD(nvme_ctrl_list);
 static DEFINE_SPINLOCK(dev_list_lock);
 
@@ -1519,7 +1523,16 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 
 	ctrl->npss = id->npss;
 	prev_apsta = ctrl->apsta;
-	ctrl->apsta = (ctrl->quirks & NVME_QUIRK_NO_APST) ? 0 : id->apsta;
+	if (ctrl->quirks & NVME_QUIRK_NO_APST) {
+		if (force_apst && id->apsta) {
+			dev_warn(ctrl->dev, "forcibly allowing APST due to nvme_core.force_apst -- use at your own risk\n");
+			ctrl->apsta = 1;
+		} else {
+			ctrl->apsta = 0;
+		}
+	} else {
+		ctrl->apsta = id->apsta;
+	}
 	memcpy(ctrl->psd, id->psd, sizeof(ctrl->psd));
 
 	if (ctrl->ops->is_fabrics) {
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  Re: [PATCH 4/5] nvme: Adjust the Samsung APST quirk Jens Axboe <axboe@kernel.dk> - 2017-04-20 05:10 +0200
    Re: [PATCH 4/5] nvme: Adjust the Samsung APST quirk Andy Lutomirski <luto@kernel.org> - 2017-04-20 06:00 +0200
      RE: [PATCH 4/5] nvme: Adjust the Samsung APST quirk Judy Brock <judy.brock@samsung.com> - 2017-04-20 06:50 +0200
  [PATCH 2/5] nvme: Display raw APST configuration via DYNAMIC_DEBUG Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  [PATCH 4/5] nvme: Adjust the Samsung APST quirk Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  [PATCH 5/5] nvme: Quirk APST off on "THNSF5256GPUK TOSHIBA" Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  [PATCH 1/5] nvme: Fix APST comment Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  [PATCH 3/5] nvme: Add nvme_core.force_apst to ignore the NO_APST quirk Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Jens Axboe <axboe@kernel.dk> - 2017-04-20 05:20 +0200
    Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski <luto@kernel.org> - 2017-04-20 06:00 +0200
      Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski <luto@amacapital.net> - 2017-04-20 07:00 +0200
        Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Christoph Hellwig <hch@lst.de> - 2017-04-20 07:20 +0200
          Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski <luto@kernel.org> - 2017-04-20 18:10 +0200

csiph-web