From patchwork Tue Nov 6 10:53: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: 993587 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="CEvi5NAB"; 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 42q5xv2g1Dz9sD4; Tue, 6 Nov 2018 21:53:39 +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 1gJyzG-0001HI-VC; Tue, 06 Nov 2018 10:53:34 +0000 Received: from mail-pf1-f196.google.com ([209.85.210.196]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1gJyzF-0001Fp-AK for kernel-team@lists.ubuntu.com; Tue, 06 Nov 2018 10:53:33 +0000 Received: by mail-pf1-f196.google.com with SMTP id j13-v6so5924614pff.11 for ; Tue, 06 Nov 2018 02:53:33 -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=SvIcYdhC+3VKczV21ZgN5UtUBvpGpWkADZWRblILKmk=; b=CEvi5NAB4iAnl7euv1rHg7XeBGhZIDVzesMSxLQLYOnGtrEAeekpJOEuQvZEB31rbd 08QjE8KC8TJk0ijTyAhJsF5FncuHUEphXP0fZ74PetAa4BY+gC0qyqKknxYaR3nC/vfB lvVLwZd1ECgFXFOzMGVJ3s3+ibZ1yv+ZjlQdGOUIrzrRXFWp4GullnXzEIk3j1ta9naJ C9yD2B7xcEiNq5DSOantYviRXmjmNLcmhp1TZZ+3YSdZXJnqVa0LyWat5dy0u78NX+Pz OhUr/dhMtgogKR7Pej8BGmJzJAPBRhSPZDVtvGoKRC/UcFR6ba4dikjpfolNPXKWdxM8 cWxQ== 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=SvIcYdhC+3VKczV21ZgN5UtUBvpGpWkADZWRblILKmk=; b=hOQaXms3r8yxReFJbkGV6UtKhpK3Z91k+TJ4sVrGbQ5YlPhDdVjXa9kPycN2A0wCGo Hp1EfxwGkVKpj2cbXKqq1eZmmu1X0BewJ/G9U094XAumbLw76YiDLJ9k4809qEUDni4B bZGB2TKNJGdd5YqvxyBNHJtmJHYQr9yhZvNj+bxj7bxmvvuZ5OMoTuNtFRvl2vBML8XN x0HocXIz7Env2DQDKC/2Br2+WZ2P5OPMtPNTBIU88eSXQk0g2Knf1E72Tuuq68iohPjI oyFCG+Qc+z4839VlFkC/Jz24m+dThPmtAYDFmJIJH14wr60EHczyMSRV10g7YLL00POR DuDA== X-Gm-Message-State: AGRZ1gLwxcForAGKM3R3pf9PAqbn0LLWl069uwbxpKiurPoPppWoSwuI 4AWpYA6OSWC5qkITaEsEhZGsOPrs X-Google-Smtp-Source: AJdET5fsdg7wuOF82Xru5LAdqmAO2zG83qLW8g9MvblZjlfHmf7EaHNMxdpB6ZVukr+qA+PeJ08CDg== X-Received: by 2002:a62:4681:: with SMTP id o1-v6mr25639310pfi.108.1541501611270; Tue, 06 Nov 2018 02:53:31 -0800 (PST) Received: from localhost (114-32-69-186.HINET-IP.hinet.net. [114.32.69.186]) by smtp.gmail.com with ESMTPSA id b7-v6sm11084682pfg.56.2018.11.06.02.53.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Nov 2018 02:53:30 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2][SRU][C] SAUCE: nvme: add quirk to not call disable function when suspending Date: Tue, 6 Nov 2018 18:53:14 +0800 Message-Id: <20181106105314.30069-5-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 0c4a33df3b2f..8e27f351d25e 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 e10b0d20c4a7..e7e5099ce6e7 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "nvme.h" @@ -2662,8 +2663,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; } @@ -2767,6 +2771,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) },