From: Huang Ying <ying.huang@intel.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
linux-pm@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl>,
Huang Ying <ying.huang@intel.com>
Subject: [BUGFIX 2/4] PCI/PM: Keep parent bridge active when probing device
Date: Fri, 3 Aug 2012 14:30:33 +0800 [thread overview]
Message-ID: <1343975435-25469-3-git-send-email-ying.huang@intel.com> (raw)
In-Reply-To: <1343975435-25469-1-git-send-email-ying.huang@intel.com>
This patch fixes the following bug:
http://marc.info/?l=linux-pci&m=134329923124234&w=2
The root cause of the bug is as follow.
If a device is not bound with the corresponding driver, the device
runtime PM will be disabled and the device will be put into suspended
state. So that, the bridge/PCIe port connected to it may be put into
suspended and low power state. When do probing for the device later,
because the bridge/PCIe port connected to it is in low power state,
the IO access to device may fail.
To solve the issue, the bridge/PCIe port connected to the device is
put into active state before probing.
Reported-by: Bjorn Mork <bjorn@mork.no>
Signed-off-by: Huang Ying <ying.huang@intel.com>
---
drivers/pci/pci-driver.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -280,8 +280,12 @@ static long local_pci_probe(void *_ddi)
{
struct drv_dev_and_id *ddi = _ddi;
struct device *dev = &ddi->dev->dev;
+ struct device *parent = dev->parent;
int rc;
+ /* The parent bridge must be in active state when probing */
+ if (parent)
+ pm_runtime_get_sync(parent);
/* Unbound PCI devices are always set to disabled and suspended.
* During probe, the device is set to enabled and active and the
* usage count is incremented. If the driver supports runtime PM,
@@ -298,6 +302,8 @@ static long local_pci_probe(void *_ddi)
pm_runtime_set_suspended(dev);
pm_runtime_put_noidle(dev);
}
+ if (parent)
+ pm_runtime_put(parent);
return rc;
}
next prev parent reply other threads:[~2012-08-03 6:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-03 6:30 [PATCH 0/4] PCI/PM: PCI D3cold support fixes for 3.6-rc1 Huang Ying
2012-08-03 6:30 ` [BUGFIX 1/4] PCI/PM: enable D3/D3cold by default for most devices Huang Ying
2012-08-04 21:46 ` Rafael J. Wysocki
2012-08-03 6:30 ` Huang Ying [this message]
2012-08-04 21:48 ` [BUGFIX 2/4] PCI/PM: Keep parent bridge active when probing device Rafael J. Wysocki
2012-08-03 6:30 ` [BUGFIX 3/4] PCI/PM: Fix config reg access for D3cold and bridge suspending Huang Ying
2012-08-03 14:46 ` Alan Stern
2012-08-04 21:37 ` Rafael J. Wysocki
2012-08-04 21:44 ` Rafael J. Wysocki
2012-08-03 6:30 ` [PATCH 4/4] PCI/PM: Add ABI document for sysfs file d3cold_allowed Huang Ying
2012-08-19 10:35 ` [PATCH 0/4] PCI/PM: PCI D3cold support fixes for 3.6-rc1 Bjørn Mork
2012-08-20 1:09 ` huang ying
2012-08-21 23:47 ` 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=1343975435-25469-3-git-send-email-ying.huang@intel.com \
--to=ying.huang@intel.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
/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).