Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp632046pxb; Thu, 19 Nov 2020 09:47:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPc2DdQZL1JW2kiXM5fZieWGgHXM4SCQtu59ptXmqdQC4yVpVzuxDenNpndqheasExQxgR X-Received: by 2002:a17:906:6897:: with SMTP id n23mr6448056ejr.458.1605808073211; Thu, 19 Nov 2020 09:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605808073; cv=none; d=google.com; s=arc-20160816; b=akIzrdQMoLpyEz06rUcj9pgzeSaufI0826F8lJrbl+P/XmWUsWIqgx+CHKcwQL0R+R h60shyiO5nMOFRpQ2OH8ceyrVdplyyk1mc8mBhCEbrpGuCv/eBXw3g9GiAKdA46mi32Z uTF4kcCRbeSoIiC/hxO1vW+PFgZlx+bBHmZHEB7K0AitWJTor/Pbk5PrZkbYWlKdnaqF vLKXWf3+dwALUCf6kbSw4a0IbaKEyc1HkqBlFGh63/XrrduwitTrJynTPURi4LLehawD 1o8iTifdqvc94RmhmLF8qNjzoDQy5qlYdWxEJ0BQoP5PFkk7/d4/JktyeGF7pE6biL7Z bUgA== 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 :user-agent:organization:references:in-reply-to:date:cc:to:reply-to :from:subject:message-id:ironport-sdr:ironport-sdr; bh=TrfjcbnXeoQ2Urobdi0cWQQNlK0moOkZkOqJvpMsvgA=; b=ZoY4iqkGyOroZumWUC5mfXBpQVha+uUsCHZwh2oN3joDcXWT6O8fhznBU9DdfSmpam PSP4skNu5T8jqRBvnSBbu50UXMo3ekv1d0dkBAhaabHVGfoXtrdyS/BvSDPxA3K5Rz+i Pf2uu6aIDs3gMOqmOsC1hvWnQEU8d8mkMMFDXt47QZ/FkdLVS8E3zZGzqH79RIszFV89 0KNC4ybn/RAf0yCFaWf0PK3Kdafh4EjHgw7ojSJhjHTkymShHsDXGq9pmHqBx04DUOzp 02AnPR5i/5QQkRIfK0TpQNvRPyG8ekA078Q1ShXDu+1Etw+FH0sIr4pMS90IdBsmTpkE EDtQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x14si260490edj.87.2020.11.19.09.47.30; Thu, 19 Nov 2020 09:47:53 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729492AbgKSRp2 (ORCPT + 99 others); Thu, 19 Nov 2020 12:45:28 -0500 Received: from mga09.intel.com ([134.134.136.24]:40769 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728511AbgKSRp1 (ORCPT ); Thu, 19 Nov 2020 12:45:27 -0500 IronPort-SDR: Hv3h+aFSzqMMN1Ep+T+YHOBl39zlE4s2ZXUCi+Xz21hvT6RmRllrNA5L8LUTBFUrBVuxlt9Qpv 03hKs7lP9DOQ== X-IronPort-AV: E=McAfee;i="6000,8403,9810"; a="171499596" X-IronPort-AV: E=Sophos;i="5.78,353,1599548400"; d="scan'208";a="171499596" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2020 09:45:26 -0800 IronPort-SDR: +bf+G675BRCLA6Z8sHKcXIqKGLu6Q/3eOF0tOWS/rj47s0G1YHVc+SC9cmCacMkZJkbDpyMqH8 2v3i2j1JDIOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,353,1599548400"; d="scan'208";a="534860651" Received: from linux.intel.com ([10.54.29.200]) by fmsmga005.fm.intel.com with ESMTP; 19 Nov 2020 09:45:26 -0800 Received: from debox1-desk1.jf.intel.com (debox1-desk1.jf.intel.com [10.7.201.137]) by linux.intel.com (Postfix) with ESMTP id 7A172580814; Thu, 19 Nov 2020 09:45:26 -0800 (PST) Message-ID: Subject: Re: [PATCH 2/2] PCI: Disable Precision Time Measurement during suspend From: "David E. Box" Reply-To: david.e.box@linux.intel.com To: "Rafael J. Wysocki" Cc: Bjorn Helgaas , Len Brown , Linux PCI , Linux Kernel Mailing List Date: Thu, 19 Nov 2020 09:45:26 -0800 In-Reply-To: References: <20201119001822.31617-1-david.e.box@linux.intel.com> <20201119001822.31617-2-david.e.box@linux.intel.com> Organization: David E. Box Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-11-19 at 13:01 +0100, Rafael J. Wysocki wrote: > On Thu, Nov 19, 2020 at 1:17 AM David E. Box > wrote: > > On Intel client platforms that support suspend-to-idle, like Ice > > Lake, > > root ports that have Precision Time Management (PTM) enabled can > > prevent > > the port from being fully power gated, causing higher power > > consumption > > while suspended. To prevent this, after saving the PTM control > > register, > > disable the feature. The feature will be returned to its previous > > state > > during restore. > > > > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=209361 > > Reported-by: Len Brown > > Suggested-by: Rafael J. Wysocki > > Signed-off-by: David E. Box > > --- > > drivers/pci/pci.c | 14 +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > > index 6fd4ae910a88..a2b40497d443 100644 > > --- a/drivers/pci/pci.c > > +++ b/drivers/pci/pci.c > > @@ -21,6 +21,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1543,7 +1544,7 @@ static void pci_save_ptm_state(struct pci_dev > > *dev) > > { > > int ptm; > > struct pci_cap_saved_state *save_state; > > - u16 *cap; > > + u16 *cap, ctrl; > > > > if (!pci_is_pcie(dev)) > > return; > > @@ -1560,6 +1561,17 @@ static void pci_save_ptm_state(struct > > pci_dev *dev) > > > > cap = (u16 *)&save_state->cap.data[0]; > > pci_read_config_word(dev, ptm + PCI_PTM_CTRL, cap); > > + > > + /* > > + * On Intel systems that support suspend-to-idle, > > additional > > + * power savings can be gained by disabling PTM on root > > ports, > > + * as this allows the port to enter a deeper pm state. > > I would say "There are systems (for example, ...) where the power > drawn while suspended can be significantly reduced by disabling PTM > on > PCIe root ports, as this allows the port to enter a lower-power PM > state and the SoC to reach a lower-power idle state as a whole". Okay. > > > + */ > > + if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE && > > AFAICS the target sleep state doesn't matter here, so I'd skip the > check above, but otherwise it LGTM. The target sleep state doesn't matter so much but that it's suspending does. pci_save_state() is called during probe for the root ports (and many other pci devices - I'm curious as to why). So without this check the capability gets disabled on boot. > > > + pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) { > > + ctrl = *cap & ~(PCI_PTM_CTRL_ENABLE | > > PCI_PTM_CTRL_ROOT); > > + pci_write_config_word(dev, ptm + PCI_PTM_CTRL, > > ctrl); > > + } > > } > > > > static void pci_restore_ptm_state(struct pci_dev *dev) > > -- David