Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp389767pxb; Thu, 19 Nov 2020 04:05:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsPcE5ACaBqVM1ofG87YIIv+fC7oWv47IqC94wL0eT3HEh9W9UQh6sqpGqtSqt1ZIh958E X-Received: by 2002:aa7:ca44:: with SMTP id j4mr31250039edt.354.1605787557366; Thu, 19 Nov 2020 04:05:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605787557; cv=none; d=google.com; s=arc-20160816; b=BdEZpLNBQF8lU8nr9ioltSxjo69th838KLSDodOfAS1gWlwnneFgRbokpGwPueqjqp 8aoDtmQbpOe6kVjD50Byue59vr4oGwujcFOyZ6T53G5sO84ZfgkA6ziVtek5TbWTASfa oz74Y3uaDQYO7+hu847WRQWRY8a2x98f/d0EBWWF7bSdbZqBdKDQURyfm6Fmtu53amgl KdAi0HbNNhWpDU1WBHJp/Jt19qfhpkJL/ibtE55jnr1/PpL99wydPb8zkYjykBqFvAVf RB3p85cx7WulJktV6WgOsSjEdJePb1aiqFoBWwLSzUh0FaMPSH2HCTMzeWb/nQKKta5T ZeRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=c3FCDKE+VCsRM90JSTxE2dzcCsYyWKuHRdMqId4kHQ0=; b=YvYjRKIgjXhPprQgNRtxh8ffXB3mvyzuMmaZYwfPE+GtDfOZIdQ5TcV3E6Mp/1AILu wDeH9hsHGkwQBCBwLePf2jqlZo00cN8p2SYNUQnH4SqqcstXsZYh2KNwRbEb4BtcIA0+ JOZr7IVaX/5Ne1bqMSD3ybRgWU8hSNZtkfxxZPEn714BsAE66wwnfUxmU84ULsLQkZQs 8qHqV6U/vxe0o7lMNolHNO6yr5RY/De6z0Al3JdgwAi/ws1M5y/UMtcZ1Qgl+wv9FFCS t0p/zlMb+un3uvufKfxhrt8/jGomCpIiPl4rPtRPVAjmqnkHsAv4ko9LGVnfyVX9cTMq ganA== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pg11si17171735ejb.92.2020.11.19.04.05.34; Thu, 19 Nov 2020 04:05:57 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727111AbgKSMCG (ORCPT + 99 others); Thu, 19 Nov 2020 07:02:06 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:38051 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727096AbgKSMCF (ORCPT ); Thu, 19 Nov 2020 07:02:05 -0500 Received: by mail-ot1-f68.google.com with SMTP id 92so1955653otd.5; Thu, 19 Nov 2020 04:02:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c3FCDKE+VCsRM90JSTxE2dzcCsYyWKuHRdMqId4kHQ0=; b=ddvSt8bDVXC/a+MI2Ud1pMpK0iOBNtKzDnkSbj8fOr5TCbOy5AOddrzmHKvg9HZG3l 5axMKW9ODpuwCtZWKZ9lE6EAk6gWM6k9cpQYK08gPy6/1dDAwLVNPSRUUnq5ghdr+Wco W8cZlAl4j+LdoKbIlgeVjyviw4AlKRUuCwjF8H2ePsqM3Ad6I8PmrhqcSSsXj+2pWPir bL/43ILHm5Ogc1Tk3+EHBPs6H8HKnJ/ESc6DeBJLMZH5xq80estjjnAQ8UpXDzZBaAay wVov9cIRV8pJkXxRytQOoWpmVdNSeD1J7aQD+HXi67yCRuGwFd56JM97ZsN0BIAehTyz 4rww== X-Gm-Message-State: AOAM530LkUMHQDawZpdQW+vIb0uc8MMsLcmP6gGOXnDPGOU6sL/s4RLS dE3ovKvOW5CcFSqChKySWw+5fGAbcO1ZvZE3H4U8/d7XIoo= X-Received: by 2002:a9d:222f:: with SMTP id o44mr10096245ota.321.1605787324203; Thu, 19 Nov 2020 04:02:04 -0800 (PST) MIME-Version: 1.0 References: <20201119001822.31617-1-david.e.box@linux.intel.com> <20201119001822.31617-2-david.e.box@linux.intel.com> In-Reply-To: <20201119001822.31617-2-david.e.box@linux.intel.com> From: "Rafael J. Wysocki" Date: Thu, 19 Nov 2020 13:01:53 +0100 Message-ID: Subject: Re: [PATCH 2/2] PCI: Disable Precision Time Measurement during suspend To: "David E. Box" Cc: Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Linux PCI , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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". > + */ > + 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. > + 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) > --