[PATCH 2/2] nvme: Provide option to disable ASPT feature

Keith Busch keith.busch at intel.com
Thu Jul 27 09:58:41 PDT 2017


Similar to PCIe's APSM, the NVMe driver needs the ability to not use APST
feature so that users have a way to prevent this feature from making their
machines unusable. This patch makes that possible via module parameter
"apst_off".

Signed-off-by: Keith Busch <keith.busch at intel.com>
Cc: Andy Lutomirski <luto at amacapital.net>
---
 drivers/nvme/host/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b150702..834913b 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -64,6 +64,10 @@ 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 bool apst_off;
+module_param(apst_off, bool, 0644);
+MODULE_PARM_DESC(apst_off, "Disable APST driver support");
+
 static bool streams;
 module_param(streams, bool, 0644);
 MODULE_PARM_DESC(streams, "turn on support for Streams write directives");
@@ -1542,7 +1546,7 @@ static int nvme_configure_apst(struct nvme_ctrl *ctrl)
 	 * If APST isn't supported or if we haven't been initialized yet,
 	 * then don't do anything.
 	 */
-	if (!ctrl->apsta)
+	if (!ctrl->apsta || apst_off)
 		return 0;
 
 	if (ctrl->npss > 31) {
-- 
2.5.5




More information about the Linux-nvme mailing list