Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3769218rwb; Sat, 12 Nov 2022 12:26:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf5GzTPKq2kQcfBYpQEDqd9dm7A8KEYnQDtBUwspqT6cWvYYauuD5F2EQ4Ejbn13u2Rnf1UN X-Received: by 2002:a63:535e:0:b0:46f:98cf:3bb6 with SMTP id t30-20020a63535e000000b0046f98cf3bb6mr6388895pgl.332.1668284799534; Sat, 12 Nov 2022 12:26:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668284799; cv=none; d=google.com; s=arc-20160816; b=CcbZG6i7ubsV97FlIGWDsQKEMJhlmRAv86MrZnJx7jtoHa+Nk0563TZhAWWDpBtZnx ymiCJLCeGN6PpOulFTb7GaplSlA5dj4paVAS82ThImr6JU3exHw9tLlREjapk44EdiUb RsFgp9iihE+TIgp2zueOFf8STKrBYwRweY1MGYYzW5OlPV1JWxDlbSrhCC2lopqrcEiU +PGa5CYzh5rLq8acDQym9h/wSZa2+QbQg2yVne/ZSwBGm0wje4P0t+jaNA+OvUWIL8Bv oPQdt5CInB+5gSH/8oGIrmMASBAttRIXSVIj0K6lfY9rpu8JRvdWphja/s8U8J2QnM7H JUVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uqtOYyBZaSxTk6vFnxq67IjlDkClKoEOAUnHV1aUrT0=; b=naf9+S5Ik/jDS/Oy/9hAy5bjbUdIRyJvDP20iNA9S3Mwa1uFiK2uI7vjbUSkmjIIym 2c66j7mYL/l30FxQofslIXb+Ydb6++bZbIKiNZ4TvqpFKjR85P6+LGHjRJNmjxPReXLV fTd2Um1/b8nA8itFitTvIlhIABcPJunT//WaolwL9yen3ZgB72kYHwSla8SFCs1rDCvr zDXo8+n5fuu1J0fOyBFzyimsV4LbIouRCWDxdtmEwG5Z28K9d1xmlQ1j61EjYc4232CM dNYcAXtYq4kGAv0EJxMQJWEkf81KA/P4nKAd45RFTRYGHh37hXl0/efKI1WZIZpZV/Yi FlLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@o2.pl header.s=1024a header.b=FhnxMZy8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=o2.pl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a63d045000000b0046fabcb7bacsi5989247pgi.823.2022.11.12.12.26.25; Sat, 12 Nov 2022 12:26:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@o2.pl header.s=1024a header.b=FhnxMZy8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=o2.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234883AbiKLUKb (ORCPT + 91 others); Sat, 12 Nov 2022 15:10:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbiKLUK3 (ORCPT ); Sat, 12 Nov 2022 15:10:29 -0500 Received: from mx-out.tlen.pl (mx-out.tlen.pl [193.222.135.145]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35FBA11C for ; Sat, 12 Nov 2022 12:10:27 -0800 (PST) Received: (wp-smtpd smtp.tlen.pl 18112 invoked from network); 12 Nov 2022 21:10:25 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=o2.pl; s=1024a; t=1668283825; bh=uqtOYyBZaSxTk6vFnxq67IjlDkClKoEOAUnHV1aUrT0=; h=From:To:Cc:Subject; b=FhnxMZy8l4sI4n3JMwI9GDByfbqZg8//i211z5MahGRACd3DKqmVMBsZ0BONJt2f0 yVX3tA8CGJkpBIwigre1BPdvyv0QNZjklYcsL4AQ+QWmqV6TMSGR69EBT7U/TZdPK+ s9iLLuzykfJTf1/yGZEw8R8eByS06fyS1Rhz330c= Received: from aaey149.neoplus.adsl.tpnet.pl (HELO localhost.localdomain) (mat.jonczyk@o2.pl@[83.4.128.149]) (envelope-sender ) by smtp.tlen.pl (WP-SMTPD) with SMTP for ; 12 Nov 2022 21:10:25 +0100 From: =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org Cc: =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Borislav Petkov , Jean Delvare Subject: [PATCH] acpi,pci: warn about duplicate IRQ routing entries returned from _PRT Date: Sat, 12 Nov 2022 21:09:27 +0100 Message-Id: <20221112200927.7255-1-mat.jonczyk@o2.pl> X-Mailer: git-send-email 2.25.1 In-Reply-To: <35cfe433-bafa-9aeb-20ad-2f275f585b6c@o2.pl> References: <35cfe433-bafa-9aeb-20ad-2f275f585b6c@o2.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-WP-MailID: 72f4d30cf4d363848074315d888fad29 X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 0000000 [UVOU] X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. To check how widespread this problem is, print a warning to dmesg if this is the case. 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: [...] 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 the table returned by the _PRT method was confirmed by disassembling the ACPI DSDT table. Signed-off-by: Mateusz Jończyk Cc: Bjorn Helgaas Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Borislav Petkov Cc: Jean Delvare --- drivers/acpi/pci_irq.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 08e15774fb9f..c3168927446c 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -203,6 +203,8 @@ static int acpi_pci_irq_find_prt_entry(struct pci_dev *dev, 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; if (dev->bus->bridge) handle = ACPI_HANDLE(dev->bus->bridge); @@ -219,13 +221,30 @@ static int acpi_pci_irq_find_prt_entry(struct pci_dev *dev, entry = buffer.pointer; 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 == NULL) { + match = curr; + match_int_source = entry->source; + } else { + pr_warn(FW_BUG + "ACPI _PRT returned duplicate IRQ routing entries for device " + "%04x:%02x:%02x[INT%c]: %s[%d] and %s[%d]. ", + curr->id.segment, curr->id.bus, curr->id.device, + pin_name(curr->pin), + match_int_source, match->index, + entry->source, curr->index); + // we use the first matching entry nonetheless + } + } + entry = (struct acpi_pci_routing_table *) ((unsigned long)entry + entry->length); } + *entry_ptr = match; + kfree(buffer.pointer); return 0; } base-commit: f0c4d9fc9cc9462659728d168387191387e903cc -- 2.25.1