From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: m.chetan.kumar@intel.com, linuxwwan@intel.com,
linux-pci@vger.kernel.org, linux-pm@vger.kernel.org,
Loic Poulain <loic.poulain@linaro.org>,
Sergey Ryazanov <ryazanov.s.a@gmail.com>,
Johannes Berg <johannes@sipsolutions.net>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Vaibhav Gupta <vaibhavgupta40@gmail.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition
Date: Thu, 30 Dec 2021 08:57:42 +0800 [thread overview]
Message-ID: <CAAd53p5GJRqRUvNSqNBLq2yTjjvJnSq5hFPSJYv08wuSLExx_w@mail.gmail.com> (raw)
In-Reply-To: <20211229201229.GA1698801@bhelgaas>
On Thu, Dec 30, 2021 at 4:12 AM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> [+cc Rafael, in case you have insight about the PCI_D0 question below;
> Vaibhav, since this is related to your generic PM conversions]
>
> On Fri, Dec 24, 2021 at 04:19:13PM +0800, Kai-Heng Feng wrote:
> > pci_pm_suspend_noirq() and pci_pm_resume_noirq() already handle power
> > transition for system-wide suspend and resume, so it's not necessary to
> > do it in the driver.
>
> I see DaveM has already applied this, but it looks good to me, thanks
> for doing this!
>
> One minor question below...
>
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > ---
> > drivers/net/wwan/iosm/iosm_ipc_pcie.c | 49 ++-------------------------
> > 1 file changed, 2 insertions(+), 47 deletions(-)
> >
> > diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > index 2fe88b8be3481..d73894e2a84ed 100644
> > --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > @@ -363,67 +363,22 @@ static int __maybe_unused ipc_pcie_resume_s2idle(struct iosm_pcie *ipc_pcie)
> >
> > int __maybe_unused ipc_pcie_suspend(struct iosm_pcie *ipc_pcie)
> > {
> > - struct pci_dev *pdev;
> > - int ret;
> > -
> > - pdev = ipc_pcie->pci;
> > -
> > - /* Execute D3 one time. */
> > - if (pdev->current_state != PCI_D0) {
> > - dev_dbg(ipc_pcie->dev, "done for PM=%d", pdev->current_state);
> > - return 0;
> > - }
>
> I don't understand the intent of this early exit, and it's not obvious
> to me that pci_pm_suspend_noirq() bails out early when
> (pdev->current_state != PCI_D0).
Yes, I think this can be removed too. Please let me send v2.
Kai-Heng
>
> > /* The HAL shall ask the shared memory layer whether D3 is allowed. */
> > ipc_imem_pm_suspend(ipc_pcie->imem);
> >
> > - /* Save the PCI configuration space of a device before suspending. */
> > - ret = pci_save_state(pdev);
> > -
> > - if (ret) {
> > - dev_err(ipc_pcie->dev, "pci_save_state error=%d", ret);
> > - return ret;
> > - }
> > -
> > - /* Set the power state of a PCI device.
> > - * Transition a device to a new power state, using the device's PCI PM
> > - * registers.
> > - */
> > - ret = pci_set_power_state(pdev, PCI_D3cold);
> > -
> > - if (ret) {
> > - dev_err(ipc_pcie->dev, "pci_set_power_state error=%d", ret);
> > - return ret;
> > - }
> > -
> > dev_dbg(ipc_pcie->dev, "SUSPEND done");
> > - return ret;
> > + return 0;
> > }
> >
> > int __maybe_unused ipc_pcie_resume(struct iosm_pcie *ipc_pcie)
> > {
> > - int ret;
> > -
> > - /* Set the power state of a PCI device.
> > - * Transition a device to a new power state, using the device's PCI PM
> > - * registers.
> > - */
> > - ret = pci_set_power_state(ipc_pcie->pci, PCI_D0);
> > -
> > - if (ret) {
> > - dev_err(ipc_pcie->dev, "pci_set_power_state error=%d", ret);
> > - return ret;
> > - }
> > -
> > - pci_restore_state(ipc_pcie->pci);
> > -
> > /* The HAL shall inform the shared memory layer that the device is
> > * active.
> > */
> > ipc_imem_pm_resume(ipc_pcie->imem);
> >
> > dev_dbg(ipc_pcie->dev, "RESUME done");
> > - return ret;
> > + return 0;
> > }
> >
> > static int __maybe_unused ipc_pcie_suspend_cb(struct device *dev)
> > --
> > 2.33.1
> >
prev parent reply other threads:[~2021-12-30 0:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-24 8:19 [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition Kai-Heng Feng
2021-12-24 8:19 ` [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case Kai-Heng Feng
2021-12-29 20:18 ` Bjorn Helgaas
2021-12-30 1:00 ` Kai-Heng Feng
2022-01-03 15:28 ` Kumar, M Chetan
2022-01-03 17:21 ` Jakub Kicinski
2022-01-04 2:23 ` Kai-Heng Feng
2021-12-27 12:30 ` [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition patchwork-bot+netdevbpf
2021-12-29 20:12 ` Bjorn Helgaas
2021-12-30 0:57 ` Kai-Heng Feng [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=CAAd53p5GJRqRUvNSqNBLq2yTjjvJnSq5hFPSJYv08wuSLExx_w@mail.gmail.com \
--to=kai.heng.feng@canonical.com \
--cc=davem@davemloft.net \
--cc=helgaas@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxwwan@intel.com \
--cc=loic.poulain@linaro.org \
--cc=m.chetan.kumar@intel.com \
--cc=netdev@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=ryazanov.s.a@gmail.com \
--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).