All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Zheng, Qi" <qi.zheng@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"Zha, Qipeng" <qipeng.zha@intel.com>,
	Dave Airlie <airlied@gmail.com>,
	"Nyman, Mathias" <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v2 2/4] PCI: Move PCIe ports to D3 during suspend
Date: Mon, 11 Apr 2016 11:56:05 +0300	[thread overview]
Message-ID: <20160411085605.GB1727@lahna.fi.intel.com> (raw)
In-Reply-To: <0DD381DBF8F68D419C32ACFCEB28EB2521D2B374@SHSMSX101.ccr.corp.intel.com>

On Mon, Apr 11, 2016 at 03:36:41AM +0000, Zheng, Qi wrote:
> > +static int pci_dev_check_d3cold(struct pci_dev *pdev, void *data) {
> > +	bool *d3cold_ok = data;
> > +
> > +	/*
> > +	 * The device needs to be allowed to go D3cold and if it is wake
> > +	 * capable to do so from D3cold.
> > +	 */
> > +	if (pdev->no_d3cold || !pdev->d3cold_allowed)
> > +		*d3cold_ok = false;
> > +	if (device_may_wakeup(&pdev->dev) && !pci_pme_capable(pdev, PCI_D3cold))
> > +		*d3cold_ok = false;
> > +
> > +	return !*d3cold_ok;
> >+}
> 
> How about the pme_poll?
> IMHO, if the pme_poll is set for some device, the PCIe port couldn't
> go to sleep as well.

I wasn't sure about that. If the device has pme_poll set, and the bridge
is in D3 (or anything else than D0) the it will not be scanned for PME
(this is done in pci_pme_list_scan()).

My understanding is that pme_poll is a workaround for bridges which do not
forward PME messages upstream properly. Since this whole thing is only
enabled for recent PCIe hardware, I would expect that this works also :)

> > +void pci_bridge_pm_update(struct pci_dev *pdev, bool remove) {
> > +	struct pci_dev *bridge;
> > +	bool d3cold_ok = true;
> > +
> > +	bridge = pci_upstream_bridge(pdev);
> > +	if (!bridge || !pci_bridge_d3_possible(bridge))
> > +		return;
> > +
> > +	pci_dev_get(bridge);
> > +	if (!remove)
> > +		pci_dev_check_d3cold(pdev, &d3cold_ok);
> > +
> > +	if (d3cold_ok) {
> > +		/*
> > +		 * We need to go through all children to find out if all of
> > +		 * them can still go to D3cold.
> > +		 */
> > +		pci_walk_bus(bridge->subordinate, pci_dev_check_d3cold,
> > +			     &d3cold_ok);
> > +	}
> > +	bridge->bridge_d3 = d3cold_ok;
> > +	pci_dev_put(bridge);
> > +}
> 
> IMHO, the PCIe port can go to sleep if all the devices behind it are
> already in D3, not they have the capability to enter D3.

The capability check in pci_pme_capable() means that we expect the
device to be capable of triggering PME from D3cold.

> Besides, why the devices should in D3cold? Why D3hot can't?

Because when you power down a bridge you cannot access config space of
the devices below that bridge anymore. It may also trigger the PCIe link
to go to L2 or L3.

  reply	other threads:[~2016-04-11  8:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 10:36 [PATCH v2 0/4] PCI: Add support for suspending (including runtime) of PCIe ports Mika Westerberg
2016-04-08 10:36 ` [PATCH v2 1/4] PCI: No need to set d3cold_allowed to " Mika Westerberg
2016-04-08 10:36 ` [PATCH v2 2/4] PCI: Move PCIe ports to D3 during suspend Mika Westerberg
2016-04-08 15:07   ` Greg Kroah-Hartman
2016-04-11  8:47     ` Mika Westerberg
2016-04-11  3:36   ` Zheng, Qi
2016-04-11  8:56     ` Mika Westerberg [this message]
2016-04-11 13:38       ` Rafael J. Wysocki
2016-04-12  6:51         ` Mika Westerberg
2016-04-12 17:45   ` Lukas Wunner
2016-04-13  8:34     ` Mika Westerberg
2016-04-08 10:36 ` [PATCH v2 3/4] ACPI / hotplug / PCI: Runtime resume bridge before rescan Mika Westerberg
2016-04-08 10:36 ` [PATCH v2 4/4] PCI: Add runtime PM support for PCIe ports Mika Westerberg
2016-04-12 17:52   ` Lukas Wunner
2016-04-13  8:33     ` Mika Westerberg
2016-04-13  9:08       ` Andreas Noever
2016-04-13  9:16         ` Mika Westerberg
2016-04-18 14:38       ` Lukas Wunner
2016-04-19 12:31         ` Mika Westerberg
2016-04-20 19:22           ` Lukas Wunner
2016-04-20 20:23             ` Rafael J. Wysocki
2016-04-21 13:12               ` Mika Westerberg
2016-04-21 19:19                 ` Rafael J. Wysocki
2016-04-21 23:25                   ` Andreas Noever
2016-04-22  0:26                     ` Rafael J. Wysocki
2016-04-22  9:10                       ` Mika Westerberg
2016-04-22 12:37                         ` Rafael J. Wysocki
2016-04-21 13:10             ` Mika Westerberg
2016-04-24 16:13               ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160411085605.GB1727@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=qi.zheng@intel.com \
    --cc=qipeng.zha@intel.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.