PCI/EDR: Support EDR_PORT_DPC_ENABLE_DSM Revision ID 5
PATCH 1/1 PCI/EDR: Support EDR_PORT_DPC_ENABLE_DSM Revision ID 5
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.
---
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(-)
drivers/pci/pcie/edr.c +26 -14
@@ -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 ;
Signature · 1 line
2.52.0