Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1299157imu; Mon, 5 Nov 2018 18:05:09 -0800 (PST) X-Google-Smtp-Source: AJdET5fAT3BnghqmiYgEeqJekaCrfQPz2NoN32luVwgQmsIVQJY8qY7PkUwdR1bQ9+8yQen4WdZH X-Received: by 2002:a17:902:4503:: with SMTP id m3-v6mr24541397pld.217.1541469909155; Mon, 05 Nov 2018 18:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541469909; cv=none; d=google.com; s=arc-20160816; b=OXQMJRw+10y9AfNU4mQDlOVjcNZs1kQRE5+VwcAtuqkYWXtDou3qkxF4wAL2eXNAX4 VFGENT9P+HbH1mJ3bgKSFooDHbM1YbqNdPIM0EFkchlb50clPT1Wq7FQGGwmnBRrwUxy KX6ZgR/PM8ufmhp95T707dx7mPluE02E7m3y0p0JMcpagxgHldNK7/l5IKZp/tMMw/wf 4KOJQ2LWYHNkVg9i3z8Q0grPUvdFoOPVfiKNkHcIczPMSCOdbrtotJU+gjfc9I63j+tL KSCKbsd621U4W1D+S+p0UDVgqj2HZ6rilw+u3/yqjy0asnDazfOfxWaLbOnLA7euZ7S8 NByQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=q1iCaObEwHgNndGc+IQ2osgW1NSsAor6JGa6GWHzAjI=; b=uYoeuifdrfPdgyLjBNz4CwU+nJUfVXYzp+iaTGZuTIBsatZJ4YBngh7l5d7dOnqJ7K /dH13FBhO4mzjkxqw1xIh0GXH6dtnS+AgxekdDGjARaQDaRA9GFW5PqOfkVwYnEmclih T3gFqcVhmqnL+AYC9kxNOBSMofRjKOSOGgOrpubBI8hmWnTSzt8vXoPMYzGLIHLYoxCx S0ZbBOMU6qqtUPWtm+BtDVgMwuovbnCJqURMqVaA2XzQL+XwrrtwyuLTx2jj6QalNh6Y oreU8fxaNYJrLaiv1LYd6xBMkTmkKwU+3qgCEDhkiIfO4qo/XUzg2q5d/f3dee/7Aexh R5xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=dZZb7Qv8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5-v6si12232304plr.1.2018.11.05.18.04.39; Mon, 05 Nov 2018 18:05:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=dZZb7Qv8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729407AbeKFL0x (ORCPT + 99 others); Tue, 6 Nov 2018 06:26:53 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35446 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729309AbeKFL0x (ORCPT ); Tue, 6 Nov 2018 06:26:53 -0500 Received: by mail-pf1-f196.google.com with SMTP id v9-v6so3038448pff.2; Mon, 05 Nov 2018 18:04:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=q1iCaObEwHgNndGc+IQ2osgW1NSsAor6JGa6GWHzAjI=; b=dZZb7Qv8iGNz116jBljeafsTgUke4MGb++eS36R2NpsyYZMX+dG8LtxyGs+/fU3ULT gDDfodxu7e229UDpblC6SmU3JRc9lL5kJKZsmfmqf7w8BVohxZ1r2f8IzFvJ1Uut3L5b lynYPz01FKEY8eaVI9WZKDQIV8frB+XNyI94GDr539SVvN3OopJcteugo2LNgXa46Q6L dXqhuzID3lGxzInLt0sxzDxZ72jr52roLRhndFKx+MUFGlexHTZIkMemAKNqt9wqqtxC vslyqGgWZFnY/evt7lUJZH96SVsV1BdBzsSbaQ84nyEPBvZfOXSHA3mtWpZ6c/YJ9w67 TTbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=q1iCaObEwHgNndGc+IQ2osgW1NSsAor6JGa6GWHzAjI=; b=Ras3qwU7zrM7bT40rDDRG8jYWHuvjK5inFLd6wE9C/nnNQK4UhlEn5FEtuVwyF1Bcm 1Sb3jrDn/Q6FM4WYu5nM6Gmv7AUatHCkJkLxZLUARWUhN/8RIlV8Yw1KddAkxUPkfYpn JqCvBbV75XV2x6U/KmG2H1roAlgEzeXimUqdsSIfdB4wNs/amjKt8om9/oDtNAa2oPVN VWOcQ0GQK9R1KO+H6YKg1rlWialW0UKhgcY8OT8pB/ch2uIjNZ9plYzFEDabDiPXjh4k KQVvryQHTBB/D/vZExUqxoMmfsQRX428OUcXfu5wway8o/M+J08MDrRZG6yqS7PA8Nu8 ZgSQ== X-Gm-Message-State: AGRZ1gI5ADRnGAw312E9Qv1+92Dh+NbdnERoI1rWg4vyJD0JBlpnMdFd ah/ADlUzqeE/5cHkXelbCZ8= X-Received: by 2002:a62:5904:: with SMTP id n4-v6mr10465640pfb.174.1541469848604; Mon, 05 Nov 2018 18:04:08 -0800 (PST) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id 188-v6sm27858805pfy.87.2018.11.05.18.04.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 18:04:07 -0800 (PST) From: AceLan Kao To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Bjorn Helgaas , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH 2/2] nvme: add quirk to not call disable function when suspending Date: Tue, 6 Nov 2018 10:04:02 +0800 Message-Id: <20181106020402.21120-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106020402.21120-1-acelan.kao@canonical.com> References: <20181106020402.21120-1-acelan.kao@canonical.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call nvme_dev_disable() function leads to the power consumption goes up to 2.2 Watt during suspend-to-idle, and from SK hynix FE, they suggest us to use its own APST feature to do the power management during s2idle. After D3 is diabled and nvme_dev_disable() is not called while suspending, the power consumption drops to 0.77 Watt during s2idle. Signed-off-by: AceLan Kao --- drivers/nvme/host/nvme.h | 5 +++++ drivers/nvme/host/pci.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index cee79cb388af..35d260a4cf46 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -90,6 +90,11 @@ enum nvme_quirks { * Set MEDIUM priority on SQ creation */ NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7), + + /* + * Do not disable nvme when suspending(s2idle) + */ + NVME_QUIRK_NO_DISABLE = (1 << 8), }; /* diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index c33bb201b884..586f3516e36b 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "nvme.h" @@ -2612,8 +2613,11 @@ static int nvme_suspend(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); struct nvme_dev *ndev = pci_get_drvdata(pdev); + struct nvme_ctrl *ctrl = &ndev->ctrl; + + if (!(pm_suspend_via_s2idle() && (ctrl->quirks & NVME_QUIRK_NO_DISABLE))) + nvme_dev_disable(ndev, true); - nvme_dev_disable(ndev, true); return 0; } @@ -2716,6 +2720,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_LIGHTNVM, }, { PCI_DEVICE(0x1d1d, 0x2601), /* CNEX Granby */ .driver_data = NVME_QUIRK_LIGHTNVM, }, + { PCI_DEVICE(0x1c5c, 0x1527), /* Sk Hynix */ + .driver_data = NVME_QUIRK_NO_DISABLE, }, { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) }, -- 2.17.1