From patchwork Sat Feb 6 15:19:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 8242711 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3D19B9F37A for ; Sat, 6 Feb 2016 15:19:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3464920219 for ; Sat, 6 Feb 2016 15:19:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21AD220211 for ; Sat, 6 Feb 2016 15:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751495AbcBFPT1 (ORCPT ); Sat, 6 Feb 2016 10:19:27 -0500 Received: from mail.kernel.org ([198.145.29.136]:41260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbcBFPT0 (ORCPT ); Sat, 6 Feb 2016 10:19:26 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD98820204; Sat, 6 Feb 2016 15:19:24 +0000 (UTC) Received: from localhost (unknown [69.71.1.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B3F01201EF; Sat, 6 Feb 2016 15:19:23 +0000 (UTC) Date: Sat, 6 Feb 2016 09:19:22 -0600 From: Bjorn Helgaas To: Heiner Kallweit Cc: "Rafael J. Wysocki" , Chen Fan , linux-acpi@vger.kernel.org, Bjorn Helgaas , Linux PCI Subject: Re: Problems since commit Recognize that Interrupt Line 255 means "not connected" Message-ID: <20160206151922.GB22119@localhost> References: <56B52990.3030103@gmail.com> <1676062.Zh6hUgWIix@vostro.rjw.lan> <56B5AA4B.5040705@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <56B5AA4B.5040705@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Heiner, On Sat, Feb 06, 2016 at 09:09:47AM +0100, Heiner Kallweit wrote: > Am 06.02.2016 um 00:37 schrieb Rafael J. Wysocki: > > On Saturday, February 06, 2016 12:00:32 AM Heiner Kallweit wrote: > >> Since commit a44c386a361e "x86/PCI/ACPI: Recognize that Interrupt Line 255 > >> means "not connected"" I get several "PCI INT not connected" warnings on > >> a Zotac CI321 and EHCI failes to load: > > > > That doesn't follow clearly from your report, but I'm assuming that it works > > correctly without that commit, right? > > > Right, w/o this commit it looks like this: > > dmesg > ehci-pci 0000:00:1d.0: irq 23, io mem 0xf7d1b000 > > /proc/interrupts > IO-APIC 23-fasteoi ehci_hcd:usb3 Thanks a lot for your report! This is a bit of a minefield, and I was worried that we'd trip over something with a44c386a361e. Oops, I think I see a problem with a44c386a361e. We're checking for Interrupt Line == 255 even before we try to look it up in the _PRT. I think we should only check Interrupt Line *after* everything else has failed. Can you try the patch below instead of a44c386a361e? If the patch below doesn't work, would you mind collecting the complete output of "lspci -vvv" and the complete dmesg logs from kernels with and without a44c386a361e, and putting them somewhere (maybe a bugzilla.kernel.org report)? Bjorn --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index d30184c..807a0a8 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -33,6 +33,7 @@ #include #include #include +#include #define PREFIX "ACPI: " @@ -387,6 +388,23 @@ static inline int acpi_isa_register_gsi(struct pci_dev *dev) } #endif +static inline bool acpi_pci_irq_valid(struct pci_dev *dev, u8 pin) +{ +#ifdef CONFIG_X86 + /* + * On x86, Interrupt Line 0xff means "unknown" or "no connection" + * (PCI 3.0, Section 6.2.4, footnote on page 223). + */ + if (dev->irq == 0xff) { + dev->irq = IRQ_NOTCONNECTED; + dev_warn(&dev->dev, "PCI INT %c: not connected\n", + pin_name(pin)); + return false; + } +#endif + return true; +} + int acpi_pci_irq_enable(struct pci_dev *dev) { struct acpi_prt_entry *entry; @@ -431,11 +449,14 @@ int acpi_pci_irq_enable(struct pci_dev *dev) } else gsi = -1; - /* - * No IRQ known to the ACPI subsystem - maybe the BIOS / - * driver reported one, then use it. Exit in any case. - */ if (gsi < 0) { + /* + * No IRQ known to the ACPI subsystem - maybe the BIOS / + * driver reported one, then use it. Exit in any case. + */ + if (!acpi_pci_irq_valid(dev, pin)) + return 0; + if (acpi_isa_register_gsi(dev)) dev_warn(&dev->dev, "PCI INT %c: no GSI\n", pin_name(pin)); diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 0e95fcc..358076e 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -125,6 +125,16 @@ struct irqaction { extern irqreturn_t no_action(int cpl, void *dev_id); +/* + * If a (PCI) device interrupt is not connected we set dev->irq to + * IRQ_NOTCONNECTED. This causes request_irq() to fail with -ENOTCONN, so we + * can distingiush that case from other error returns. + * + * 0x80000000 is guaranteed to be outside the available range of interrupts + * and easy to distinguish from other possible incorrect values. + */ +#define IRQ_NOTCONNECTED (1U << 31) + extern int __must_check request_threaded_irq(unsigned int irq, irq_handler_t handler, irq_handler_t thread_fn, diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 8411872..e79e60f 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -1609,6 +1609,9 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler, struct irq_desc *desc; int retval; + if (irq == IRQ_NOTCONNECTED) + return -ENOTCONN; + /* * Sanity-check: shared interrupts must pass in a real dev-ID, * otherwise we'll have trouble later trying to figure out @@ -1699,9 +1702,13 @@ EXPORT_SYMBOL(request_threaded_irq); int request_any_context_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev_id) { - struct irq_desc *desc = irq_to_desc(irq); + struct irq_desc *desc; int ret; + if (irq == IRQ_NOTCONNECTED) + return -ENOTCONN; + + desc = irq_to_desc(irq); if (!desc) return -EINVAL;