Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1280247rdb; Fri, 16 Feb 2024 10:26:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWsyz3NkBGt4nRuwmMRL5qenSMjVvfdlOTDRc/xzu85q8RrRVSspXRNXXlQNZaq57phiKsjlZ2ZFPqdRaqpq2oGp3BU3Pkdr2KhuS5h7A== X-Google-Smtp-Source: AGHT+IFmOD1iwCWUQzWeTFaZVc8gUR8kU+X7kQyXbvnDHvpFyntFi2YLHTwtVdfQztYKBoltTaqt X-Received: by 2002:a05:6a20:e68c:b0:19c:8ed6:8bb5 with SMTP id mz12-20020a056a20e68c00b0019c8ed68bb5mr6389086pzb.39.1708107993719; Fri, 16 Feb 2024 10:26:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708107993; cv=pass; d=google.com; s=arc-20160816; b=qtpWps092S3+rffE7A+NhvPc6mOz46GmIhUbukWpN8k7WnDQ/S7qzZg6UShNjhzRJE 8L3bmBog/CAlKhhMdEPkTxf2JdbyAI68MY3rba5ITB1Lfa7N1SMMf0txyvaEe4O5Y689 3eC2MRXW7B9ZwYBpxmlJzc7s/XorkghhINRf0xML4beukTpHk4+bpYUJhXdd2xDpiLyD UT5GDStI4p6WfvQQvV6YFgc8ZUxM9C664BCG8e/EYamgi6/L11THfe0S5UEIaQE5UWrd b2U5N6Nbvx+DZApIbHj9CeHN9DGyOGy1F6KSkTxWXx17gDHlnNYymloB8h/k0gb3lUJy gDnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=cnCQSP7Q2DGhdaW7uq0lpYyGZnAXczAPeeTaQs//qA0=; fh=APc+Pu+KnnyLM5AfnmzdtHa2LIAz3PlJEFzb5SJcbcc=; b=DN912FZRFJ0pscu3TeqDSWOOD1D0wdbQagtQLdyyIBQKZNFGCnbOrcWNuFvPs96wbV bOnhfia4JCec1TsvJYaPUUNqMF3/0PWb0gzU9Ta22Yf7cJPRNdWZmwMrQBU0ZxYZnp+X V5zt3F5EgokmxNbinU2+e7l1UNQIGBQ8yIgOh1tsQdYOOGBRu9NwvtFddusP2KG1CRod PxxZ4tWSP0thi+ucUcMrpQ4OBAgzS7kAQxaAK1azHaiaWCvkRd9HOSyfoEaTgGuElQqN ppIfyaTXAT8Utyay17C6ULka7TV7XxYpDW06oX4QV11Zs+icWZzOO7AVMSYMCcQ5uz4n MMgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-69148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 35-20020a630e63000000b005dc905460f4si259078pgo.3.2024.02.16.10.26.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:26:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-69148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 68A12284F32 for ; Fri, 16 Feb 2024 18:26:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9CA01350F5; Fri, 16 Feb 2024 18:26:21 +0000 (UTC) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F2811350C8; Fri, 16 Feb 2024 18:26:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708107981; cv=none; b=uVG2wpS5YlUOdTLRAD97M30NgyCR2H97o7LM0JqE0WuEil+bBGSBfo7te1YXBIpy0N7DGcu1wH8iGO5LLBcauA1GbaOX61uHYXfjo5taH1XJeXvaa1tUKEGipp6KHekkK2TMKUinfzLrK42bhr2G73gknWoEIJWPDnKsIeD8UEY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708107981; c=relaxed/simple; bh=ENNPYomZv2DOwlCWBS7j/IZHANnF9ek4BFQ20oT9Q/0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=hWpO4ISeRGNSsjLbN5g62q/qNYLLpPZExC7EnU7RnvNiTLTCucdrnDCE+jk6sRdZYTE+vI46zXZ4Ra07dorbsrZOG65/b1eJLPXhptcXTyWGfA7n/URyYvbVURng0zY/cxecCqYCFZEjXxr/zfvvwN+aZR+KjuOzJrMheX2REVg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6e43ba6d74fso107769a34.1; Fri, 16 Feb 2024 10:26:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708107978; x=1708712778; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cnCQSP7Q2DGhdaW7uq0lpYyGZnAXczAPeeTaQs//qA0=; b=W5Ex81H8ECPQ/0rJdCwshMtB2uUY05917Dnnc1sAenEw+x1/dkp4/Eedeag9RJqZI9 dJBk6NN1lLgRNRfVi6A2z0dyINm3X+Q4A0dEGDVDzogTRPcnEtaPI6eQoyam/OGOm/nF 2uCwmrc63Dw5Cn3kQAvPO8tuODL+yhYypDDtK42fxnGDMbPVKHzEl1+W8ozv1i0sdxjI UdyhwceQcNGCjdaJP1C9dBdaMDXgEH5Dkc88oXCOHXa55a/0J3kva5aoKbuO/FoZ1xlO fVAkzTj0oAntII1IJvSZLPfXXNUPlS9PsdmHffnfpCDIyL9T6c7FKnjV3itU6knLgyv7 zaHg== X-Forwarded-Encrypted: i=1; AJvYcCXftsUBlCYlNF2ye7lfeThpd5ILDEk5ZAOnoJzAA6hCqCVmGdazRNFxdpxHmeefN7oiNPLzboIoSrSKnYhiv7mzcrSi1MYlktxOQUSwh6QmCZOTU84+hI2n/UduV9w5/YYbVA7go974DGlaFXLc9vceJykko4e1L2MeH8Lz4Xay39NwKg== X-Gm-Message-State: AOJu0YzNjIdW36r8rNpLnNzxLPxsXV+MudA+4TY9MvRoIQwJ9J2uRATI R1Re2tlOoMqUM1Tg2sZEcdumkOHNUuM6mo5LkFRMwgrFFbYDP926rLnugmIOW7jhYroo7giVkfl v6yA7eYWBMajjvUNvbDnNytXngec= X-Received: by 2002:a05:6820:312:b0:59f:8105:3085 with SMTP id l18-20020a056820031200b0059f81053085mr5739812ooe.0.1708107978403; Fri, 16 Feb 2024 10:26:18 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231226124254.66102-1-mat.jonczyk@o2.pl> In-Reply-To: <20231226124254.66102-1-mat.jonczyk@o2.pl> From: "Rafael J. Wysocki" Date: Fri, 16 Feb 2024 19:26:06 +0100 Message-ID: Subject: Re: [PATCH v4] acpi,pci: warn about duplicate IRQ routing entries returned from _PRT To: =?UTF-8?Q?Mateusz_Jo=C5=84czyk?= , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , Borislav Petkov , Jean Delvare Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Dec 26, 2023 at 1:50=E2=80=AFPM Mateusz Jo=C5=84czyk 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. > > 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=3D0x10" 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=E2=80=94PIRQ[A,B,C,D] Routing Control Register). > > [1] https://www.intel.com/content/dam/doc/datasheet/io-controller-hub-9-d= atasheet.pdf > > Signed-off-by: Mateusz Jo=C5=84czyk > Cc: Bjorn Helgaas > Cc: "Rafael J. Wysocki" > Cc: Len Brown > Cc: Borislav Petkov > Cc: Jean Delvare > Previously-reviewed-by: Jean Delvare > Previously-tested-by: Jean Delvare > > --- > Hello, > > I'm resurrecting an older patch that was discussed back in January: > > https://lore.kernel.org/lkml/20230121153314.6109-1-mat.jonczyk@o2.pl/T/#u > > To consider: should we print a warning or an error in case of duplicate > entries? This may not be serious enough to disturb the user with an > error message at boot. > > I'm also looking into modifying the i2c-i801 driver to disable its usage > of interrupts if one did not fire. > > v2: - add a newline at the end of the kernel log message, > - replace: "if (match =3D=3D NULL)" -> "if (!match)" > - patch description tweaks. > v3: - fix C style issues pointed by Jean Delvare, > - switch severity from warning to error. > v3 RESEND: retested on top of v6.2-rc4 > v4: - rebase and retest on top of v6.7-rc7 > - switch severity back to warning, > - change pr_err() to dev_warn() and simplify the code, > - modify patch description (describe Windows behaviour etc.) > --- > 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 ff30ceca2203..1fcf72e335b0 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 =3D { ACPI_ALLOCATE_BUFFER, NULL }; > struct acpi_pci_routing_table *entry; > acpi_handle handle =3D NULL; > + struct acpi_prt_entry *match =3D NULL; > + const char *match_int_source =3D NULL; > > if (dev->bus->bridge) > handle =3D ACPI_HANDLE(dev->bus->bridge); > @@ -219,13 +221,30 @@ static int acpi_pci_irq_find_prt_entry(struct pci_d= ev *dev, > > entry =3D 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, &c= urr)) { > + if (!match) { > + match =3D curr; > + match_int_source =3D entry->source; > + } else { > + dev_warn(&dev->dev, FW_BUG dev_info() would be sufficient here IMV. > + "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 noneth= eless, > + * for compatibility with older kernels. > + */ > + } > + } > + > entry =3D (struct acpi_pci_routing_table *) > ((unsigned long)entry + entry->length); > } > > + *entry_ptr =3D match; > + > kfree(buffer.pointer); > return 0; > } > > base-commit: 861deac3b092f37b2c5e6871732f3e11486f7082 > -- Bjorn, any concerns regarding this one?