From patchwork Tue Nov 6 07:12:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 993519 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LhFq4Kam"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42q12W6Cv4z9sDL for ; Tue, 6 Nov 2018 18:12:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387428AbeKFQgG (ORCPT ); Tue, 6 Nov 2018 11:36:06 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42153 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387397AbeKFQgG (ORCPT ); Tue, 6 Nov 2018 11:36:06 -0500 Received: by mail-pg1-f196.google.com with SMTP id i4-v6so5397256pgq.9; Mon, 05 Nov 2018 23:12:17 -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; bh=19U5nnS+32OVLXwVWLlWkIemkFQKEnGuAOn8fC7twHs=; b=LhFq4KamDaWcGBJqYQG99l2SatgOSGNABwaQ0BSG7ku60dK+RkD0598Nx+yJtWKHpy Fq6ieC4FDtHZtcFnIoxhgXqJWyayaQd2CZO9uA1fwQBL/2UOJWxJ/1fO0yE1+VeXiWwt EZZrvGULW+Vy0hoW6ZEIkc2rjqEZLWNfY7Eacb9Sz8KTn7vKbu7RVjNyS6EI8xhWzfZF 8040xoiZkF70K7UIJ1jRj/8TRFDCCACrzwmJvWbLssjYu3zQ9eTwVxQnrVZFNoOcSE4t q7FFO8u5p91WxQdezB0cCNYrvhFdB6ePenKElCiE9CXtvKuHq3LVWQRTZzLZojHrydvz RMsw== 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; bh=19U5nnS+32OVLXwVWLlWkIemkFQKEnGuAOn8fC7twHs=; b=U0Pm0Ya7YHPkBNVhap59DxBzZmfPmmssjtEtoHwmpZGMrV4SgaamAAA1zGYyLSkBFc ISUZA2N1Sdi+GUdzssJ7mrbhGCD3n2g+ky579/+Ut13Q3rkcglKNJDlO7P6vxjBO3PEx VyM5Xss7dmXFJvs+EsD3Sv5vcy7rriNMhVaOvEwqb67fp8zRYgPwDwHIwAT5QpbnZ3Cy 9cH51VYYYo3C8XHRnsPXdlsjs+11V4YaeH6YnUEB+m19JSSkREQzAN1ApP0LE9+sy12P YO5yER6pSt1iELGvVikb3s8oeLr7VoIU7Vi/Q8rhIwKY7wtMexrQFrBx224bB1kFVRLd S5nw== X-Gm-Message-State: AGRZ1gLdIWo2C4xW90MqHTNwUHlAe2FEQBfh4Pc+ddNuO3PfHcsiLSpx YbZ9d/xAZCRpcekBr1DhbpI= X-Google-Smtp-Source: AJdET5e9ZHtZd6Ng4JAXTVvw2HMd3uJwibhruC7v0Gn79a76iuspxWAwz/FunPd4xrY2daFxpJzDkA== X-Received: by 2002:a63:4044:: with SMTP id n65mr16177157pga.90.1541488337122; Mon, 05 Nov 2018 23:12:17 -0800 (PST) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id g65-v6sm61184521pfg.98.2018.11.05.23.12.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 23:12:16 -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 v2 1/2] pci: prevent sk hynix nvme from entering D3 Date: Tue, 6 Nov 2018 15:12:13 +0800 Message-Id: <20181106071214.12745-1-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org It leads to the power consumption raises to 2.2W during s2idle, while it consumes less than 1W during long idle if put SK hynix nvme to D3 and then enter s2idle. From SK hynix FE, MS Windows doesn't put nvme to D3, and uses its own APST feature to do the power management. To leverage its APST feature during s2idle, we can't disable nvme device while suspending, too. BTW, prevent it from entering D3 will increase the power consumtion around 0.13W ~ 0.15W during short/long idle, and the power consumption during s2idle becomes 0.77W. Signed-off-by: AceLan Kao --- drivers/pci/quirks.c | 1 + include/linux/pci_ids.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 4700d24e5d55..b7e6492e8311 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1332,6 +1332,7 @@ DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_AL, PCI_ANY_ID, occur when mode detecting */ DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE, 8, quirk_no_ata_d3); +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SK_HYNIX, 0x1527, quirk_no_ata_d3); /* * This was originally an Alpha-specific thing, but it really fits here. diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 69f0abe1ba1a..5f5adda07de0 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -3090,4 +3090,6 @@ #define PCI_VENDOR_ID_NCUBE 0x10ff +#define PCI_VENDOR_ID_SK_HYNIX 0x1c5c + #endif /* _LINUX_PCI_IDS_H */ From patchwork Tue Nov 6 07:12:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 993520 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="InM7qxq0"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42q12h48Xyz9sDL for ; Tue, 6 Nov 2018 18:12:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387650AbeKFQgJ (ORCPT ); Tue, 6 Nov 2018 11:36:09 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40870 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387397AbeKFQgJ (ORCPT ); Tue, 6 Nov 2018 11:36:09 -0500 Received: by mail-pg1-f194.google.com with SMTP id z10so3525392pgp.7; Mon, 05 Nov 2018 23:12:20 -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=dCdFuC5uq+nvBgO+o579iBw5Dpdn29R4tXUybtl7/1M=; b=InM7qxq0DLaTh+nCS0A8fmWxzn+AxelYcrqDCqfufxKsifjV5KXgypagI12elEwNBM HLKB/9rIDEh92jYEoI601g21bew/BE7TkeEH3BOKaZ6G8wpFk7Lko0+/NSwg8ZhPw2Ww bvLuS36ESJixaQGDJj4l0USB3mCWHybUd8Hy+WoHFxk9s2w9f5QiDh1JBogldNfRXHqX LVoARqZ6sLx5SG7+DFMJCspnYfjPGm8jJW7KV+irITBIpRJdRccPytbedyy2oq6PzIrY 4wcAtVqMh/tQQ0vl819vKlfMkpnEUYcLK68mTmQ9lsc+irLqW9cxsZ0/3pMHyoRrn5x+ zrEA== 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=dCdFuC5uq+nvBgO+o579iBw5Dpdn29R4tXUybtl7/1M=; b=t9UBoMTsAzRJDYz+BokhJT0ixvmUCsSykv7ChxrDPQfCdZ9JKjNnNIBG7lR45+7DjX q98PsKzfKQP17r1lDnLYZOv5rlScW/np7V+LpmI11FE5WS4+mjSy13HW7OvaMd7eTphx 0X5M6CIbN3vstLmC8T7wCKzfpnp3ZvWUHHJsQwK6yJOX7UYHUm7AJ0ksy6Kt9OKjNR0O NyHLGoRZSDkVOf7z6mXb1RBLN/0akL/qSsKPP/6i/HdkEs/yWiNS2uvf/OrLPY1kJ8eF laeXlNdbiYG0CrLA/n+0Pq7afBV5ZD40e8gwl263vO+Mh0LL1od7kIHIaVuex1uDHY+L GH3A== X-Gm-Message-State: AGRZ1gJeCxoWTGG4MVOQMULA5WN58/jK/wQKqNTDR54CY4EFmcvhHmDf haYXHdrCyWoWZswMNI31WezhiN84 X-Google-Smtp-Source: AJdET5cT53l4moNMe+/HaEUlSFW6hqXsHUlmfr9IRlbyf6oBB8YNM2Y8uvLsn+pq6trIyoKkFrshfw== X-Received: by 2002:a63:4243:: with SMTP id p64-v6mr23138415pga.127.1541488339942; Mon, 05 Nov 2018 23:12:19 -0800 (PST) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id i189-v6sm36652213pfg.156.2018.11.05.23.12.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 23:12:19 -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 v2 2/2] nvme: add quirk to not call disable function when suspending Date: Tue, 6 Nov 2018 15:12:14 +0800 Message-Id: <20181106071214.12745-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106071214.12745-1-acelan.kao@canonical.com> References: <20181106071214.12745-1-acelan.kao@canonical.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. V2: - replace PCI_DEVICE with PCI_VDEVICE - replace 0x1c5c with SK_HYNIX 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..13a2d6b2d047 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_VDEVICE(SK_HYNIX, 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) },