From: Johannes Thumshirn <jthumshirn@suse.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Yinghai Lu <yinghai@kernel.org>, Hannes Reinecke <hare@suse.de>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Johannes Thumshirn <jthumshirn@suse.de>
Subject: [PATCH] pci: Don't set RCB bit in LNKCTL if the upstream bridge hasn't
Date: Wed, 26 Oct 2016 15:53:34 +0200 [thread overview]
Message-ID: <1477490014-115917-1-git-send-email-jthumshirn@suse.de> (raw)
The Read Completion Boundary bit must only be set on a device or endpoint if
it is set on the upstream bridge.
Fixes: 7a1562d4f ("PCI: Apply _HPX Link Control settings to all devices with a link")
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/pci/probe.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ab00267..5007b96 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1439,6 +1439,16 @@ static void program_hpp_type1(struct pci_dev *dev, struct hpp_type1 *hpp)
dev_warn(&dev->dev, "PCI-X settings not supported\n");
}
+static bool pcie_get_upstream_rcb(struct pci_dev *dev)
+{
+ struct pci_dev *bridge = pci_upstream_bridge(dev);
+ u16 lnkctl;
+
+ pcie_capability_read_word(bridge, PCI_EXP_LNKCTL, &lnkctl);
+
+ return lnkctl & PCI_EXP_LNKCTL_RCB;
+}
+
static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
{
int pos;
@@ -1468,9 +1478,21 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or);
/* Initialize Link Control Register */
- if (pcie_cap_has_lnkctl(dev))
+ if (pcie_cap_has_lnkctl(dev)) {
+ bool us_rcb;
+ u16 clear;
+ u16 set;
+
+ us_rcb = pcie_get_upstream_rcb(dev);
+
+ clear = ~hpp->pci_exp_lnkctl_and;
+ set = hpp->pci_exp_lnkctl_or;
+ if (!us_rcb)
+ set &= ~PCI_EXP_LNKCTL_RCB;
+
pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,
- ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or);
+ clear, set);
+ }
/* Find Advanced Error Reporting Enhanced Capability */
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
--
1.8.5.6
next reply other threads:[~2016-10-26 13:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 13:53 Johannes Thumshirn [this message]
2016-10-26 13:58 ` Hannes Reinecke
2016-10-26 19:43 ` Bjorn Helgaas
2016-10-27 5:42 ` Hannes Reinecke
2016-10-27 11:51 ` Bjorn Helgaas
2016-10-27 12:06 ` Hannes Reinecke
2016-10-27 12:25 ` Johannes Thumshirn
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=1477490014-115917-1-git-send-email-jthumshirn@suse.de \
--to=jthumshirn@suse.de \
--cc=bhelgaas@google.com \
--cc=hare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=yinghai@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
all inboxes | Powered by JetHome®