public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: andy.shevchenko@gmail.com
To: "Mateusz Jończyk" <mat.jonczyk@o2.pl>
Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Borislav Petkov <bp@suse.de>,
	Jean Delvare <jdelvare@suse.de>
Subject: Re: [PATCH v4] acpi,pci: warn about duplicate IRQ routing entries returned from _PRT
Date: Wed, 21 Feb 2024 00:12:13 +0200	[thread overview]
Message-ID: <ZdUjvUG3aUgGCwBs@surfacebook.localdomain> (raw)
In-Reply-To: <20231226124254.66102-1-mat.jonczyk@o2.pl>

Tue, Dec 26, 2023 at 01:42:54PM +0100, Mateusz Jończyk kirjoitti:
> 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.
> 
> As a debugging aid, print a warning to dmesg if duplicate interrupt
> routing entries are present. This way, we could check how many models
> are affected.
> 
> This happens on a Dell Latitude E6500 laptop with the i2c-i801 Intel
> SMBus controller. This controller is nonfunctional unless its interrupt
> usage is 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:
> 
>         [...]
>         i801_smbus 0000:00:1f.3: Timeout waiting for interrupt!
>         i801_smbus 0000:00:1f.3: Transaction timeout
>         i801_smbus 0000:00:1f.3: Timeout waiting for interrupt!
>         i801_smbus 0000:00:1f.3: Transaction timeout
>         irq 17: nobody cared (try booting with the "irqpoll" option)
> 
> Existence of duplicate entries in a table returned by the _PRT method
> was confirmed by disassembling the ACPI DSDT table.
> 
> Windows XP is using IRQ3 (as reported by HWiNFO32 and in the Device
> Manager), which is neither of the two vectors returned by _PRT.
> As HWiNFO32 decoded contents of the SPD EEPROMs, the i2c-i801 device is
> working under Windows. It appears that Windows has reconfigured the
> chipset independently to use another interrupt vector for the device.
> This is possible, according to the chipset datasheet [1], page 436 for
> example (PIRQ[n]_ROUT—PIRQ[A,B,C,D] Routing Control Register).

> [1] https://www.intel.com/content/dam/doc/datasheet/io-controller-hub-9-datasheet.pdf
> 

Can you convert this to be a Link tag?

Link: ...URL... # [1]
Signed-off-by: ...

> Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>

> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Jean Delvare <jdelvare@suse.de>

Please, move these (Cc lines) down after --- cutter line.

> Previously-reviewed-by: Jean Delvare <jdelvare@suse.de>
> Previously-tested-by: Jean Delvare <jdelvare@suse.de>

This shouldn't be in the commit message, just use the comment block
(after --- line) for this.

...

>  	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
>  	struct acpi_pci_routing_table *entry;
>  	acpi_handle handle = NULL;
> +	struct acpi_prt_entry *match = NULL;
> +	const char *match_int_source = NULL;

Can you preserve reversed xmas tree ordering?

...

>  	while (entry && (entry->length > 0)) {
> -		if (!acpi_pci_irq_check_entry(handle, dev, pin,
> -						 entry, entry_ptr))
> -			break;
> +		struct acpi_prt_entry *curr;
> +
> +		if (!acpi_pci_irq_check_entry(handle, dev, pin, entry, &curr)) {

> +			if (!match) {

Why not positive condition?

> +				match = curr;
> +				match_int_source = entry->source;
> +			} else {
> +				dev_warn(&dev->dev, FW_BUG
> +				       "ACPI _PRT returned duplicate IRQ routing entries for INT%c: %s[%d] and %s[%d]\n",
> +				       pin_name(curr->pin),
> +				       match_int_source, match->index,
> +				       entry->source, curr->index);
> +				/* We use the first matching entry nonetheless,
> +				 * for compatibility with older kernels.
> +				 */
> +			}
> +		}

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2024-02-20 22:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-26 12:42 [PATCH v4] acpi,pci: warn about duplicate IRQ routing entries returned from _PRT Mateusz Jończyk
2024-02-13 21:39 ` Jean Delvare
2024-02-16 18:26 ` Rafael J. Wysocki
2024-02-16 18:49   ` Bjorn Helgaas
2024-02-16 20:20     ` Mateusz Jończyk
2024-02-16 20:51       ` Rafael J. Wysocki
2024-02-16 21:19         ` Mateusz Jończyk
2024-02-20 22:12 ` andy.shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZdUjvUG3aUgGCwBs@surfacebook.localdomain \
    --to=andy.shevchenko@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=bp@suse.de \
    --cc=jdelvare@suse.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mat.jonczyk@o2.pl \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox