From patchwork Tue Nov 6 10:53:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 993585 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=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; 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="GbDoTEnl"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42q5xn6j5dz9sD4; Tue, 6 Nov 2018 21:53:33 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gJyzB-0001DM-6S; Tue, 06 Nov 2018 10:53:29 +0000 Received: from mail-pl1-f196.google.com ([209.85.214.196]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1gJyz8-0001Bw-S4 for kernel-team@lists.ubuntu.com; Tue, 06 Nov 2018 10:53:27 +0000 Received: by mail-pl1-f196.google.com with SMTP id f12-v6so4833657plo.1 for ; Tue, 06 Nov 2018 02:53:26 -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=p3snnfRjh3YyXLO51xcSwRYsRciTdnCPPXep1RSpGCA=; b=GbDoTEnlczYDhUGsSNG3S6b055LOssHQK6+ny+s/FNUYjeUvFr5XrIl05MLd6kRpGQ yicOI+XWVkibMrPGw696TD8c0gJSDitfJjIYKEM0SxUDDMmSBjM8La4gE006VWZPw3eu ghp5BqmniySE+7ecnnvBhwmj//k5CZytFm2FMKcSMmMw4HuFYnCzZXeJ5gahkdpm6TkY uSMgQIJKFZOlaitnvI9FwE2x6MPZn6+NJxVMbRmhaZWZpUnR51WudAkDSYIx6QpEjcjM OZ2RCdRDgR/rGg4HCDsgE/C+c20F0hPeTcgscsIhYxaGqr2MlXOTXQEeVx//eKmyI0ak U+MQ== 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=p3snnfRjh3YyXLO51xcSwRYsRciTdnCPPXep1RSpGCA=; b=bBGlK4TYlzIr5ejx8GzUmx1qyJsl2c5SPtnCyUbGgQqsCbiNr6YHTrWNm97GJgLUW5 tP9ecYk+vPWFr+2P70XyjHIN2qOro3RobZk0n9+IJXh9oeNsQ4Akmbo0BYCh7TqDOXVF qNPNc542pnnHv63fwtHfNWFxnNj3/COESipTCccOWOr5wgND7iMIpCTGBkonR8PhnpDz +OjhqlUUzjAyIwW+nYtBTSdff0vBBXWUvf9bB2zprKIQrXv3QAKgZkJMLt8q7ldu1ScM 1IBKAZ8UF/FjiMxzVrjIZk5FuRcl0XXXZn0VC39cqCwYBfv31zS6ldY02TIL91v/HMxb KMAA== X-Gm-Message-State: AGRZ1gIMZovTlfpcP6Z3cl5w6bfaPSUNFPebuQR6pg1j/Y2yjOBSl6G/ ym/fklLot52ibmjgDwkr8stSB6iv X-Google-Smtp-Source: AJdET5d+2pKUgy+c95M+de4w14bwR2S56fdXYybHc/RkXUwEYastOpapL9fxSvP1GXHOQ9YJOmNg8A== X-Received: by 2002:a17:902:860a:: with SMTP id f10-v6mr25742493plo.96.1541501604964; Tue, 06 Nov 2018 02:53:24 -0800 (PST) Received: from localhost (114-32-69-186.HINET-IP.hinet.net. [114.32.69.186]) by smtp.gmail.com with ESMTPSA id b14-v6sm55688057pgn.49.2018.11.06.02.53.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Nov 2018 02:53:24 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2][SRU][B][OEM-B] SAUCE: nvme: add quirk to not call disable function when suspending Date: Tue, 6 Nov 2018 18:53:12 +0800 Message-Id: <20181106105314.30069-3-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106105314.30069-1-acelan.kao@canonical.com> References: <20181106105314.30069-1-acelan.kao@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1801875 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 a9ec71cce3cc..c2f71cb23700 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -86,6 +86,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 3be974ff4261..5f797d595e52 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "nvme.h" @@ -2611,8 +2612,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; } @@ -2709,6 +2713,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_LIGHTNVM, }, { PCI_DEVICE(0x1d1d, 0x2807), /* CNEX WL */ .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) },