Received: by 2002:ac0:cd04:0:0:0:0:0 with SMTP id w4csp46211imn; Fri, 1 Jul 2022 09:36:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sb2ZbGMQVAG0iGB8L8uRgMzk3sDbcF4P80NXZMAt8sJPbyLNg4rf+73rSn73uT+mU1cCcu X-Received: by 2002:a05:6402:1854:b0:435:7f6e:e553 with SMTP id v20-20020a056402185400b004357f6ee553mr19983545edy.282.1656693419066; Fri, 01 Jul 2022 09:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656693419; cv=none; d=google.com; s=arc-20160816; b=au3jEOSsI1QIa9pYYB0Pz6+/+x0vd1ZLYiBZgK3U+eF7c2kAMpym0+gjjeKRj4EEB/ flv4qoXS8lva3tLZX8DKUJ/bpvzwm7nrYwkx7Me82jS9SSMJq/gqsvolo0IP+PSrj4TF 2FBsPgy9iUJbt2OV9IrEsh8RSRmGyaO0WhgzhgoYXss71MV0SZ8GczFqdVf99XVHRK2L 1/DMi1+VbUmOK9mjOYIpEbD9+lNd9klJLOb4n2xa48O2nhv7CexCAk6C5vy89RD0if6L dQeoF9u4Dq5WkkKLxf4nWESLiNwRWMkicI63n3K9XeQC4kkWyDXUxYRowdPxaZRCVtg3 w5KA== 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; bh=1e4/L+DJbqbiTMoIo696mX8OtTy6SSSshBBUhWQmxEk=; b=Fw+Ci6TtupHbmbFCNJtvFF6/zU5kmm9d2d5JQpX9kmVxuTKz1n2HWxGElFyAbohzIQ Nf3lPRX3ALGKe7bEa1uPd+TTHBRuCqGamp9rM9mfC32rogATLqycj6Gs763UxP62gyOL oZBps4uw6qXOBr69YyVk2i0mQpsX7tI0FxbOdfCxmM33+4xtTKeQso++BgjbYEX/hbC3 wrjwzgfPscCUvIsAxgYq+nA6lqBY0v0LCwRyqrGHY+ngYG/mxSIJBS9ZhD35VqnnaRRs t6EpTBsh1Ohsck1aqfEf38c+G8/esIvwbBZ8JR6A3bQsF8cK6UjJOTvcSJtoT12Twl+z yqQg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fl22-20020a1709072a9600b006f3d82ce68esi1001935ejc.145.2022.07.01.09.36.33; Fri, 01 Jul 2022 09:36:59 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231510AbiGAQDu (ORCPT + 99 others); Fri, 1 Jul 2022 12:03:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231442AbiGAQDk (ORCPT ); Fri, 1 Jul 2022 12:03:40 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 88C241F2DF; Fri, 1 Jul 2022 09:03:39 -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 98867143D; Fri, 1 Jul 2022 09:03:39 -0700 (PDT) Received: from pierre123.arm.com (unknown [10.57.40.143]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 61C8F3F66F; Fri, 1 Jul 2022 09:03:37 -0700 (PDT) From: Pierre Gondois To: linux-eng@arm.com Cc: Pierre Gondois , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/2] ACPI/PCI: Make _PRS optional for link device Date: Fri, 1 Jul 2022 18:03:08 +0200 Message-Id: <20220701160309.2842180-2-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701160309.2842180-1-pierre.gondois@arm.com> References: <20220701160309.2842180-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 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=215560 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) static int acpi_irq_balance = -1; /* 0: static, 1: balance */ -static int acpi_pci_link_allocate(struct acpi_pci_link *link) +static int select_from_possible(struct acpi_pci_link *link) { - acpi_handle handle = link->device->handle; - int irq; int i; - if (link->irq.initialized) { - if (link->refcnt == 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 == 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 = 0; } @@ -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 = 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 = link->device->handle; + int irq; + int i; + + if (link->irq.initialized) { + if (link->refcnt == 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 = select_from_possible(link); else - irq = link->irq.possible[link->irq.possible_count - 1]; + irq = link->irq.active; if (acpi_irq_balance || !link->irq.active) { /* -- 2.25.1