public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/EDR: Support EDR_PORT_DPC_ENABLE_DSM Revision ID 5
@ 2026-04-23 16:38 Mattias Nissler
  0 siblings, 0 replies; only message in thread
From: Mattias Nissler @ 2026-04-23 16:38 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci; +Cc: Mattias Nissler, Kuppuswamy Sathyanarayanan

Commit f24ba846133d ("PCI/EDR: Align EDR_PORT_DPC_ENABLE_DSM with PCI
Firmware r3.3") updated the code to adhere to the
EDR_PORT_DPC_ENABLE_DSM interface as defined in v3.3 of the PCI Firmware
Specification. This DSM was originally proposed in EDN 12888 under a
different Revision ID and with differing parameter type for Arg3. It
turns out that there are BIOSes in production that only implement
Revision ID 5, so we're re-adding support for that.

Signed-off-by: Mattias Nissler <mnissler@meta.com>
cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
This patch deserves a bit of commentary, as I'm not really sure whether
it should get applied or not. In fact I can see arguments either way.

On the one hand, BIOSes are supposed to implement what is standardized
in the PCI firmware specification, and supporting random
pre-standardization variants adds unnecessary baggage to the kernel code
and reduces incentive to implement support for the standardized version.

On the other hand, the text in the standard explicitly calls out the ECN
that defines revision 5. Furthermore, there's a chance that there are
machines out there which only support revision 5. At Meta, we recently
came across such a platform. Fortunately, we do have the ability to
upgrade the BIOS with revision 6 support, but I would expect that this
is more the exception than the rule for users in general.

Bottom line: I'm posting this in case it is helpful to others, and to
prompt consideration/discussion as to whether to apply or not.
---
 drivers/pci/pcie/edr.c | 40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/pcie/edr.c b/drivers/pci/pcie/edr.c
index e86298dbbcff..e5cedd41be04 100644
--- a/drivers/pci/pcie/edr.c
+++ b/drivers/pci/pcie/edr.c
@@ -28,26 +28,38 @@
 static int acpi_enable_dpc(struct pci_dev *pdev)
 {
 	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
-	union acpi_object *obj, argv4, req;
+	union acpi_object *obj, *arg3, pkg, req;
 	int status = 0;
-
-	/*
-	 * Per PCI Firmware r3.3, sec 4.6.12, EDR_PORT_DPC_ENABLE_DSM is
-	 * optional. Return success if it's not implemented.
-	 */
-	if (!acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 6,
-			    1ULL << EDR_PORT_DPC_ENABLE_DSM))
-		return 0;
+	u64 rev = 0;
 
 	req.type = ACPI_TYPE_INTEGER;
 	req.integer.value = 1;
 
-	argv4.type = ACPI_TYPE_PACKAGE;
-	argv4.package.count = 1;
-	argv4.package.elements = &req;
+	pkg.type = ACPI_TYPE_PACKAGE;
+	pkg.package.count = 1;
+	pkg.package.elements = &req;
+
+	/*
+	 * EDR_PORT_DPC_ENABLE_DSM is defined in PCI Firmware r3.3, sec 4.6.12.
+	 * Revision ID 6 is the variant that appears in the spec, Revision ID 5
+	 * corresponds to the variant defined in ECN #12888, known to be
+	 * implemented in some platforms.
+	 */
+	if (acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 6,
+			   1ULL << EDR_PORT_DPC_ENABLE_DSM)) {
+		rev = 6;
+		arg3 = &pkg;
+	} else if (acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 5,
+				  1ULL << EDR_PORT_DPC_ENABLE_DSM)) {
+		rev = 5;
+		arg3 = &req;
+	} else {
+		/* Return success if not implemented. */
+		return 0;
+	}
 
-	obj = acpi_evaluate_dsm(adev->handle, &pci_acpi_dsm_guid, 6,
-				EDR_PORT_DPC_ENABLE_DSM, &argv4);
+	obj = acpi_evaluate_dsm(adev->handle, &pci_acpi_dsm_guid, rev,
+				EDR_PORT_DPC_ENABLE_DSM, arg3);
 	if (!obj)
 		return 0;
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-23 16:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 16:38 [PATCH] PCI/EDR: Support EDR_PORT_DPC_ENABLE_DSM Revision ID 5 Mattias Nissler

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