Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4154870pxj; Tue, 25 May 2021 01:26:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV++njzVcKe0Bp8ePRH5Dn7So3f0D5IcaZXqJwybgT16O4cVS1u4+9nZtLnB+ABIaO+xIj X-Received: by 2002:a02:c73a:: with SMTP id h26mr29105486jao.95.1621931184524; Tue, 25 May 2021 01:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621931184; cv=none; d=google.com; s=arc-20160816; b=zNUfu6D8prG+qBFf5GHxbwoMlafeUwoAyF0QZnwSl3Ww1UfHk7YRLaNeAQi4FvQX7R at1ZsFqeDpt3fDv+riEQkOE7D1MZC8axskyLy+C+9kVd+eXqyCHGkS7v3CFU16Z/TR6i VI6LQFOQ8qfYGYE6SP2A25jlKV8/iKXJcRJ1NuPBlsnU5C3CuYIBZpkUvT3nj+u+SfkX RPP04tWp/3K+nq6eEGU0s4Pn9I1cI0UpaVyADbolUfsjyS3o7e7YG5T+blQJq7Y06aUs HxbrnxBCU/4MbLBOu+QFIflcm3ZVHeCNQlgx5rKB/wohgW0Q6E6n6MsUVQx0eo3buoX7 B71g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=XIqSYUoLeaD/fCMzaDVK6UV5+zDcSFl5381NtuTOF/c=; b=VuvVj6jU8fljx4+fhWC+E3H5ViMHd6y1tYRzDNJkV/WPRuYiFSWz9SZAYyg5Wpp873 CAQLgiRJc8B6mtf7FLkEQqqkiogvuzvPTvNm/iK3faneGDhJYaU8NL4t8x0LE2KIPnrR oLZsYn8ddjFLdoavD7/+czGO22WAR3EwgH2lRsO0zhidHhisVkEWh5CHf0YCaonym7SZ 8ZGdCfARlxrtCqnDsMAimJ9CCiEL41XE1egagzQCTqEJyMoqLZo1G6Q7AKQNBts4h4mf Pwn30Y33unp4X7zDgSDk6yI9UUIMaZCbn2IDxBZgbxQi2bhitXtmXAsE0ILPy4GTan46 tuEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si18910286jal.41.2021.05.25.01.26.11; Tue, 25 May 2021 01:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231739AbhEYHp7 (ORCPT + 99 others); Tue, 25 May 2021 03:45:59 -0400 Received: from verein.lst.de ([213.95.11.211]:58036 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbhEYHp6 (ORCPT ); Tue, 25 May 2021 03:45:58 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id E209367357; Tue, 25 May 2021 09:44:26 +0200 (CEST) Date: Tue, 25 May 2021 09:44:26 +0200 From: Christoph Hellwig To: Koba Ko Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Henrik Juul Hansen , Kai-Heng Feng , Bjorn Helgaas , linux-pci@vger.kernel.org Subject: Re: [PATCH] nvme-pci: Avoid to go into d3cold if device can't use npss. Message-ID: <20210525074426.GA14916@lst.de> References: <20210520033315.490584-1-koba.ko@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210520033315.490584-1-koba.ko@canonical.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 20, 2021 at 11:33:15AM +0800, Koba Ko wrote: > After resume, host can't change power state of the closed controller > from D3cold to D0. Why? > For these devices, just avoid to go deeper than d3hot. What are "these devices"? > @@ -2958,6 +2959,15 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) > > dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev)); > > + if (pm_suspend_via_firmware() || !dev->ctrl.npss || > + !pcie_aspm_enabled(pdev) || > + dev->nr_host_mem_descs || > + (dev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) { Before we start open coding this in even more places we really want a little helper function for these checks, which should be accomodated with the comment near the existing copy of the checks. > + pdev->d3cold_allowed = false; > + pci_d3cold_disable(pdev); > + pm_runtime_resume(&pdev->dev); Why do we need to both set d3cold_allowed and call pci_d3cold_disable? What is the pm_runtime_resume doing here?