From patchwork Thu Mar 3 03:14:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 8487591 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 794E1C0554 for ; Thu, 3 Mar 2016 03:14:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6CBF202B8 for ; Thu, 3 Mar 2016 03:14:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA7BC202FF for ; Thu, 3 Mar 2016 03:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753365AbcCCDOK (ORCPT ); Wed, 2 Mar 2016 22:14:10 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:33084 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751076AbcCCDOJ (ORCPT ); Wed, 2 Mar 2016 22:14:09 -0500 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id ED58C60CF7; Thu, 3 Mar 2016 03:14:07 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DDFBC60D00; Thu, 3 Mar 2016 03:14:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from [192.168.1.129] (cpe-174-109-255-171.nc.res.rr.com [174.109.255.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 91DD1609F7; Thu, 3 Mar 2016 03:14:05 +0000 (UTC) Subject: Re: [PATCH V2] acpi, pci, irq: account for early penalty assignment To: Bjorn Helgaas References: <1455801582-21595-1-git-send-email-okaya@codeaurora.org> <20160229192420.GC3653@localhost> <56D4A53A.1070708@codeaurora.org> <20160229223453.GA12162@localhost> <56D5E43E.7050406@codeaurora.org> <20160301194340.GA19783@localhost> <56D7317F.7090500@codeaurora.org> Cc: linux-acpi@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org, linux-pci@vger.kernel.org, ravikanth.nalla@hpe.com, lenb@kernel.org, harish.k@hpe.com, ashwin.reghunandanan@hpe.com, bhelgaas@google.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org From: Sinan Kaya Message-ID: <56D7ABFB.3070302@codeaurora.org> Date: Wed, 2 Mar 2016 22:14:03 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56D7317F.7090500@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 3/2/2016 1:31 PM, Sinan Kaya wrote: > I don't think there's a restriction on what the SCI IRQ can be. But >> there is only one SCI IRQ, so all we have to do is keep track of what >> it is, which only requires one word. Taking a step back here and also some inspiration from your code, why don't we fix the actual problem instead of redesigning the whole thing? The code failed because we didn't account for the non-ISA SCI IRQs. Below code does this. diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index fa28635..99d0716 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -87,6 +87,7 @@ struct acpi_pci_link { static LIST_HEAD(acpi_link_list); static DEFINE_MUTEX(acpi_link_lock); +static int sci_irq, sci_irq_penalty; /* -------------------------------------------------------------------------- PCI Link Device Management @@ -481,6 +482,9 @@ static int acpi_irq_get_penalty(int irq) if (irq < ACPI_MAX_ISA_IRQ) return acpi_irq_isa_penalty[irq]; + if (irq == sci_irq) + return sci_penalty; + list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { if (irq_info->irq == irq) return irq_info->penalty; @@ -507,6 +511,11 @@ static int acpi_irq_set_penalty(int irq, int new_penalty) } } + if (irq == sci_irq) { + sci_penalty = penalty; + return 0; + } + /* nope, let's allocate a slot for this IRQ */ irq_info = kzalloc(sizeof(*irq_info), GFP_KERNEL); if (!irq_info) @@ -900,6 +909,7 @@ void acpi_penalize_sci_irq(int irq, int trigger, int polarity) if (irq < 0) return; + sci_irq = irq; if (trigger != ACPI_MADT_TRIGGER_LEVEL || polarity != ACPI_MADT_POLARITY_ACTIVE_LOW) penalty = PIRQ_PENALTY_ISA_ALWAYS;