linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, Dave Airlie <airlied@redhat.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Vaibhav Gupta <vaibhavgupta40@gmail.com>,
	linux-pm@vger.kernel.org
Subject: Re: PME while runtime suspend
Date: Fri, 26 Feb 2021 16:22:25 -0600	[thread overview]
Message-ID: <20210226222225.GA164608@bjorn-Precision-5520> (raw)
In-Reply-To: <CAMZdPi9PGWcPOHKk3cNU3Nw+hdVOsivLeXzqyd2FQ7nn8dDfvg@mail.gmail.com>

[+cc Rafael, Dave (author of 42eca2302146), Vaibhav, linux-pm]

On Fri, Feb 26, 2021 at 11:37:12AM +0100, Loic Poulain wrote:
> Hi Bjorn,
> 
> Trying to support runtime suspend in a driver, which puts the device
> in D3hot and wait either for host/driver initiated resume
> (runtime_get), or device initiated resume (PME).
> 
> But, given that old change: 42eca2302146 ("PCI: Don't touch card regs
> after runtime suspend D3")
> 
> PME that was enabled from pci_finish_runtime_suspend() is not enabled
> anymore for almost all drivers in case of runtime-suspend. The only
> way to enable this is by calling pci_wake_from_d3() from the PCI device
> driver's runtime_suspend() callback, but this function fails if the
> device wake_up is not enabled, which makes sense since it targets
> system-wide sleep wake-up (and wake-up is user/distro policy).
> 
> So is there a proper way to allow PME while the device is runtime
> suspended, without having to tell the user to enabled 'unrelated' wake_up
> capability?

pci_pm_runtime_suspend() calls pci_finish_runtime_suspend(), which
enables wake-up, unless "pci_dev->state_saved".  IIUC we should be
enabling wake-up unless the driver has called pci_save_state() itself.

So I infer that your driver does call pci_save_state() and the PCI
core does not enable wake-up.  Right?

Why does your driver call pci_save_state()?  In most cases I don't
think drivers should need to do that themselves because the PCI core
will do it for them.  E.g., see Vaibhav's recent eb6779d4c505 ("e1000:
use generic power management") [1]

Bjorn

[1] https://git.kernel.org/linus/eb6779d4c505

  reply	other threads:[~2021-02-26 22:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 10:37 PME while runtime suspend Loic Poulain
2021-02-26 22:22 ` Bjorn Helgaas [this message]
2021-03-02 14:52   ` Loic Poulain
2021-03-02 16:32     ` Bjorn Helgaas

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=20210226222225.GA164608@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=airlied@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=rjw@rjwysocki.net \
    --cc=vaibhavgupta40@gmail.com \
    /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).