linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/DPC: Add pcie_ports=dpc-native parameter to bring back old behavior
@ 2019-10-23 19:22 Olof Johansson
  2019-10-24  2:37 ` Keith Busch
  2019-10-25 20:20 ` Bjorn Helgaas
  0 siblings, 2 replies; 8+ messages in thread
From: Olof Johansson @ 2019-10-23 19:22 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Keith Busch, linux-pci, linux-kernel, Olof Johansson

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-07 23:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 19:22 [PATCH] PCI/DPC: Add pcie_ports=dpc-native parameter to bring back old behavior Olof Johansson
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

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).