linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Peter Wu <peter@lekensteyn.nl>
Cc: Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: export pci_bridge_d3_possible
Date: Fri, 8 Jul 2016 12:24:40 +0300	[thread overview]
Message-ID: <20160708092440.GA23527@lahna.fi.intel.com> (raw)
In-Reply-To: <20160708084525.GA1205@al>

On Fri, Jul 08, 2016 at 10:45:25AM +0200, Peter Wu wrote:
> On Fri, Jul 08, 2016 at 11:25:03AM +0300, Mika Westerberg wrote:
> > On Fri, Jul 08, 2016 at 01:54:48AM +0200, Peter Wu wrote:
> > > Allow the nouveau driver to find out whether the bridge can put itself
> > > in the D3cold state or whether it should use a specific DSM method to
> > > achieve the same result.
> > > 
> > > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> > > Signed-off-by: Peter Wu <peter@lekensteyn.nl>
> > > ---
> > > Since it is not yet merged in Linus tree, maybe the patch in pci/pm can be
> > > amended? This is the follow-up patch I had in mind for nouveau:
> > > 
> > >     --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
> > >     +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
> > >     @@ -223,6 +223,9 @@ static bool nouveau_pr3_present(struct pci_dev *pdev)
> > >      	if (!parent_pdev)
> > >      		return false;
> > >      
> > >     +	if (!pci_bridge_d3_possible(parent_pdev))
> > >     +		return false;
> > >     +
> > 
> > Why not check bridge_d3 directly?
> > 
> > 	if (!parent_dev->bridge_d3)
> > 		return false;
> 
> I have thought of that but then dismissed the idea because
> pci_bridge_d3_update could change it after initialization based on the
> d3cold_allowed flag on the bridge or its children. Then this could
> happen:
> 
>  - initially d3cold_allowed is set false by the user
>  - nouveau decides to use DSM
>  - d3cold_allowed is set by user to true
>  - PCI thinks that power resources are OK to use, but that conflicts
>    with nouveau.

Indeed that might happen. However, to be on the safe side I think we
should just do something like this:

	if (!parent_dev->bridge_d3) {
		/*
		 * Parent PCI bridge is currently not power managed.
		 * Since userspace can change these afterwards to be on
		 * the safe side we stick with _DSM and prevent usage of
		 * _PR3 from the bridge.
		 */
		pci_d3cold_disable(pdev);
		return false;
	}

      reply	other threads:[~2016-07-08  9:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07 23:54 [PATCH] PCI: export pci_bridge_d3_possible Peter Wu
2016-07-08  8:25 ` Mika Westerberg
2016-07-08  8:45   ` Peter Wu
2016-07-08  9:24     ` Mika Westerberg [this message]

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=20160708092440.GA23527@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=peter@lekensteyn.nl \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).