public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] PCI/DPC: Skip EDR init when BIOS disable OS native DPC
@ 2022-07-27 11:05 Xiaochun Lee
  2022-07-27 14:23 ` Sathyanarayanan Kuppuswamy
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaochun Lee @ 2022-07-27 11:05 UTC (permalink / raw)
  To: linux-pci; +Cc: bhelgaas, linux-kernel, Xiaochun Lee

From: Xiaochun Lee <lixc17@lenovo.com>

ACPI BIOS may disable OS native AER and DPC support to notify OS
that our platform doesn't support AER and DPC via the _OSC method.
BIOS also might leave the containment be accomplished purely in HW.
When firmware is set to non-aware OS DPC, we skip to install
EDR handler to an ACPI device.

Signed-off-by: Xiaochun Lee <lixc17@lenovo.com>
---
 drivers/pci/pcie/edr.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/pci/pcie/edr.c b/drivers/pci/pcie/edr.c
index a6b9b47..97a680b 100644
--- a/drivers/pci/pcie/edr.c
+++ b/drivers/pci/pcie/edr.c
@@ -19,6 +19,17 @@
 #define EDR_OST_SUCCESS			0x80
 #define EDR_OST_FAILED			0x81
 
+static int pcie_dpc_is_native(struct pci_dev *dev)
+{
+	struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
+
+	if (!dev->dpc_cap)
+		return 0;
+
+	return pcie_ports_dpc_native || host->native_dpc;
+}
+
+
 /*
  * _DSM wrapper function to enable/disable DPC
  * @pdev   : PCI device structure
@@ -212,6 +223,11 @@ void pci_acpi_add_edr_notifier(struct pci_dev *pdev)
 		return;
 	}
 
+	if (!pcie_dpc_is_native(pdev) && !pcie_aer_is_native(pdev)) {
+		pci_dbg(pdev, "OS doesn't control DPC, skipping EDR init\n");
+		return;
+	}
+
 	status = acpi_install_notify_handler(adev->handle, ACPI_SYSTEM_NOTIFY,
 					     edr_handle_event, pdev);
 	if (ACPI_FAILURE(status)) {
-- 
1.8.3.1


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

end of thread, other threads:[~2022-07-28 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-27 11:05 [PATCH v1] PCI/DPC: Skip EDR init when BIOS disable OS native DPC Xiaochun Lee
2022-07-27 14:23 ` Sathyanarayanan Kuppuswamy
2022-07-28 10:11   ` [External] " Xiaochun XC17 Li
2022-07-28 13:38     ` Sathyanarayanan Kuppuswamy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox