[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2209100057070.2275@angie.orcam.me.uk>
Date: Sat, 17 Sep 2022 13:03:09 +0100 (BST)
From: "Maciej W. Rozycki" <macro@...am.me.uk>
To: Bjorn Helgaas <bhelgaas@...gle.com>
cc: Stefan Roese <sr@...x.de>, Jim Wilson <wilson@...iptree.org>,
David Abdurachmanov <david.abdurachmanov@...il.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v5 1/5] PCI: Consistently report presence of PCIe link
registers
Consistently with commit c8b303d0206b ("PCI: Remove PCIe Capability
version checks") only consider the PCI Express capability's Link Control
2, etc. registers present if the Link Control register is.
Before said commit with PCI Express capability versions higher than one
all link registers used to be considered present, however starting from
said commit Link Control, etc. original registers are only considered
present in devices with links, but Link Control 2, etc. registers
continue being considered always present even though likewise they are
only present in devices with links.
Fix the inconsistency then.
Signed-off-by: Maciej W. Rozycki <macro@...am.me.uk>
---
New change in v5.
---
drivers/pci/access.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
linux-pcie-cap-has-lnkctl2.diff
Index: linux-macro/drivers/pci/access.c
===================================================================
--- linux-macro.orig/drivers/pci/access.c
+++ linux-macro/drivers/pci/access.c
@@ -350,6 +350,11 @@ bool pcie_cap_has_lnkctl(const struct pc
type == PCI_EXP_TYPE_PCIE_BRIDGE;
}
+static inline bool pcie_cap_has_lnkctl2(const struct pci_dev *dev)
+{
+ return pcie_cap_has_lnkctl(dev) && pcie_cap_version(dev) > 1;
+}
+
static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
{
return pcie_downstream_port(dev) &&
@@ -390,10 +395,11 @@ static bool pcie_capability_reg_implemen
return pcie_cap_has_rtctl(dev);
case PCI_EXP_DEVCAP2:
case PCI_EXP_DEVCTL2:
+ return pcie_cap_version(dev) > 1;
case PCI_EXP_LNKCAP2:
case PCI_EXP_LNKCTL2:
case PCI_EXP_LNKSTA2:
- return pcie_cap_version(dev) > 1;
+ return pcie_cap_has_lnkctl2(dev);
default:
return false;
}
Powered by blists - more mailing lists