From: Bjorn Helgaas <bhelgaas@google.com>
To: stable@vger.kernel.org
Cc: Myron Stowe <myron.stowe@redhat.com>,
linux-pci@vger.kernel.org, Amos Kong <kongjianjun@gmail.com>,
Adam Lee <adam.lee@canonical.com>,
linux-kernel@vger.kernel.org, Yuval Mintz <yuvalmin@broadcom.com>,
Ben Hutchings <ben@decadent.org.uk>,
Thomas Renninger <trenn@suse.de>
Subject: [PATCH v2 3/3] PCI: Support PCIe Capability Slot registers only for ports with slots
Date: Tue, 19 Nov 2013 14:35:57 -0700 [thread overview]
Message-ID: <20131119213557.3839.56953.stgit@bhelgaas-glaptop.roam.corp.google.com> (raw)
In-Reply-To: <20131119212714.3839.52182.stgit@bhelgaas-glaptop.roam.corp.google.com>
Commit 6d3a1741f1e648cfbd5a0cc94477a0d5004c6f5e upstream. This is part
of the fix for https://bugzilla.kernel.org/show_bug.cgi?id=65211
Previously we allowed callers to access Slot Capabilities, Status, and
Control for Root Ports even if the Root Port did not implement a slot.
This seems dubious because the spec only requires these registers if a
slot is implemented.
It's true that even Root Ports without slots must have *space* for these
slot registers, because the Root Capabilities, Status, and Control
registers are after the slot registers in the capability. However,
for a v1 PCIe Capability, the *semantics* of the slot registers are
undefined unless a slot is implemented.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-By: Jiang Liu <jiang.liu@huawei.com>
CC: stable@vger.kernel.org # v3.7+
---
drivers/pci/access.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 9a46fa9135d9..061da8c3ab4b 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -497,9 +497,9 @@ static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
{
int type = pci_pcie_type(dev);
- return type == PCI_EXP_TYPE_ROOT_PORT ||
- (type == PCI_EXP_TYPE_DOWNSTREAM &&
- pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT);
+ return (type == PCI_EXP_TYPE_ROOT_PORT ||
+ type == PCI_EXP_TYPE_DOWNSTREAM) &&
+ pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT;
}
static inline bool pcie_cap_has_rtctl(const struct pci_dev *dev)
next prev parent reply other threads:[~2013-11-19 21:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 21:35 [PATCH v2 0/3] PCIe Capability accessor fixes [stable backports] Bjorn Helgaas
2013-11-19 21:35 ` [PATCH v2 1/3] PCI: Allow PCIe Capability link-related register access for switches Bjorn Helgaas
2013-11-19 21:35 ` [PATCH v2 2/3] PCI: Remove PCIe Capability version checks Bjorn Helgaas
2013-11-19 22:04 ` Myron Stowe
2013-11-19 21:35 ` Bjorn Helgaas [this message]
2013-11-19 22:05 ` [PATCH v2 3/3] PCI: Support PCIe Capability Slot registers only for ports with slots Myron Stowe
2013-11-20 7:13 ` [PATCH v2 0/3] PCIe Capability accessor fixes [stable backports] Adam Lee
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=20131119213557.3839.56953.stgit@bhelgaas-glaptop.roam.corp.google.com \
--to=bhelgaas@google.com \
--cc=adam.lee@canonical.com \
--cc=ben@decadent.org.uk \
--cc=kongjianjun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=myron.stowe@redhat.com \
--cc=stable@vger.kernel.org \
--cc=trenn@suse.de \
--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
all inboxes | Powered by JetHome®