From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Kalle Valo <kvalo@codeaurora.org>,
Yicong Yang <yangyicong@hisilicon.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: Make pcie_find_root_port() work for PCIe root ports as well
Date: Wed, 1 Jul 2020 13:14:00 +0300 [thread overview]
Message-ID: <20200701101400.GN5180@lahna.fi.intel.com> (raw)
In-Reply-To: <20200630220107.GA3489322@bjorn-Precision-5520>
On Tue, Jun 30, 2020 at 05:01:07PM -0500, Bjorn Helgaas wrote:
> On Mon, Jun 22, 2020 at 07:12:48PM +0300, Mika Westerberg wrote:
> > Commit 6ae72bfa656e ("PCI: Unify pcie_find_root_port() and
> > pci_find_pcie_root_port()") unified the root port finding functionality
> > into a single function but missed the fact that the passed in device may
> > already be a root port. This causes the kernel to block power management
> > of PCIe hierarchies in recent systems because ->bridge_d3 started to
> > return false for such ports after the commit in question.
> >
> > Fixes: 6ae72bfa656e ("PCI: Unify pcie_find_root_port() and pci_find_pcie_root_port()")
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Cc: stable@vger.kernel.org
> > ---
> > include/linux/pci.h | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/pci.h b/include/linux/pci.h
> > index c79d83304e52..c17c24f5eeed 100644
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -2169,8 +2169,13 @@ static inline int pci_pcie_type(const struct pci_dev *dev)
> > */
> > static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
> > {
> > - struct pci_dev *bridge = pci_upstream_bridge(dev);
> > + struct pci_dev *bridge;
> >
> > + /* If dev is already root port */
> > + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
> > + return dev;
> > +
> > + bridge = pci_upstream_bridge(dev);
> > while (bridge) {
> > if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT)
> > return bridge;
>
> I applied the patch below, which is slightly simplified but I think
> still equivalent, to for-linus for v5.8. Let me know if it's not.
Thanks I just tested and it also works fine.
> I dropped the stable tag because 6ae72bfa656e was merged for v5.8-rc1,
> and I assume v5.7 works correctly so it doesn't need any change.
Right, makes sense.
prev parent reply other threads:[~2020-07-01 10:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 16:12 [PATCH] PCI: Make pcie_find_root_port() work for PCIe root ports as well Mika Westerberg
2020-06-30 22:01 ` Bjorn Helgaas
2020-07-01 1:53 ` Yicong Yang
2020-07-01 10:15 ` Mika Westerberg
2020-07-01 12:47 ` Yicong Yang
2020-07-01 10:14 ` 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=20200701101400.GN5180@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-pci@vger.kernel.org \
--cc=yangyicong@hisilicon.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 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.