From patchwork Tue Mar 3 05:17:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 445550 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 59798140161 for ; Tue, 3 Mar 2015 16:45:14 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 383E11A083B for ; Tue, 3 Mar 2015 16:45:14 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id AF1F61A02FA for ; Tue, 3 Mar 2015 16:43:29 +1100 (AEDT) Received: by ozlabs.org (Postfix) id 67383140161; Tue, 3 Mar 2015 16:43:29 +1100 (AEDT) Delivered-To: linuxppc-dev@ozlabs.org X-Greylist: delayed 861 seconds by postgrey-1.35 at bilbo; Tue, 03 Mar 2015 16:43:27 AEDT Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0139.outbound.protection.outlook.com [157.56.111.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BB0D2140146 for ; Tue, 3 Mar 2015 16:43:27 +1100 (AEDT) Received: from BY2PR03CA007.namprd03.prod.outlook.com (10.255.93.24) by BN1PR0301MB0723.namprd03.prod.outlook.com (25.160.78.142) with Microsoft SMTP Server (TLS) id 15.1.99.14; Tue, 3 Mar 2015 05:28:00 +0000 Received: from BY2FFO11FD051.protection.gbl (10.255.93.4) by BY2PR03CA007.outlook.office365.com (10.255.93.24) with Microsoft SMTP Server (TLS) id 15.1.99.14 via Frontend Transport; Tue, 3 Mar 2015 05:27:58 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD051.mail.protection.outlook.com (10.1.15.188) with Microsoft SMTP Server (TLS) id 15.1.99.6 via Frontend Transport; Tue, 3 Mar 2015 05:27:58 +0000 Received: from kvm.ap.freescale.net (kvm.ap.freescale.net [10.232.14.24]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t235RrVV019197; Mon, 2 Mar 2015 22:27:57 -0700 From: Bharat Bhushan To: Subject: [PATCH 2/4 RFC] fsl/msi: Move fsl, msi mode specific MSI device search out of main loop Date: Tue, 3 Mar 2015 10:47:44 +0530 Message-ID: <1425359866-31049-2-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1425359866-31049-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1425359866-31049-1-git-send-email-Bharat.Bhushan@freescale.com> X-EOPAttributedMessage: 0 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Bharat.Bhushan@freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(189002)(199003)(87936001)(76176999)(229853001)(50986999)(47776003)(104016003)(2351001)(50226001)(48376002)(46102003)(106466001)(105606002)(110136001)(50466002)(2950100001)(86362001)(62966003)(77156002)(36756003)(450100001)(6806004)(2371004)(19580405001)(85426001)(92566002)(77096005)(19580395003)(142933001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR0301MB0723; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0723; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006); SRVR:BN1PR0301MB0723; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0301MB0723; X-Forefront-PRVS: 0504F29D72 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2015 05:27:58.8558 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0723 Cc: Bharat Bhushan , linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Moving out the specific MSI device search out of main loop. And now the specific msi device search is placed with other "fsl.msi" specific code in same function. This is in preparation to MSI bank partitioning. Signed-off-by: Bharat Bhushan --- arch/powerpc/sysdev/fsl_msi.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index ec3161b..32ba1e3 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c @@ -178,7 +178,8 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) unsigned int virq; struct msi_desc *entry; struct msi_msg msg; - struct fsl_msi *msi_data; + struct fsl_msi *msi_data = NULL; + bool specific_msi_bank = false; if (type == PCI_CAP_ID_MSIX) pr_debug("fslmsi: MSI-X untested, trying anyway.\n"); @@ -199,12 +200,9 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) hose->dn->full_name, np->phandle); return -EINVAL; } - } - - list_for_each_entry(entry, &pdev->msi_list, list) { /* - * Loop over all the MSI devices until we find one that has an - * available interrupt. + * Loop over all the MSI devices till we find + * specific MSI device. */ list_for_each_entry(msi_data, &msi_head, list) { /* @@ -215,12 +213,33 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) * has the additional benefit of skipping over MSI * nodes that are not mapped in the PAMU. */ - if (phandle && (phandle != msi_data->phandle)) - continue; + if (phandle == msi_data->phandle) { + specific_msi_bank = true; + break; + } + } + if (!specific_msi_bank) { + dev_err(&pdev->dev, + "No specific MSI device found for node %s\n", + hose->dn->full_name); + return -EINVAL; + } + } + + list_for_each_entry(entry, &pdev->msi_list, list) { + if (specific_msi_bank) { hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1); - if (hwirq >= 0) - break; + } else { + /* + * Loop over all the MSI devices until we find one that has an + * available interrupt. + */ + list_for_each_entry(msi_data, &msi_head, list) { + hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1); + if (hwirq >= 0) + break; + } } if (hwirq < 0) {