From: Olof Johansson <olof@lixom.net>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Keith Busch <keith.busch@intel.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Olof Johansson <olof@lixom.net>
Subject: [PATCH] PCI/DPC: Add pcie_ports=dpc-native parameter to bring back old behavior
Date: Wed, 23 Oct 2019 12:22:05 -0700 [thread overview]
Message-ID: <20191023192205.97024-1-olof@lixom.net> (raw)
In commit eed85ff4c0da7 ("PCI/DPC: Enable DPC only if AER is available"),
the behavior was changed such that native (kernel) handling of DPC
got tied to whether the kernel also handled AER. While this is what
the standard recommends, there are BIOSes out there that lack the DPC
handling since it was never required in the past.
To make DPC still work on said platforms the same way they did before,
add a "pcie_ports=dpc-native" kernel parameter that can be passed in
if needed, while keeping defaults unchanged.
Signed-off-by: Olof Johansson <olof@lixom.net>
---
Documentation/admin-guide/kernel-parameters.txt | 1 +
drivers/pci/pcie/dpc.c | 2 +-
drivers/pci/pcie/portdrv_core.c | 7 ++++++-
drivers/pci/pcie/portdrv_pci.c | 8 ++++++++
include/linux/pci.h | 2 ++
5 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 5e27d74e2b74b..e0325421980aa 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3548,6 +3548,7 @@
even if the platform doesn't give the OS permission to
use them. This may cause conflicts if the platform
also tries to use these services.
+ dpc-native Use native PCIe service for DPC, but none other.
compat Disable native PCIe services (PME, AER, DPC, PCIe
hotplug).
diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c
index a32ec3487a8d0..e06f42f58d3d4 100644
--- a/drivers/pci/pcie/dpc.c
+++ b/drivers/pci/pcie/dpc.c
@@ -291,7 +291,7 @@ static int dpc_probe(struct pcie_device *dev)
int status;
u16 ctl, cap;
- if (pcie_aer_get_firmware_first(pdev))
+ if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native)
return -ENOTSUPP;
dpc = devm_kzalloc(device, sizeof(*dpc), GFP_KERNEL);
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 1b330129089fe..c24bf6cac4186 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -250,8 +250,13 @@ static int get_port_device_capability(struct pci_dev *dev)
pcie_pme_interrupt_enable(dev, false);
}
+ /*
+ * With dpc-native, we set it if AER is available, even if AER is
+ * handled by firmware.
+ */
if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
- pci_aer_available() && services & PCIE_PORT_SERVICE_AER)
+ pci_aer_available() &&
+ (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
services |= PCIE_PORT_SERVICE_DPC;
if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 0a87091a0800e..b415656519a73 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -29,12 +29,20 @@ bool pcie_ports_disabled;
*/
bool pcie_ports_native;
+/*
+ * If the user specified "pcie_ports=dpc-native", use the PCIe services
+ * for DPC, but cuse platform defaults for the others.
+ */
+bool pcie_ports_dpc_native;
+
static int __init pcie_port_setup(char *str)
{
if (!strncmp(str, "compat", 6))
pcie_ports_disabled = true;
else if (!strncmp(str, "native", 6))
pcie_ports_native = true;
+ else if (!strncmp(str, "dpc-native", 10))
+ pcie_ports_dpc_native = true;
return 1;
}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fc1844061e88f..603d4822757b6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1534,9 +1534,11 @@ static inline int pci_irqd_intx_xlate(struct irq_domain *d,
#ifdef CONFIG_PCIEPORTBUS
extern bool pcie_ports_disabled;
extern bool pcie_ports_native;
+extern bool pcie_ports_dpc_native;
#else
#define pcie_ports_disabled true
#define pcie_ports_native false
+#define pcie_ports_dpc_native false
#endif
#define PCIE_LINK_STATE_L0S BIT(0)
--
2.11.0
next reply other threads:[~2019-10-23 19:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 19:22 Olof Johansson [this message]
2019-10-24 2:37 ` Keith Busch
2019-10-24 3:45 ` Olof Johansson
2019-10-25 20:20 ` Bjorn Helgaas
2019-11-07 19:59 ` Kuppuswamy Sathyanarayanan
2019-11-07 20:09 ` Olof Johansson
2019-11-07 22:05 ` Kuppuswamy Sathyanarayanan
2019-11-07 23:59 ` Olof Johansson
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=20191023192205.97024-1-olof@lixom.net \
--to=olof@lixom.net \
--cc=bhelgaas@google.com \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®