Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1385704rdb; Wed, 20 Sep 2023 07:49:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaz57vWbWCVgtO/81EgRdD7j9ibC3ZoJKrQ9C14VOdJCHpiLptKoIqUSKNGlaDEO3YqVjv X-Received: by 2002:a05:6a20:3d92:b0:153:73ec:fe67 with SMTP id s18-20020a056a203d9200b0015373ecfe67mr3631234pzi.19.1695221396228; Wed, 20 Sep 2023 07:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695221396; cv=none; d=google.com; s=arc-20160816; b=t+S/50bQJbh5VZSFiffr55yBj24fzsiiX9H86ungmn64w2CFmfgOmwPlAFmlMwTANB NZLg6srr6sxZZkkMw22vBtKaySj7tG405qQhlFul3ez9I2TQi1h0wWDxcTYEfednQyoO vkXXeG2rkvKvcuPG0+6gqovRODJB/UBXkuNh4o1WQbxLKKNDF/ZLSKW+omQzs7HgbMpz z0p20D5coUaNK4CUBWG/J7RA0mJmG3omOjH6ZwBczKc2NBuCygZURwIO21bY0L6kWpso 97/86pTCjifgZKkyObnTuY8xOELGOkRXa1LXArrqFVO9NAdj8lMBvCtSm+GgrZ6oS7kx zFGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=42LaC+Ki9kS2X5mr9P1WxGQwcv49odezsy0vgHHfVsw=; fh=RTW/Al1GCPbRPIVp/2f+uU4+i15WQ+qqZGjtTtW4jE0=; b=Kc1REbZmUh4D/tOqhp+X28ugEwKs6WOSkAlY1Lxa8/izIrTgO2cPh+BVFCLXbEMO0N RuJelrFDy7SNbHxQmVKTEgfCAQOMVqFUcUDpznwCxQ5gsOwKNpHzMBWKxDgSow6LwPo8 /9a+qb44iUw8fg5zxexqOoT1OaOMYU+Cf8WeDsaOE7toapJpzlZXzWIP3Y3fAwpKPeqc bTM0EJC+KZoxzDLSnXb9kH00ha0lmXr5rAjQ0tm2aMJnx+DrWvmkezc3/FUqWMAXUxab D9DA2hIkfdQwYDO7lf8aTEytem+rnTlsA4XuTwyxmeJ8hKWsz7YQ1KqoCIRi4kvoiEJ8 QnrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=mv0T9T49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id h184-20020a6383c1000000b005775c7e503csi3086686pge.116.2023.09.20.07.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 07:49:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=mv0T9T49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 08F8B82A1767; Wed, 20 Sep 2023 02:02:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234005AbjITJCb (ORCPT + 99 others); Wed, 20 Sep 2023 05:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233907AbjITJCM (ORCPT ); Wed, 20 Sep 2023 05:02:12 -0400 X-Greylist: delayed 475 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 20 Sep 2023 02:00:22 PDT Received: from mail.tuxedocomputers.com (mail.tuxedocomputers.com [157.90.84.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 144E61FEB for ; Wed, 20 Sep 2023 02:00:22 -0700 (PDT) Received: from wse.fritz.box (p5de45a8d.dip0.t-ipconnect.de [93.228.90.141]) (Authenticated sender: wse@tuxedocomputers.com) by mail.tuxedocomputers.com (Postfix) with ESMTPA id 213F42FC00D1; Wed, 20 Sep 2023 10:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxedocomputers.com; s=default; t=1695199945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=42LaC+Ki9kS2X5mr9P1WxGQwcv49odezsy0vgHHfVsw=; b=mv0T9T498iqueOpCOv40rVcUWk2+Ha5utGq1dUZye38ZUOBKjBTzWioTp5oV7/1VXUep0C Nz1tVqDZ0TCIjcYQdIa1gZP+RpuMN68XYrHHNzRVWxAgR3Ry/6PyrDYp7AF642pPn4Qjjn xMVGyHv+De0RuCec2o+hwsSpT01epTs= Authentication-Results: mail.tuxedocomputers.com; auth=pass smtp.auth=wse@tuxedocomputers.com smtp.mailfrom=wse@tuxedocomputers.com From: Werner Sembach To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: Georg Gottleuber , Werner Sembach , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] nvme-pci: Add sleep quirk for Kingston drives Date: Wed, 20 Sep 2023 10:52:10 +0200 Message-Id: <20230920085210.22573-1-wse@tuxedocomputers.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 20 Sep 2023 02:02:32 -0700 (PDT) From: Georg Gottleuber Some Kingston NV1 and A2000 are wasting a lot of power on specific TUXEDO platforms in s2idle sleep if 'Simple Suspend' is used. This patch applies a new quirk 'Force No Simple Suspend' to achieve a low power sleep without 'Simple Suspend'. Signed-off-by: Werner Sembach Signed-off-by: Georg Gottleuber Cc: --- drivers/nvme/host/nvme.h | 5 +++++ drivers/nvme/host/pci.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index f35647c470afa..74f74b459f5fa 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -156,6 +156,11 @@ enum nvme_quirks { * No temperature thresholds for channels other than 0 (Composite). */ NVME_QUIRK_NO_SECONDARY_TEMP_THRESH = (1 << 19), + + /* + * Disables simple suspend/resume path. + */ + NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND = (1 << 20), }; /* diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 347cb5daebc3c..b4e6f0d21a44c 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2903,6 +2903,18 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev) if ((dmi_match(DMI_BOARD_VENDOR, "LENOVO")) && dmi_match(DMI_BOARD_NAME, "LNVNB161216")) return NVME_QUIRK_SIMPLE_SUSPEND; + } else if (pdev->vendor == 0x2646 && (pdev->device == 0x2263 || + pdev->device == 0x500f)) { + /* + * Exclude some Kingston NV1 and A2000 devices from + * NVME_QUIRK_SIMPLE_SUSPEND. Do a full suspend to save a + * lot fo energy with s2idle sleep on some TUXEDO platforms. + */ + if (dmi_match(DMI_BOARD_NAME, "NS5X_NS7XAU") || + dmi_match(DMI_BOARD_NAME, "NS5x_7xAU") || + dmi_match(DMI_BOARD_NAME, "NS5x_7xPU") || + dmi_match(DMI_BOARD_NAME, "PH4PRX1_PH6PRX1")) + return NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND; } return 0; @@ -2933,7 +2945,9 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev, dev->dev = get_device(&pdev->dev); quirks |= check_vendor_combination_bug(pdev); - if (!noacpi && acpi_storage_d3(&pdev->dev)) { + if (!noacpi && + !(quirks & NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND) && + acpi_storage_d3(&pdev->dev)) { /* * Some systems use a bios work around to ask for D3 on * platforms that support kernel managed suspend. -- 2.34.1