From: Yijing Wang <wangyijing@huawei.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
Jon Mason <jon.mason@intel.com>, Jon Mason <jdmason@kudzu.us>
Cc: <linux-pci@vger.kernel.org>, Hanjun Guo <guohanjun@huawei.com>,
<jiang.liu@huawei.com>, Yijing Wang <wangyijing@huawei.com>
Subject: [PATCH V2] PCI: print pcie max_payload_size default setting info to help diagnosis
Date: Thu, 11 Oct 2012 20:03:27 +0800 [thread overview]
Message-ID: <1349957007-9920-1-git-send-email-wangyijing@huawei.com> (raw)
PCIe device mps maybe not equal to its bridge mps after doing hotplug.
This may result unexpected problem like
http://marc.info/?l=linux-scsi&m=134788365823217&w=2. So add mps log for current
mps setting to help diagnosis an issue like this.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
drivers/pci/probe.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ec909af..a31e615 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1533,6 +1533,33 @@ static void pcie_write_mrrs(struct pci_dev *dev)
"with pci=pcie_bus_safe.\n");
}
+static int pcie_mps_info(struct pci_dev *dev, void *data)
+{
+ int mps, mpss;
+
+ if (!pci_is_pcie(dev))
+ return -EINVAL;
+
+ mps = pcie_get_mps(dev);
+ mpss = 128 << dev->pcie_mpss;
+ dev_printk(KERN_DEBUG, &dev->dev, "PCI-E Max_Payload_Size Supported %d, "
+ "Max_Payload_Size %d\n", mpss, mps);
+
+ return 0;
+}
+
+static void pcie_dump_mps_info(struct pci_bus *bus)
+{
+ int mps, mpss;
+
+ mps = pcie_get_mps(bus->self);
+ mpss = 128 << bus->self->pcie_mpss;
+ dev_printk(KERN_DEBUG, &bus->self->dev, "PCI-E Max_Payload_Size Supported %d, "
+ "Max_Payload_Size %d\n", mpss, mps);
+
+ pci_walk_bus(bus, pcie_mps_info, NULL);
+}
+
static int pcie_bus_configure_set(struct pci_dev *dev, void *data)
{
int mps, orig_mps;
@@ -1564,6 +1591,8 @@ void pcie_bus_configure_settings(struct pci_bus *bus, u8 mpss)
if (!pci_is_pcie(bus->self))
return;
+ pcie_dump_mps_info(bus);
+
if (pcie_bus_config == PCIE_BUS_TUNE_OFF)
return;
--
1.7.1
next reply other threads:[~2012-10-11 12:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-11 12:03 Yijing Wang [this message]
2012-10-12 0:15 ` [PATCH V2] PCI: print pcie max_payload_size default setting info to help diagnosis Jon Mason
2012-10-12 1:51 ` Yijing Wang
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=1349957007-9920-1-git-send-email-wangyijing@huawei.com \
--to=wangyijing@huawei.com \
--cc=bhelgaas@google.com \
--cc=guohanjun@huawei.com \
--cc=jdmason@kudzu.us \
--cc=jiang.liu@huawei.com \
--cc=jon.mason@intel.com \
--cc=linux-pci@vger.kernel.org \
/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).