From patchwork Wed Oct 19 22:21:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9385507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4CD79608A7 for ; Wed, 19 Oct 2016 22:22:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4040728B8F for ; Wed, 19 Oct 2016 22:22:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 347F0293A8; Wed, 19 Oct 2016 22:22:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B7E629201 for ; Wed, 19 Oct 2016 22:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932277AbcJSWVY (ORCPT ); Wed, 19 Oct 2016 18:21:24 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38556 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932236AbcJSWVU (ORCPT ); Wed, 19 Oct 2016 18:21:20 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5963961B79; Wed, 19 Oct 2016 22:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1476915679; bh=4kWumqlPT5zLyoOnEO/XsHQCnJvrYnWiQ19BB4YqsGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BNQjiyHHvuQyaCGnCmx111rGnn40Lxc2y0DtwhoEhsLaQbkCu6eBkcDBbFmoECFk1 LrwgM2fkvDIltOYsFiV4xilAylN7qAjFBYidgZ0772SNVF2uHJedel9Ahe5KhnU9Oi Z067aNB47nrYb88QP+HHxh+FzMn/wnOeqHJ2RYEE= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 61B3F61B2D; Wed, 19 Oct 2016 22:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1476915677; bh=4kWumqlPT5zLyoOnEO/XsHQCnJvrYnWiQ19BB4YqsGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=khW/d6ABgMPTsF+pQRy7+dEsKg7cusImVAH7Mrbid6ywoP4K2vGgW3Jn2IZaLJaDi 2GiCPNoXZgJGzFhxCpV7bL0U9haMPy6o5Il/qGDwG83WYRxUF/VkBOMZaN+sjWdeWQ x3x0lFxpkgz4MCwqwy/d1QnUQ0gTTTOpudmBrqNE= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org 61B3F61B2D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-acpi@vger.kernel.org, rjw@rjwysocki.net, bhelgaas@google.com, ravikanth.nalla@hpe.com, linux@rainbow-software.org, timur@codeaurora.org, cov@codeaurora.org, jcm@redhat.com, alex.williamson@redhat.com Cc: linux-pci@vger.kernel.org, agross@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, wim@djo.tudelft.nl, Sinan Kaya , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Len Brown , Robert Moore , Lv Zheng , linux-kernel@vger.kernel.org, devel@acpica.org Subject: [PATCH V4 3/3] Revert "ACPI, PCI, IRQ: separate ISA penalty calculation" Date: Wed, 19 Oct 2016 18:21:04 -0400 Message-Id: <1476915664-27231-4-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476915664-27231-1-git-send-email-okaya@codeaurora.org> References: <1476915664-27231-1-git-send-email-okaya@codeaurora.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit f7eca374f000 ("ACPI,PCI,IRQ: separate ISA penalty calculation") and commit 487cf917ed0d ("revert "ACPI, PCI, IRQ: remove redundant code in acpi_irq_penalty_init()""). Now that we understand the real issue (SCI and ISA penalty getting calculated before ACPI start), there is no need for special handling for ISA interrupts. Let's try to simplify the code one more time to share code. Signed-off-by: Sinan Kaya Tested-by: Jonathan Liu --- arch/x86/pci/acpi.c | 1 - drivers/acpi/pci_link.c | 44 +++++--------------------------------------- include/acpi/acpi_drivers.h | 1 - 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 3cd6983..b2a4e2a 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -396,7 +396,6 @@ int __init pci_acpi_init(void) return -ENODEV; printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); - acpi_irq_penalty_init(); pcibios_enable_irq = acpi_pci_irq_enable; pcibios_disable_irq = acpi_pci_irq_disable; x86_init.pci.init_irq = x86_init_noop; diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 294b190..dd14d78 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -478,7 +478,8 @@ static int acpi_irq_pci_sharing_penalty(int irq) * If a link is active, penalize its IRQ heavily * so we try to choose a different IRQ. */ - if (link->irq.active && link->irq.active == irq) + if ((link->irq.active && link->irq.active == irq) && + (link->irq.initialized == 1)) penalty += PIRQ_PENALTY_PCI_USING; /* @@ -501,45 +502,10 @@ static int acpi_irq_get_penalty(int irq) penalty += sci_penalty; if (irq < ACPI_MAX_ISA_IRQS) - return penalty + acpi_isa_irq_penalty[irq]; + penalty += acpi_isa_irq_penalty[irq]; - return penalty + acpi_irq_pci_sharing_penalty(irq); -} - -int __init acpi_irq_penalty_init(void) -{ - struct acpi_pci_link *link; - int i; - - /* - * Update penalties to facilitate IRQ balancing. - */ - list_for_each_entry(link, &acpi_link_list, list) { - - /* - * reflect the possible and active irqs in the penalty table -- - * useful for breaking ties. - */ - if (link->irq.possible_count) { - int penalty = - PIRQ_PENALTY_PCI_POSSIBLE / - link->irq.possible_count; - - for (i = 0; i < link->irq.possible_count; i++) { - if (link->irq.possible[i] < ACPI_MAX_ISA_IRQS) - acpi_isa_irq_penalty[link->irq. - possible[i]] += - penalty; - } - - } else if (link->irq.active && - (link->irq.active < ACPI_MAX_ISA_IRQS)) { - acpi_isa_irq_penalty[link->irq.active] += - PIRQ_PENALTY_PCI_POSSIBLE; - } - } - - return 0; + penalty += acpi_irq_pci_sharing_penalty(irq); + return penalty; } static int acpi_irq_balance = -1; /* 0: static, 1: balance */ diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index 29c6912..797ae2e 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -78,7 +78,6 @@ /* ACPI PCI Interrupt Link (pci_link.c) */ -int acpi_irq_penalty_init(void); int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, int *polarity, char **name); int acpi_pci_link_free_irq(acpi_handle handle);