From: Bjorn Helgaas <bhelgaas@google.com>
To: linux-pci@vger.kernel.org
Cc: Yuval Mintz <yuvalmin@broadcom.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Jiang Liu <jiang.liu@huawei.com>, Jiang Liu <liuj97@gmail.com>
Subject: [PATCH 1/4] PCI: Allow PCIe Capability link-related register access for switches
Date: Wed, 28 Aug 2013 13:27:00 -0600 [thread overview]
Message-ID: <20130828192700.5895.77389.stgit@bhelgaas-glaptop> (raw)
In-Reply-To: <20130828192627.5895.26558.stgit@bhelgaas-glaptop>
Every PCIe device has a link, except Root Complex Integrated Endpoints
and Root Complex Event Collectors. Previously we didn't give access
to PCIe capability link-related registers for Upstream Ports, Downstream
Ports, and Bridges, so attempts to read PCI_EXP_LNKCTL incorrectly
returned zero. See PCIe spec r3.0, sec 7.8 and 1.3.2.3.
Reported-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/access.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 1cc2366..e26c3bd 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -485,9 +485,13 @@ static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
int type = pci_pcie_type(dev);
return pcie_cap_version(dev) > 1 ||
- type == PCI_EXP_TYPE_ROOT_PORT ||
type == PCI_EXP_TYPE_ENDPOINT ||
- type == PCI_EXP_TYPE_LEG_END;
+ type == PCI_EXP_TYPE_LEG_END ||
+ type == PCI_EXP_TYPE_ROOT_PORT ||
+ type == PCI_EXP_TYPE_UPSTREAM ||
+ type == PCI_EXP_TYPE_DOWNSTREAM ||
+ type == PCI_EXP_TYPE_PCI_BRIDGE ||
+ type == PCI_EXP_TYPE_PCIE_BRIDGE;
}
static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
next prev parent reply other threads:[~2013-08-28 19:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-28 19:26 [PATCH 0/4] PCIe Capability accessor fix and cleanups Bjorn Helgaas
2013-08-28 19:27 ` Bjorn Helgaas [this message]
2013-08-28 19:27 ` [PATCH 2/4] PCI: Remove PCIe Capability version checks Bjorn Helgaas
2013-08-28 19:27 ` [PATCH 3/4] PCI: Support PCIe Capability Slot registers only for ports with slots Bjorn Helgaas
2013-08-28 19:27 ` [PATCH 4/4] PCI: Remove pcie_cap_has_devctl() Bjorn Helgaas
2013-08-28 20:06 ` [PATCH 0/4] PCIe Capability accessor fix and cleanups Keller, Jacob E
2013-08-29 0:41 ` Jiang Liu
2013-08-29 3:15 ` 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=20130828192700.5895.77389.stgit@bhelgaas-glaptop \
--to=bhelgaas@google.com \
--cc=jacob.e.keller@intel.com \
--cc=jiang.liu@huawei.com \
--cc=linux-pci@vger.kernel.org \
--cc=liuj97@gmail.com \
--cc=yuvalmin@broadcom.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).