From nobody Sun Apr 19 10:43:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A14B7C43334 for ; Fri, 1 Jul 2022 16:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231836AbiGAQRC (ORCPT ); Fri, 1 Jul 2022 12:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231775AbiGAQRA (ORCPT ); Fri, 1 Jul 2022 12:17:00 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4FA13BBF9; Fri, 1 Jul 2022 09:16:59 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F3633143D; Fri, 1 Jul 2022 09:16:59 -0700 (PDT) Received: from pierre123.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D4A2A3F66F; Fri, 1 Jul 2022 09:16:57 -0700 (PDT) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Pierre Gondois , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH RESEND v1 1/2] ACPI/PCI: Make _SRS optional for link device Date: Fri, 1 Jul 2022 18:16:23 +0200 Message-Id: <20220701161624.2844305-2-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701161624.2844305-1-pierre.gondois@arm.com> References: <20220701161624.2844305-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre Gondois In ACPI 6.4, s6.2.13 "_PRT (PCI Routing Table)", PCI legacy interrupts can be described though a link device (first model). From s6.2.16 "_SRS (Set Resource Settings)": "This optional control method [...]" Make it optional to have a _SRS method for link devices. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D215560 Signed-off-by: Pierre Gondois --- drivers/acpi/pci_link.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 58647051c948..129e3e7e80ee 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -288,6 +288,13 @@ static int acpi_pci_link_set(struct acpi_pci_link *lin= k, int irq) if (!irq) return -EINVAL; =20 + if (!acpi_has_method(handle, METHOD_NAME__SRS)) { + if (link->irq.active =3D=3D irq) + return 0; + acpi_handle_err(handle, "Unable to set IRQ %d: No _SRS.\n", irq); + return -ENODEV; + } + resource =3D kzalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC:= GFP_KERNEL); if (!resource) return -ENOMEM; --=20 2.25.1 From nobody Sun Apr 19 10:43:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5220BC433EF for ; Fri, 1 Jul 2022 16:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231776AbiGAQRI (ORCPT ); Fri, 1 Jul 2022 12:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231851AbiGAQRC (ORCPT ); Fri, 1 Jul 2022 12:17:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 53CF53BBF9; Fri, 1 Jul 2022 09:17:02 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 564EF113E; Fri, 1 Jul 2022 09:17:02 -0700 (PDT) Received: from pierre123.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4EE2F3F66F; Fri, 1 Jul 2022 09:17:00 -0700 (PDT) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Pierre Gondois , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH RESEND v1 2/2] ACPI/PCI: Make _PRS optional for link device Date: Fri, 1 Jul 2022 18:16:24 +0200 Message-Id: <20220701161624.2844305-3-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701161624.2844305-1-pierre.gondois@arm.com> References: <20220701161624.2844305-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre Gondois In ACPI 6.4, s6.2.13 "_PRT (PCI Routing Table)", PCI legacy interrupts can be described though a link device (first model). From s6.2.12 "_PRS (Possible Resource Settings)": "This optional object evaluates [...]" It is currently checked that the interrupt advertised in _CRS is one of the interrupts available in _PRS. Make this check conditional to the presence of _PRS. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D215560 Signed-off-by: Pierre Gondois --- drivers/acpi/pci_link.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 129e3e7e80ee..b5a41866f135 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -532,19 +532,10 @@ int __init acpi_irq_penalty_init(void) =20 static int acpi_irq_balance =3D -1; /* 0: static, 1: balance */ =20 -static int acpi_pci_link_allocate(struct acpi_pci_link *link) +static int select_from_possible(struct acpi_pci_link *link) { - acpi_handle handle =3D link->device->handle; - int irq; int i; =20 - if (link->irq.initialized) { - if (link->refcnt =3D=3D 0) - /* This means the link is disabled but initialized */ - acpi_pci_link_set(link, link->irq.active); - return 0; - } - /* * search for active IRQ in list of possible IRQs. */ @@ -557,8 +548,9 @@ static int acpi_pci_link_allocate(struct acpi_pci_link = *link) */ if (i =3D=3D link->irq.possible_count) { if (acpi_strict) - acpi_handle_warn(handle, "_CRS %d not found in _PRS\n", - link->irq.active); + acpi_handle_warn(link->device->handle, + "_CRS %d not found in _PRS\n", + link->irq.active); link->irq.active =3D 0; } =20 @@ -566,9 +558,28 @@ static int acpi_pci_link_allocate(struct acpi_pci_link= *link) * if active found, use it; else pick entry from end of possible list. */ if (link->irq.active) - irq =3D link->irq.active; + return link->irq.active; + else + return link->irq.possible[link->irq.possible_count - 1]; +} + +static int acpi_pci_link_allocate(struct acpi_pci_link *link) +{ + acpi_handle handle =3D link->device->handle; + int irq; + int i; + + if (link->irq.initialized) { + if (link->refcnt =3D=3D 0) + /* This means the link is disabled but initialized */ + acpi_pci_link_set(link, link->irq.active); + return 0; + } + + if (link->irq.possible_count) + irq =3D select_from_possible(link); else - irq =3D link->irq.possible[link->irq.possible_count - 1]; + irq =3D link->irq.active; =20 if (acpi_irq_balance || !link->irq.active) { /* --=20 2.25.1