Skip to contentSkip to conversation

acpi,pci: handle duplicate IRQ routing entries returned from _PRT

PATCH Superseded Mateusz Jończyk 1 participant 1 message Sep 9, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi,pci: handle duplicate IRQ routing entries returned from _PRT

On some platforms, the ACPI _PRT function returns duplicate interrupt routing entries. Linux uses the first matching entry, but sometimes the second matching entry contains the correct interrupt vector.

This happens on a Dell Latitude E6500 laptop with the i2c-i801 Intel SMBus controller. This controller was nonfunctional unless its interrupt usage was disabled (using the "disable_features=0x10" module parameter).

After investigation, it turned out that the driver was using an incorrect interrupt vector: in lspci output for this device there was:
Interrupt: pin B routed to IRQ 19
but after running i2cdetect (without using any i2c-i801 module parameters) the following was logged to dmesg:

        [...]
        [  132.248657] i801_smbus 0000:00:1f.3: Timeout waiting for interrupt!
        [  132.248669] i801_smbus 0000:00:1f.3: Transaction timeout
        [  132.452649] i801_smbus 0000:00:1f.3: Timeout waiting for interrupt!
        [  132.452662] i801_smbus 0000:00:1f.3: Transaction timeout
        [  132.467682] irq 17: nobody cared (try booting with the "irqpoll" option)

The existence of duplicate entries returned from _PRT was confirmed in the ACPI DSTD table, which contains:

	Name (API0, Package (0x1D)
	{
		Package (0x04)
		{
		0x001FFFFF,
		0x01,
		0x00,
		0x13
		},

		Package (0x04)
		{
		0x001FFFFF,
		0x00,
		0x00,
		0x10
		},

		Package (0x04)
		{
		0x001FFFFF,
		0x01,
		0x00,
		0x11
		},

		[...]
	})
	Method (_PRT, 0, NotSerialized)  // _PRT: PCI Routing Table
	{
		Local0 = API0 /* \_SB_.PCI0.API0 */
		If (!GPIC)
		{
		Local0 = PIC0 /* \_SB_.PCI0.PIC0 */
		}

		Return (Local0)
	}

Linux used the first matching entry, which was incorrect. In order not to disrupt existing systems, use the first matching entry unless the pci=prtlast kernel parameter is used or a Dell Latitude E6500 laptop is detected.

Disclaimer: there is nothing really interesting connected to the SMBus controller on this laptop, but this change may help other systems.

Cc Jonathan Corbet <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Len Brown <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 .../admin-guide/kernel-parameters.txt         |  8 ++
 drivers/acpi/pci_irq.c                        | 89 ++++++++++++++++++-
 drivers/pci/pci.c                             |  9 ++
 3 files changed, 102 insertions(+), 4 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +8 -0
index 426fa892d311..2ff351db10b8 100644
@@ -4190,6 +4190,14 @@
 				bridge windows. This is the default on modern
 				hardware. If you need to use this, please report
 				a bug to <[email protected]>.
+		prtlast		If the _PRT ACPI method returns duplicate
+				IRQ routing entries, use the last matching entry
+				for a given device. If the platform may be
+				affected by this problem, an error message is
+				printed to dmesg - this parameter is
+				ineffective otherwise. If you need to use this,
+				please report a bug to
+				<[email protected]>.
 		routeirq	Do IRQ routing for all PCI devices.
 				This is normally done in pci_enable_device(),
 				so this option is a temporary workaround
drivers/acpi/pci_irq.c +85 -4

110 lines not on this page · raw message

drivers/pci/pci.c +9 -0
index 95bc329e74c0..a14a2e4e4197 100644
@@ -155,6 +155,11 @@ static bool pci_bridge_d3_disable;
 /* Force bridge_d3 for all PCIe ports */
 static bool pci_bridge_d3_force;
 
+#ifdef CONFIG_ACPI
+/* Use the last matching entry from the table returned by the _PRT ACPI method. */
+bool pci_prtlast;
+#endif
+
 static int __init pcie_port_pm_setup(char *str)
 {
 	if (!strcmp(str, "off"))
@@ -6896,6 +6901,10 @@ static int __init pci_setup(char *str)
 				pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS);
 			} else if (!strncmp(str, "disable_acs_redir=", 18)) {
 				disable_acs_redir_param = str + 18;
+#ifdef CONFIG_ACPI
+			} else if (!strncmp(str, "prtlast", 7)) {
+				pci_prtlast = true;
+#endif
 			} else {
 				pr_err("PCI: Unknown option `%s'\n", str);
 			}

base-commit: 7e18e42e4b280c85b76967a9106a13ca61c16179

Signature · 1 line
2.25.1