Re: [PATCH v2] acpi,pci: handle duplicate IRQ routing entries returned from _PRT

Bjorn Helgaas
2022-09-27T19:28:34Z

On Sat, Sep 17, 2022 at 11:09:44AM +0200, Mateusz Jończyk wrote:
> 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)

Drop the timestamps; they add clutter but not useful information.

> Existence of duplicate entries in a table returned by the _PRT method
> was confirmed by disassembling the ACPI DSTD table.
>
> 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.

Do we have a reason to believe that in general, using the first
matching entry is incorrect? I don't see anything in the ACPI spec
(r6.5, sec 6.2.13) that sheds light on this.

Presumably this works on Windows, and I doubt Windows would have a
platform quirk for this, so I hypothesize that Windows treats _PRT
entries as assignments, and the last one rules. Maybe Linux should
adopt that rule?

Bjorn